diff --git a/Mage.Common/src/mage/interfaces/plugin/ThemePlugin.java b/Mage.Common/src/mage/interfaces/plugin/ThemePlugin.java index 12c920c0e3..b5dbda9c49 100644 --- a/Mage.Common/src/mage/interfaces/plugin/ThemePlugin.java +++ b/Mage.Common/src/mage/interfaces/plugin/ThemePlugin.java @@ -13,5 +13,6 @@ import net.xeoh.plugins.base.Plugin; * @author nantuko */ public interface ThemePlugin extends Plugin { - void apply(Map ui); + void applyInGame(Map ui); + void applyOnTable(Map ui); } diff --git a/Mage.Plugins/Mage.Theme.Plugin/pom.xml b/Mage.Plugins/Mage.Theme.Plugin/pom.xml index eaa70c9137..450c260025 100644 --- a/Mage.Plugins/Mage.Theme.Plugin/pom.xml +++ b/Mage.Plugins/Mage.Theme.Plugin/pom.xml @@ -45,29 +45,6 @@ 1.6 - - - org.apache.maven.plugins - maven-shade-plugin - 1.4 - - - package - - shade - - - true - - - log4j:log4j:jar: - - - - - - - mage-theme-plugin diff --git a/Mage.Plugins/Mage.Theme.Plugin/src/main/java/org/mage/plugins/theme/ThemePluginImpl.java b/Mage.Plugins/Mage.Theme.Plugin/src/main/java/org/mage/plugins/theme/ThemePluginImpl.java index 9da06898fc..4e83c656d4 100644 --- a/Mage.Plugins/Mage.Theme.Plugin/src/main/java/org/mage/plugins/theme/ThemePluginImpl.java +++ b/Mage.Plugins/Mage.Theme.Plugin/src/main/java/org/mage/plugins/theme/ThemePluginImpl.java @@ -1,6 +1,7 @@ package org.mage.plugins.theme; import java.awt.image.BufferedImage; import java.io.FileNotFoundException; +import java.io.InputStream; import java.util.Map; import javax.imageio.ImageIO; @@ -31,16 +32,55 @@ public class ThemePluginImpl implements ThemePlugin { } public String toString() { - return "[Theme plugin, version 0.2]"; + return "[Theme plugin, version 0.3]"; } - public void apply(Map ui) { - //log.info("Adding background..."); + public void applyInGame(Map ui) { + String filename = "/wood.png"; try { - BufferedImage background = ImageIO.read(this.getClass().getResourceAsStream("/dk_gray.jpg")); + InputStream is = this.getClass().getResourceAsStream(filename); + + if (is == null) + throw new FileNotFoundException("Couldn't find " + filename + " in resources."); + + BufferedImage background = ImageIO.read(is); if (background == null) - throw new FileNotFoundException("Couldn't find dk_gray.jpg in resources."); + throw new FileNotFoundException("Couldn't find " + filename + " in resources."); + + if (ui.containsKey("gamePanel") && ui.containsKey("jLayeredPane")) { + ImagePanel bgPanel = new ImagePanel(background, ImagePanel.TILED); + + unsetOpaque(ui.get("jSplitPane1")); + unsetOpaque(ui.get("pnlBattlefield")); + unsetOpaque(ui.get("jPanel3")); + unsetOpaque(ui.get("hand")); + unsetOpaque(ui.get("chatPanel")); + + ui.get("gamePanel").remove(ui.get("jLayeredPane")); + bgPanel.add(ui.get("jLayeredPane")); + ui.get("gamePanel").add(bgPanel); + } else { + log.error("error: no components"); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + return; + } + } + + public void applyOnTable(Map ui) { + String filename = "/regret.jpg"; + try { + InputStream is = this.getClass().getResourceAsStream(filename); + + if (is == null) + throw new FileNotFoundException("Couldn't find " + filename + " in resources."); + + BufferedImage background = ImageIO.read(is); + + if (background == null) + throw new FileNotFoundException("Couldn't find " + filename + " in resources."); if (ui.containsKey("gamePanel") && ui.containsKey("jLayeredPane")) { ImagePanel bgPanel = new ImagePanel(background, ImagePanel.TILED); @@ -61,8 +101,6 @@ public class ThemePluginImpl implements ThemePlugin { log.error(e.getMessage(), e); return; } - - //log.info("Done."); } private void unsetOpaque(JComponent c) { diff --git a/Mage.Plugins/Mage.Theme.Plugin/src/main/resources/wood.png b/Mage.Plugins/Mage.Theme.Plugin/src/main/resources/wood.png new file mode 100644 index 0000000000..4b44371dc5 Binary files /dev/null and b/Mage.Plugins/Mage.Theme.Plugin/src/main/resources/wood.png differ diff --git a/Mage.Server/config/init.txt b/Mage.Server/config/init.txt index cee1f75679..a8553ad77b 100644 --- a/Mage.Server/config/init.txt +++ b/Mage.Server/config/init.txt @@ -9,5 +9,5 @@ hand:player:Fireball:2 battlefield:player:Plains:5 battlefield:player:Brindle Boar:1 -battlefield:computer:Brindle Boar:1 +battlefield:computer:Bloodbraid Elf:1 hand:player:Holy Strength:2