diff --git a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java index 923315b7f0a..c589fe32cc2 100644 --- a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java +++ b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java @@ -30,9 +30,9 @@ public class MageTextArea extends JEditorPane { public void setText(String text, int fontSize) { if (text == null) return; - String fontFamily = "arial"; + String fontFamily = "times"; - final StringBuffer buffer = new StringBuffer(512); + final StringBuilder buffer = new StringBuilder(512); buffer.append(""); + } else { + buffer.append("color: #FFFFFF'>"); + } + buffer.append(""); + + text = text.replaceAll("#([^#]+)#", "$1"); + text = text.replaceAll("\\s*//\\s*", "
"); + text = text.replace("\r\n", "
"); + //text += "
"; + + if (text.length() > 0) { + buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.PAY)); + } + + buffer.append("
"); + return buffer; + } + + + } + + class ImageRenderer extends DefaultListCellRenderer { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); JLabel label = ((JLabel) c); + label.setOpaque(false); label.setForeground(Color.white); @@ -316,8 +391,8 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener { List objectList = new ArrayList(); objectList.add("T: add {R} to your mana pool. 111111111111111111111111111"); - objectList.add("T: add {B} to your mana pool"); - objectList.add("T: add {B} to your mana pool"); + objectList.add("T: add {B} to your mana pool. {source} deals 1 damage to you."); + objectList.add("{T}: add {B} to your mana pool"); objectList.add("T: add {B} to your mana pool"); objectList.add("T: add {B} to your mana pool"); objectList.add("T: add {B} to your mana pool"); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java index 99f6a8565a3..b5c6f8210cb 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java @@ -1,9 +1,13 @@ package org.mage.card.arcane; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Rectangle; +import mage.client.cards.CardsStorage; +import mage.client.util.ImageHelper; +import mage.client.util.gui.BufferedImageBuilder; +import org.apache.log4j.Logger; +import org.mage.plugins.card.constants.Constants; + +import javax.imageio.ImageIO; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.util.HashMap; @@ -11,12 +15,6 @@ import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.regex.Pattern; -import javax.imageio.ImageIO; -import mage.client.cards.CardsStorage; -import mage.client.util.ImageHelper; -import mage.client.util.gui.BufferedImageBuilder; -import org.apache.log4j.Logger; -import org.mage.plugins.card.constants.Constants; public class ManaSymbols { @@ -171,16 +169,23 @@ public class ManaSymbols { } static public synchronized String replaceSymbolsWithHTML(String value, Type type) { - if (type.equals(Type.TOOLTIP)) { - return replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); - } else if (type.equals(Type.CARD)) { - value = value.replace("{slash}", "slash"); - return replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); - } else if (type.equals(Type.PAY)) { - value = value.replace("{slash}", "slash"); - return replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); + value = value.replace("{source}", "|source|"); + value = value.replace("{this}", "|this|"); + String replaced = value; + if (!manaImages.isEmpty()) { + if (type.equals(Type.TOOLTIP)) { + replaced = replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); + } else if (type.equals(Type.CARD)) { + value = value.replace("{slash}", "slash"); + replaced = replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); + } else if (type.equals(Type.PAY)) { + value = value.replace("{slash}", "slash"); + replaced = replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); + } } - return value; + replaced = replaced.replace("|source|", "{source}"); + replaced = replaced.replace("|this|", "{this}"); + return replaced; } static public String replaceSetCodeWithHTML(String set, String rarity) {