mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
First attempt at converting the Android code for the GUI refactoring (untested).
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1122,6 +1122,7 @@ forge-gui-mobile/libs/gdx.jar -text
|
|||||||
forge-gui-mobile/pom.xml -text
|
forge-gui-mobile/pom.xml -text
|
||||||
forge-gui-mobile/src/forge/Forge.java -text
|
forge-gui-mobile/src/forge/Forge.java -text
|
||||||
forge-gui-mobile/src/forge/Graphics.java -text
|
forge-gui-mobile/src/forge/Graphics.java -text
|
||||||
|
forge-gui-mobile/src/forge/GuiBase.java -text
|
||||||
forge-gui-mobile/src/forge/GuiMobile.java -text
|
forge-gui-mobile/src/forge/GuiMobile.java -text
|
||||||
forge-gui-mobile/src/forge/animation/AbilityEffect.java -text
|
forge-gui-mobile/src/forge/animation/AbilityEffect.java -text
|
||||||
forge-gui-mobile/src/forge/animation/ForgeAnimation.java -text
|
forge-gui-mobile/src/forge/animation/ForgeAnimation.java -text
|
||||||
@@ -1280,6 +1281,7 @@ forge-gui-mobile/src/forge/toolbox/ListChooser.java -text
|
|||||||
forge-gui-mobile/src/forge/util/LayoutHelper.java -text
|
forge-gui-mobile/src/forge/util/LayoutHelper.java -text
|
||||||
forge-gui-mobile/src/forge/util/PhysicsObject.java -text
|
forge-gui-mobile/src/forge/util/PhysicsObject.java -text
|
||||||
forge-gui-mobile/src/forge/util/Utils.java -text
|
forge-gui-mobile/src/forge/util/Utils.java -text
|
||||||
|
forge-gui-mobile/src/forge/util/WaitCallback.java -text
|
||||||
forge-gui-mobile/src/forge/util/WaitRunnable.java -text
|
forge-gui-mobile/src/forge/util/WaitRunnable.java -text
|
||||||
forge-gui/.classpath -text
|
forge-gui/.classpath -text
|
||||||
forge-gui/.project -text
|
forge-gui/.project -text
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<packaging.type>jar</packaging.type>
|
<packaging.type>jar</packaging.type>
|
||||||
<build.min.memory>-Xms128m</build.min.memory>
|
<build.min.memory>-Xms128m</build.min.memory>
|
||||||
<build.max.memory>-Xmx2048m</build.max.memory>
|
<build.max.memory>-Xmx2048m</build.max.memory>
|
||||||
<alpha-version>1.5.26.004</alpha-version>
|
<alpha-version>1.5.26.005</alpha-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import forge.util.FileUtil;
|
|||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
|
||||||
public class Forge implements ApplicationListener {
|
public class Forge implements ApplicationListener {
|
||||||
public static final String CURRENT_VERSION = "1.5.26.004";
|
public static final String CURRENT_VERSION = "1.5.26.005";
|
||||||
|
|
||||||
private static final ApplicationListener app = new Forge();
|
private static final ApplicationListener app = new Forge();
|
||||||
private static Clipboard clipboard;
|
private static Clipboard clipboard;
|
||||||
@@ -49,14 +49,15 @@ public class Forge implements ApplicationListener {
|
|||||||
private static SplashScreen splashScreen;
|
private static SplashScreen splashScreen;
|
||||||
private static KeyInputAdapter keyInputAdapter;
|
private static KeyInputAdapter keyInputAdapter;
|
||||||
private static boolean exited;
|
private static boolean exited;
|
||||||
private static final SoundSystem soundSystem = new SoundSystem();
|
private static final SoundSystem soundSystem = new SoundSystem(GuiBase.getInterface());
|
||||||
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
||||||
|
|
||||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) {
|
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) {
|
||||||
if (GuiBase.getInterface() == null) {
|
if (GuiBase.getInterface() == null) {
|
||||||
|
ForgeConstants.init(assetDir0);
|
||||||
clipboard = clipboard0;
|
clipboard = clipboard0;
|
||||||
deviceAdapter = deviceAdapter0;
|
deviceAdapter = deviceAdapter0;
|
||||||
GuiBase.setInterface(new GuiMobile(assetDir0));
|
GuiBase.setInterface(new GuiMobile());
|
||||||
}
|
}
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
@@ -67,7 +68,7 @@ public class Forge implements ApplicationListener {
|
|||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
//install our error handler
|
//install our error handler
|
||||||
ExceptionHandler.registerErrorHandling();
|
ExceptionHandler.registerErrorHandling(GuiBase.getInterface());
|
||||||
|
|
||||||
graphics = new Graphics();
|
graphics = new Graphics();
|
||||||
splashScreen = new SplashScreen();
|
splashScreen = new SplashScreen();
|
||||||
@@ -90,7 +91,7 @@ public class Forge implements ApplicationListener {
|
|||||||
AssetsDownloader.checkForUpdates(splashScreen);
|
AssetsDownloader.checkForUpdates(splashScreen);
|
||||||
if (exited) { return; } //don't continue if user chose to exit or couldn't download required assets
|
if (exited) { return; } //don't continue if user chose to exit or couldn't download required assets
|
||||||
|
|
||||||
FModel.initialize(splashScreen.getProgressBar());
|
FModel.initialize(GuiBase.getInterface(), splashScreen.getProgressBar());
|
||||||
|
|
||||||
splashScreen.getProgressBar().setDescription("Loading fonts...");
|
splashScreen.getProgressBar().setDescription("Loading fonts...");
|
||||||
FSkinFont.preloadAll();
|
FSkinFont.preloadAll();
|
||||||
@@ -211,7 +212,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
graphics.end();
|
graphics.end();
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +246,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
graphics.end();
|
graphics.end();
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +264,7 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
graphics.end();
|
graphics.end();
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +434,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -449,7 +450,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,7 +466,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -481,7 +482,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,7 +498,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,7 +514,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -529,7 +530,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -545,7 +546,7 @@ public class Forge implements ApplicationListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
forge-gui-mobile/src/forge/GuiBase.java
Normal file
14
forge-gui-mobile/src/forge/GuiBase.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package forge;
|
||||||
|
|
||||||
|
import forge.interfaces.IGuiBase;
|
||||||
|
|
||||||
|
public class GuiBase {
|
||||||
|
private static IGuiBase guiInterface;
|
||||||
|
|
||||||
|
public static IGuiBase getInterface() {
|
||||||
|
return guiInterface;
|
||||||
|
}
|
||||||
|
public static void setInterface(IGuiBase i0) {
|
||||||
|
guiInterface = i0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,19 +25,11 @@ import forge.deck.FDeckViewer;
|
|||||||
import forge.deck.FSideboardDialog;
|
import forge.deck.FSideboardDialog;
|
||||||
import forge.error.BugReportDialog;
|
import forge.error.BugReportDialog;
|
||||||
import forge.events.UiEvent;
|
import forge.events.UiEvent;
|
||||||
import forge.game.Game;
|
|
||||||
import forge.game.GameEntity;
|
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.game.Match;
|
import forge.game.Match;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.combat.Combat;
|
|
||||||
import forge.game.event.GameEventTurnBegan;
|
|
||||||
import forge.game.phase.PhaseHandler;
|
|
||||||
import forge.game.phase.PhaseType;
|
import forge.game.phase.PhaseType;
|
||||||
import forge.game.player.IHasIcon;
|
import forge.game.player.IHasIcon;
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.game.player.RegisteredPlayer;
|
import forge.game.player.RegisteredPlayer;
|
||||||
import forge.game.spellability.SpellAbility;
|
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.interfaces.IButton;
|
import forge.interfaces.IButton;
|
||||||
import forge.interfaces.IGuiBase;
|
import forge.interfaces.IGuiBase;
|
||||||
@@ -61,13 +53,15 @@ import forge.util.ThreadUtil;
|
|||||||
import forge.util.WaitCallback;
|
import forge.util.WaitCallback;
|
||||||
import forge.util.WaitRunnable;
|
import forge.util.WaitRunnable;
|
||||||
import forge.util.gui.SGuiChoose;
|
import forge.util.gui.SGuiChoose;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.CombatView;
|
||||||
|
import forge.view.GameEntityView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
import forge.view.SpellAbilityView;
|
||||||
|
|
||||||
public class GuiMobile implements IGuiBase {
|
public class GuiMobile implements IGuiBase {
|
||||||
|
|
||||||
private final String assetsDir;
|
public GuiMobile() {
|
||||||
|
|
||||||
public GuiMobile(String assetsDir0) {
|
|
||||||
assetsDir = assetsDir0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -105,16 +99,6 @@ public class GuiMobile implements IGuiBase {
|
|||||||
return !ThreadUtil.isGameThread();
|
return !ThreadUtil.isGameThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAssetsDir() {
|
|
||||||
return assetsDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mayShowCard(Card card) {
|
|
||||||
return FControl.mayShowCard(card);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISkinImage getSkinIcon(FSkinProp skinProp) {
|
public ISkinImage getSkinIcon(FSkinProp skinProp) {
|
||||||
if (skinProp == null) { return null; }
|
if (skinProp == null) { return null; }
|
||||||
@@ -137,7 +121,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int showCardOptionDialog(final Card card, final String message, final String title, final FSkinProp icon, final String[] options, final int defaultOption) {
|
public int showCardOptionDialog(final CardView card, final String message, final String title, final FSkinProp icon, final String[] options, final int defaultOption) {
|
||||||
return new WaitCallback<Integer>() {
|
return new WaitCallback<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -168,7 +152,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
|
public <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
|
||||||
final List<T> sourceChoices, final List<T> destChoices, final Card referenceCard, final boolean sideboardingMode) {
|
final List<T> sourceChoices, final List<T> destChoices, final CardView referenceCard, final boolean sideboardingMode) {
|
||||||
return new WaitCallback<List<T>>() {
|
return new WaitCallback<List<T>>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -230,9 +214,8 @@ public class GuiMobile implements IGuiBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePhase() {
|
public void updatePhase() {
|
||||||
PhaseHandler pH = FControl.getGame().getPhaseHandler();
|
final PlayerView p = FControl.getGameView().getPlayerTurn();
|
||||||
Player p = pH.getPlayerTurn();
|
final PhaseType ph = FControl.getGameView().getPhase();
|
||||||
PhaseType ph = pH.getPhase();
|
|
||||||
|
|
||||||
PhaseLabel lbl = FControl.getPlayerPanel(p).getPhaseIndicator().getLabel(ph);
|
PhaseLabel lbl = FControl.getPlayerPanel(p).getPhaseIndicator().getLabel(ph);
|
||||||
|
|
||||||
@@ -243,7 +226,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTurn(final GameEventTurnBegan event, final Game game) {
|
public void updateTurn(final PlayerView player) {
|
||||||
//VField nextField = FControl.getFieldViewFor(event.turnOwner);
|
//VField nextField = FControl.getFieldViewFor(event.turnOwner);
|
||||||
//SDisplayUtil.showTab(nextField);
|
//SDisplayUtil.showTab(nextField);
|
||||||
}
|
}
|
||||||
@@ -263,7 +246,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finishGame() {
|
public void finishGame() {
|
||||||
new ViewWinLose(FControl.getGame()).setVisible(true);
|
new ViewWinLose(FControl.getGameView()).setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -277,19 +260,19 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPanelSelection(Card c) {
|
public void setPanelSelection(final CardView c) {
|
||||||
//GuiUtils.setPanelSelection(c); //TODO
|
//GuiUtils.setPanelSelection(c); //TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpellAbility getAbilityToPlay(List<SpellAbility> abilities, ITriggerEvent triggerEvent) {
|
public SpellAbilityView getAbilityToPlay(List<SpellAbilityView> abilities, ITriggerEvent triggerEvent) {
|
||||||
if (abilities.isEmpty()) {
|
if (abilities.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (abilities.size() == 1) {
|
if (abilities.size() == 1) {
|
||||||
return abilities.get(0);
|
return abilities.get(0);
|
||||||
}
|
}
|
||||||
return SGuiChoose.oneOrNone("Choose ability to play", abilities);
|
return SGuiChoose.oneOrNone(this, "Choose ability to play", abilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -311,22 +294,22 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCard(Card card) {
|
public void setCard(final CardView card) {
|
||||||
//doesn't need to do anything
|
//doesn't need to do anything
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showCombat(Combat combat) {
|
public void showCombat(final CombatView combat) {
|
||||||
FControl.showCombat(combat);
|
FControl.showCombat(combat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUsedToPay(Card card, boolean b) {
|
public void setUsedToPay(final CardView card, final boolean b) {
|
||||||
FControl.setUsedToPay(card, b);
|
FControl.setUsedToPay(card, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHighlighted(Player player, boolean b) {
|
public void setHighlighted(final PlayerView player, boolean b) {
|
||||||
FControl.setHighlighted(player, b);
|
FControl.setHighlighted(player, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +319,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean stopAtPhase(Player playerTurn, PhaseType phase) {
|
public boolean stopAtPhase(final PlayerView playerTurn, final PhaseType phase) {
|
||||||
return FControl.stopAtPhase(playerTurn, phase);
|
return FControl.stopAtPhase(playerTurn, phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,12 +329,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Game getGame() {
|
public Object showManaPool(final PlayerView player) {
|
||||||
return FControl.getGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object showManaPool(Player player) {
|
|
||||||
VPlayerPanel playerPanel = FControl.getPlayerPanel(player);
|
VPlayerPanel playerPanel = FControl.getPlayerPanel(player);
|
||||||
InfoTab oldSelectedTab = playerPanel.getSelectedTab();
|
InfoTab oldSelectedTab = playerPanel.getSelectedTab();
|
||||||
playerPanel.setSelectedTab(playerPanel.getManaPoolTab());
|
playerPanel.setSelectedTab(playerPanel.getManaPoolTab());
|
||||||
@@ -359,7 +337,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hideManaPool(Player player, Object zoneToRestore) {
|
public void hideManaPool(final PlayerView player, final Object zoneToRestore) {
|
||||||
VPlayerPanel playerPanel = FControl.getPlayerPanel(player);
|
VPlayerPanel playerPanel = FControl.getPlayerPanel(player);
|
||||||
if (zoneToRestore == playerPanel.getManaPoolTab()) {
|
if (zoneToRestore == playerPanel.getManaPoolTab()) {
|
||||||
return; //if mana pool was selected previously, we don't need to switch back to anything
|
return; //if mana pool was selected previously, we don't need to switch back to anything
|
||||||
@@ -371,9 +349,9 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean openZones(List<ZoneType> zones, Map<Player, Object> players) {
|
public boolean openZones(Collection<ZoneType> zones, Map<PlayerView, Object> players) {
|
||||||
if (zones.size() == 1) {
|
if (zones.size() == 1) {
|
||||||
ZoneType zoneType = zones.get(0);
|
ZoneType zoneType = zones.iterator().next();
|
||||||
switch (zoneType) {
|
switch (zoneType) {
|
||||||
case Battlefield:
|
case Battlefield:
|
||||||
case Command:
|
case Command:
|
||||||
@@ -382,7 +360,7 @@ public class GuiMobile implements IGuiBase {
|
|||||||
default:
|
default:
|
||||||
//open zone tab for given zone if needed
|
//open zone tab for given zone if needed
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
for (Player player : players.keySet()) {
|
for (PlayerView player : players.keySet()) {
|
||||||
VPlayerPanel playerPanel = FControl.getPlayerPanel(player);
|
VPlayerPanel playerPanel = FControl.getPlayerPanel(player);
|
||||||
players.put(player, playerPanel.getSelectedTab()); //backup selected tab before changing it
|
players.put(player, playerPanel.getSelectedTab()); //backup selected tab before changing it
|
||||||
InfoTab zoneTab = playerPanel.getZoneTab(zoneType);
|
InfoTab zoneTab = playerPanel.getZoneTab(zoneType);
|
||||||
@@ -400,35 +378,35 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restoreOldZones(Map<Player, Object> playersToRestoreZonesFor) {
|
public void restoreOldZones(Map<PlayerView, Object> playersToRestoreZonesFor) {
|
||||||
for (Entry<Player, Object> player : playersToRestoreZonesFor.entrySet()) {
|
for (Entry<PlayerView, Object> player : playersToRestoreZonesFor.entrySet()) {
|
||||||
VPlayerPanel playerPanel = FControl.getPlayerPanel(player.getKey());
|
VPlayerPanel playerPanel = FControl.getPlayerPanel(player.getKey());
|
||||||
playerPanel.setSelectedTab((InfoTab)player.getValue());
|
playerPanel.setSelectedTab((InfoTab)player.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateZones(List<Pair<Player, ZoneType>> zonesToUpdate) {
|
public void updateZones(List<Pair<PlayerView, ZoneType>> zonesToUpdate) {
|
||||||
FControl.updateZones(zonesToUpdate);
|
FControl.updateZones(zonesToUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCards(Set<Card> cardsToUpdate) {
|
public void updateCards(Set<CardView> cardsToUpdate) {
|
||||||
FControl.updateCards(cardsToUpdate);
|
FControl.updateCards(cardsToUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshCardDetails(Collection<Card> cards) {
|
public void refreshCardDetails(Iterable<CardView> cards) {
|
||||||
FControl.refreshCardDetails(cards);
|
FControl.refreshCardDetails(cards);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateManaPool(List<Player> manaPoolUpdate) {
|
public void updateManaPool(List<PlayerView> manaPoolUpdate) {
|
||||||
FControl.updateManaPool(manaPoolUpdate);
|
FControl.updateManaPool(manaPoolUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLives(List<Player> livesUpdate) {
|
public void updateLives(List<PlayerView> livesUpdate) {
|
||||||
FControl.updateLives(livesUpdate);
|
FControl.updateLives(livesUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,8 +416,8 @@ public class GuiMobile implements IGuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Card, Integer> getDamageToAssign(Card attacker, List<Card> blockers,
|
public Map<CardView, Integer> getDamageToAssign(CardView attacker, List<CardView> blockers,
|
||||||
int damageDealt, GameEntity defender, boolean overrideOrder) {
|
int damageDealt, GameEntityView defender, boolean overrideOrder) {
|
||||||
return FControl.getDamageToAssign(attacker, blockers,
|
return FControl.getDamageToAssign(attacker, blockers,
|
||||||
damageDealt, defender, overrideOrder);
|
damageDealt, defender, overrideOrder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.esotericsoftware.minlog.Log;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.screens.SplashScreen;
|
import forge.screens.SplashScreen;
|
||||||
import forge.toolbox.FProgressBar;
|
import forge.toolbox.FProgressBar;
|
||||||
@@ -51,7 +52,7 @@ public class AssetsDownloader {
|
|||||||
if (!Forge.getDeviceAdapter().isConnectedToWifi()) {
|
if (!Forge.getDeviceAdapter().isConnectedToWifi()) {
|
||||||
message += " If so, you may want to connect to wifi first. The download is around 6.5MB.";
|
message += " If so, you may want to connect to wifi first. The download is around 6.5MB.";
|
||||||
}
|
}
|
||||||
if (SOptionPane.showConfirmDialog(message, "New Version Available", "Update Now", "Update Later")) {
|
if (SOptionPane.showConfirmDialog(GuiBase.getInterface(), message, "New Version Available", "Update Now", "Update Later")) {
|
||||||
String apkFile = downloadFile("update", "forge-android-" + version + "-signed-aligned.apk",
|
String apkFile = downloadFile("update", "forge-android-" + version + "-signed-aligned.apk",
|
||||||
"http://cardforge.org/android/releases/forge/forge-gui-android/" + version + "/",
|
"http://cardforge.org/android/releases/forge/forge-gui-android/" + version + "/",
|
||||||
Forge.getDeviceAdapter().getDownloadsDir(), splashScreen.getProgressBar());
|
Forge.getDeviceAdapter().getDownloadsDir(), splashScreen.getProgressBar());
|
||||||
@@ -60,7 +61,7 @@ public class AssetsDownloader {
|
|||||||
Forge.exit(true);
|
Forge.exit(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SOptionPane.showMessageDialog("Could not download update. " +
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), "Could not download update. " +
|
||||||
"Press OK to proceed without update.", "Update Failed");
|
"Press OK to proceed without update.", "Update Failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +99,7 @@ public class AssetsDownloader {
|
|||||||
else {
|
else {
|
||||||
message += "You cannot start the app since you haven't previously downloaded these files.";
|
message += "You cannot start the app since you haven't previously downloaded these files.";
|
||||||
}
|
}
|
||||||
SOptionPane.showMessageDialog(message, "No Internet Connection");
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), message, "No Internet Connection");
|
||||||
if (!canIgnoreDownload) {
|
if (!canIgnoreDownload) {
|
||||||
Forge.exit(true); //exit if can't ignore download
|
Forge.exit(true); //exit if can't ignore download
|
||||||
}
|
}
|
||||||
@@ -124,7 +125,7 @@ public class AssetsDownloader {
|
|||||||
message += "This download is mandatory to start the app since you haven't previously downloaded these files.";
|
message += "This download is mandatory to start the app since you haven't previously downloaded these files.";
|
||||||
options = new String[] { "Download", "Exit" };
|
options = new String[] { "Download", "Exit" };
|
||||||
}
|
}
|
||||||
switch (SOptionPane.showOptionDialog(message, "Download Resource Files?",
|
switch (SOptionPane.showOptionDialog(GuiBase.getInterface(), message, "Download Resource Files?",
|
||||||
null, options)) {
|
null, options)) {
|
||||||
case 1:
|
case 1:
|
||||||
if (!canIgnoreDownload) {
|
if (!canIgnoreDownload) {
|
||||||
@@ -141,7 +142,7 @@ public class AssetsDownloader {
|
|||||||
FSkinFont.deleteCachedFiles(); //delete cached font files in case any skin's .ttf file changed
|
FSkinFont.deleteCachedFiles(); //delete cached font files in case any skin's .ttf file changed
|
||||||
|
|
||||||
//reload light version of skin after assets updated
|
//reload light version of skin after assets updated
|
||||||
FThreads.invokeInEdtAndWait(new Runnable() {
|
FThreads.invokeInEdtAndWait(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FSkinFont.updateAll(); //update all fonts used by splash screen
|
FSkinFont.updateAll(); //update all fonts used by splash screen
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.badlogic.gdx.math.Matrix4;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
|
|
||||||
//Special graphics object for rendering to a texture
|
//Special graphics object for rendering to a texture
|
||||||
public abstract class FBufferedImage extends FImageComplex {
|
public abstract class FBufferedImage extends FImageComplex {
|
||||||
@@ -72,7 +73,7 @@ public abstract class FBufferedImage extends FImageComplex {
|
|||||||
final FrameBuffer fb = frameBuffer;
|
final FrameBuffer fb = frameBuffer;
|
||||||
if (fb != null) {
|
if (fb != null) {
|
||||||
frameBuffer = null;
|
frameBuffer = null;
|
||||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
FThreads.invokeInEdtNowOrLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
fb.dispose(); //must be disposed on EDT thread
|
fb.dispose(); //must be disposed on EDT thread
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.badlogic.gdx.graphics.Texture;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinImage.SourceFile;
|
import forge.assets.FSkinImage.SourceFile;
|
||||||
import forge.card.CardFaceSymbols;
|
import forge.card.CardFaceSymbols;
|
||||||
import forge.card.CardImageRenderer;
|
import forge.card.CardImageRenderer;
|
||||||
@@ -51,7 +52,7 @@ public class FSkin {
|
|||||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
FThreads.invokeInBackgroundThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
loadLight(skinName, null);
|
loadLight(skinName, null);
|
||||||
@@ -63,7 +64,7 @@ public class FSkin {
|
|||||||
FSkinFont.deleteCachedFiles(); //delete cached font files so font can be update for new skin
|
FSkinFont.deleteCachedFiles(); //delete cached font files so font can be update for new skin
|
||||||
FSkinFont.updateAll();
|
FSkinFont.updateAll();
|
||||||
CardImageRenderer.forceStaticFieldUpdate();
|
CardImageRenderer.forceStaticFieldUpdate();
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
loader.hide();
|
loader.hide();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.badlogic.gdx.graphics.glutils.PixmapTextureData;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
@@ -163,7 +164,7 @@ public class FSkinFont {
|
|||||||
FileHandle fontFile = Gdx.files.absolute(ForgeConstants.FONTS_DIR + fontName + ".fnt");
|
FileHandle fontFile = Gdx.files.absolute(ForgeConstants.FONTS_DIR + fontName + ".fnt");
|
||||||
if (fontFile != null && fontFile.exists()) {
|
if (fontFile != null && fontFile.exists()) {
|
||||||
final BitmapFontData data = new BitmapFontData(fontFile, false);
|
final BitmapFontData data = new BitmapFontData(fontFile, false);
|
||||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
FThreads.invokeInEdtNowOrLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() { //font must be initialized on UI thread
|
public void run() { //font must be initialized on UI thread
|
||||||
font = new BitmapFont(data, (TextureRegion)null, true);
|
font = new BitmapFont(data, (TextureRegion)null, true);
|
||||||
@@ -202,7 +203,7 @@ public class FSkinFont {
|
|||||||
final Array<PixmapPacker.Page> pages = packer.getPages();
|
final Array<PixmapPacker.Page> pages = packer.getPages();
|
||||||
|
|
||||||
//finish generating font on UI thread
|
//finish generating font on UI thread
|
||||||
FThreads.invokeInEdtNowOrLater(new Runnable() {
|
FThreads.invokeInEdtNowOrLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
TextureRegion[] textureRegions = new TextureRegion[pages.size];
|
TextureRegion[] textureRegions = new TextureRegion[pages.size];
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ import com.google.common.cache.CacheBuilder;
|
|||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
|
|
||||||
import forge.ImageKeys;
|
import forge.ImageKeys;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.player.IHasIcon;
|
import forge.game.player.IHasIcon;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.screens.match.FControl;
|
import forge.view.CardView;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -80,14 +79,8 @@ public class ImageCache {
|
|||||||
missingIconKeys.clear();
|
missingIconKeys.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture getImage(Card card) {
|
public static Texture getImage(CardView card) {
|
||||||
final String key;
|
final String key = card.getOriginal().getImageKey();
|
||||||
if (!FControl.mayShowCard(card) || card.isFaceDown()) {
|
|
||||||
key = ImageKeys.TOKEN_PREFIX + ImageKeys.MORPH_IMAGE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
key = card.getImageKey();
|
|
||||||
}
|
|
||||||
return getImage(key, true);
|
return getImage(key, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.card.mana.ManaCostShard;
|
import forge.card.mana.ManaCostShard;
|
||||||
@@ -178,7 +179,7 @@ public class CardFaceSymbols {
|
|||||||
String symbol = tok.nextToken();
|
String symbol = tok.nextToken();
|
||||||
FSkinImage image = MANA_IMAGES.get(symbol);
|
FSkinImage image = MANA_IMAGES.get(symbol);
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
BugReporter.reportBug("Symbol not recognized \"" + symbol + "\" in string: " + s);
|
BugReporter.reportBug(GuiBase.getInterface(), "Symbol not recognized \"" + symbol + "\" in string: " + s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
g.drawImage(image, x, y, w, h);
|
g.drawImage(image, x, y, w, h);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FBufferedImage;
|
import forge.assets.FBufferedImage;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
@@ -16,8 +17,9 @@ import forge.assets.FSkinTexture;
|
|||||||
import forge.assets.TextRenderer;
|
import forge.assets.TextRenderer;
|
||||||
import forge.card.CardDetailUtil.DetailColors;
|
import forge.card.CardDetailUtil.DetailColors;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.screens.FScreen;
|
import forge.screens.FScreen;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.CardView.CardStateView;
|
||||||
|
|
||||||
public class CardImageRenderer {
|
public class CardImageRenderer {
|
||||||
private static final float BASE_IMAGE_WIDTH = 360;
|
private static final float BASE_IMAGE_WIDTH = 360;
|
||||||
@@ -54,9 +56,9 @@ public class CardImageRenderer {
|
|||||||
prevImageHeight = h;
|
prevImageHeight = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCardImage(Graphics g, Card card, float x, float y, float w, float h) {
|
public static void drawCardImage(Graphics g, CardView card, float x, float y, float w, float h) {
|
||||||
card = card.getCardForUi();
|
|
||||||
updateStaticFields(w, h);
|
updateStaticFields(w, h);
|
||||||
|
final CardStateView state = card.getOriginal();
|
||||||
|
|
||||||
float blackBorderThickness = w * CardRenderer.BLACK_BORDER_THICKNESS_RATIO;
|
float blackBorderThickness = w * CardRenderer.BLACK_BORDER_THICKNESS_RATIO;
|
||||||
g.fillRect(Color.BLACK, x, y, w, h);
|
g.fillRect(Color.BLACK, x, y, w, h);
|
||||||
@@ -66,7 +68,7 @@ public class CardImageRenderer {
|
|||||||
h -= 2 * blackBorderThickness;
|
h -= 2 * blackBorderThickness;
|
||||||
|
|
||||||
//determine colors for borders
|
//determine colors for borders
|
||||||
List<DetailColors> borderColors = CardDetailUtil.getBorderColors(card, true, true);
|
final List<DetailColors> borderColors = CardDetailUtil.getBorderColors(card.getOriginal());
|
||||||
DetailColors borderColor = borderColors.get(0);
|
DetailColors borderColor = borderColors.get(0);
|
||||||
Color color1 = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
Color color1 = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
||||||
Color color2 = null;
|
Color color2 = null;
|
||||||
@@ -99,7 +101,7 @@ public class CardImageRenderer {
|
|||||||
float typeBoxHeight = 2 * TYPE_FONT.getCapHeight();
|
float typeBoxHeight = 2 * TYPE_FONT.getCapHeight();
|
||||||
float ptBoxHeight = 0;
|
float ptBoxHeight = 0;
|
||||||
float textBoxHeight = h - headerHeight - artHeight - typeBoxHeight - outerBorderThickness - artInset;
|
float textBoxHeight = h - headerHeight - artHeight - typeBoxHeight - outerBorderThickness - artInset;
|
||||||
if (card.isCreature() || card.isPlaneswalker()) {
|
if (state.isCreature() || state.isPlaneswalker()) {
|
||||||
//if P/T box needed, make room for it
|
//if P/T box needed, make room for it
|
||||||
ptBoxHeight = 2 * PT_FONT.getCapHeight();
|
ptBoxHeight = 2 * PT_FONT.getCapHeight();
|
||||||
textBoxHeight -= ptBoxHeight;
|
textBoxHeight -= ptBoxHeight;
|
||||||
@@ -143,7 +145,7 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawHeader(Graphics g, Card card, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawHeader(Graphics g, CardView card, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
if (color2 == null) {
|
if (color2 == null) {
|
||||||
g.fillRect(color1, x, y, w, h);
|
g.fillRect(color1, x, y, w, h);
|
||||||
}
|
}
|
||||||
@@ -154,13 +156,14 @@ public class CardImageRenderer {
|
|||||||
|
|
||||||
float padding = h / 8;
|
float padding = h / 8;
|
||||||
|
|
||||||
|
final CardStateView state = card.getOriginal();
|
||||||
//draw mana cost for card
|
//draw mana cost for card
|
||||||
float manaCostWidth = 0;
|
float manaCostWidth = 0;
|
||||||
ManaCost mainManaCost = card.getManaCost();
|
ManaCost mainManaCost = state.getManaCost();
|
||||||
if (card.isSplitCard() && card.getCurState() == CardCharacteristicName.Original) {
|
if (card.isSplitCard() && card.hasAltState()) {
|
||||||
//handle rendering both parts of split card
|
//handle rendering both parts of split card
|
||||||
mainManaCost = card.getRules().getMainPart().getManaCost();
|
mainManaCost = state.getManaCost();
|
||||||
ManaCost otherManaCost = card.getRules().getOtherPart().getManaCost();
|
ManaCost otherManaCost = card.getAlternate().getManaCost();
|
||||||
manaCostWidth = CardFaceSymbols.getWidth(otherManaCost, MANA_SYMBOL_SIZE) + HEADER_PADDING;
|
manaCostWidth = CardFaceSymbols.getWidth(otherManaCost, MANA_SYMBOL_SIZE) + HEADER_PADDING;
|
||||||
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
|
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
|
||||||
//draw "//" between two parts of mana cost
|
//draw "//" between two parts of mana cost
|
||||||
@@ -173,7 +176,7 @@ public class CardImageRenderer {
|
|||||||
//draw name for card
|
//draw name for card
|
||||||
x += padding;
|
x += padding;
|
||||||
w -= 2 * padding;
|
w -= 2 * padding;
|
||||||
g.drawText(card.getName(), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true);
|
g.drawText(state.getName(), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final FBufferedImage forgeArt;
|
public static final FBufferedImage forgeArt;
|
||||||
@@ -197,7 +200,7 @@ public class CardImageRenderer {
|
|||||||
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawTypeLine(Graphics g, Card card, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawTypeLine(Graphics g, CardView card, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
if (color2 == null) {
|
if (color2 == null) {
|
||||||
g.fillRect(color1, x, y, w, h);
|
g.fillRect(color1, x, y, w, h);
|
||||||
}
|
}
|
||||||
@@ -216,13 +219,13 @@ public class CardImageRenderer {
|
|||||||
|
|
||||||
//draw type
|
//draw type
|
||||||
x += padding;
|
x += padding;
|
||||||
g.drawText(CardDetailUtil.formatCardType(card), TYPE_FONT, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true);
|
g.drawText(CardDetailUtil.formatCardType(card.getOriginal()), TYPE_FONT, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//use text g to handle mana symbols and reminder text
|
//use text g to handle mana symbols and reminder text
|
||||||
private static final TextRenderer cardTextRenderer = new TextRenderer(true);
|
private static final TextRenderer cardTextRenderer = new TextRenderer(true);
|
||||||
|
|
||||||
private static void drawTextBox(Graphics g, Card card, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawTextBox(Graphics g, CardView card, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
if (color2 == null) {
|
if (color2 == null) {
|
||||||
g.fillRect(color1, x, y, w, h);
|
g.fillRect(color1, x, y, w, h);
|
||||||
}
|
}
|
||||||
@@ -231,10 +234,11 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
||||||
|
|
||||||
if (card.isBasicLand()) {
|
final CardStateView state = card.getOriginal();
|
||||||
|
if (state.isBasicLand()) {
|
||||||
//draw icons for basic lands
|
//draw icons for basic lands
|
||||||
FSkinImage image;
|
FSkinImage image;
|
||||||
switch (card.getName()) {
|
switch (state.getName()) {
|
||||||
case "Plains":
|
case "Plains":
|
||||||
image = FSkinImage.MANA_W;
|
image = FSkinImage.MANA_W;
|
||||||
break;
|
break;
|
||||||
@@ -255,11 +259,9 @@ public class CardImageRenderer {
|
|||||||
g.drawImage(image, x + (w - iconSize) / 2, y + (h - iconSize) / 2, iconSize, iconSize);
|
g.drawImage(image, x + (w - iconSize) / 2, y + (h - iconSize) / 2, iconSize, iconSize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String text = card.getOracleText();
|
final String text = card.getOriginal().getText();
|
||||||
if (StringUtils.isEmpty(text)) { return; }
|
if (StringUtils.isEmpty(text)) { return; }
|
||||||
|
|
||||||
text = text.replace("\\n", "\n"); //replace new line placeholders with actual new line characters
|
|
||||||
|
|
||||||
float padding = TEXT_FONT.getCapHeight() * 0.75f;
|
float padding = TEXT_FONT.getCapHeight() * 0.75f;
|
||||||
x += padding;
|
x += padding;
|
||||||
y += padding;
|
y += padding;
|
||||||
@@ -269,15 +271,16 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawPtBox(Graphics g, Card card, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawPtBox(Graphics g, CardView card, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
|
final CardStateView state = card.getOriginal();
|
||||||
List<String> pieces = new ArrayList<String>();
|
List<String> pieces = new ArrayList<String>();
|
||||||
if (card.isCreature()) {
|
if (state.isCreature()) {
|
||||||
pieces.add(String.valueOf(card.getBaseAttack()));
|
pieces.add(String.valueOf(state.getPower()));
|
||||||
pieces.add("/");
|
pieces.add("/");
|
||||||
pieces.add(String.valueOf(card.getBaseDefense()));
|
pieces.add(String.valueOf(state.getToughness()));
|
||||||
}
|
}
|
||||||
else if (card.isPlaneswalker()) {
|
else if (state.isPlaneswalker()) {
|
||||||
pieces.add(String.valueOf(card.getBaseLoyalty()));
|
pieces.add(String.valueOf(state.getLoyalty()));
|
||||||
}
|
}
|
||||||
else { return; }
|
else { return; }
|
||||||
|
|
||||||
|
|||||||
@@ -23,18 +23,20 @@ import forge.assets.ImageCache;
|
|||||||
import forge.assets.TextRenderer;
|
import forge.assets.TextRenderer;
|
||||||
import forge.card.CardDetailUtil.DetailColors;
|
import forge.card.CardDetailUtil.DetailColors;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.game.Game;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.combat.Combat;
|
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.screens.match.FControl.CardDetails;
|
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
import forge.toolbox.FDialog;
|
import forge.toolbox.FDialog;
|
||||||
import forge.toolbox.FList;
|
import forge.toolbox.FList;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.CombatView;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
import forge.view.CardView.CardStateView;
|
||||||
|
import forge.view.ViewUtil;
|
||||||
|
|
||||||
public class CardRenderer {
|
public class CardRenderer {
|
||||||
private static final FSkinFont NAME_FONT = FSkinFont.get(16);
|
private static final FSkinFont NAME_FONT = FSkinFont.get(16);
|
||||||
@@ -72,36 +74,30 @@ public class CardRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean drawZoom(Graphics g, Card card, float width, float height) {
|
public static boolean drawZoom(Graphics g, CardView card, float width, float height) {
|
||||||
float x = FDialog.INSETS;
|
float x = FDialog.INSETS;
|
||||||
float y = FDialog.INSETS;
|
float y = FDialog.INSETS;
|
||||||
float w = width - 2 * x;
|
float w = width - 2 * x;
|
||||||
float h = height - 2 * y;
|
float h = height - 2 * y;
|
||||||
|
|
||||||
final Texture image;
|
final Texture image = ImageCache.getImage(card.getOriginal().getImageKey(), true);
|
||||||
boolean canShow = FControl.mayShowCard(card) || FDialog.isDialogOpen(); //support showing if card revealed in dialog
|
if (image == ImageCache.defaultImage) { //support drawing card image manually if card image not found
|
||||||
if (canShow) {
|
float ratio = h / w;
|
||||||
image = ImageCache.getImage(card.getImageKey(), true);
|
if (ratio > FCardPanel.ASPECT_RATIO) {
|
||||||
if (image == ImageCache.defaultImage) { //support drawing card image manually if card image not found
|
float oldHeight = h;
|
||||||
float ratio = h / w;
|
h = w * FCardPanel.ASPECT_RATIO;
|
||||||
if (ratio > FCardPanel.ASPECT_RATIO) {
|
y += (oldHeight - h) / 2;
|
||||||
float oldHeight = h;
|
|
||||||
h = w * FCardPanel.ASPECT_RATIO;
|
|
||||||
y += (oldHeight - h) / 2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
float oldWidth = w;
|
|
||||||
w = h / FCardPanel.ASPECT_RATIO;
|
|
||||||
x += (oldWidth - w) / 2;
|
|
||||||
}
|
|
||||||
CardImageRenderer.drawCardImage(g, card, x, y, w, h);
|
|
||||||
drawFoilEffect(g, card, x, y, w, h);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
float oldWidth = w;
|
||||||
|
w = h / FCardPanel.ASPECT_RATIO;
|
||||||
|
x += (oldWidth - w) / 2;
|
||||||
|
}
|
||||||
|
CardImageRenderer.drawCardImage(g, card, x, y, w, h);
|
||||||
|
drawFoilEffect(g, card, x, y, w, h);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else { //only show card back if can't show card
|
|
||||||
image = ImageCache.getImage(ImageKeys.TOKEN_PREFIX + ImageKeys.MORPH_IMAGE, true);
|
|
||||||
}
|
|
||||||
if (image == null || image == ImageCache.defaultImage) { return false; } //don't support drawing zoom for null or default textures
|
if (image == null || image == ImageCache.defaultImage) { return false; } //don't support drawing zoom for null or default textures
|
||||||
|
|
||||||
float imageWidth = image.getWidth();
|
float imageWidth = image.getWidth();
|
||||||
@@ -134,15 +130,11 @@ public class CardRenderer {
|
|||||||
x = (width - imageWidth) / 2;
|
x = (width - imageWidth) / 2;
|
||||||
y = (height - imageHeight) / 2;
|
y = (height - imageHeight) / 2;
|
||||||
g.drawImage(image, x, y, imageWidth, imageHeight);
|
g.drawImage(image, x, y, imageWidth, imageHeight);
|
||||||
if (canShow) {
|
drawFoilEffect(g, card, x, y, w, h);
|
||||||
drawFoilEffect(g, card, x, y, w, h);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawDetails(Graphics g, Card card, float width, float height) {
|
public static void drawDetails(Graphics g, CardView card, float width, float height) {
|
||||||
card = card.getCardForUi();
|
|
||||||
|
|
||||||
float x = FDialog.INSETS;
|
float x = FDialog.INSETS;
|
||||||
float y = FDialog.INSETS;
|
float y = FDialog.INSETS;
|
||||||
float w = width - 2 * x;
|
float w = width - 2 * x;
|
||||||
@@ -160,8 +152,6 @@ public class CardRenderer {
|
|||||||
x += (oldWidth - w) / 2;
|
x += (oldWidth - w) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canShow = FControl.mayShowCard(card) || FDialog.isDialogOpen(); //support showing if card revealed in dialog
|
|
||||||
|
|
||||||
float blackBorderThickness = w * BLACK_BORDER_THICKNESS_RATIO;
|
float blackBorderThickness = w * BLACK_BORDER_THICKNESS_RATIO;
|
||||||
g.fillRect(Color.BLACK, x, y, w, h);
|
g.fillRect(Color.BLACK, x, y, w, h);
|
||||||
x += blackBorderThickness;
|
x += blackBorderThickness;
|
||||||
@@ -170,7 +160,7 @@ public class CardRenderer {
|
|||||||
h -= 2 * blackBorderThickness;
|
h -= 2 * blackBorderThickness;
|
||||||
|
|
||||||
//determine colors for borders
|
//determine colors for borders
|
||||||
List<DetailColors> borderColors = CardDetailUtil.getBorderColors(card, canShow, true);
|
List<DetailColors> borderColors = CardDetailUtil.getBorderColors(card.getOriginal());
|
||||||
DetailColors borderColor = borderColors.get(0);
|
DetailColors borderColor = borderColors.get(0);
|
||||||
Color color1 = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
Color color1 = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
||||||
Color color2 = null;
|
Color color2 = null;
|
||||||
@@ -196,7 +186,7 @@ public class CardRenderer {
|
|||||||
//draw name/type box
|
//draw name/type box
|
||||||
Color nameBoxColor1 = FSkinColor.tintColor(Color.WHITE, color1, NAME_BOX_TINT);
|
Color nameBoxColor1 = FSkinColor.tintColor(Color.WHITE, color1, NAME_BOX_TINT);
|
||||||
Color nameBoxColor2 = color2 == null ? null : FSkinColor.tintColor(Color.WHITE, color2, NAME_BOX_TINT);
|
Color nameBoxColor2 = color2 == null ? null : FSkinColor.tintColor(Color.WHITE, color2, NAME_BOX_TINT);
|
||||||
drawCardNameBox(g, card, canShow, nameBoxColor1, nameBoxColor2, x, y, w, cardNameBoxHeight);
|
drawCardNameBox(g, card, nameBoxColor1, nameBoxColor2, x, y, w, cardNameBoxHeight);
|
||||||
|
|
||||||
float innerBorderThickness = outerBorderThickness / 2;
|
float innerBorderThickness = outerBorderThickness / 2;
|
||||||
float ptBoxHeight = 2 * PT_FONT.getCapHeight();
|
float ptBoxHeight = 2 * PT_FONT.getCapHeight();
|
||||||
@@ -205,14 +195,12 @@ public class CardRenderer {
|
|||||||
y += cardNameBoxHeight + innerBorderThickness;
|
y += cardNameBoxHeight + innerBorderThickness;
|
||||||
Color textBoxColor1 = FSkinColor.tintColor(Color.WHITE, color1, TEXT_BOX_TINT);
|
Color textBoxColor1 = FSkinColor.tintColor(Color.WHITE, color1, TEXT_BOX_TINT);
|
||||||
Color textBoxColor2 = color2 == null ? null : FSkinColor.tintColor(Color.WHITE, color2, TEXT_BOX_TINT);
|
Color textBoxColor2 = color2 == null ? null : FSkinColor.tintColor(Color.WHITE, color2, TEXT_BOX_TINT);
|
||||||
drawCardTextBox(g, card, canShow, textBoxColor1, textBoxColor2, x, y, w, textBoxHeight);
|
drawCardTextBox(g, card, textBoxColor1, textBoxColor2, x, y, w, textBoxHeight);
|
||||||
|
|
||||||
if (canShow) {
|
y += textBoxHeight + innerBorderThickness;
|
||||||
y += textBoxHeight + innerBorderThickness;
|
Color ptColor1 = FSkinColor.tintColor(Color.WHITE, color1, PT_BOX_TINT);
|
||||||
Color ptColor1 = FSkinColor.tintColor(Color.WHITE, color1, PT_BOX_TINT);
|
Color ptColor2 = color2 == null ? null : FSkinColor.tintColor(Color.WHITE, color2, PT_BOX_TINT);
|
||||||
Color ptColor2 = color2 == null ? null : FSkinColor.tintColor(Color.WHITE, color2, PT_BOX_TINT);
|
drawCardIdAndPtBox(g, card, idForeColor, ptColor1, ptColor2, x, y, w, ptBoxHeight);
|
||||||
drawCardIdAndPtBox(g, card, idForeColor, ptColor1, ptColor2, x, y, w, ptBoxHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getCardListItemHeight(boolean compactMode) {
|
public static float getCardListItemHeight(boolean compactMode) {
|
||||||
@@ -229,8 +217,8 @@ public class CardRenderer {
|
|||||||
public static FImageComplex getCardArt(IPaperCard pc) {
|
public static FImageComplex getCardArt(IPaperCard pc) {
|
||||||
return getCardArt(ImageKeys.getImageKey(pc, false), pc.getRules().getSplitType() == CardSplitType.Split);
|
return getCardArt(ImageKeys.getImageKey(pc, false), pc.getRules().getSplitType() == CardSplitType.Split);
|
||||||
}
|
}
|
||||||
public static FImageComplex getCardArt(Card card) {
|
public static FImageComplex getCardArt(CardView card) {
|
||||||
return getCardArt(card.getImageKey(), card.isSplitCard());
|
return getCardArt(card.getOriginal().getImageKey(), card.isSplitCard());
|
||||||
}
|
}
|
||||||
public static FImageComplex getCardArt(String imageKey, boolean isSplitCard) {
|
public static FImageComplex getCardArt(String imageKey, boolean isSplitCard) {
|
||||||
FImageComplex cardArt = cardArtCache.get(imageKey);
|
FImageComplex cardArt = cardArtCache.get(imageKey);
|
||||||
@@ -274,16 +262,14 @@ public class CardRenderer {
|
|||||||
return cardArt;
|
return cardArt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, Card card, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
|
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, CardView card, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
|
||||||
card = card.getCardForUi();
|
final CardStateView state = card.getOriginal();
|
||||||
CardRules cardRules = card.getRules();
|
if (card.isUiDisplayable()) {
|
||||||
if (cardRules != null) {
|
drawCardListItem(g, font, foreColor, getCardArt(card), card, card.getSetCode(),
|
||||||
drawCardListItem(g, font, foreColor, getCardArt(card), cardRules, card.getCurSetCode(),
|
card.getRarity(), state.getPower(), state.getToughness(),
|
||||||
card.getRarity(), card.getNetAttack(), card.getNetDefense(),
|
state.getLoyalty(), count, suffix, x, y, w, h, compactMode);
|
||||||
card.getCurrentLoyalty(), count, suffix, x, y, w, h, compactMode);
|
} else { //if fake card, just draw card name centered
|
||||||
}
|
String name = state.getName();
|
||||||
else { //if fake card, just draw card name centered
|
|
||||||
String name = card.getName();
|
|
||||||
if (count > 0) { //preface name with count if applicable
|
if (count > 0) { //preface name with count if applicable
|
||||||
name = count + " " + name;
|
name = count + " " + name;
|
||||||
}
|
}
|
||||||
@@ -294,11 +280,12 @@ public class CardRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, IPaperCard pc, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
|
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, IPaperCard pc, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
|
||||||
CardRules cardRules = pc.getRules();
|
final CardView card = ViewUtil.getCardForUi(pc);
|
||||||
if (cardRules != null) {
|
if (card.isUiDisplayable()) {
|
||||||
drawCardListItem(g, font, foreColor, getCardArt(pc), cardRules, pc.getEdition(),
|
final CardStateView state = card.getOriginal();
|
||||||
pc.getRarity(), cardRules.getIntPower(), cardRules.getIntToughness(),
|
drawCardListItem(g, font, foreColor, getCardArt(pc), card, pc.getEdition(),
|
||||||
cardRules.getInitialLoyalty(), count, suffix, x, y, w, h, compactMode);
|
pc.getRarity(), state.getPower(), state.getToughness(),
|
||||||
|
state.getLoyalty(), count, suffix, x, y, w, h, compactMode);
|
||||||
}
|
}
|
||||||
else { //if fake card, just draw card name centered
|
else { //if fake card, just draw card name centered
|
||||||
String name = pc.getName();
|
String name = pc.getName();
|
||||||
@@ -311,13 +298,13 @@ public class CardRenderer {
|
|||||||
g.drawText(name, font, foreColor, x, y, w, h, false, HAlignment.CENTER, true);
|
g.drawText(name, font, foreColor, x, y, w, h, false, HAlignment.CENTER, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, FImageComplex cardArt, CardRules cardRules, String set, CardRarity rarity, int power, int toughness, int loyalty, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
|
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, FImageComplex cardArt, CardView card, String set, CardRarity rarity, int power, int toughness, int loyalty, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
|
||||||
float cardArtHeight = h + 2 * FList.PADDING;
|
float cardArtHeight = h + 2 * FList.PADDING;
|
||||||
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
|
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
|
||||||
if (cardArt != null) {
|
if (cardArt != null) {
|
||||||
float artX = x - FList.PADDING;
|
float artX = x - FList.PADDING;
|
||||||
float artY = y - FList.PADDING;
|
float artY = y - FList.PADDING;
|
||||||
if (cardRules.getSplitType() == CardSplitType.Split) {
|
if (card.isSplitCard()) {
|
||||||
//draw split art with proper orientation
|
//draw split art with proper orientation
|
||||||
float srcY = cardArt.getHeight() * 13f / 354f;
|
float srcY = cardArt.getHeight() * 13f / 354f;
|
||||||
float srcHeight = cardArt.getHeight() * 150f / 354f;
|
float srcHeight = cardArt.getHeight() * 150f / 354f;
|
||||||
@@ -334,10 +321,10 @@ public class CardRenderer {
|
|||||||
|
|
||||||
//render card name and mana cost on first line
|
//render card name and mana cost on first line
|
||||||
float manaCostWidth = 0;
|
float manaCostWidth = 0;
|
||||||
ManaCost mainManaCost = cardRules.getMainPart().getManaCost();
|
ManaCost mainManaCost = card.getOriginal().getManaCost();
|
||||||
if (cardRules.getSplitType() == CardSplitType.Split) {
|
if (card.isSplitCard()) {
|
||||||
//handle rendering both parts of split card
|
//handle rendering both parts of split card
|
||||||
ManaCost otherManaCost = cardRules.getOtherPart().getManaCost();
|
ManaCost otherManaCost = card.getAlternate().getManaCost();
|
||||||
manaCostWidth = CardFaceSymbols.getWidth(otherManaCost, MANA_SYMBOL_SIZE) + MANA_COST_PADDING;
|
manaCostWidth = CardFaceSymbols.getWidth(otherManaCost, MANA_SYMBOL_SIZE) + MANA_COST_PADDING;
|
||||||
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth + MANA_COST_PADDING, y, MANA_SYMBOL_SIZE);
|
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth + MANA_COST_PADDING, y, MANA_SYMBOL_SIZE);
|
||||||
//draw "//" between two parts of mana cost
|
//draw "//" between two parts of mana cost
|
||||||
@@ -348,7 +335,7 @@ public class CardRenderer {
|
|||||||
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y, MANA_SYMBOL_SIZE);
|
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y, MANA_SYMBOL_SIZE);
|
||||||
|
|
||||||
x += cardArtWidth;
|
x += cardArtWidth;
|
||||||
String name = cardRules.getName();
|
String name = card.getOriginal().getName();
|
||||||
if (count > 0) { //preface name with count if applicable
|
if (count > 0) { //preface name with count if applicable
|
||||||
name = count + " " + name;
|
name = count + " " + name;
|
||||||
}
|
}
|
||||||
@@ -372,17 +359,17 @@ public class CardRenderer {
|
|||||||
availableTypeWidth -= setWidth;
|
availableTypeWidth -= setWidth;
|
||||||
drawSetLabel(g, typeFont, set, rarity, x + availableTypeWidth + SET_BOX_MARGIN, y - SET_BOX_MARGIN, setWidth, lineHeight + 2 * SET_BOX_MARGIN);
|
drawSetLabel(g, typeFont, set, rarity, x + availableTypeWidth + SET_BOX_MARGIN, y - SET_BOX_MARGIN, setWidth, lineHeight + 2 * SET_BOX_MARGIN);
|
||||||
}
|
}
|
||||||
String type = cardRules.getType().toString();
|
String type = CardDetailUtil.formatCardId(card.getOriginal());
|
||||||
if (cardRules.getType().isCreature()) { //include P/T or Loyalty at end of type
|
if (card.getOriginal().isCreature()) { //include P/T or Loyalty at end of type
|
||||||
type += " (" + power + " / " + toughness + ")";
|
type += " (" + power + " / " + toughness + ")";
|
||||||
}
|
}
|
||||||
else if (cardRules.getType().isPlaneswalker()) {
|
else if (card.getOriginal().isPlaneswalker()) {
|
||||||
type += " (" + loyalty + ")";
|
type += " (" + loyalty + ")";
|
||||||
}
|
}
|
||||||
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, HAlignment.LEFT, true);
|
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, HAlignment.LEFT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean cardListItemTap(Card card, float x, float y, int count, boolean compactMode) {
|
public static boolean cardListItemTap(CardView card, float x, float y, int count, boolean compactMode) {
|
||||||
if (x <= getCardListItemHeight(compactMode) * CARD_ART_RATIO) {
|
if (x <= getCardListItemHeight(compactMode) * CARD_ART_RATIO) {
|
||||||
CardZoom.show(card);
|
CardZoom.show(card);
|
||||||
return true;
|
return true;
|
||||||
@@ -393,13 +380,13 @@ public class CardRenderer {
|
|||||||
float cardArtHeight = getCardListItemHeight(compactMode);
|
float cardArtHeight = getCardListItemHeight(compactMode);
|
||||||
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
|
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
|
||||||
if (x <= cardArtWidth && y <= cardArtHeight) {
|
if (x <= cardArtWidth && y <= cardArtHeight) {
|
||||||
CardZoom.show(Card.getCardForUi(pc));
|
CardZoom.show(ViewUtil.getCardForUi(pc));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawCardNameBox(Graphics g, Card card, boolean canShow, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawCardNameBox(Graphics g, CardView card, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
if (color2 == null) {
|
if (color2 == null) {
|
||||||
g.fillRect(color1, x, y, w, h);
|
g.fillRect(color1, x, y, w, h);
|
||||||
}
|
}
|
||||||
@@ -409,47 +396,44 @@ public class CardRenderer {
|
|||||||
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
||||||
|
|
||||||
float padding = h / 8;
|
float padding = h / 8;
|
||||||
|
final CardStateView state = card.getOriginal();
|
||||||
|
|
||||||
//make sure name/mana cost row height is tall enough for both
|
//make sure name/mana cost row height is tall enough for both
|
||||||
h = Math.max(MANA_SYMBOL_SIZE + 2 * MANA_COST_PADDING, 2 * NAME_FONT.getCapHeight());
|
h = Math.max(MANA_SYMBOL_SIZE + 2 * MANA_COST_PADDING, 2 * NAME_FONT.getCapHeight());
|
||||||
|
|
||||||
//draw mana cost for card
|
//draw mana cost for card
|
||||||
float manaCostWidth = 0;
|
float manaCostWidth = 0;
|
||||||
if (canShow) {
|
ManaCost mainManaCost = state.getManaCost();
|
||||||
ManaCost mainManaCost = card.getManaCost();
|
if (card.isSplitCard() && card.hasAltState()) {
|
||||||
if (card.isSplitCard() && card.getCurState() == CardCharacteristicName.Original) {
|
//handle rendering both parts of split card
|
||||||
//handle rendering both parts of split card
|
mainManaCost = state.getManaCost();
|
||||||
mainManaCost = card.getRules().getMainPart().getManaCost();
|
ManaCost otherManaCost = card.getAlternate().getManaCost();
|
||||||
ManaCost otherManaCost = card.getRules().getOtherPart().getManaCost();
|
manaCostWidth = CardFaceSymbols.getWidth(otherManaCost, MANA_SYMBOL_SIZE) + MANA_COST_PADDING;
|
||||||
manaCostWidth = CardFaceSymbols.getWidth(otherManaCost, MANA_SYMBOL_SIZE) + MANA_COST_PADDING;
|
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
|
||||||
CardFaceSymbols.drawManaCost(g, otherManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
|
//draw "//" between two parts of mana cost
|
||||||
//draw "//" between two parts of mana cost
|
manaCostWidth += NAME_FONT.getBounds("//").width + MANA_COST_PADDING;
|
||||||
manaCostWidth += NAME_FONT.getBounds("//").width + MANA_COST_PADDING;
|
g.drawText("//", NAME_FONT, Color.BLACK, x + w - manaCostWidth, y, w, h, false, HAlignment.LEFT, true);
|
||||||
g.drawText("//", NAME_FONT, Color.BLACK, x + w - manaCostWidth, y, w, h, false, HAlignment.LEFT, true);
|
|
||||||
}
|
|
||||||
manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE) + MANA_COST_PADDING;
|
|
||||||
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
|
|
||||||
}
|
}
|
||||||
|
manaCostWidth += CardFaceSymbols.getWidth(mainManaCost, MANA_SYMBOL_SIZE) + MANA_COST_PADDING;
|
||||||
|
CardFaceSymbols.drawManaCost(g, mainManaCost, x + w - manaCostWidth, y + (h - MANA_SYMBOL_SIZE) / 2, MANA_SYMBOL_SIZE);
|
||||||
|
|
||||||
//draw name for card
|
//draw name for card
|
||||||
x += padding;
|
x += padding;
|
||||||
w -= 2 * padding;
|
w -= 2 * padding;
|
||||||
g.drawText(!canShow || card.isFaceDown() ? "???" : card.getName(), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true);
|
g.drawText(state.getName(), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, HAlignment.LEFT, true);
|
||||||
|
|
||||||
//draw type and set label for card
|
//draw type and set label for card
|
||||||
if (canShow) {
|
y += h;
|
||||||
y += h;
|
h = 2 * TYPE_FONT.getCapHeight();
|
||||||
h = 2 * TYPE_FONT.getCapHeight();
|
|
||||||
|
|
||||||
String set = card.getCurSetCode();
|
String set = card.getSetCode();
|
||||||
if (!StringUtils.isEmpty(set)) {
|
if (!StringUtils.isEmpty(set)) {
|
||||||
float setWidth = getSetWidth(SET_FONT, set);
|
float setWidth = getSetWidth(SET_FONT, set);
|
||||||
drawSetLabel(g, SET_FONT, set, card.getRarity(), x + w + padding - setWidth - SET_BOX_MARGIN, y + SET_BOX_MARGIN, setWidth, h - SET_BOX_MARGIN);
|
drawSetLabel(g, SET_FONT, set, card.getRarity(), x + w + padding - setWidth - SET_BOX_MARGIN, y + SET_BOX_MARGIN, setWidth, h - SET_BOX_MARGIN);
|
||||||
w -= setWidth; //reduce available width for type
|
w -= setWidth; //reduce available width for type
|
||||||
}
|
|
||||||
|
|
||||||
g.drawText(CardDetailUtil.formatCardType(card), TYPE_FONT, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g.drawText(CardDetailUtil.formatCardType(state), TYPE_FONT, Color.BLACK, x, y, w, h, false, HAlignment.LEFT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getSetWidth(FSkinFont font, String set) {
|
public static float getSetWidth(FSkinFont font, String set) {
|
||||||
@@ -466,7 +450,7 @@ public class CardRenderer {
|
|||||||
//use text renderer to handle mana symbols and reminder text
|
//use text renderer to handle mana symbols and reminder text
|
||||||
private static final TextRenderer cardTextRenderer = new TextRenderer(true);
|
private static final TextRenderer cardTextRenderer = new TextRenderer(true);
|
||||||
|
|
||||||
private static void drawCardTextBox(Graphics g, Card card, boolean canShow, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawCardTextBox(Graphics g, CardView card, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
if (color2 == null) {
|
if (color2 == null) {
|
||||||
g.fillRect(color1, x, y, w, h);
|
g.fillRect(color1, x, y, w, h);
|
||||||
}
|
}
|
||||||
@@ -481,14 +465,16 @@ public class CardRenderer {
|
|||||||
y += padY;
|
y += padY;
|
||||||
w -= 2 * padX;
|
w -= 2 * padX;
|
||||||
h -= 2 * padY;
|
h -= 2 * padY;
|
||||||
cardTextRenderer.drawText(g, CardDetailUtil.composeCardText(card, canShow), TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, HAlignment.LEFT, false);
|
cardTextRenderer.drawText(g, CardDetailUtil.composeCardText(card.getOriginal()), TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, HAlignment.LEFT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawCardIdAndPtBox(Graphics g, Card card, Color idForeColor, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawCardIdAndPtBox(Graphics g, CardView card, Color idForeColor, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
String idText = CardDetailUtil.formatCardId(card);
|
final CardStateView state = card.getOriginal();
|
||||||
|
|
||||||
|
String idText = CardDetailUtil.formatCardId(state);
|
||||||
g.drawText(idText, ID_FONT, idForeColor, x, y + ID_FONT.getCapHeight() / 2, w, h, false, HAlignment.LEFT, false);
|
g.drawText(idText, ID_FONT, idForeColor, x, y + ID_FONT.getCapHeight() / 2, w, h, false, HAlignment.LEFT, false);
|
||||||
|
|
||||||
String ptText = CardDetailUtil.formatPowerToughness(card);
|
String ptText = CardDetailUtil.formatPowerToughness(state);
|
||||||
if (StringUtils.isEmpty(ptText)) { return; }
|
if (StringUtils.isEmpty(ptText)) { return; }
|
||||||
|
|
||||||
float padding = PT_FONT.getCapHeight() / 2;
|
float padding = PT_FONT.getCapHeight() / 2;
|
||||||
@@ -511,14 +497,14 @@ public class CardRenderer {
|
|||||||
Texture image = ImageCache.getImage(pc);
|
Texture image = ImageCache.getImage(pc);
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
if (image == ImageCache.defaultImage) {
|
if (image == ImageCache.defaultImage) {
|
||||||
CardImageRenderer.drawCardImage(g, Card.getCardForUi(pc), x, y, w, h);
|
CardImageRenderer.drawCardImage(g, ViewUtil.getCardForUi(pc), x, y, w, h);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g.drawImage(image, x, y, w, h);
|
g.drawImage(image, x, y, w, h);
|
||||||
}
|
}
|
||||||
if (pc.isFoil()) { //draw foil effect if needed
|
if (pc.isFoil()) { //draw foil effect if needed
|
||||||
Card card = Card.getCardForUi(pc);
|
final CardView card = ViewUtil.getCardForUi(pc);
|
||||||
if (card.getFoil() == 0) { //if foil finish not yet established, assign a random one
|
if (card.getFoilIndex() == 0) { //if foil finish not yet established, assign a random one
|
||||||
card.setRandomFoil();
|
card.setRandomFoil();
|
||||||
}
|
}
|
||||||
drawFoilEffect(g, card, x, y, w, h);
|
drawFoilEffect(g, card, x, y, w, h);
|
||||||
@@ -528,29 +514,24 @@ public class CardRenderer {
|
|||||||
g.fillRect(Color.BLACK, x, y, w, h);
|
g.fillRect(Color.BLACK, x, y, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void drawCard(Graphics g, Card card, boolean canShow, float x, float y, float w, float h) {
|
public static void drawCard(Graphics g, CardView card, float x, float y, float w, float h) {
|
||||||
Texture image = ImageCache.getImage(card);
|
Texture image = ImageCache.getImage(card);
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
if (image == ImageCache.defaultImage && canShow) {
|
if (image == ImageCache.defaultImage) {
|
||||||
CardImageRenderer.drawCardImage(g, card, x, y, w, h);
|
CardImageRenderer.drawCardImage(g, card, x, y, w, h);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g.drawImage(image, x, y, w, h);
|
g.drawImage(image, x, y, w, h);
|
||||||
}
|
}
|
||||||
if (canShow) {
|
drawFoilEffect(g, card, x, y, w, h);
|
||||||
drawFoilEffect(g, card, x, y, w, h);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else { //draw cards without textures as just a black rectangle
|
else { //draw cards without textures as just a black rectangle
|
||||||
g.fillRect(Color.BLACK, x, y, w, h);
|
g.fillRect(Color.BLACK, x, y, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCardWithOverlays(Graphics g, Card card, float x, float y, float w, float h) {
|
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h) {
|
||||||
card = card.getCardForUi();
|
drawCard(g, card, x, y, w, h);
|
||||||
|
|
||||||
boolean canShow = FControl.mayShowCard(card);
|
|
||||||
drawCard(g, card, canShow, x, y, w, h);
|
|
||||||
|
|
||||||
float padding = w * 0.021f; //adjust for card border
|
float padding = w * 0.021f; //adjust for card border
|
||||||
x += padding;
|
x += padding;
|
||||||
@@ -558,25 +539,25 @@ public class CardRenderer {
|
|||||||
w -= 2 * padding;
|
w -= 2 * padding;
|
||||||
h -= 2 * padding;
|
h -= 2 * padding;
|
||||||
|
|
||||||
CardDetails details = FControl.getCardDetails(card);
|
CardStateView details = FControl.getCardDetails(card);
|
||||||
DetailColors borderColor = CardDetailUtil.getBorderColor(details.colors, details.isLand, canShow);
|
DetailColors borderColor = CardDetailUtil.getBorderColor(details);
|
||||||
Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
Color color = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
||||||
color = FSkinColor.tintColor(Color.WHITE, color, CardRenderer.PT_BOX_TINT);
|
color = FSkinColor.tintColor(Color.WHITE, color, CardRenderer.PT_BOX_TINT);
|
||||||
|
|
||||||
//draw name and mana cost overlays if card is small or default card image being used
|
//draw name and mana cost overlays if card is small or default card image being used
|
||||||
if (h <= NAME_COST_THRESHOLD) {
|
if (h <= NAME_COST_THRESHOLD) {
|
||||||
if (showCardNameOverlay(card)) {
|
if (showCardNameOverlay(card)) {
|
||||||
g.drawOutlinedText(card.getName(), FSkinFont.forHeight(h * 0.18f), Color.WHITE, Color.BLACK, x + padding, y + padding, w - 2 * padding, h * 0.4f, true, HAlignment.LEFT, false);
|
g.drawOutlinedText(details.getName(), FSkinFont.forHeight(h * 0.18f), Color.WHITE, Color.BLACK, x + padding, y + padding, w - 2 * padding, h * 0.4f, true, HAlignment.LEFT, false);
|
||||||
}
|
}
|
||||||
if (showCardManaCostOverlay(card)) {
|
if (showCardManaCostOverlay(card)) {
|
||||||
float manaSymbolSize = w / 4;
|
float manaSymbolSize = w / 4;
|
||||||
if (card.isSplitCard() && card.getCurState() == CardCharacteristicName.Original) {
|
if (card.isSplitCard() && card.hasAltState()) {
|
||||||
float dy = manaSymbolSize / 2 + Utils.scaleY(5);
|
float dy = manaSymbolSize / 2 + Utils.scaleY(5);
|
||||||
drawManaCost(g, card.getRules().getMainPart().getManaCost(), x, y + dy, w, h, manaSymbolSize);
|
drawManaCost(g, card.getOriginal().getManaCost(), x, y + dy, w, h, manaSymbolSize);
|
||||||
drawManaCost(g, card.getRules().getOtherPart().getManaCost(), x, y - dy, w, h, manaSymbolSize);
|
drawManaCost(g, card.getAlternate().getManaCost(), x, y - dy, w, h, manaSymbolSize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawManaCost(g, card.getManaCost(), x, y, w, h, manaSymbolSize);
|
drawManaCost(g, card.getOriginal().getManaCost(), x, y, w, h, manaSymbolSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -584,7 +565,7 @@ public class CardRenderer {
|
|||||||
if (showCardIdOverlay(card)) {
|
if (showCardIdOverlay(card)) {
|
||||||
FSkinFont idFont = FSkinFont.forHeight(h * 0.12f);
|
FSkinFont idFont = FSkinFont.forHeight(h * 0.12f);
|
||||||
float idHeight = idFont.getCapHeight();
|
float idHeight = idFont.getCapHeight();
|
||||||
g.drawOutlinedText(String.valueOf(card.getUniqueNumber()), idFont, Color.WHITE, Color.BLACK, x + padding, y + h - idHeight - padding, w, h, false, HAlignment.LEFT, false);
|
g.drawOutlinedText(String.valueOf(card.getId()), idFont, Color.WHITE, Color.BLACK, x + padding, y + h - idHeight - padding, w, h, false, HAlignment.LEFT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int number = 0;
|
int number = 0;
|
||||||
@@ -616,12 +597,9 @@ public class CardRenderer {
|
|||||||
final float stateXSymbols = (x + (w / 2)) - otherSymbolsSize / 2;
|
final float stateXSymbols = (x + (w / 2)) - otherSymbolsSize / 2;
|
||||||
final float ySymbols = (y + h) - (h / 8) - otherSymbolsSize / 2;
|
final float ySymbols = (y + h) - (h / 8) - otherSymbolsSize / 2;
|
||||||
|
|
||||||
Game game = card.getGame();
|
final IGameView game = FControl.getGameView();
|
||||||
if (game == null) {
|
|
||||||
game = FControl.getGame();
|
|
||||||
}
|
|
||||||
if (game != null) {
|
if (game != null) {
|
||||||
Combat combat = game.getCombat();
|
final CombatView combat = game.getCombat();
|
||||||
if (combat != null) {
|
if (combat != null) {
|
||||||
if (combat.isAttacking(card)) {
|
if (combat.isAttacking(card)) {
|
||||||
CardFaceSymbols.drawSymbol("attack", g, combatXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
CardFaceSymbols.drawSymbol("attack", g, combatXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
||||||
@@ -632,7 +610,7 @@ public class CardRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (details.isCreature && card.hasSickness() && card.isInPlay()) {
|
if (details.isCreature() && card.isSick() && card.getZone() == ZoneType.Battlefield) {
|
||||||
CardFaceSymbols.drawSymbol("summonsick", g, stateXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
CardFaceSymbols.drawSymbol("summonsick", g, stateXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,21 +628,21 @@ public class CardRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawPtBox(Graphics g, Card card, CardDetails details, Color color, float x, float y, float w, float h) {
|
private static void drawPtBox(Graphics g, CardView card, CardStateView details, Color color, float x, float y, float w, float h) {
|
||||||
//use array of strings to render separately with a tiny amount of space in between
|
//use array of strings to render separately with a tiny amount of space in between
|
||||||
//instead of using actual spaces which are too wide
|
//instead of using actual spaces which are too wide
|
||||||
List<String> pieces = new ArrayList<String>();
|
List<String> pieces = new ArrayList<String>();
|
||||||
if (details.isCreature) {
|
if (details.isCreature()) {
|
||||||
pieces.add(String.valueOf(details.power));
|
pieces.add(String.valueOf(details.getPower()));
|
||||||
pieces.add("/");
|
pieces.add("/");
|
||||||
pieces.add(String.valueOf(details.toughness));
|
pieces.add(String.valueOf(details.getToughness()));
|
||||||
}
|
}
|
||||||
if (details.isPlaneswalker) {
|
if (details.isPlaneswalker()) {
|
||||||
if (pieces.isEmpty()) {
|
if (pieces.isEmpty()) {
|
||||||
pieces.add(String.valueOf(details.loyalty));
|
pieces.add(String.valueOf(details.getLoyalty()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pieces.add("(" + details.loyalty + ")");
|
pieces.add("(" + details.getLoyalty() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pieces.isEmpty()) { return; }
|
if (pieces.isEmpty()) { return; }
|
||||||
@@ -705,9 +683,9 @@ public class CardRenderer {
|
|||||||
CardFaceSymbols.drawManaCost(g, cost, x + (w - manaCostWidth) / 2, y + (h - manaSymbolSize) / 2, manaSymbolSize);
|
CardFaceSymbols.drawManaCost(g, cost, x + (w - manaCostWidth) / 2, y + (h - manaSymbolSize) / 2, manaSymbolSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawFoilEffect(Graphics g, Card card, float x, float y, float w, float h) {
|
public static void drawFoilEffect(Graphics g, CardView card, float x, float y, float w, float h) {
|
||||||
if (isPreferenceEnabled(FPref.UI_OVERLAY_FOIL_EFFECT)) {
|
if (isPreferenceEnabled(FPref.UI_OVERLAY_FOIL_EFFECT)) {
|
||||||
int foil = card.getFoil();
|
int foil = card.getFoilIndex();
|
||||||
if (foil > 0) {
|
if (foil > 0) {
|
||||||
CardFaceSymbols.drawOther(g, String.format("foil%02d", foil), x, y, w, h);
|
CardFaceSymbols.drawOther(g, String.format("foil%02d", foil), x, y, w, h);
|
||||||
}
|
}
|
||||||
@@ -718,25 +696,25 @@ public class CardRenderer {
|
|||||||
return FModel.getPreferences().getPrefBoolean(preferenceName);
|
return FModel.getPreferences().getPrefBoolean(preferenceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isShowingOverlays(Card card) {
|
private static boolean isShowingOverlays(CardView card) {
|
||||||
return isPreferenceEnabled(FPref.UI_SHOW_CARD_OVERLAYS) && card != null && FControl.mayShowCard(card);
|
return isPreferenceEnabled(FPref.UI_SHOW_CARD_OVERLAYS) && card != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean showCardNameOverlay(Card card) {
|
private static boolean showCardNameOverlay(CardView card) {
|
||||||
return isShowingOverlays(card) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_NAME);
|
return isShowingOverlays(card) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean showCardPowerOverlay(Card card) {
|
private static boolean showCardPowerOverlay(CardView card) {
|
||||||
return isShowingOverlays(card) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_POWER);
|
return isShowingOverlays(card) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_POWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean showCardManaCostOverlay(Card card) {
|
private static boolean showCardManaCostOverlay(CardView card) {
|
||||||
return isShowingOverlays(card) &&
|
return isShowingOverlays(card) &&
|
||||||
isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST) &&
|
isPreferenceEnabled(FPref.UI_OVERLAY_CARD_MANA_COST) &&
|
||||||
!card.isFaceDown();
|
!card.isFaceDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean showCardIdOverlay(Card card) {
|
private static boolean showCardIdOverlay(CardView card) {
|
||||||
return card.getUniqueNumber() > 0 && isShowingOverlays(card) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_ID);
|
return card.getId() > 0 && isShowingOverlays(card) && isPreferenceEnabled(FPref.UI_OVERLAY_CARD_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,25 +5,26 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
|||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.game.card.Card;
|
import forge.item.IPaperCard;
|
||||||
import forge.item.PaperCard;
|
|
||||||
import forge.toolbox.FList;
|
import forge.toolbox.FList;
|
||||||
import forge.toolbox.FOverlay;
|
import forge.toolbox.FOverlay;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.ViewUtil;
|
||||||
|
|
||||||
public class CardZoom extends FOverlay {
|
public class CardZoom extends FOverlay {
|
||||||
private static final float TAB_HEIGHT = Utils.AVG_FINGER_HEIGHT;
|
private static final float TAB_HEIGHT = Utils.AVG_FINGER_HEIGHT;
|
||||||
private static final FSkinFont FONT = FSkinFont.get(14);
|
private static final FSkinFont FONT = FSkinFont.get(14);
|
||||||
private static final CardZoom cardZoom = new CardZoom();
|
private static final CardZoom cardZoom = new CardZoom();
|
||||||
private static Card card;
|
private static CardView card;
|
||||||
private static boolean zoomMode = true;
|
private static boolean zoomMode = true;
|
||||||
|
|
||||||
public static <T> void show(final PaperCard pc0) {
|
public static <T> void show(final IPaperCard pc0) {
|
||||||
card = Card.getCardForUi(pc0);
|
card = ViewUtil.getCardForUi(pc0);
|
||||||
cardZoom.show();
|
cardZoom.show();
|
||||||
}
|
}
|
||||||
public static <T> void show(final Card card0) {
|
public static <T> void show(final CardView card0) {
|
||||||
card = card0.getCardForUi();
|
card = card0;
|
||||||
cardZoom.show();
|
cardZoom.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.deck;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.FDeckEditor.EditorType;
|
import forge.deck.FDeckEditor.EditorType;
|
||||||
import forge.deck.io.DeckPreferences;
|
import forge.deck.io.DeckPreferences;
|
||||||
@@ -56,7 +57,7 @@ public class FDeckChooser extends FScreen {
|
|||||||
//Show screen to select a deck
|
//Show screen to select a deck
|
||||||
private static FDeckChooser deckChooserForPrompt;
|
private static FDeckChooser deckChooserForPrompt;
|
||||||
public static void promptForDeck(String title, GameType gameType, boolean forAi, final Callback<Deck> callback) {
|
public static void promptForDeck(String title, GameType gameType, boolean forAi, final Callback<Deck> callback) {
|
||||||
FThreads.assertExecutedByEdt(true);
|
FThreads.assertExecutedByEdt(GuiBase.getInterface(), true);
|
||||||
if (deckChooserForPrompt == null) {
|
if (deckChooserForPrompt == null) {
|
||||||
deckChooserForPrompt = new FDeckChooser(gameType, forAi, null);
|
deckChooserForPrompt = new FDeckChooser(gameType, forAi, null);
|
||||||
}
|
}
|
||||||
@@ -374,7 +375,7 @@ public class FDeckChooser extends FScreen {
|
|||||||
"White", "Blue", "Black", "Red", "Green" };
|
"White", "Blue", "Black", "Red", "Green" };
|
||||||
ArrayList<DeckProxy> decks = new ArrayList<DeckProxy>();
|
ArrayList<DeckProxy> decks = new ArrayList<DeckProxy>();
|
||||||
for (int i = 0; i < colors.length; i++) {
|
for (int i = 0; i < colors.length; i++) {
|
||||||
decks.add(new ColorDeckGenerator(colors[i], i, lstDecks, isAi));
|
decks.add(new ColorDeckGenerator(GuiBase.getInterface(), colors[i], i, lstDecks, isAi));
|
||||||
}
|
}
|
||||||
|
|
||||||
lstDecks.setPool(decks);
|
lstDecks.setPool(decks);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.TextBounds;
|
|||||||
|
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
@@ -43,13 +44,13 @@ public class BugReportDialog extends FScreen { //use screen rather than dialog s
|
|||||||
btnReport.setCommand(new FEventHandler() {
|
btnReport.setCommand(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
BugReporter.copyAndGoToForums(tvDetails.text);
|
BugReporter.copyAndGoToForums(GuiBase.getInterface(), tvDetails.text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btnSave.setCommand(new FEventHandler() {
|
btnSave.setCommand(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
BugReporter.saveToFile(tvDetails.text);
|
BugReporter.saveToFile(GuiBase.getInterface(), tvDetails.text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btnContinue.setCommand(new FEventHandler() {
|
btnContinue.setCommand(new FEventHandler() {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import forge.assets.ImageCache;
|
|||||||
import forge.card.CardRenderer;
|
import forge.card.CardRenderer;
|
||||||
import forge.card.CardZoom;
|
import forge.card.CardZoom;
|
||||||
import forge.deck.DeckProxy;
|
import forge.deck.DeckProxy;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
@@ -32,6 +31,7 @@ import forge.toolbox.FEvent.FEventHandler;
|
|||||||
import forge.toolbox.FLabel;
|
import forge.toolbox.FLabel;
|
||||||
import forge.toolbox.FScrollPane;
|
import forge.toolbox.FScrollPane;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.ViewUtil;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -870,7 +870,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
public boolean longPress(float x, float y) {
|
public boolean longPress(float x, float y) {
|
||||||
ItemInfo item = getItemAtPoint(x + getLeft(), y + getTop());
|
ItemInfo item = getItemAtPoint(x + getLeft(), y + getTop());
|
||||||
if (item != null && item.item instanceof IPaperCard) {
|
if (item != null && item.item instanceof IPaperCard) {
|
||||||
CardZoom.show(Card.getCardForUi((IPaperCard) item.item));
|
CardZoom.show(ViewUtil.getCardForUi((IPaperCard) item.item));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
@@ -25,7 +26,7 @@ public class LoadingOverlay extends FOverlay {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
runnable.run();
|
runnable.run();
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ public class ConstructedScreen extends LaunchScreen {
|
|||||||
playerPanels.get(6).initialize(FPref.CONSTRUCTED_P7_DECK_STATE, DeckType.COLOR_DECK);
|
playerPanels.get(6).initialize(FPref.CONSTRUCTED_P7_DECK_STATE, DeckType.COLOR_DECK);
|
||||||
playerPanels.get(7).initialize(FPref.CONSTRUCTED_P8_DECK_STATE, DeckType.COLOR_DECK);*/ //TODO: Support multiplayer and improve performance of loading this screen by using background thread
|
playerPanels.get(7).initialize(FPref.CONSTRUCTED_P8_DECK_STATE, DeckType.COLOR_DECK);*/ //TODO: Support multiplayer and improve performance of loading this screen by using background thread
|
||||||
|
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
btnStart.setEnabled(true);
|
btnStart.setEnabled(true);
|
||||||
@@ -935,12 +935,12 @@ public class ConstructedScreen extends LaunchScreen {
|
|||||||
super("Select Variants");
|
super("Select Variants");
|
||||||
|
|
||||||
lstVariants.setListItemRenderer(new VariantRenderer());
|
lstVariants.setListItemRenderer(new VariantRenderer());
|
||||||
lstVariants.addItem(new Variant(GameType.Vanguard, "Each player has a special \"Avatar\" card that affects the game."));
|
lstVariants.addItem(new Variant(GameType.Vanguard));
|
||||||
lstVariants.addItem(new Variant(GameType.MomirBasic, "Each player has a deck containing 60 basic lands and the Momir Vig avatar."));
|
lstVariants.addItem(new Variant(GameType.MomirBasic));
|
||||||
lstVariants.addItem(new Variant(GameType.Commander, "Each player has a legendary \"General\" card which can be cast at any time and determines deck colors."));
|
lstVariants.addItem(new Variant(GameType.Commander));
|
||||||
lstVariants.addItem(new Variant(GameType.Planechase, "Plane cards apply global effects. Plane card changed when a player rolls \"Chaos\" on the planar die."));
|
lstVariants.addItem(new Variant(GameType.Planechase));
|
||||||
lstVariants.addItem(new Variant(GameType.Archenemy, "One player is the Archenemy and can play scheme cards."));
|
lstVariants.addItem(new Variant(GameType.Archenemy));
|
||||||
lstVariants.addItem(new Variant(GameType.ArchenemyRumble, "All players are Archenemies and can play scheme cards."));
|
lstVariants.addItem(new Variant(GameType.ArchenemyRumble));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -950,11 +950,9 @@ public class ConstructedScreen extends LaunchScreen {
|
|||||||
|
|
||||||
private class Variant {
|
private class Variant {
|
||||||
private final GameType gameType;
|
private final GameType gameType;
|
||||||
private final String description;
|
|
||||||
|
|
||||||
private Variant(GameType gameType0, String description0) {
|
private Variant(GameType gameType0) {
|
||||||
gameType = gameType0;
|
gameType = gameType0;
|
||||||
description = description0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void draw(Graphics g, FSkinFont font, FSkinColor color, float x, float y, float w, float h) {
|
private void draw(Graphics g, FSkinFont font, FSkinColor color, float x, float y, float w, float h) {
|
||||||
@@ -1025,7 +1023,7 @@ public class ConstructedScreen extends LaunchScreen {
|
|||||||
g.drawText(text, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false);
|
g.drawText(text, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false);
|
||||||
value.draw(g, font, foreColor, x, y, w, h);
|
value.draw(g, font, foreColor, x, y, w, h);
|
||||||
h += SettingsScreen.SETTING_PADDING;
|
h += SettingsScreen.SETTING_PADDING;
|
||||||
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + w * SettingsScreen.INSETS_FACTOR, true, HAlignment.LEFT, false);
|
g.drawText(value.gameType.getDescription(), SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + w * SettingsScreen.INSETS_FACTOR, true, HAlignment.LEFT, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.screens.draft;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.screens.LaunchScreen;
|
import forge.screens.LaunchScreen;
|
||||||
import forge.screens.LoadingOverlay;
|
import forge.screens.LoadingOverlay;
|
||||||
@@ -48,13 +49,13 @@ public class DraftScreen extends LaunchScreen {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() { //must run in game thread to prevent blocking UI thread
|
ThreadUtil.invokeInGameThread(new Runnable() { //must run in game thread to prevent blocking UI thread
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final LimitedPoolType poolType = SGuiChoose.oneOrNone("Choose Draft Format", LimitedPoolType.values());
|
final LimitedPoolType poolType = SGuiChoose.oneOrNone(GuiBase.getInterface(), "Choose Draft Format", LimitedPoolType.values());
|
||||||
if (poolType == null) { return; }
|
if (poolType == null) { return; }
|
||||||
|
|
||||||
final BoosterDraft draft = BoosterDraft.createDraft(poolType);
|
final BoosterDraft draft = BoosterDraft.createDraft(GuiBase.getInterface(), poolType);
|
||||||
if (draft == null) { return; }
|
if (draft == null) { return; }
|
||||||
|
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LoadingOverlay.show("Loading new draft...", new Runnable() {
|
LoadingOverlay.show("Loading new draft...", new Runnable() {
|
||||||
@@ -131,21 +132,21 @@ public class DraftScreen extends LaunchScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Integer rounds = SGuiChoose.getInteger("How many opponents are you willing to face?",
|
final Integer rounds = SGuiChoose.getInteger(GuiBase.getInterface(), "How many opponents are you willing to face?",
|
||||||
1, FModel.getDecks().getDraft().get(humanDeck.getName()).getAiDecks().size());
|
1, FModel.getDecks().getDraft().get(humanDeck.getName()).getAiDecks().size());
|
||||||
if (rounds == null) {
|
if (rounds == null) {
|
||||||
creatingMatch = false;
|
creatingMatch = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LoadingOverlay.show("Loading new game...", new Runnable() {
|
LoadingOverlay.show("Loading new game...", new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FModel.getGauntletMini().resetGauntletDraft();
|
FModel.getGauntletMini(GuiBase.getInterface()).resetGauntletDraft();
|
||||||
FModel.getGauntletMini().launch(rounds, humanDeck.getDeck(), GameType.Draft);
|
FModel.getGauntletMini(GuiBase.getInterface()).launch(rounds, humanDeck.getDeck(), GameType.Draft);
|
||||||
creatingMatch = false;
|
creatingMatch = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -284,14 +284,14 @@ public class GauntletScreen extends LaunchScreen {
|
|||||||
String gauntletName;
|
String gauntletName;
|
||||||
String oldGauntletName = gauntlet.getName();
|
String oldGauntletName = gauntlet.getName();
|
||||||
while (true) {
|
while (true) {
|
||||||
gauntletName = SOptionPane.showInputDialog("Enter new name for gauntlet:", "Rename Gauntlet", null, oldGauntletName);
|
gauntletName = SOptionPane.showInputDialog(GuiBase.getInterface(), "Enter new name for gauntlet:", "Rename Gauntlet", null, oldGauntletName);
|
||||||
if (gauntletName == null) { return; }
|
if (gauntletName == null) { return; }
|
||||||
|
|
||||||
gauntletName = QuestUtil.cleanString(gauntletName);
|
gauntletName = QuestUtil.cleanString(gauntletName);
|
||||||
if (gauntletName.equals(oldGauntletName)) { return; } //quit if chose same name
|
if (gauntletName.equals(oldGauntletName)) { return; } //quit if chose same name
|
||||||
|
|
||||||
if (gauntletName.isEmpty()) {
|
if (gauntletName.isEmpty()) {
|
||||||
SOptionPane.showMessageDialog("Please specify a gauntlet name.");
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), "Please specify a gauntlet name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,13 +303,13 @@ public class GauntletScreen extends LaunchScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exists) {
|
if (exists) {
|
||||||
SOptionPane.showMessageDialog("A gauntlet already exists with that name. Please pick another gauntlet name.");
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), "A gauntlet already exists with that name. Please pick another gauntlet name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
final String newGauntletName = gauntletName;
|
final String newGauntletName = gauntletName;
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
gauntlet.rename(newGauntletName);
|
gauntlet.rename(newGauntletName);
|
||||||
@@ -327,7 +327,7 @@ public class GauntletScreen extends LaunchScreen {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!SOptionPane.showConfirmDialog(
|
if (!SOptionPane.showConfirmDialog(GuiBase.getInterface(),
|
||||||
"Are you sure you want to delete '" + gauntlet.getName() + "'?",
|
"Are you sure you want to delete '" + gauntlet.getName() + "'?",
|
||||||
"Delete Gauntlet", "Delete", "Cancel")) {
|
"Delete Gauntlet", "Delete", "Cancel")) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -30,7 +29,6 @@ import forge.assets.FImage;
|
|||||||
import forge.assets.FSkin;
|
import forge.assets.FSkin;
|
||||||
import forge.assets.FTextureRegionImage;
|
import forge.assets.FTextureRegionImage;
|
||||||
import forge.card.CardCharacteristicName;
|
import forge.card.CardCharacteristicName;
|
||||||
import forge.card.ColorSet;
|
|
||||||
import forge.control.FControlGameEventHandler;
|
import forge.control.FControlGameEventHandler;
|
||||||
import forge.control.FControlGamePlayback;
|
import forge.control.FControlGamePlayback;
|
||||||
import forge.events.IUiEventVisitor;
|
import forge.events.IUiEventVisitor;
|
||||||
@@ -38,7 +36,6 @@ import forge.events.UiEvent;
|
|||||||
import forge.events.UiEventAttackerDeclared;
|
import forge.events.UiEventAttackerDeclared;
|
||||||
import forge.events.UiEventBlockerAssigned;
|
import forge.events.UiEventBlockerAssigned;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameEntity;
|
|
||||||
import forge.game.GameRules;
|
import forge.game.GameRules;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.game.Match;
|
import forge.game.Match;
|
||||||
@@ -53,13 +50,12 @@ import forge.game.phase.PhaseType;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.player.RegisteredPlayer;
|
import forge.game.player.RegisteredPlayer;
|
||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
import forge.game.zone.Zone;
|
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.match.input.InputPlaybackControl;
|
import forge.match.input.InputPlaybackControl;
|
||||||
import forge.match.input.InputProxy;
|
|
||||||
import forge.match.input.InputQueue;
|
import forge.match.input.InputQueue;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.player.LobbyPlayerHuman;
|
import forge.player.LobbyPlayerHuman;
|
||||||
|
import forge.player.PlayerControllerHuman;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
@@ -78,20 +74,25 @@ import forge.util.GuiDisplayUtil;
|
|||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
import forge.util.NameGenerator;
|
import forge.util.NameGenerator;
|
||||||
import forge.util.WaitCallback;
|
import forge.util.WaitCallback;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.CardView.CardStateView;
|
||||||
|
import forge.view.CombatView;
|
||||||
|
import forge.view.GameEntityView;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class FControl {
|
public class FControl {
|
||||||
private FControl() { } //don't allow creating instance
|
private FControl() { } //don't allow creating instance
|
||||||
|
|
||||||
private static Game game;
|
private static Game game;
|
||||||
|
private static IGameView gameView;
|
||||||
private static MatchScreen view;
|
private static MatchScreen view;
|
||||||
private static InputQueue inputQueue;
|
private static InputQueue inputQueue;
|
||||||
private static InputProxy inputProxy;
|
|
||||||
private static List<Player> sortedPlayers;
|
|
||||||
private static final EventBus uiEvents;
|
private static final EventBus uiEvents;
|
||||||
private static boolean gameHasHumanPlayer;
|
private static boolean gameHasHumanPlayer;
|
||||||
private static final MatchUiEventVisitor visitor = new MatchUiEventVisitor();
|
private static final MatchUiEventVisitor visitor = new MatchUiEventVisitor();
|
||||||
private static final FControlGameEventHandler fcVisitor = new FControlGameEventHandler();
|
private static FControlGameEventHandler fcVisitor;
|
||||||
private static final FControlGamePlayback playbackControl = new FControlGamePlayback();
|
private static FControlGamePlayback playbackControl;
|
||||||
private static final Map<LobbyPlayer, FImage> avatarImages = new HashMap<LobbyPlayer, FImage>();
|
private static final Map<LobbyPlayer, FImage> avatarImages = new HashMap<LobbyPlayer, FImage>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -121,6 +122,19 @@ public class FControl {
|
|||||||
startGame(new Match(rules, players));
|
startGame(new Match(rules, players));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void startGameInSameMatch() {
|
||||||
|
endCurrentGame();
|
||||||
|
startGame(game.getMatch());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void startGameInNewMatch() {
|
||||||
|
endCurrentGame();
|
||||||
|
final Match match = game.getMatch();
|
||||||
|
match.clearGamesPlayed();
|
||||||
|
FControl.endCurrentGame();
|
||||||
|
startGame(match);
|
||||||
|
}
|
||||||
|
|
||||||
public static void startGame(final Match match) {
|
public static void startGame(final Match match) {
|
||||||
cardDetailsCache.clear(); //ensure details cache cleared before starting a new game
|
cardDetailsCache.clear(); //ensure details cache cleared before starting a new game
|
||||||
CardAreaPanel.resetForNewGame(); //ensure card panels reset between games
|
CardAreaPanel.resetForNewGame(); //ensure card panels reset between games
|
||||||
@@ -138,8 +152,7 @@ public class FControl {
|
|||||||
game.subscribeToEvents(qc); // this one listens to player's mulligans ATM
|
game.subscribeToEvents(qc); // this one listens to player's mulligans ATM
|
||||||
}
|
}
|
||||||
|
|
||||||
inputQueue = new InputQueue();
|
inputQueue = new InputQueue(game);
|
||||||
inputProxy = new InputProxy();
|
|
||||||
|
|
||||||
game.subscribeToEvents(Forge.getSoundSystem());
|
game.subscribeToEvents(Forge.getSoundSystem());
|
||||||
|
|
||||||
@@ -148,7 +161,6 @@ public class FControl {
|
|||||||
initMatch(game.getRegisteredPlayers(), humanLobbyPlayer);
|
initMatch(game.getRegisteredPlayers(), humanLobbyPlayer);
|
||||||
|
|
||||||
actuateMatchPreferences();
|
actuateMatchPreferences();
|
||||||
inputProxy.setGame(game);
|
|
||||||
|
|
||||||
// Listen to DuelOutcome event to show ViewWinLose
|
// Listen to DuelOutcome event to show ViewWinLose
|
||||||
game.subscribeToEvents(fcVisitor);
|
game.subscribeToEvents(fcVisitor);
|
||||||
@@ -195,6 +207,10 @@ public class FControl {
|
|||||||
return game;
|
return game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IGameView getGameView() {
|
||||||
|
return gameView;
|
||||||
|
}
|
||||||
|
|
||||||
public static MatchScreen getView() {
|
public static MatchScreen getView() {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@@ -203,28 +219,20 @@ public class FControl {
|
|||||||
return inputQueue;
|
return inputQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InputProxy getInputProxy() {
|
public static boolean stopAtPhase(final PlayerView turn, final PhaseType phase) {
|
||||||
return inputProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean stopAtPhase(final Player turn, final PhaseType phase) {
|
|
||||||
PhaseLabel label = getPlayerPanel(turn).getPhaseIndicator().getLabel(phase);
|
PhaseLabel label = getPlayerPanel(turn).getPhaseIndicator().getLabel(phase);
|
||||||
return label == null || label.getStopAtPhase();
|
return label == null || label.getStopAtPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void endCurrentTurn() {
|
public static void endCurrentTurn() {
|
||||||
Player p = getCurrentPlayer();
|
gameView.passPriorityUntilEndOfTurn();
|
||||||
|
|
||||||
if (p != null) {
|
|
||||||
inputProxy.passPriority(p, PhaseType.CLEANUP);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initMatch(final List<Player> players, Player localPlayer) {
|
public static void initMatch(final List<Player> players, Player localPlayer) {
|
||||||
final String[] indices = FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",");
|
final String[] indices = FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",");
|
||||||
|
|
||||||
// Instantiate all required field slots (user at 0)
|
// Instantiate all required field slots (user at 0)
|
||||||
sortedPlayers = shiftPlayersPlaceLocalFirst(players, localPlayer);
|
final List<Player> sortedPlayers = shiftPlayersPlaceLocalFirst(players, localPlayer);
|
||||||
|
|
||||||
List<VPlayerPanel> playerPanels = new ArrayList<VPlayerPanel>();
|
List<VPlayerPanel> playerPanels = new ArrayList<VPlayerPanel>();
|
||||||
|
|
||||||
@@ -236,10 +244,17 @@ public class FControl {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
p.getLobbyPlayer().setAvatarIndex(avatarIndex);
|
p.getLobbyPlayer().setAvatarIndex(avatarIndex);
|
||||||
playerPanels.add(new VPlayerPanel(p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
view = new MatchScreen(game, localPlayer, playerPanels);
|
final PlayerControllerHuman humanController = (PlayerControllerHuman) localPlayer.getController();
|
||||||
|
gameView = (IGameView) humanController;
|
||||||
|
fcVisitor = new FControlGameEventHandler(humanController);
|
||||||
|
playbackControl = new FControlGamePlayback(humanController);
|
||||||
|
|
||||||
|
for (Player p : sortedPlayers) {
|
||||||
|
playerPanels.add(new VPlayerPanel(humanController.getPlayerView(p)));
|
||||||
|
}
|
||||||
|
view = new MatchScreen(gameView, humanController.getPlayerView(localPlayer), playerPanels);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Player> shiftPlayersPlaceLocalFirst(final List<Player> players, Player localPlayer) {
|
private static List<Player> shiftPlayersPlaceLocalFirst(final List<Player> players, Player localPlayer) {
|
||||||
@@ -268,11 +283,11 @@ public class FControl {
|
|||||||
view.getPrompt().setMessage(s0);
|
view.getPrompt().setMessage(s0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VPlayerPanel getPlayerPanel(Player p) {
|
public static VPlayerPanel getPlayerPanel(final PlayerView playerView) {
|
||||||
return view.getPlayerPanels().get(p);
|
return view.getPlayerPanels().get(playerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void highlightCard(final Card c) {
|
public static void highlightCard(final CardView c) {
|
||||||
for (VPlayerPanel playerPanel : FControl.getView().getPlayerPanels().values()) {
|
for (VPlayerPanel playerPanel : FControl.getView().getPlayerPanels().values()) {
|
||||||
for (FCardPanel p : playerPanel.getField().getCardPanels()) {
|
for (FCardPanel p : playerPanel.getField().getCardPanels()) {
|
||||||
if (p.getCard().equals(c)) {
|
if (p.getCard().equals(c)) {
|
||||||
@@ -291,10 +306,6 @@ public class FControl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Iterable<Player> getSortedPlayers() {
|
|
||||||
return sortedPlayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Player getCurrentPlayer() {
|
public static Player getCurrentPlayer() {
|
||||||
// try current priority
|
// try current priority
|
||||||
Player currentPriority = game.getPhaseHandler().getPriorityPlayer();
|
Player currentPriority = game.getPhaseHandler().getPriorityPlayer();
|
||||||
@@ -312,10 +323,6 @@ public class FControl {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean mayShowCard(Card c) {
|
|
||||||
return game == null || !gameHasHumanPlayer || c.canBeShownTo(getCurrentPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void alphaStrike() {
|
public static void alphaStrike() {
|
||||||
final PhaseHandler ph = game.getPhaseHandler();
|
final PhaseHandler ph = game.getPhaseHandler();
|
||||||
|
|
||||||
@@ -342,7 +349,7 @@ public class FControl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showCombat(Combat combat) {
|
public static void showCombat(CombatView combat) {
|
||||||
/*if (combat != null && combat.getAttackers().size() > 0 && combat.getAttackingPlayer().getGame().getStack().isEmpty()) {
|
/*if (combat != null && combat.getAttackers().size() > 0 && combat.getAttackingPlayer().getGame().getStack().isEmpty()) {
|
||||||
if (selectedDocBeforeCombat == null) {
|
if (selectedDocBeforeCombat == null) {
|
||||||
IVDoc<? extends ICDoc> combatDoc = EDocID.REPORT_COMBAT.getDoc();
|
IVDoc<? extends ICDoc> combatDoc = EDocID.REPORT_COMBAT.getDoc();
|
||||||
@@ -365,20 +372,20 @@ public class FControl {
|
|||||||
CCombat.SINGLETON_INSTANCE.update();*/
|
CCombat.SINGLETON_INSTANCE.update();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Card, Integer> getDamageToAssign(final Card attacker, final List<Card> blockers, final int damage, final GameEntity defender, final boolean overrideOrder) {
|
public static Map<CardView, Integer> getDamageToAssign(final CardView attacker, final List<CardView> blockers, final int damage, final GameEntityView defender, final boolean overrideOrder) {
|
||||||
if (damage <= 0) {
|
if (damage <= 0) {
|
||||||
return new HashMap<Card, Integer>();
|
return new HashMap<CardView, Integer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the first blocker can absorb all of the damage, don't show the Assign Damage dialog
|
// If the first blocker can absorb all of the damage, don't show the Assign Damage dialog
|
||||||
Card firstBlocker = blockers.get(0);
|
CardView firstBlocker = blockers.get(0);
|
||||||
if (!overrideOrder && !attacker.hasKeyword("Deathtouch") && firstBlocker.getLethalDamage() >= damage) {
|
if (!overrideOrder && !attacker.getOriginal().hasDeathtouch() && firstBlocker.getLethalDamage() >= damage) {
|
||||||
Map<Card, Integer> res = new HashMap<Card, Integer>();
|
Map<CardView, Integer> res = new HashMap<CardView, Integer>();
|
||||||
res.put(firstBlocker, damage);
|
res.put(firstBlocker, damage);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new WaitCallback<Map<Card, Integer>>() {
|
return new WaitCallback<Map<CardView, Integer>>() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
VAssignDamage v = new VAssignDamage(attacker, blockers, damage, defender, overrideOrder, this);
|
VAssignDamage v = new VAssignDamage(attacker, blockers, damage, defender, overrideOrder, this);
|
||||||
@@ -387,8 +394,8 @@ public class FControl {
|
|||||||
}.invokeAndWait();
|
}.invokeAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<Player> highlightedPlayers = new HashSet<Player>();
|
private static Set<PlayerView> highlightedPlayers = new HashSet<PlayerView>();
|
||||||
public static void setHighlighted(Player ge, boolean b) {
|
public static void setHighlighted(PlayerView ge, boolean b) {
|
||||||
if (b) highlightedPlayers.add(ge);
|
if (b) highlightedPlayers.add(ge);
|
||||||
else highlightedPlayers.remove(ge);
|
else highlightedPlayers.remove(ge);
|
||||||
}
|
}
|
||||||
@@ -397,115 +404,89 @@ public class FControl {
|
|||||||
return highlightedPlayers.contains(player);
|
return highlightedPlayers.contains(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<Card> highlightedCards = new HashSet<Card>();
|
private static Set<CardView> highlightedCards = new HashSet<CardView>();
|
||||||
// used to highlight cards in UI
|
// used to highlight cards in UI
|
||||||
public static void setUsedToPay(Card card, boolean value) {
|
public static void setUsedToPay(CardView card, boolean value) {
|
||||||
boolean hasChanged = value ? highlightedCards.add(card) : highlightedCards.remove(card);
|
boolean hasChanged = value ? highlightedCards.add(card) : highlightedCards.remove(card);
|
||||||
if (hasChanged) { // since we are in UI thread, may redraw the card right now
|
if (hasChanged) { // since we are in UI thread, may redraw the card right now
|
||||||
updateSingleCard(card);
|
updateSingleCard(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUsedToPay(Card card) {
|
public static boolean isUsedToPay(CardView card) {
|
||||||
return highlightedCards.contains(card);
|
return highlightedCards.contains(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateZones(List<Pair<Player, ZoneType>> zonesToUpdate) {
|
public static void updateZones(List<Pair<PlayerView, ZoneType>> zonesToUpdate) {
|
||||||
for (Pair<Player, ZoneType> kv : zonesToUpdate) {
|
for (Pair<PlayerView, ZoneType> kv : zonesToUpdate) {
|
||||||
Player owner = kv.getKey();
|
PlayerView owner = kv.getKey();
|
||||||
ZoneType zt = kv.getValue();
|
ZoneType zt = kv.getValue();
|
||||||
getPlayerPanel(owner).updateZone(zt);
|
getPlayerPanel(owner).updateZone(zt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player's mana pool changes
|
// Player's mana pool changes
|
||||||
public static void updateManaPool(List<Player> manaPoolUpdate) {
|
public static void updateManaPool(List<PlayerView> manaPoolUpdate) {
|
||||||
for (Player p : manaPoolUpdate) {
|
for (PlayerView p : manaPoolUpdate) {
|
||||||
getPlayerPanel(p).updateManaPool();
|
getPlayerPanel(p).updateManaPool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player's lives and poison counters
|
// Player's lives and poison counters
|
||||||
public static void updateLives(List<Player> livesUpdate) {
|
public static void updateLives(List<PlayerView> livesUpdate) {
|
||||||
for (Player p : livesUpdate) {
|
for (PlayerView p : livesUpdate) {
|
||||||
getPlayerPanel(p).updateLife();
|
getPlayerPanel(p).updateLife();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateCards(Set<Card> cardsToUpdate) {
|
public static void updateCards(Set<CardView> cardsToUpdate) {
|
||||||
for (Card c : cardsToUpdate) {
|
for (CardView c : cardsToUpdate) {
|
||||||
updateSingleCard(c);
|
updateSingleCard(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Integer, CardDetails> cardDetailsCache = new HashMap<Integer, CardDetails>();
|
private static final Map<Integer, CardStateView> cardDetailsCache = new HashMap<Integer, CardStateView>();
|
||||||
|
|
||||||
public static CardDetails getCardDetails(Card card) {
|
public static CardStateView getCardDetails(CardView card) {
|
||||||
CardDetails details = cardDetailsCache.get(card.getUniqueNumber());
|
final CardStateView details = cardDetailsCache.get(card.getId());
|
||||||
if (details == null) {
|
if (details == null) {
|
||||||
details = new CardDetails(card);
|
cardDetailsCache.put(card.getId(), card.getOriginal());
|
||||||
cardDetailsCache.put(card.getUniqueNumber(), details);
|
return card.getOriginal();
|
||||||
}
|
}
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CardDetails {
|
public static void refreshCardDetails(Iterable<CardView> cards) {
|
||||||
public final int power, toughness, loyalty;
|
Set<PlayerView> playersNeedingFieldUpdate = null;
|
||||||
public final boolean isCreature, isPlaneswalker, isLand;
|
|
||||||
public final ColorSet colors;
|
|
||||||
|
|
||||||
private CardDetails(Card card) {
|
for (final CardView c : cards) {
|
||||||
isCreature = card.isCreature();
|
|
||||||
if (isCreature) {
|
|
||||||
power = card.getNetAttack();
|
|
||||||
toughness = card.getNetDefense();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
power = 0;
|
|
||||||
toughness = 0;
|
|
||||||
}
|
|
||||||
isPlaneswalker = card.isPlaneswalker();
|
|
||||||
if (isPlaneswalker) {
|
|
||||||
loyalty = card.getCurrentLoyalty();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
loyalty = 0;
|
|
||||||
}
|
|
||||||
colors = card.determineColor();
|
|
||||||
isLand = card.isLand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void refreshCardDetails(Collection<Card> cards) {
|
|
||||||
Set<Player> playersNeedingFieldUpdate = null;
|
|
||||||
|
|
||||||
for (Card c : cards) {
|
|
||||||
//for each card in play, if it changed from creature to non-creature or vice versa,
|
//for each card in play, if it changed from creature to non-creature or vice versa,
|
||||||
//or if it changed from land to non-land or vice-versa,
|
//or if it changed from land to non-land or vice-versa,
|
||||||
//ensure field containing that card is updated to reflect that change
|
//ensure field containing that card is updated to reflect that change
|
||||||
if (c.isInPlay()) {
|
final CardStateView state = c.getOriginal();
|
||||||
CardDetails oldDetails = cardDetailsCache.get(c);
|
if (c.getZone() == ZoneType.Battlefield) {
|
||||||
if (oldDetails == null || c.isCreature() != oldDetails.isCreature || c.isLand() != oldDetails.isLand) {
|
CardStateView oldDetails = cardDetailsCache.get(c);
|
||||||
|
if (oldDetails == null || state.isCreature() != oldDetails.isCreature() || state.isLand() != oldDetails.isLand()) {
|
||||||
if (playersNeedingFieldUpdate == null) {
|
if (playersNeedingFieldUpdate == null) {
|
||||||
playersNeedingFieldUpdate = new HashSet<Player>();
|
playersNeedingFieldUpdate = new HashSet<PlayerView>();
|
||||||
}
|
}
|
||||||
playersNeedingFieldUpdate.add(c.getController());
|
playersNeedingFieldUpdate.add(c.getController());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cardDetailsCache.put(c.getUniqueNumber(), new CardDetails(c));
|
cardDetailsCache.put(c.getId(), c.getOriginal());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playersNeedingFieldUpdate != null) { //update field for any players necessary
|
if (playersNeedingFieldUpdate != null) { //update field for any players necessary
|
||||||
for (Player p : playersNeedingFieldUpdate) {
|
for (PlayerView p : playersNeedingFieldUpdate) {
|
||||||
getPlayerPanel(p).getField().update();
|
getPlayerPanel(p).getField().update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateSingleCard(Card c) {
|
public static void updateSingleCard(final CardView card) {
|
||||||
Zone zone = c.getZone();
|
final ZoneType zone = card.getZone();
|
||||||
if (zone != null && zone.getZoneType() == ZoneType.Battlefield) {
|
if (zone != null && zone == ZoneType.Battlefield) {
|
||||||
getPlayerPanel(zone.getPlayer()).getField().updateCard(c);
|
getPlayerPanel(card.getController()).getField().updateCard(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,12 +852,12 @@ public class FControl {
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static LobbyPlayer guiPlayer = new LobbyPlayerHuman("Human");
|
private final static LobbyPlayer guiPlayer = new LobbyPlayerHuman("Human", GuiBase.getInterface());
|
||||||
public final static LobbyPlayer getGuiPlayer() {
|
public final static LobbyPlayer getGuiPlayer() {
|
||||||
return guiPlayer;
|
return guiPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FImage getPlayerAvatar(final Player p) {
|
public static FImage getPlayerAvatar(final PlayerView p) {
|
||||||
LobbyPlayer lp = p.getLobbyPlayer();
|
LobbyPlayer lp = p.getLobbyPlayer();
|
||||||
FImage avatar = avatarImages.get(lp);
|
FImage avatar = avatarImages.get(lp);
|
||||||
if (avatar == null) {
|
if (avatar == null) {
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import java.util.Map.Entry;
|
|||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.match.MatchUtil;
|
|
||||||
import forge.menu.FMenuBar;
|
import forge.menu.FMenuBar;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
@@ -34,20 +34,22 @@ import forge.animation.AbilityEffect;
|
|||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinTexture;
|
import forge.assets.FSkinTexture;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.game.Game;
|
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.combat.Combat;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.toolbox.FEvent;
|
import forge.toolbox.FEvent;
|
||||||
import forge.toolbox.FEvent.FEventHandler;
|
import forge.toolbox.FEvent.FEventHandler;
|
||||||
import forge.toolbox.FScrollPane;
|
import forge.toolbox.FScrollPane;
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.CombatView;
|
||||||
|
import forge.view.GameEntityView;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class MatchScreen extends FScreen {
|
public class MatchScreen extends FScreen {
|
||||||
public static FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS);
|
public static FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS);
|
||||||
|
|
||||||
private final Map<Player, VPlayerPanel> playerPanels = new HashMap<Player, VPlayerPanel>();
|
private final IGameView gameView;
|
||||||
|
private final Map<PlayerView, VPlayerPanel> playerPanels = Maps.newHashMap();
|
||||||
private final VPrompt prompt;
|
private final VPrompt prompt;
|
||||||
private final VLog log;
|
private final VLog log;
|
||||||
private final VStack stack;
|
private final VStack stack;
|
||||||
@@ -56,8 +58,9 @@ public class MatchScreen extends FScreen {
|
|||||||
private VPlayerPanel bottomPlayerPanel, topPlayerPanel;
|
private VPlayerPanel bottomPlayerPanel, topPlayerPanel;
|
||||||
private AbilityEffect activeEffect;
|
private AbilityEffect activeEffect;
|
||||||
|
|
||||||
public MatchScreen(Game game, Player localPlayer, List<VPlayerPanel> playerPanels0) {
|
public MatchScreen(final IGameView game, PlayerView localPlayer, List<VPlayerPanel> playerPanels0) {
|
||||||
super(new FMenuBar());
|
super(new FMenuBar());
|
||||||
|
this.gameView = game;
|
||||||
|
|
||||||
scroller = add(new FieldScroller());
|
scroller = add(new FieldScroller());
|
||||||
for (VPlayerPanel playerPanel : playerPanels0) {
|
for (VPlayerPanel playerPanel : playerPanels0) {
|
||||||
@@ -72,19 +75,19 @@ public class MatchScreen extends FScreen {
|
|||||||
new FEventHandler() {
|
new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
FControl.getInputProxy().selectButtonOK();
|
game.selectButtonOk();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FEventHandler() {
|
new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
FControl.getInputProxy().selectButtonCancel();
|
game.selectButtonCancel();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
log = new VLog(game.getGameLog());
|
log = new VLog(game);
|
||||||
log.setDropDownContainer(this);
|
log.setDropDownContainer(this);
|
||||||
stack = new VStack(game.getStack(), localPlayer);
|
stack = new VStack(game, localPlayer);
|
||||||
stack.setDropDownContainer(this);
|
stack.setDropDownContainer(this);
|
||||||
devMenu = new VDevMenu();
|
devMenu = new VDevMenu();
|
||||||
devMenu.setDropDownContainer(this);
|
devMenu.setDropDownContainer(this);
|
||||||
@@ -93,7 +96,7 @@ public class MatchScreen extends FScreen {
|
|||||||
players.setDropDownContainer(this);
|
players.setDropDownContainer(this);
|
||||||
|
|
||||||
FMenuBar menuBar = (FMenuBar)getHeader();
|
FMenuBar menuBar = (FMenuBar)getHeader();
|
||||||
menuBar.addTab("Game", new VGameMenu(localPlayer));
|
menuBar.addTab("Game", new VGameMenu());
|
||||||
menuBar.addTab("Players (" + playerPanels.size() + ")", players);
|
menuBar.addTab("Players (" + playerPanels.size() + ")", players);
|
||||||
menuBar.addTab("Log", log);
|
menuBar.addTab("Log", log);
|
||||||
menuBar.addTab("Dev", devMenu);
|
menuBar.addTab("Dev", devMenu);
|
||||||
@@ -126,7 +129,7 @@ public class MatchScreen extends FScreen {
|
|||||||
return bottomPlayerPanel;
|
return bottomPlayerPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Player, VPlayerPanel> getPlayerPanels() {
|
public Map<PlayerView, VPlayerPanel> getPlayerPanels() {
|
||||||
return playerPanels;
|
return playerPanels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,12 +149,12 @@ public class MatchScreen extends FScreen {
|
|||||||
@Override
|
@Override
|
||||||
protected void drawOverlay(Graphics g) {
|
protected void drawOverlay(Graphics g) {
|
||||||
//draw arrows for paired cards
|
//draw arrows for paired cards
|
||||||
HashSet<Card> pairedCards = new HashSet<Card>();
|
HashSet<CardView> pairedCards = new HashSet<CardView>();
|
||||||
for (VPlayerPanel playerPanel : playerPanels.values()) {
|
for (VPlayerPanel playerPanel : playerPanels.values()) {
|
||||||
for (Card card : playerPanel.getField().getRow1().getOrderedCards()) {
|
for (CardView card : playerPanel.getField().getRow1().getOrderedCards()) {
|
||||||
if (pairedCards.contains(card)) { continue; } //prevent arrows going both ways
|
if (pairedCards.contains(card)) { continue; } //prevent arrows going both ways
|
||||||
|
|
||||||
Card paired = card.getPairedWith();
|
CardView paired = card.getPairedWith();
|
||||||
if (paired != null) {
|
if (paired != null) {
|
||||||
TargetingOverlay.drawArrow(g, card, paired);
|
TargetingOverlay.drawArrow(g, card, paired);
|
||||||
}
|
}
|
||||||
@@ -159,18 +162,16 @@ public class MatchScreen extends FScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//draw arrows for combat
|
//draw arrows for combat
|
||||||
final Combat combat = FControl.getGame().getCombat();
|
final CombatView combat = gameView.getCombat();
|
||||||
if (combat != null) {
|
if (combat != null) {
|
||||||
//connect each attacker with planeswalker it's attacking if applicable
|
for (final CardView attacker : combat.getAttackers()) {
|
||||||
for (Card planeswalker : combat.getDefendingPlaneswalkers()) {
|
//connect each attacker with planeswalker it's attacking if applicable
|
||||||
for (Card attacker : combat.getAttackersOf(planeswalker)) {
|
final GameEntityView defender = combat.getDefender(attacker);
|
||||||
TargetingOverlay.drawArrow(g, attacker, planeswalker);
|
if (defender instanceof CardView) {
|
||||||
|
TargetingOverlay.drawArrow(g, attacker, (CardView) defender);
|
||||||
}
|
}
|
||||||
}
|
//connect each blocker with the attacker it's blocking
|
||||||
|
for (final CardView blocker : combat.getBlockers(attacker)) {
|
||||||
//connect each blocker with the attacker it's blocking
|
|
||||||
for (Card blocker : combat.getAllBlockers()) {
|
|
||||||
for (Card attacker : combat.getAttackersBlockedBy(blocker)) {
|
|
||||||
TargetingOverlay.drawArrow(g, blocker, attacker);
|
TargetingOverlay.drawArrow(g, blocker, attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,7 +215,7 @@ public class MatchScreen extends FScreen {
|
|||||||
break;
|
break;
|
||||||
case Keys.Z: //undo on Ctrl+Z
|
case Keys.Z: //undo on Ctrl+Z
|
||||||
if (KeyInputAdapter.isCtrlKeyDown()) {
|
if (KeyInputAdapter.isCtrlKeyDown()) {
|
||||||
MatchUtil.undoLastAction();
|
gameView.tryUndoLastAction();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ package forge.screens.match;
|
|||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.screens.match.views.VCardDisplayArea.CardAreaPanel;
|
import forge.screens.match.views.VCardDisplayArea.CardAreaPanel;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
@@ -49,17 +49,17 @@ public class TargetingOverlay {
|
|||||||
private TargetingOverlay() {
|
private TargetingOverlay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawArrow(Graphics g, Card startCard, Card endCard) {
|
public static void drawArrow(Graphics g, CardView startCard, CardView endCard) {
|
||||||
drawArrow(g, CardAreaPanel.get(startCard).getTargetingArrowOrigin(),
|
drawArrow(g, CardAreaPanel.get(startCard).getTargetingArrowOrigin(),
|
||||||
CardAreaPanel.get(endCard).getTargetingArrowOrigin(),
|
CardAreaPanel.get(endCard).getTargetingArrowOrigin(),
|
||||||
startCard.getOwner().isOpponentOf(endCard.getOwner()));
|
startCard.getOwner().isOpponentOf(endCard.getOwner()));
|
||||||
}
|
}
|
||||||
public static void drawArrow(Graphics g, Vector2 start, Card targetCard, boolean connectsFoes) {
|
public static void drawArrow(Graphics g, Vector2 start, CardView targetCard, boolean connectsFoes) {
|
||||||
drawArrow(g, start,
|
drawArrow(g, start,
|
||||||
CardAreaPanel.get(targetCard).getTargetingArrowOrigin(),
|
CardAreaPanel.get(targetCard).getTargetingArrowOrigin(),
|
||||||
connectsFoes);
|
connectsFoes);
|
||||||
}
|
}
|
||||||
public static void drawArrow(Graphics g, Vector2 start, Player targetPlayer, boolean connectsFoes) {
|
public static void drawArrow(Graphics g, Vector2 start, PlayerView targetPlayer, boolean connectsFoes) {
|
||||||
drawArrow(g, start,
|
drawArrow(g, start,
|
||||||
FControl.getPlayerPanel(targetPlayer).getAvatar().getTargetingArrowOrigin(),
|
FControl.getPlayerPanel(targetPlayer).getAvatar().getTargetingArrowOrigin(),
|
||||||
connectsFoes);
|
connectsFoes);
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ import forge.assets.FSkinFont;
|
|||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.card.CardZoom;
|
import forge.card.CardZoom;
|
||||||
import forge.game.GameEntity;
|
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.card.CounterType;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FButton;
|
import forge.toolbox.FButton;
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
@@ -41,6 +37,10 @@ import forge.toolbox.FOptionPane;
|
|||||||
import forge.toolbox.FScrollPane;
|
import forge.toolbox.FScrollPane;
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.util.WaitCallback;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.GameEntityView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -49,12 +49,11 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
|
|
||||||
public class VAssignDamage extends FDialog {
|
public class VAssignDamage extends FDialog {
|
||||||
private static final float CARD_GAP_X = Utils.scaleX(10);
|
private static final float CARD_GAP_X = Utils.scaleX(10);
|
||||||
private static final float ADD_BTN_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f;
|
private static final float ADD_BTN_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f;
|
||||||
|
|
||||||
private final Callback<Map<Card, Integer>> callback;
|
private final Callback<Map<CardView, Integer>> callback;
|
||||||
private final int totalDamageToAssign;
|
private final int totalDamageToAssign;
|
||||||
|
|
||||||
private boolean attackerHasDeathtouch = false;
|
private boolean attackerHasDeathtouch = false;
|
||||||
@@ -62,7 +61,7 @@ public class VAssignDamage extends FDialog {
|
|||||||
private boolean attackerHasInfect = false;
|
private boolean attackerHasInfect = false;
|
||||||
private boolean overrideCombatantOrder = false;
|
private boolean overrideCombatantOrder = false;
|
||||||
|
|
||||||
private final GameEntity defender;
|
private final GameEntityView defender;
|
||||||
|
|
||||||
private final FLabel lblTotalDamage = add(new FLabel.Builder().text("Available damage points: Unknown").align(HAlignment.CENTER).build());
|
private final FLabel lblTotalDamage = add(new FLabel.Builder().text("Available damage points: Unknown").align(HAlignment.CENTER).build());
|
||||||
private final FLabel lblAssignRemaining = add(new FLabel.Builder().text("Distribute the remaining damage points among lethally wounded entities").align(HAlignment.CENTER).build());
|
private final FLabel lblAssignRemaining = add(new FLabel.Builder().text("Distribute the remaining damage points among lethally wounded entities").align(HAlignment.CENTER).build());
|
||||||
@@ -76,9 +75,9 @@ public class VAssignDamage extends FDialog {
|
|||||||
|
|
||||||
// Indexes of defenders correspond to their indexes in the damage list and labels.
|
// Indexes of defenders correspond to their indexes in the damage list and labels.
|
||||||
private final List<DamageTarget> defenders = new ArrayList<DamageTarget>(); // NULL in this map means defender
|
private final List<DamageTarget> defenders = new ArrayList<DamageTarget>(); // NULL in this map means defender
|
||||||
private final Map<Card, DamageTarget> damage = new HashMap<Card, DamageTarget>(); // NULL in this map means defender
|
private final Map<CardView, DamageTarget> damage = new HashMap<CardView, DamageTarget>(); // NULL in this map means defender
|
||||||
|
|
||||||
private boolean canAssignTo(Card card) {
|
private boolean canAssignTo(CardView card) {
|
||||||
for (DamageTarget dt : defenders) {
|
for (DamageTarget dt : defenders) {
|
||||||
if (dt.card == card) { return true; }
|
if (dt.card == card) { return true; }
|
||||||
if (getDamageToKill(dt.card) > dt.damage) {
|
if (getDamageToKill(dt.card) > dt.damage) {
|
||||||
@@ -91,24 +90,24 @@ public class VAssignDamage extends FDialog {
|
|||||||
/** Constructor.
|
/** Constructor.
|
||||||
*
|
*
|
||||||
* @param attacker0 {@link forge.game.card.Card}
|
* @param attacker0 {@link forge.game.card.Card}
|
||||||
* @param defenderCards List<{@link forge.game.card.Card}>
|
* @param blockers List<{@link forge.game.card.Card}>
|
||||||
* @param damage0 int
|
* @param damage0 int
|
||||||
* @param defender GameEntity that's bein attacked
|
* @param defender GameEntity that's bein attacked
|
||||||
* @param overrideOrder override combatant order
|
* @param overrideOrder override combatant order
|
||||||
*/
|
*/
|
||||||
public VAssignDamage(final Card attacker, final List<Card> defenderCards, final int damage0, final GameEntity defender0, boolean overrideOrder, final Callback<Map<Card, Integer>> callback0) {
|
public VAssignDamage(final CardView attacker, final List<CardView> blockers, final int damage0, final GameEntityView defender0, boolean overrideOrder, final WaitCallback<Map<CardView, Integer>> waitCallback) {
|
||||||
super("Assign damage dealt by " + attacker.getName());
|
super("Assign damage dealt by " + attacker);
|
||||||
|
|
||||||
callback = callback0;
|
callback = waitCallback;
|
||||||
totalDamageToAssign = damage0;
|
totalDamageToAssign = damage0;
|
||||||
defender = defender0;
|
defender = defender0;
|
||||||
attackerHasDeathtouch = attacker.hasKeyword("Deathtouch");
|
attackerHasDeathtouch = attacker.getOriginal().hasDeathtouch();
|
||||||
attackerHasInfect = attacker.hasKeyword("Infect");
|
attackerHasInfect = attacker.getOriginal().hasInfect();
|
||||||
attackerHasTrample = defender != null && attacker.hasKeyword("Trample");
|
attackerHasTrample = defender != null && attacker.getOriginal().hasTrample();
|
||||||
overrideCombatantOrder = overrideOrder;
|
overrideCombatantOrder = overrideOrder;
|
||||||
|
|
||||||
pnlAttacker = add(new AttDefCardPanel(attacker));
|
pnlAttacker = add(new AttDefCardPanel(attacker));
|
||||||
pnlDefenders = add(new DefendersPanel(defenderCards));
|
pnlDefenders = add(new DefendersPanel(blockers));
|
||||||
|
|
||||||
btnAuto.setCommand(new FEventHandler() {
|
btnAuto.setCommand(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
@@ -174,8 +173,8 @@ public class VAssignDamage extends FDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class DefendersPanel extends FScrollPane {
|
private class DefendersPanel extends FScrollPane {
|
||||||
private DefendersPanel(final List<Card> defenderCards) {
|
private DefendersPanel(final List<CardView> defenderCards) {
|
||||||
for (final Card c : defenderCards) {
|
for (final CardView c : defenderCards) {
|
||||||
addDamageTarget(c);
|
addDamageTarget(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +184,7 @@ public class VAssignDamage extends FDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDamageTarget(Card card) {
|
private void addDamageTarget(CardView card) {
|
||||||
DamageTarget dt = add(new DamageTarget(card));
|
DamageTarget dt = add(new DamageTarget(card));
|
||||||
damage.put(card, dt);
|
damage.put(card, dt);
|
||||||
defenders.add(dt);
|
defenders.add(dt);
|
||||||
@@ -211,25 +210,25 @@ public class VAssignDamage extends FDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class DamageTarget extends FContainer {
|
private class DamageTarget extends FContainer {
|
||||||
private final Card card;
|
private final CardView card;
|
||||||
private final FDisplayObject obj;
|
private final FDisplayObject obj;
|
||||||
private final FLabel label, btnSubtract, btnAdd;
|
private final FLabel label, btnSubtract, btnAdd;
|
||||||
private int damage;
|
private int damage;
|
||||||
|
|
||||||
public DamageTarget(Card card0) {
|
public DamageTarget(CardView card0) {
|
||||||
card = card0;
|
card = card0;
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
obj = add(new AttDefCardPanel(card));
|
obj = add(new AttDefCardPanel(card));
|
||||||
}
|
}
|
||||||
else if (defender instanceof Card) {
|
else if (defender instanceof CardView) {
|
||||||
obj = add(new AttDefCardPanel((Card)defender));
|
obj = add(new AttDefCardPanel((CardView)defender));
|
||||||
}
|
}
|
||||||
else if (defender instanceof Player) {
|
else if (defender instanceof PlayerView) {
|
||||||
Player player = (Player)defender;
|
PlayerView player = (PlayerView)defender;
|
||||||
obj = add(new MiscAttDefPanel(player.getName(), FControl.getPlayerAvatar(player)));
|
obj = add(new MiscAttDefPanel(player.getName(), FControl.getPlayerAvatar(player)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
obj = add(new MiscAttDefPanel(defender.getName(), FSkinImage.UNKNOWN));
|
obj = add(new MiscAttDefPanel(defender.toString(), FSkinImage.UNKNOWN));
|
||||||
}
|
}
|
||||||
label = add(new FLabel.Builder().text("0").font(FSkinFont.get(18)).align(HAlignment.CENTER).build());
|
label = add(new FLabel.Builder().text("0").font(FSkinFont.get(18)).align(HAlignment.CENTER).build());
|
||||||
btnSubtract = add(new FLabel.ButtonBuilder().icon(FSkinImage.MINUS).command(new FEventHandler() {
|
btnSubtract = add(new FLabel.ButtonBuilder().icon(FSkinImage.MINUS).command(new FEventHandler() {
|
||||||
@@ -262,7 +261,7 @@ public class VAssignDamage extends FDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class AttDefCardPanel extends FCardPanel {
|
private static class AttDefCardPanel extends FCardPanel {
|
||||||
private AttDefCardPanel(Card card) {
|
private AttDefCardPanel(CardView card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +303,7 @@ public class VAssignDamage extends FDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assignDamageTo(Card source, boolean isAdding) {
|
private void assignDamageTo(CardView source, boolean isAdding) {
|
||||||
if (!damage.containsKey(source)) {
|
if (!damage.containsKey(source)) {
|
||||||
source = null;
|
source = null;
|
||||||
}
|
}
|
||||||
@@ -394,7 +393,7 @@ public class VAssignDamage extends FDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDamage(final Card card, int addedDamage) {
|
private void addDamage(final CardView card, int addedDamage) {
|
||||||
// If we don't have enough left or we're trying to unassign too much return
|
// If we don't have enough left or we're trying to unassign too much return
|
||||||
int canAssign = getRemainingDamage();
|
int canAssign = getRemainingDamage();
|
||||||
if (canAssign < addedDamage) {
|
if (canAssign < addedDamage) {
|
||||||
@@ -452,16 +451,16 @@ public class VAssignDamage extends FDialog {
|
|||||||
callback.run(getDamageMap());
|
callback.run(getDamageMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getDamageToKill(Card source) {
|
private int getDamageToKill(CardView source) {
|
||||||
int lethalDamage = 0;
|
int lethalDamage = 0;
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
if (defender instanceof Player) {
|
if (defender instanceof PlayerView) {
|
||||||
Player p = (Player)defender;
|
PlayerView p = (PlayerView)defender;
|
||||||
lethalDamage = attackerHasInfect ? p.getGame().getRules().getPoisonCountersToLose() - p.getPoisonCounters() : p.getLife();
|
lethalDamage = attackerHasInfect ? FControl.getGameView().getPoisonCountersToLose() - p.getPoisonCounters() : p.getLife();
|
||||||
}
|
}
|
||||||
else if (defender instanceof Card) { // planeswalker
|
else if (defender instanceof CardView) { // planeswalker
|
||||||
Card pw = (Card)defender;
|
CardView pw = (CardView)defender;
|
||||||
lethalDamage = pw.getCounters(CounterType.LOYALTY);
|
lethalDamage = pw.getOriginal().getLoyalty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -470,8 +469,8 @@ public class VAssignDamage extends FDialog {
|
|||||||
return lethalDamage;
|
return lethalDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Card, Integer> getDamageMap() {
|
public Map<CardView, Integer> getDamageMap() {
|
||||||
Map<Card, Integer> result = new HashMap<Card, Integer>();
|
Map<CardView, Integer> result = new HashMap<CardView, Integer>();
|
||||||
for (DamageTarget dt : defenders) {
|
for (DamageTarget dt : defenders) {
|
||||||
result.put(dt.card, dt.damage);
|
result.put(dt.card, dt.damage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
|
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FImage;
|
import forge.assets.FImage;
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.util.ThreadUtil;
|
import forge.util.ThreadUtil;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class VAvatar extends FDisplayObject {
|
public class VAvatar extends FDisplayObject {
|
||||||
public static final float WIDTH = Utils.AVG_FINGER_WIDTH;
|
public static final float WIDTH = Utils.AVG_FINGER_WIDTH;
|
||||||
public static final float HEIGHT = Utils.AVG_FINGER_HEIGHT;
|
public static final float HEIGHT = Utils.AVG_FINGER_HEIGHT;
|
||||||
|
|
||||||
private final Player player;
|
private final PlayerView player;
|
||||||
private final FImage image;
|
private final FImage image;
|
||||||
|
|
||||||
public VAvatar(Player player0) {
|
public VAvatar(PlayerView player0) {
|
||||||
player = player0;
|
player = player0;
|
||||||
image = FControl.getPlayerAvatar(player);
|
image = FControl.getPlayerAvatar(player);
|
||||||
setSize(WIDTH, HEIGHT);
|
setSize(WIDTH, HEIGHT);
|
||||||
@@ -28,7 +28,7 @@ public class VAvatar extends FDisplayObject {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() { //must invoke in game thread in case a dialog needs to be shown
|
ThreadUtil.invokeInGameThread(new Runnable() { //must invoke in game thread in case a dialog needs to be shown
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FControl.getInputProxy().selectPlayer(player, null);
|
FControl.getGameView().selectPlayer(player, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -9,19 +9,20 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.card.CardZoom;
|
import forge.card.CardZoom;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
import forge.util.ThreadUtil;
|
import forge.util.ThreadUtil;
|
||||||
|
import forge.view.CardView;
|
||||||
|
|
||||||
public abstract class VCardDisplayArea extends VDisplayArea {
|
public abstract class VCardDisplayArea extends VDisplayArea {
|
||||||
private static final float CARD_STACK_OFFSET = 0.2f;
|
private static final float CARD_STACK_OFFSET = 0.2f;
|
||||||
|
|
||||||
protected final List<Card> orderedCards = new ArrayList<Card>();
|
protected final List<CardView> orderedCards = new ArrayList<CardView>();
|
||||||
protected final List<CardAreaPanel> cardPanels = new ArrayList<CardAreaPanel>();
|
protected final List<CardAreaPanel> cardPanels = new ArrayList<CardAreaPanel>();
|
||||||
|
|
||||||
public Iterable<Card> getOrderedCards() {
|
public Iterable<CardView> getOrderedCards() {
|
||||||
return orderedCards;
|
return orderedCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,12 +35,12 @@ public abstract class VCardDisplayArea extends VDisplayArea {
|
|||||||
return cardPanels.size();
|
return cardPanels.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void refreshCardPanels(List<Card> model) {
|
protected void refreshCardPanels(List<CardView> model) {
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
CardAreaPanel newCardPanel = null;
|
CardAreaPanel newCardPanel = null;
|
||||||
for (Card card : model) {
|
for (CardView card : model) {
|
||||||
if (card.getCardForUi() == card) { //only include cards that are meant for display
|
if (card.isUiDisplayable()) { //only include cards that are meant for display
|
||||||
CardAreaPanel cardPanel = CardAreaPanel.get(card);
|
CardAreaPanel cardPanel = CardAreaPanel.get(card);
|
||||||
addCardPanelToDisplayArea(cardPanel);
|
addCardPanelToDisplayArea(cardPanel);
|
||||||
cardPanels.add(cardPanel);
|
cardPanels.add(cardPanel);
|
||||||
@@ -73,7 +74,7 @@ public abstract class VCardDisplayArea extends VDisplayArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void removeCardPanel(final CardAreaPanel fromPanel) {
|
public final void removeCardPanel(final CardAreaPanel fromPanel) {
|
||||||
FThreads.assertExecutedByEdt(true);
|
FThreads.assertExecutedByEdt(GuiBase.getInterface(), true);
|
||||||
/*if (CardPanelContainer.this.getMouseDragPanel() != null) {
|
/*if (CardPanelContainer.this.getMouseDragPanel() != null) {
|
||||||
CardPanel.getDragAnimationPanel().setVisible(false);
|
CardPanel.getDragAnimationPanel().setVisible(false);
|
||||||
CardPanel.getDragAnimationPanel().repaint();
|
CardPanel.getDragAnimationPanel().repaint();
|
||||||
@@ -152,11 +153,11 @@ public abstract class VCardDisplayArea extends VDisplayArea {
|
|||||||
public static class CardAreaPanel extends FCardPanel {
|
public static class CardAreaPanel extends FCardPanel {
|
||||||
private static final Map<Integer, CardAreaPanel> allCardPanels = new HashMap<Integer, CardAreaPanel>();
|
private static final Map<Integer, CardAreaPanel> allCardPanels = new HashMap<Integer, CardAreaPanel>();
|
||||||
|
|
||||||
public static CardAreaPanel get(Card card0) {
|
public static CardAreaPanel get(CardView card0) {
|
||||||
CardAreaPanel cardPanel = allCardPanels.get(card0.getUniqueNumber());
|
CardAreaPanel cardPanel = allCardPanels.get(card0.getId());
|
||||||
if (cardPanel == null || cardPanel.getCard() != card0) { //replace card panel if card copied
|
if (cardPanel == null || cardPanel.getCard() != card0) { //replace card panel if card copied
|
||||||
cardPanel = new CardAreaPanel(card0);
|
cardPanel = new CardAreaPanel(card0);
|
||||||
allCardPanels.put(card0.getUniqueNumber(), cardPanel);
|
allCardPanels.put(card0.getId(), cardPanel);
|
||||||
}
|
}
|
||||||
return cardPanel;
|
return cardPanel;
|
||||||
}
|
}
|
||||||
@@ -178,7 +179,7 @@ public abstract class VCardDisplayArea extends VDisplayArea {
|
|||||||
private CardAreaPanel nextPanelInStack, prevPanelInStack;
|
private CardAreaPanel nextPanelInStack, prevPanelInStack;
|
||||||
|
|
||||||
//use static get(card) function instead
|
//use static get(card) function instead
|
||||||
private CardAreaPanel(Card card0) {
|
private CardAreaPanel(CardView card0) {
|
||||||
super(card0);
|
super(card0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +245,7 @@ public abstract class VCardDisplayArea extends VDisplayArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean selectCard() {
|
public boolean selectCard() {
|
||||||
if (FControl.getInputProxy().selectCard(getCard(), null)) {
|
if (FControl.getGameView().selectCard(getCard(), null)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//if panel can't do anything with card selection, try selecting previous panel in stack
|
//if panel can't do anything with card selection, try selecting previous panel in stack
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package forge.screens.match.views;
|
package forge.screens.match.views;
|
||||||
|
|
||||||
import forge.GuiBase;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.menu.FCheckBoxMenuItem;
|
import forge.menu.FCheckBoxMenuItem;
|
||||||
import forge.menu.FDropDownMenu;
|
import forge.menu.FDropDownMenu;
|
||||||
import forge.menu.FMenuItem;
|
import forge.menu.FMenuItem;
|
||||||
@@ -11,7 +9,6 @@ import forge.properties.ForgePreferences.FPref;
|
|||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FEvent;
|
import forge.toolbox.FEvent;
|
||||||
import forge.toolbox.FEvent.FEventHandler;
|
import forge.toolbox.FEvent.FEventHandler;
|
||||||
import forge.util.GuiDisplayUtil;
|
|
||||||
import forge.util.ThreadUtil;
|
import forge.util.ThreadUtil;
|
||||||
|
|
||||||
public class VDevMenu extends FDropDownMenu {
|
public class VDevMenu extends FDropDownMenu {
|
||||||
@@ -23,7 +20,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() { //must invoke all these in game thread since they may require synchronous user input
|
ThreadUtil.invokeInGameThread(new Runnable() { //must invoke all these in game thread since they may require synchronous user input
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeGenerateMana();
|
FControl.getGameView().devGenerateMana();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -34,7 +31,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeTutor();
|
FControl.getGameView().devTutorForCard();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -45,7 +42,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeCardToHand();
|
FControl.getGameView().devAddCardToHand();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -56,7 +53,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeCardToBattlefield();
|
FControl.getGameView().devAddCardToBattlefield();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -67,7 +64,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeSetLife();
|
FControl.getGameView().devSetPlayerLife();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -78,7 +75,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeWinGame();
|
FControl.getGameView().devWinGame();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -89,7 +86,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devSetupGameState();
|
FControl.getGameView().devSetupGameState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -102,12 +99,8 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
boolean unlimitedLands = !prefs.getPrefBoolean(FPref.DEV_UNLIMITED_LAND);
|
boolean unlimitedLands = !prefs.getPrefBoolean(FPref.DEV_UNLIMITED_LAND);
|
||||||
|
FControl.getGameView().devTogglePlayManyLands(unlimitedLands);
|
||||||
|
|
||||||
for (Player p : FControl.getGame().getPlayers()) {
|
|
||||||
if (p.getLobbyPlayer() == GuiBase.getInterface().getGuiPlayer() ) {
|
|
||||||
p.canCheatPlayUnlimitedLands = unlimitedLands;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// probably will need to call a synchronized method to have the game thread see changed value of the variable
|
// probably will need to call a synchronized method to have the game thread see changed value of the variable
|
||||||
|
|
||||||
prefs.setPref(FPref.DEV_UNLIMITED_LAND, String.valueOf(unlimitedLands));
|
prefs.setPref(FPref.DEV_UNLIMITED_LAND, String.valueOf(unlimitedLands));
|
||||||
@@ -120,7 +113,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeAddCounter();
|
FControl.getGameView().devAddCounterToPermanent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -131,7 +124,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeTapPerm();
|
FControl.getGameView().devTapPermanent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -142,7 +135,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeUntapPerm();
|
FControl.getGameView().devUntapPermanent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -153,7 +146,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModeRiggedPlanarRoll();
|
FControl.getGameView().devRiggedPlanerRoll();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -164,7 +157,7 @@ public class VDevMenu extends FDropDownMenu {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GuiDisplayUtil.devModePlaneswalkTo();
|
FControl.getGameView().devPlaneswalkTo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,21 +4,21 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.game.card.Card;
|
import forge.GuiBase;
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.game.zone.ZoneType;
|
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.screens.match.FControl.CardDetails;
|
|
||||||
import forge.screens.match.views.VCardDisplayArea.CardAreaPanel;
|
import forge.screens.match.views.VCardDisplayArea.CardAreaPanel;
|
||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.FContainer;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.CardView.CardStateView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class VField extends FContainer {
|
public class VField extends FContainer {
|
||||||
private final Player player;
|
private final PlayerView player;
|
||||||
private final FieldRow row1, row2;
|
private final FieldRow row1, row2;
|
||||||
private boolean flipped;
|
private boolean flipped;
|
||||||
private float commandZoneWidth;
|
private float commandZoneWidth;
|
||||||
|
|
||||||
public VField(Player player0) {
|
public VField(PlayerView player0) {
|
||||||
player = player0;
|
player = player0;
|
||||||
row1 = add(new FieldRow());
|
row1 = add(new FieldRow());
|
||||||
row2 = add(new FieldRow());
|
row2 = add(new FieldRow());
|
||||||
@@ -43,7 +43,7 @@ public class VField extends FContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
FThreads.invokeInEdtNowOrLater(updateRoutine);
|
FThreads.invokeInEdtNowOrLater(GuiBase.getInterface(), updateRoutine);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Runnable updateRoutine = new Runnable() {
|
private final Runnable updateRoutine = new Runnable() {
|
||||||
@@ -51,25 +51,25 @@ public class VField extends FContainer {
|
|||||||
public void run() {
|
public void run() {
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
List<Card> model = player.getZone(ZoneType.Battlefield).getCards();
|
List<CardView> model = player.getBfCards();
|
||||||
for (Card card : model) {
|
for (CardView card : model) {
|
||||||
updateCard(card);
|
updateCard(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Card> creatures = new ArrayList<Card>();
|
List<CardView> creatures = new ArrayList<CardView>();
|
||||||
List<Card> lands = new ArrayList<Card>();
|
List<CardView> lands = new ArrayList<CardView>();
|
||||||
List<Card> otherPermanents = new ArrayList<Card>();
|
List<CardView> otherPermanents = new ArrayList<CardView>();
|
||||||
|
|
||||||
for (Card card : model) {
|
for (CardView card : model) {
|
||||||
CardAreaPanel cardPanel = CardAreaPanel.get(card);
|
CardAreaPanel cardPanel = CardAreaPanel.get(card);
|
||||||
CardDetails details = FControl.getCardDetails(card); //use details so creature/land check is accurate
|
CardStateView details = FControl.getCardDetails(card); //use details so creature/land check is accurate
|
||||||
if (cardPanel.getAttachedToPanel() == null) { //skip attached panels
|
if (cardPanel.getAttachedToPanel() == null) { //skip attached panels
|
||||||
if (details.isCreature) {
|
if (details.isCreature()) {
|
||||||
if (!tryStackCard(card, creatures)) {
|
if (!tryStackCard(card, creatures)) {
|
||||||
creatures.add(card);
|
creatures.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (details.isLand) {
|
else if (details.isLand()) {
|
||||||
if (!tryStackCard(card, lands)) {
|
if (!tryStackCard(card, lands)) {
|
||||||
lands.add(card);
|
lands.add(card);
|
||||||
}
|
}
|
||||||
@@ -94,16 +94,17 @@ public class VField extends FContainer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean tryStackCard(Card card, List<Card> cardsOfType) {
|
private boolean tryStackCard(CardView card, List<CardView> cardsOfType) {
|
||||||
if (card.isEnchanted() || card.isEquipped()) {
|
if (card.isEnchanted() || card.isEquipped()) {
|
||||||
return false; //can stack with enchanted or equipped card
|
return false; //can stack with enchanted or equipped card
|
||||||
}
|
}
|
||||||
if (card.isCreature() && !card.isToken()) {
|
if (card.getOriginal().isCreature() && !card.isToken()) {
|
||||||
return false; //don't stack non-token creatures
|
return false; //don't stack non-token creatures
|
||||||
}
|
}
|
||||||
for (Card c : cardsOfType) {
|
final String cardName = card.getOriginal().getName();
|
||||||
|
for (CardView c : cardsOfType) {
|
||||||
if (!c.isEnchanted() && !c.isEquipped() &&
|
if (!c.isEnchanted() && !c.isEquipped() &&
|
||||||
card.getName().equals(c.getName()) &&
|
cardName.equals(c.getOriginal().getName()) &&
|
||||||
card.getCounters().equals(card.getCounters()) &&
|
card.getCounters().equals(card.getCounters()) &&
|
||||||
card.isToken() == c.isToken()) { //don't stack tokens on top of non-tokens
|
card.isToken() == c.isToken()) { //don't stack tokens on top of non-tokens
|
||||||
CardAreaPanel cPanel = CardAreaPanel.get(c);
|
CardAreaPanel cPanel = CardAreaPanel.get(c);
|
||||||
@@ -119,7 +120,7 @@ public class VField extends FContainer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCard(final Card card) {
|
public void updateCard(final CardView card) {
|
||||||
final CardAreaPanel toPanel = CardAreaPanel.get(card);
|
final CardAreaPanel toPanel = CardAreaPanel.get(card);
|
||||||
if (toPanel == null) { return; }
|
if (toPanel == null) { return; }
|
||||||
|
|
||||||
@@ -134,8 +135,8 @@ public class VField extends FContainer {
|
|||||||
|
|
||||||
toPanel.getAttachedPanels().clear();
|
toPanel.getAttachedPanels().clear();
|
||||||
if (card.isEnchanted()) {
|
if (card.isEnchanted()) {
|
||||||
final ArrayList<Card> enchants = card.getEnchantedBy();
|
final Iterable<CardView> enchants = card.getEnchantedBy();
|
||||||
for (final Card e : enchants) {
|
for (final CardView e : enchants) {
|
||||||
final CardAreaPanel cardE = CardAreaPanel.get(e);
|
final CardAreaPanel cardE = CardAreaPanel.get(e);
|
||||||
if (cardE != null) {
|
if (cardE != null) {
|
||||||
toPanel.getAttachedPanels().add(cardE);
|
toPanel.getAttachedPanels().add(cardE);
|
||||||
@@ -144,8 +145,8 @@ public class VField extends FContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card.isEquipped()) {
|
if (card.isEquipped()) {
|
||||||
final ArrayList<Card> enchants = card.getEquippedBy();
|
final Iterable<CardView> enchants = card.getEquippedBy();
|
||||||
for (final Card e : enchants) {
|
for (final CardView e : enchants) {
|
||||||
final CardAreaPanel cardE = CardAreaPanel.get(e);
|
final CardAreaPanel cardE = CardAreaPanel.get(e);
|
||||||
if (cardE != null) {
|
if (cardE != null) {
|
||||||
toPanel.getAttachedPanels().add(cardE);
|
toPanel.getAttachedPanels().add(cardE);
|
||||||
@@ -154,8 +155,8 @@ public class VField extends FContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (card.isFortified()) {
|
if (card.isFortified()) {
|
||||||
final ArrayList<Card> fortifications = card.getFortifiedBy();
|
final Iterable<CardView> fortifications = card.getFortifiedBy();
|
||||||
for (final Card e : fortifications) {
|
for (final CardView e : fortifications) {
|
||||||
final CardAreaPanel cardE = CardAreaPanel.get(e);
|
final CardAreaPanel cardE = CardAreaPanel.get(e);
|
||||||
if (cardE != null) {
|
if (cardE != null) {
|
||||||
toPanel.getAttachedPanels().add(cardE);
|
toPanel.getAttachedPanels().add(cardE);
|
||||||
@@ -163,14 +164,14 @@ public class VField extends FContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card.isEnchantingCard()) {
|
if (card.getEnchantingCard() != null) {
|
||||||
toPanel.setAttachedToPanel(CardAreaPanel.get(card.getEnchantingCard()));
|
toPanel.setAttachedToPanel(CardAreaPanel.get(card.getEnchantingCard()));
|
||||||
}
|
}
|
||||||
else if (card.isEquipping()) {
|
else if (card.getEquipping() != null) {
|
||||||
toPanel.setAttachedToPanel(CardAreaPanel.get(card.getEquipping().get(0)));
|
toPanel.setAttachedToPanel(CardAreaPanel.get(card.getEquipping()));
|
||||||
}
|
}
|
||||||
else if (card.isFortifying()) {
|
else if (card.getFortifying() != null) {
|
||||||
toPanel.setAttachedToPanel(CardAreaPanel.get(card.getFortifying().get(0)));
|
toPanel.setAttachedToPanel(CardAreaPanel.get(card.getFortifying()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toPanel.setAttachedToPanel(null);
|
toPanel.setAttachedToPanel(null);
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
package forge.screens.match.views;
|
package forge.screens.match.views;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.game.player.Player;
|
import forge.GuiBase;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class VFlashbackZone extends VCardDisplayArea {
|
public class VFlashbackZone extends VCardDisplayArea {
|
||||||
private final Player player;
|
private final PlayerView player;
|
||||||
|
|
||||||
public VFlashbackZone(Player player0) {
|
public VFlashbackZone(PlayerView player0) {
|
||||||
player = player0;
|
player = player0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
FThreads.invokeInEdtNowOrLater(updateRoutine);
|
FThreads.invokeInEdtNowOrLater(GuiBase.getInterface(), updateRoutine);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Runnable updateRoutine = new Runnable() {
|
private final Runnable updateRoutine = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
refreshCardPanels(player.getCardsActivableInExternalZones(false));
|
refreshCardPanels(player.getFlashbackCards());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package forge.screens.match.views;
|
package forge.screens.match.views;
|
||||||
|
|
||||||
|
import forge.GuiBase;
|
||||||
|
import forge.LobbyPlayer;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.deck.FDeckViewer;
|
import forge.deck.FDeckViewer;
|
||||||
import forge.game.io.GameStateDeserializer;
|
import forge.game.io.GameStateDeserializer;
|
||||||
@@ -7,7 +9,6 @@ import forge.game.io.GameStateSerializer;
|
|||||||
import forge.game.player.RegisteredPlayer;
|
import forge.game.player.RegisteredPlayer;
|
||||||
import forge.menu.FDropDownMenu;
|
import forge.menu.FDropDownMenu;
|
||||||
import forge.menu.FMenuItem;
|
import forge.menu.FMenuItem;
|
||||||
import forge.player.GamePlayerUtil;
|
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.screens.settings.SettingsScreen;
|
import forge.screens.settings.SettingsScreen;
|
||||||
@@ -40,7 +41,8 @@ public class VGameMenu extends FDropDownMenu {
|
|||||||
addItem(new FMenuItem("Deck List", FSkinImage.DECKLIST, new FEventHandler() {
|
addItem(new FMenuItem("Deck List", FSkinImage.DECKLIST, new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
RegisteredPlayer player = GamePlayerUtil.getGuiRegisteredPlayer(FControl.getGame());
|
final LobbyPlayer guiPlayer = GuiBase.getInterface().getGuiPlayer();
|
||||||
|
final RegisteredPlayer player = FControl.getGameView().getGuiRegisteredPlayer(guiPlayer);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
FDeckViewer.show(player.getDeck());
|
FDeckViewer.show(player.getDeck());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import forge.assets.FSkinColor;
|
|||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.TextRenderer;
|
import forge.assets.TextRenderer;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.game.GameLog;
|
|
||||||
import forge.game.GameLogEntry;
|
import forge.game.GameLogEntry;
|
||||||
import forge.game.GameLogEntryType;
|
import forge.game.GameLogEntryType;
|
||||||
import forge.menu.FDropDown;
|
import forge.menu.FDropDown;
|
||||||
@@ -17,6 +16,7 @@ import forge.model.FModel;
|
|||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
|
||||||
public class VLog extends FDropDown {
|
public class VLog extends FDropDown {
|
||||||
private static final float PADDING = Utils.scaleMin(5);
|
private static final float PADDING = Utils.scaleMin(5);
|
||||||
@@ -25,10 +25,10 @@ public class VLog extends FDropDown {
|
|||||||
private static final FSkinColor ROW_COLOR = ALT_ROW_COLOR.darker();
|
private static final FSkinColor ROW_COLOR = ALT_ROW_COLOR.darker();
|
||||||
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
|
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
|
||||||
|
|
||||||
private final GameLog log;
|
private final IGameView gameView;
|
||||||
|
|
||||||
public VLog(GameLog log0) {
|
public VLog(IGameView log0) {
|
||||||
log = log0;
|
gameView = log0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,7 +48,7 @@ public class VLog extends FDropDown {
|
|||||||
clear();
|
clear();
|
||||||
|
|
||||||
GameLogEntryType logVerbosityFilter = GameLogEntryType.valueOf(FModel.getPreferences().getPref(FPref.DEV_LOG_ENTRY_TYPE));
|
GameLogEntryType logVerbosityFilter = GameLogEntryType.valueOf(FModel.getPreferences().getPref(FPref.DEV_LOG_ENTRY_TYPE));
|
||||||
List<GameLogEntry> logEntrys = log.getLogEntries(logVerbosityFilter);
|
List<GameLogEntry> logEntrys = gameView.getLogEntries(logVerbosityFilter);
|
||||||
|
|
||||||
LogEntryDisplay logEntryDisplay;
|
LogEntryDisplay logEntryDisplay;
|
||||||
float width = maxWidth - getMenuTab().getScreenPosition().x; //stretch from tab to edge of screen
|
float width = maxWidth - getMenuTab().getScreenPosition().x; //stretch from tab to edge of screen
|
||||||
|
|||||||
@@ -12,22 +12,19 @@ import forge.assets.FSkinFont;
|
|||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.game.mana.ManaPool;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.match.input.Input;
|
|
||||||
import forge.match.input.InputPayMana;
|
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class VManaPool extends VDisplayArea {
|
public class VManaPool extends VDisplayArea {
|
||||||
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
|
private static final FSkinColor FORE_COLOR = FSkinColor.get(Colors.CLR_TEXT);
|
||||||
private static final FSkinFont FONT = FSkinFont.get(16);
|
private static final FSkinFont FONT = FSkinFont.get(16);
|
||||||
|
|
||||||
private final Player player;
|
private final PlayerView player;
|
||||||
private final List<ManaLabel> manaLabels = new ArrayList<ManaLabel>();
|
private final List<ManaLabel> manaLabels = new ArrayList<ManaLabel>();
|
||||||
private int totalMana;
|
private int totalMana;
|
||||||
|
|
||||||
public VManaPool(Player player0) {
|
public VManaPool(PlayerView player0) {
|
||||||
player = player0;
|
player = player0;
|
||||||
|
|
||||||
addManaLabel(FSkinImage.MANA_COLORLESS, MagicColor.COLORLESS);
|
addManaLabel(FSkinImage.MANA_COLORLESS, MagicColor.COLORLESS);
|
||||||
@@ -50,9 +47,8 @@ public class VManaPool extends VDisplayArea {
|
|||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
totalMana = 0;
|
totalMana = 0;
|
||||||
ManaPool m = player.getManaPool();
|
|
||||||
for (ManaLabel label : manaLabels) {
|
for (ManaLabel label : manaLabels) {
|
||||||
int colorCount = m.getAmountOfColor(label.colorCode);
|
int colorCount = player.getMana(label.colorCode);
|
||||||
totalMana += colorCount;
|
totalMana += colorCount;
|
||||||
label.text = Integer.toString(colorCount);
|
label.text = Integer.toString(colorCount);
|
||||||
}
|
}
|
||||||
@@ -86,11 +82,7 @@ public class VManaPool extends VDisplayArea {
|
|||||||
@Override
|
@Override
|
||||||
public boolean tap(float x, float y, int count) {
|
public boolean tap(float x, float y, int count) {
|
||||||
if (player.getLobbyPlayer() == GuiBase.getInterface().getGuiPlayer()) {
|
if (player.getLobbyPlayer() == GuiBase.getInterface().getGuiPlayer()) {
|
||||||
final Input input = FControl.getInputQueue().getInput();
|
FControl.getGameView().useMana(colorCode);
|
||||||
if (input instanceof InputPayMana) {
|
|
||||||
// Do something
|
|
||||||
((InputPayMana) input).useManaFromPool(colorCode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import forge.assets.FSkinColor;
|
|||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
@@ -23,6 +21,8 @@ import forge.screens.match.MatchScreen;
|
|||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.FContainer;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class VPlayerPanel extends FContainer {
|
public class VPlayerPanel extends FContainer {
|
||||||
private static final FSkinFont LIFE_FONT = FSkinFont.get(18);
|
private static final FSkinFont LIFE_FONT = FSkinFont.get(18);
|
||||||
@@ -32,7 +32,7 @@ public class VPlayerPanel extends FContainer {
|
|||||||
private static final float INFO_TAB_PADDING_X = Utils.scaleX(2);
|
private static final float INFO_TAB_PADDING_X = Utils.scaleX(2);
|
||||||
private static final float INFO_TAB_PADDING_Y = Utils.scaleY(2);
|
private static final float INFO_TAB_PADDING_Y = Utils.scaleY(2);
|
||||||
|
|
||||||
private final Player player;
|
private final PlayerView player;
|
||||||
private final VPhaseIndicator phaseIndicator;
|
private final VPhaseIndicator phaseIndicator;
|
||||||
private final VField field;
|
private final VField field;
|
||||||
private final VAvatar avatar;
|
private final VAvatar avatar;
|
||||||
@@ -44,7 +44,7 @@ public class VPlayerPanel extends FContainer {
|
|||||||
private final List<InfoTab> tabs = new ArrayList<InfoTab>();
|
private final List<InfoTab> tabs = new ArrayList<InfoTab>();
|
||||||
private InfoTab selectedTab;
|
private InfoTab selectedTab;
|
||||||
|
|
||||||
public VPlayerPanel(Player player0) {
|
public VPlayerPanel(PlayerView player0) {
|
||||||
player = player0;
|
player = player0;
|
||||||
phaseIndicator = add(new VPhaseIndicator());
|
phaseIndicator = add(new VPhaseIndicator());
|
||||||
field = add(new VField(player));
|
field = add(new VField(player));
|
||||||
@@ -67,7 +67,7 @@ public class VPlayerPanel extends FContainer {
|
|||||||
commandZone = add(new CommandZoneDisplay(player));
|
commandZone = add(new CommandZoneDisplay(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public PlayerView getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ public class VPlayerPanel extends FContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tap(float x, float y, int count) {
|
public boolean tap(float x, float y, int count) {
|
||||||
FControl.getInputProxy().selectPlayer(player, null); //treat tapping on life the same as tapping on the avatar
|
FControl.getGameView().selectPlayer(player, null); //treat tapping on life the same as tapping on the avatar
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,12 +411,12 @@ public class VPlayerPanel extends FContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class CommandZoneDisplay extends VZoneDisplay {
|
private class CommandZoneDisplay extends VZoneDisplay {
|
||||||
private CommandZoneDisplay(Player player0) {
|
private CommandZoneDisplay(PlayerView player0) {
|
||||||
super(player0, ZoneType.Command);
|
super(player0, ZoneType.Command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void refreshCardPanels(List<Card> model) {
|
protected void refreshCardPanels(List<CardView> model) {
|
||||||
int oldCount = getCount();
|
int oldCount = getCount();
|
||||||
super.refreshCardPanels(model);
|
super.refreshCardPanels(model);
|
||||||
int newCount = getCount();
|
int newCount = getCount();
|
||||||
|
|||||||
@@ -7,11 +7,6 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
|||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.assets.FImage;
|
import forge.assets.FImage;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.game.GameType;
|
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.card.CardFactoryUtil;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.game.zone.ZoneType;
|
|
||||||
import forge.menu.FDropDown;
|
import forge.menu.FDropDown;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
@@ -20,10 +15,12 @@ import forge.toolbox.FContainer;
|
|||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.toolbox.FList;
|
import forge.toolbox.FList;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class VPlayers extends FDropDown {
|
public class VPlayers extends FDropDown {
|
||||||
public VPlayers() {
|
public VPlayers() {
|
||||||
for (final Player p : FControl.getSortedPlayers()) {
|
for (final PlayerView p : FControl.getGameView().getPlayers()) {
|
||||||
add(new PlayerInfoPanel(p));
|
add(new PlayerInfoPanel(p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,9 +46,9 @@ public class VPlayers extends FDropDown {
|
|||||||
private static final FSkinFont FONT = FSkinFont.get(12);
|
private static final FSkinFont FONT = FSkinFont.get(12);
|
||||||
private static final float PADDING = Utils.scaleMin(5);
|
private static final float PADDING = Utils.scaleMin(5);
|
||||||
private static final float HEIGHT = Utils.AVG_FINGER_HEIGHT * 1.8f;
|
private static final float HEIGHT = Utils.AVG_FINGER_HEIGHT * 1.8f;
|
||||||
private final Player player;
|
private final PlayerView player;
|
||||||
|
|
||||||
private PlayerInfoPanel(Player player0) {
|
private PlayerInfoPanel(PlayerView player0) {
|
||||||
player = player0;
|
player = player0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,12 +73,12 @@ public class VPlayers extends FDropDown {
|
|||||||
builder.append(" | Poison counters: " + String.valueOf(player.getPoisonCounters()));
|
builder.append(" | Poison counters: " + String.valueOf(player.getPoisonCounters()));
|
||||||
builder.append(" | Maximum hand size: " + String.valueOf(player.getMaxHandSize()));
|
builder.append(" | Maximum hand size: " + String.valueOf(player.getMaxHandSize()));
|
||||||
builder.append(" | Cards drawn this turn: " + String.valueOf(player.getNumDrawnThisTurn()));
|
builder.append(" | Cards drawn this turn: " + String.valueOf(player.getNumDrawnThisTurn()));
|
||||||
builder.append(" | Damage Prevention: " + String.valueOf(player.getPreventNextDamageTotalShields()));
|
builder.append(" | Damage Prevention: " + String.valueOf(player.getPreventNextDamage()));
|
||||||
if (!player.getKeywords().isEmpty()) {
|
if (!player.getKeywords().isEmpty()) {
|
||||||
builder.append(" | " + player.getKeywords().toString());
|
builder.append(" | " + player.getKeywords().toString());
|
||||||
}
|
}
|
||||||
if (FModel.getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
if (FModel.getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
||||||
List<Card> list = player.getCardsIn(ZoneType.Ante);
|
List<CardView> list = player.getAnteCards();
|
||||||
builder.append(" | Ante'd: ");
|
builder.append(" | Ante'd: ");
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
builder.append(list.get(i));
|
builder.append(list.get(i));
|
||||||
@@ -90,8 +87,8 @@ public class VPlayers extends FDropDown {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player.getGame().getRules().getGameType() == GameType.Commander) {
|
if (FControl.getGameView().isCommander()) {
|
||||||
builder.append(" | " + CardFactoryUtil.getCommanderInfo(player));
|
builder.append(" | " + player.getCommanderInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
g.drawText(builder.toString(), FONT, FList.FORE_COLOR, x, y, getWidth() - PADDING - x, h, true, HAlignment.LEFT, true);
|
g.drawText(builder.toString(), FONT, FList.FORE_COLOR, x, y, getWidth() - PADDING - x, h, true, HAlignment.LEFT, true);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package forge.screens.match.views;
|
package forge.screens.match.views;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
@@ -17,15 +20,7 @@ import forge.card.CardDetailUtil;
|
|||||||
import forge.card.CardRenderer;
|
import forge.card.CardRenderer;
|
||||||
import forge.card.CardZoom;
|
import forge.card.CardZoom;
|
||||||
import forge.card.CardDetailUtil.DetailColors;
|
import forge.card.CardDetailUtil.DetailColors;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.game.player.PlayerController;
|
|
||||||
import forge.game.spellability.SpellAbility;
|
|
||||||
import forge.game.spellability.SpellAbilityStackInstance;
|
|
||||||
import forge.game.spellability.TargetChoices;
|
|
||||||
import forge.game.zone.MagicStack;
|
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.match.input.InputConfirm;
|
|
||||||
import forge.menu.FCheckBoxMenuItem;
|
import forge.menu.FCheckBoxMenuItem;
|
||||||
import forge.menu.FDropDown;
|
import forge.menu.FDropDown;
|
||||||
import forge.menu.FMenuItem;
|
import forge.menu.FMenuItem;
|
||||||
@@ -38,6 +33,10 @@ import forge.toolbox.FEvent;
|
|||||||
import forge.toolbox.FEvent.FEventHandler;
|
import forge.toolbox.FEvent.FEventHandler;
|
||||||
import forge.toolbox.FLabel;
|
import forge.toolbox.FLabel;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
import forge.view.StackItemView;
|
||||||
|
|
||||||
public class VStack extends FDropDown {
|
public class VStack extends FDropDown {
|
||||||
public static final float CARD_WIDTH = Utils.AVG_FINGER_WIDTH;
|
public static final float CARD_WIDTH = Utils.AVG_FINGER_WIDTH;
|
||||||
@@ -49,16 +48,16 @@ public class VStack extends FDropDown {
|
|||||||
private static final float ALPHA_COMPOSITE = 0.5f;
|
private static final float ALPHA_COMPOSITE = 0.5f;
|
||||||
private static final TextRenderer textRenderer = new TextRenderer(true);
|
private static final TextRenderer textRenderer = new TextRenderer(true);
|
||||||
|
|
||||||
private final MagicStack stack;
|
private final IGameView gameView;
|
||||||
private final Player localPlayer;
|
private final PlayerView localPlayer;
|
||||||
private StackInstanceDisplay activeItem;
|
private StackInstanceDisplay activeItem;
|
||||||
private SpellAbilityStackInstance activeStackInstance;
|
private StackItemView activeStackInstance;
|
||||||
private Map<Player, Object> playersWithValidTargets;
|
private Map<PlayerView, Object> playersWithValidTargets;
|
||||||
|
|
||||||
private int stackSize;
|
private int stackSize;
|
||||||
|
|
||||||
public VStack(MagicStack stack0, Player localPlayer0) {
|
public VStack(IGameView stack0, PlayerView localPlayer0) {
|
||||||
stack = stack0;
|
gameView = stack0;
|
||||||
localPlayer = localPlayer0;
|
localPlayer = localPlayer0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +70,12 @@ public class VStack extends FDropDown {
|
|||||||
private void revealTargetZones() {
|
private void revealTargetZones() {
|
||||||
if (activeStackInstance == null) { return; }
|
if (activeStackInstance == null) { return; }
|
||||||
|
|
||||||
final List<ZoneType> zones = activeStackInstance.getZonesToOpen();
|
final Set<ZoneType> zones = new HashSet<ZoneType>();
|
||||||
playersWithValidTargets = activeStackInstance.getPlayersWithValidTargets();
|
playersWithValidTargets = new HashMap<PlayerView, Object>();
|
||||||
|
for (final CardView c : activeStackInstance.getTargetCards()) {
|
||||||
|
zones.add(c.getZone());
|
||||||
|
playersWithValidTargets.put(c.getController(), c);
|
||||||
|
}
|
||||||
if (zones != null && zones.size() > 0 && playersWithValidTargets != null && playersWithValidTargets.size() > 0) {
|
if (zones != null && zones.size() > 0 && playersWithValidTargets != null && playersWithValidTargets.size() > 0) {
|
||||||
GuiBase.getInterface().openZones(zones, playersWithValidTargets);
|
GuiBase.getInterface().openZones(zones, playersWithValidTargets);
|
||||||
}
|
}
|
||||||
@@ -91,6 +94,7 @@ public class VStack extends FDropDown {
|
|||||||
activeStackInstance = null; //reset before updating stack
|
activeStackInstance = null; //reset before updating stack
|
||||||
restoreOldZones();
|
restoreOldZones();
|
||||||
|
|
||||||
|
final List<StackItemView> stack = gameView.getStack();
|
||||||
if (stackSize != stack.size()) {
|
if (stackSize != stack.size()) {
|
||||||
int oldStackSize = stackSize;
|
int oldStackSize = stackSize;
|
||||||
stackSize = stack.size();
|
stackSize = stack.size();
|
||||||
@@ -121,6 +125,7 @@ public class VStack extends FDropDown {
|
|||||||
float totalWidth = Math.min(4 * CARD_WIDTH, maxWidth);
|
float totalWidth = Math.min(4 * CARD_WIDTH, maxWidth);
|
||||||
float width = totalWidth - 2 * MARGINS;
|
float width = totalWidth - 2 * MARGINS;
|
||||||
|
|
||||||
|
final List<StackItemView> stack = gameView.getStack();
|
||||||
if (stack.isEmpty()) { //show label if stack empty
|
if (stack.isEmpty()) { //show label if stack empty
|
||||||
FLabel label = add(new FLabel.Builder().text("[Empty]").font(FONT).align(HAlignment.CENTER).build());
|
FLabel label = add(new FLabel.Builder().text("[Empty]").font(FONT).align(HAlignment.CENTER).build());
|
||||||
|
|
||||||
@@ -130,10 +135,10 @@ public class VStack extends FDropDown {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//iterate stack in reverse so most recent items appear on bottom
|
//iterate stack in reverse so most recent items appear on bottom
|
||||||
SpellAbilityStackInstance stackInstance = null;
|
StackItemView stackInstance = null;
|
||||||
StackInstanceDisplay display = null;
|
StackInstanceDisplay display = null;
|
||||||
float overlap = Math.round(CARD_HEIGHT / 2 + PADDING + BORDER_THICKNESS);
|
float overlap = Math.round(CARD_HEIGHT / 2 + PADDING + BORDER_THICKNESS);
|
||||||
Iterator<SpellAbilityStackInstance> iterator = stack.reverseIterator();
|
Iterator<StackItemView> iterator = stack.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
stackInstance = iterator.next();
|
stackInstance = iterator.next();
|
||||||
display = new StackInstanceDisplay(stackInstance, width);
|
display = new StackInstanceDisplay(stackInstance, width);
|
||||||
@@ -177,36 +182,35 @@ public class VStack extends FDropDown {
|
|||||||
activeItem.getLeft() + VStack.CARD_WIDTH * FCardPanel.TARGET_ORIGIN_FACTOR_X + VStack.PADDING + VStack.BORDER_THICKNESS,
|
activeItem.getLeft() + VStack.CARD_WIDTH * FCardPanel.TARGET_ORIGIN_FACTOR_X + VStack.PADDING + VStack.BORDER_THICKNESS,
|
||||||
activeItem.getTop() + VStack.CARD_HEIGHT * FCardPanel.TARGET_ORIGIN_FACTOR_Y + VStack.PADDING + VStack.BORDER_THICKNESS);
|
activeItem.getTop() + VStack.CARD_HEIGHT * FCardPanel.TARGET_ORIGIN_FACTOR_Y + VStack.PADDING + VStack.BORDER_THICKNESS);
|
||||||
|
|
||||||
TargetChoices targets = activeStackInstance.getSpellAbility().getTargets();
|
PlayerView activator = activeStackInstance.getActivatingPlayer();
|
||||||
Player activator = activeStackInstance.getActivator();
|
|
||||||
arrowOrigin = arrowOrigin.add(getScreenPosition());
|
arrowOrigin = arrowOrigin.add(getScreenPosition());
|
||||||
|
|
||||||
for (Card c : targets.getTargetCards()) {
|
for (CardView c : activeStackInstance.getTargetCards()) {
|
||||||
TargetingOverlay.drawArrow(g, arrowOrigin, c, activator.isOpponentOf(c.getOwner()));
|
TargetingOverlay.drawArrow(g, arrowOrigin, c, activator.isOpponentOf(c.getController()));
|
||||||
}
|
}
|
||||||
for (Player p : targets.getTargetPlayers()) {
|
for (PlayerView p : activeStackInstance.getTargetPlayers()) {
|
||||||
TargetingOverlay.drawArrow(g, arrowOrigin, p, activator.isOpponentOf(p));
|
TargetingOverlay.drawArrow(g, arrowOrigin, p, activator.isOpponentOf(p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StackInstanceDisplay extends FDisplayObject {
|
private class StackInstanceDisplay extends FDisplayObject {
|
||||||
private final SpellAbilityStackInstance stackInstance;
|
private final StackItemView stackInstance;
|
||||||
private final Color foreColor, backColor;
|
private final Color foreColor, backColor;
|
||||||
private String text;
|
private String text;
|
||||||
private float preferredHeight;
|
private float preferredHeight;
|
||||||
|
|
||||||
private StackInstanceDisplay(SpellAbilityStackInstance stackInstance0, float width) {
|
private StackInstanceDisplay(StackItemView stackInstance0, float width) {
|
||||||
stackInstance = stackInstance0;
|
stackInstance = stackInstance0;
|
||||||
Card card = stackInstance.getSourceCard().getCardForUi();
|
CardView card = stackInstance.getSource();
|
||||||
|
|
||||||
text = stackInstance.getStackDescription();
|
text = stackInstance.getText();
|
||||||
if (stackInstance.getSpellAbility().isOptionalTrigger() &&
|
if (stackInstance.isOptionalTrigger() &&
|
||||||
card.getController().getController().getLobbyPlayer().equals(localPlayer)) {
|
stackInstance0.getActivatingPlayer().getLobbyPlayer().equals(localPlayer)) {
|
||||||
text = "(OPTIONAL) " + text;
|
text = "(OPTIONAL) " + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
DetailColors color = CardDetailUtil.getBorderColor(card, !stackInstance.getStackDescription().startsWith("Morph "));
|
DetailColors color = CardDetailUtil.getBorderColor(card.getOriginal());
|
||||||
backColor = FSkinColor.fromRGB(color.r, color.g, color.b);
|
backColor = FSkinColor.fromRGB(color.r, color.g, color.b);
|
||||||
foreColor = FSkinColor.getHighContrastColor(backColor);
|
foreColor = FSkinColor.getHighContrastColor(backColor);
|
||||||
|
|
||||||
@@ -226,59 +230,55 @@ public class VStack extends FDropDown {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (localPlayer != null) { //don't show menu if tapping on art
|
if (localPlayer != null) { //don't show menu if tapping on art
|
||||||
final SpellAbility ability = stackInstance.getSpellAbility();
|
if (stackInstance.isAbility()) {
|
||||||
if (ability.isAbility()) {
|
|
||||||
FPopupMenu menu = new FPopupMenu() {
|
FPopupMenu menu = new FPopupMenu() {
|
||||||
@Override
|
@Override
|
||||||
protected void buildMenu() {
|
protected void buildMenu() {
|
||||||
final PlayerController controller = localPlayer.getController();
|
final String key = stackInstance.getKey();
|
||||||
final String key = ability.toUnsuppressedString();
|
final boolean autoYield = gameView.shouldAutoYield(key);
|
||||||
final boolean autoYield = controller.shouldAutoYield(key);
|
|
||||||
addItem(new FCheckBoxMenuItem("Auto-Yield", autoYield,
|
addItem(new FCheckBoxMenuItem("Auto-Yield", autoYield,
|
||||||
new FEventHandler() {
|
new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
controller.setShouldAutoYield(key, !autoYield);
|
FControl.getGameView().setShouldAutoYield(key, !autoYield);
|
||||||
if (!autoYield && stack.peekAbility() == ability) {
|
if (!autoYield && stackInstance.equals(gameView.peekStack())) {
|
||||||
//auto-pass priority if ability is on top of stack
|
//auto-pass priority if ability is on top of stack
|
||||||
FControl.getInputProxy().passPriority();
|
gameView.passPriority();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
if (ability.isOptionalTrigger() && ability.getActivatingPlayer() == localPlayer) {
|
if (stackInstance.isOptionalTrigger() && stackInstance.getActivatingPlayer() == localPlayer) {
|
||||||
final int triggerID = ability.getSourceTrigger();
|
final int triggerID = stackInstance.getSourceTrigger();
|
||||||
addItem(new FCheckBoxMenuItem("Always Yes",
|
addItem(new FCheckBoxMenuItem("Always Yes",
|
||||||
controller.shouldAlwaysAcceptTrigger(triggerID),
|
gameView.shouldAlwaysAcceptTrigger(triggerID),
|
||||||
new FEventHandler() {
|
new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
if (controller.shouldAlwaysAcceptTrigger(triggerID)) {
|
if (gameView.shouldAlwaysAcceptTrigger(triggerID)) {
|
||||||
controller.setShouldAlwaysAskTrigger(triggerID);
|
gameView.setShouldAlwaysAskTrigger(triggerID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
controller.setShouldAlwaysAcceptTrigger(triggerID);
|
gameView.setShouldAlwaysAcceptTrigger(triggerID);
|
||||||
if (stack.peekAbility() == ability &&
|
if (stackInstance.equals(gameView.peekStack())) {
|
||||||
FControl.getInputQueue().getInput() instanceof InputConfirm) {
|
|
||||||
//auto-yes if ability is on top of stack
|
//auto-yes if ability is on top of stack
|
||||||
FControl.getInputProxy().selectButtonOK();
|
gameView.confirm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
addItem(new FCheckBoxMenuItem("Always No",
|
addItem(new FCheckBoxMenuItem("Always No",
|
||||||
controller.shouldAlwaysDeclineTrigger(triggerID),
|
gameView.shouldAlwaysDeclineTrigger(triggerID),
|
||||||
new FEventHandler() {
|
new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
if (controller.shouldAlwaysDeclineTrigger(triggerID)) {
|
if (gameView.shouldAlwaysDeclineTrigger(triggerID)) {
|
||||||
controller.setShouldAlwaysAskTrigger(triggerID);
|
gameView.setShouldAlwaysAskTrigger(triggerID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
controller.setShouldAlwaysDeclineTrigger(triggerID);
|
gameView.setShouldAlwaysDeclineTrigger(triggerID);
|
||||||
if (stack.peekAbility() == ability &&
|
if (stackInstance.equals(gameView.peekStack())) {
|
||||||
FControl.getInputQueue().getInput() instanceof InputConfirm) {
|
|
||||||
//auto-no if ability is on top of stack
|
//auto-no if ability is on top of stack
|
||||||
FControl.getInputProxy().selectButtonOK();
|
gameView.confirm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,7 +287,7 @@ public class VStack extends FDropDown {
|
|||||||
addItem(new FMenuItem("Zoom/Details", new FEventHandler() {
|
addItem(new FMenuItem("Zoom/Details", new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
CardZoom.show(stackInstance.getSourceCard());
|
CardZoom.show(stackInstance.getSource());
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
@@ -297,13 +297,13 @@ public class VStack extends FDropDown {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CardZoom.show(stackInstance.getSourceCard());
|
CardZoom.show(stackInstance.getSource());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(float x, float y) {
|
public boolean longPress(float x, float y) {
|
||||||
CardZoom.show(stackInstance.getSourceCard());
|
CardZoom.show(stackInstance.getSource());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ public class VStack extends FDropDown {
|
|||||||
|
|
||||||
x += PADDING;
|
x += PADDING;
|
||||||
y += PADDING;
|
y += PADDING;
|
||||||
CardRenderer.drawCardWithOverlays(g, stackInstance.getSourceCard(), x, y, CARD_WIDTH, CARD_HEIGHT);
|
CardRenderer.drawCardWithOverlays(g, stackInstance.getSource(), x, y, CARD_WIDTH, CARD_HEIGHT);
|
||||||
|
|
||||||
x += CARD_WIDTH + PADDING;
|
x += CARD_WIDTH + PADDING;
|
||||||
w -= x + PADDING - BORDER_THICKNESS;
|
w -= x + PADDING - BORDER_THICKNESS;
|
||||||
|
|||||||
@@ -3,17 +3,18 @@ package forge.screens.match.views;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.game.player.Player;
|
import forge.GuiBase;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
|
||||||
public class VZoneDisplay extends VCardDisplayArea {
|
public class VZoneDisplay extends VCardDisplayArea {
|
||||||
private final Player player;
|
private final PlayerView player;
|
||||||
private final ZoneType zoneType;
|
private final ZoneType zoneType;
|
||||||
private FCardPanel revealedPanel;
|
private FCardPanel revealedPanel;
|
||||||
|
|
||||||
public VZoneDisplay(Player player0, ZoneType zoneType0) {
|
public VZoneDisplay(PlayerView player0, ZoneType zoneType0) {
|
||||||
player = player0;
|
player = player0;
|
||||||
zoneType = zoneType0;
|
zoneType = zoneType0;
|
||||||
}
|
}
|
||||||
@@ -24,13 +25,13 @@ public class VZoneDisplay extends VCardDisplayArea {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
FThreads.invokeInEdtNowOrLater(updateRoutine);
|
FThreads.invokeInEdtNowOrLater(GuiBase.getInterface(), updateRoutine);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Runnable updateRoutine = new Runnable() {
|
private final Runnable updateRoutine = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
refreshCardPanels(player.getZone(zoneType).getCards());
|
refreshCardPanels(player.getCards(zoneType));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package forge.screens.match.winlose;
|
package forge.screens.match.winlose;
|
||||||
|
|
||||||
import forge.game.Game;
|
|
||||||
import forge.game.Match;
|
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
import forge.toolbox.FEvent;
|
import forge.toolbox.FEvent;
|
||||||
import forge.toolbox.FEvent.FEventHandler;
|
import forge.toolbox.FEvent.FEventHandler;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default controller for a ViewWinLose object. This class can
|
* Default controller for a ViewWinLose object. This class can
|
||||||
@@ -14,11 +13,11 @@ import forge.toolbox.FEvent.FEventHandler;
|
|||||||
*/
|
*/
|
||||||
public class ControlWinLose {
|
public class ControlWinLose {
|
||||||
private final ViewWinLose view;
|
private final ViewWinLose view;
|
||||||
protected final Game lastGame;
|
protected final IGameView lastGame;
|
||||||
|
|
||||||
/** @param v   ViewWinLose
|
/** @param v   ViewWinLose
|
||||||
* @param match */
|
* @param match */
|
||||||
public ControlWinLose(final ViewWinLose v, Game game) {
|
public ControlWinLose(final ViewWinLose v, IGameView game) {
|
||||||
view = v;
|
view = v;
|
||||||
lastGame = game;
|
lastGame = game;
|
||||||
addListeners();
|
addListeners();
|
||||||
@@ -54,18 +53,14 @@ public class ControlWinLose {
|
|||||||
view.hide();
|
view.hide();
|
||||||
saveOptions();
|
saveOptions();
|
||||||
|
|
||||||
FControl.endCurrentGame();
|
FControl.startGameInSameMatch();
|
||||||
FControl.startGame(lastGame.getMatch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Action performed when "restart" button is pressed in default win/lose UI. */
|
/** Action performed when "restart" button is pressed in default win/lose UI. */
|
||||||
public void actionOnRestart() {
|
public void actionOnRestart() {
|
||||||
view.hide();
|
view.hide();
|
||||||
saveOptions();
|
saveOptions();
|
||||||
final Match match = lastGame.getMatch();
|
FControl.startGameInNewMatch();
|
||||||
match.clearGamesPlayed();
|
|
||||||
FControl.endCurrentGame();
|
|
||||||
FControl.startGame(match);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ package forge.screens.match.winlose;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinProp;
|
import forge.assets.FSkinProp;
|
||||||
import forge.game.Game;
|
|
||||||
import forge.gauntlet.GauntletWinLoseController;
|
import forge.gauntlet.GauntletWinLoseController;
|
||||||
import forge.util.gui.SOptionPane;
|
import forge.util.gui.SOptionPane;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -38,9 +39,9 @@ public class GauntletWinLose extends ControlWinLose {
|
|||||||
* @param view0 ViewWinLose object
|
* @param view0 ViewWinLose object
|
||||||
* @param match
|
* @param match
|
||||||
*/
|
*/
|
||||||
public GauntletWinLose(final ViewWinLose view0, Game lastGame) {
|
public GauntletWinLose(final ViewWinLose view0, IGameView lastGame) {
|
||||||
super(view0, lastGame);
|
super(view0, lastGame);
|
||||||
controller = new GauntletWinLoseController(view0, lastGame) {
|
controller = new GauntletWinLoseController(view0, lastGame, GuiBase.getInterface()) {
|
||||||
@Override
|
@Override
|
||||||
protected void showOutcome(final String message1, final String message2, final FSkinProp icon, final List<String> lstEventNames, final List<String> lstEventRecords, final int len, final int num) {
|
protected void showOutcome(final String message1, final String message2, final FSkinProp icon, final List<String> lstEventNames, final List<String> lstEventRecords, final int len, final int num) {
|
||||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
FThreads.invokeInBackgroundThread(new Runnable() {
|
||||||
@@ -66,7 +67,7 @@ public class GauntletWinLose extends ControlWinLose {
|
|||||||
sb.deleteCharAt(sb.length() - 1); //remove final new line character
|
sb.deleteCharAt(sb.length() - 1); //remove final new line character
|
||||||
}
|
}
|
||||||
|
|
||||||
SOptionPane.showMessageDialog(sb.toString(), "Gauntlet Progress", icon);
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), sb.toString(), "Gauntlet Progress", icon);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ package forge.screens.match.winlose;
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import forge.game.Game;
|
import forge.GuiBase;
|
||||||
import forge.limited.LimitedWinLoseController;
|
import forge.limited.LimitedWinLoseController;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Win/Lose handler for 'gauntlet' type tournament
|
* The Win/Lose handler for 'gauntlet' type tournament
|
||||||
@@ -33,9 +34,9 @@ public class LimitedWinLose extends ControlWinLose {
|
|||||||
* @param view0 {@link forge.gui.match.ViewWinLose}
|
* @param view0 {@link forge.gui.match.ViewWinLose}
|
||||||
* @param match {@link forge.game.Match}
|
* @param match {@link forge.game.Match}
|
||||||
*/
|
*/
|
||||||
public LimitedWinLose(final ViewWinLose view0, Game lastGame) {
|
public LimitedWinLose(final ViewWinLose view0, IGameView lastGame) {
|
||||||
super(view0, lastGame);
|
super(view0, lastGame);
|
||||||
controller = new LimitedWinLoseController(view0, lastGame) {
|
controller = new LimitedWinLoseController(view0, lastGame, GuiBase.getInterface()) {
|
||||||
@Override
|
@Override
|
||||||
protected void showOutcome(Runnable runnable) {
|
protected void showOutcome(Runnable runnable) {
|
||||||
//invoke reward logic in background thread so dialogs can be shown
|
//invoke reward logic in background thread so dialogs can be shown
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ package forge.screens.match.winlose;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinProp;
|
import forge.assets.FSkinProp;
|
||||||
import forge.game.Game;
|
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.quest.*;
|
import forge.quest.QuestWinLoseController;
|
||||||
import forge.util.gui.SGuiChoose;
|
import forge.util.gui.SGuiChoose;
|
||||||
import forge.util.gui.SOptionPane;
|
import forge.util.gui.SOptionPane;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -44,9 +45,9 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
* @param view0 ViewWinLose object
|
* @param view0 ViewWinLose object
|
||||||
* @param match2
|
* @param match2
|
||||||
*/
|
*/
|
||||||
public QuestWinLose(final ViewWinLose view0, Game lastGame) {
|
public QuestWinLose(final ViewWinLose view0, IGameView lastGame) {
|
||||||
super(view0, lastGame);
|
super(view0, lastGame);
|
||||||
controller = new QuestWinLoseController(lastGame) {
|
controller = new QuestWinLoseController(lastGame, GuiBase.getInterface()) {
|
||||||
@Override
|
@Override
|
||||||
protected void showRewards(Runnable runnable) {
|
protected void showRewards(Runnable runnable) {
|
||||||
//invoke reward logic in background thread so dialogs can be shown
|
//invoke reward logic in background thread so dialogs can be shown
|
||||||
@@ -55,12 +56,12 @@ public class QuestWinLose extends ControlWinLose {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showCards(String title, List<PaperCard> cards) {
|
protected void showCards(String title, List<PaperCard> cards) {
|
||||||
SGuiChoose.reveal(title, cards);
|
SGuiChoose.reveal(gui, title, cards);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showMessage(String message, String title, FSkinProp icon) {
|
protected void showMessage(String message, String title, FSkinProp icon) {
|
||||||
SOptionPane.showMessageDialog(message, title, icon);
|
SOptionPane.showMessageDialog(gui, message, title, icon);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
package forge.screens.match.winlose;
|
package forge.screens.match.winlose;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.GuiBase;
|
||||||
|
import forge.LobbyPlayer;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.game.Game;
|
|
||||||
import forge.game.GameLog;
|
|
||||||
import forge.game.GameLogEntry;
|
import forge.game.GameLogEntry;
|
||||||
import forge.game.GameLogEntryType;
|
import forge.game.GameLogEntryType;
|
||||||
import forge.game.GameOutcome;
|
|
||||||
import forge.game.player.Player;
|
|
||||||
import forge.interfaces.IWinLoseView;
|
import forge.interfaces.IWinLoseView;
|
||||||
import forge.menu.FMagnifyView;
|
import forge.menu.FMagnifyView;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
@@ -25,6 +25,7 @@ import forge.toolbox.FLabel;
|
|||||||
import forge.toolbox.FOverlay;
|
import forge.toolbox.FOverlay;
|
||||||
import forge.toolbox.FTextArea;
|
import forge.toolbox.FTextArea;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.IGameView;
|
||||||
|
|
||||||
public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
||||||
private static final float INSETS_FACTOR = 0.025f;
|
private static final float INSETS_FACTOR = 0.025f;
|
||||||
@@ -34,9 +35,9 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
private final FLabel lblTitle, lblLog, lblStats, btnCopyLog;
|
private final FLabel lblTitle, lblLog, lblStats, btnCopyLog;
|
||||||
private final FTextArea txtLog;
|
private final FTextArea txtLog;
|
||||||
private final OutcomesPanel pnlOutcomes;
|
private final OutcomesPanel pnlOutcomes;
|
||||||
private final Game game;
|
private final IGameView game;
|
||||||
|
|
||||||
public ViewWinLose(final Game game0) {
|
public ViewWinLose(final IGameView game0) {
|
||||||
super(FSkinColor.get(Colors.CLR_OVERLAY).alphaColor(0.75f));
|
super(FSkinColor.get(Colors.CLR_OVERLAY).alphaColor(0.75f));
|
||||||
|
|
||||||
game = game0;
|
game = game0;
|
||||||
@@ -52,7 +53,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
// Control of the win/lose is handled differently for various game
|
// Control of the win/lose is handled differently for various game
|
||||||
// modes.
|
// modes.
|
||||||
ControlWinLose control = null;
|
ControlWinLose control = null;
|
||||||
switch (game0.getRules().getGameType()) {
|
switch (game0.getGameType()) {
|
||||||
case Quest:
|
case Quest:
|
||||||
control = new QuestWinLose(this, game0);
|
control = new QuestWinLose(this, game0);
|
||||||
break;
|
break;
|
||||||
@@ -60,7 +61,7 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
//control = new QuestDraftWinLose(this, game0);
|
//control = new QuestDraftWinLose(this, game0);
|
||||||
break;
|
break;
|
||||||
case Draft:
|
case Draft:
|
||||||
if (!FModel.getGauntletMini().isGauntletDraft()) {
|
if (!FModel.getGauntletMini(GuiBase.getInterface()).isGauntletDraft()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Sealed:
|
case Sealed:
|
||||||
@@ -82,10 +83,10 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
btnRestart.setFont(btnContinue.getFont());
|
btnRestart.setFont(btnContinue.getFont());
|
||||||
btnQuit.setText("Quit Match");
|
btnQuit.setText("Quit Match");
|
||||||
btnQuit.setFont(btnContinue.getFont());
|
btnQuit.setFont(btnContinue.getFont());
|
||||||
btnContinue.setEnabled(!game0.getMatch().isMatchOver());
|
btnContinue.setEnabled(!game0.isMatchOver());
|
||||||
|
|
||||||
lblLog = add(new FLabel.Builder().text("Game Log").align(HAlignment.CENTER).font(FSkinFont.get(18)).build());
|
lblLog = add(new FLabel.Builder().text("Game Log").align(HAlignment.CENTER).font(FSkinFont.get(18)).build());
|
||||||
txtLog = add(new FTextArea(true, game.getGameLog().getLogText(null).replace("[COMPUTER]", "[AI]")) {
|
txtLog = add(new FTextArea(true, StringUtils.join(game.getLogEntries(null), "\r\n").replace("[COMPUTER]", "[AI]")) {
|
||||||
@Override
|
@Override
|
||||||
public boolean tap(float x, float y, int count) {
|
public boolean tap(float x, float y, int count) {
|
||||||
if (txtLog.getMaxScrollTop() > 0) {
|
if (txtLog.getMaxScrollTop() > 0) {
|
||||||
@@ -103,20 +104,20 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
}
|
}
|
||||||
}).build());
|
}).build());
|
||||||
|
|
||||||
lblTitle.setText(composeTitle(game0.getOutcome()));
|
lblTitle.setText(composeTitle(game0));
|
||||||
|
|
||||||
showGameOutcomeSummary();
|
showGameOutcomeSummary();
|
||||||
showPlayerScores();
|
showPlayerScores();
|
||||||
control.showRewards();
|
control.showRewards();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String composeTitle(GameOutcome outcome) {
|
private String composeTitle(final IGameView game) {
|
||||||
Player winner = outcome.getWinningPlayer();
|
final LobbyPlayer winner = game.getWinningPlayer();
|
||||||
int winningTeam = outcome.getWinningTeam();
|
final int winningTeam = game.getWinningTeam();
|
||||||
if (winner == null) {
|
if (winner == null) {
|
||||||
return "It's a draw!";
|
return "It's a draw!";
|
||||||
} else if (winningTeam != -1) {
|
} else if (winningTeam != -1) {
|
||||||
return "Team " + winner.getTeam() + " Won!";
|
return "Team " + winningTeam + " Won!";
|
||||||
} else {
|
} else {
|
||||||
return winner.getName() + " Won!";
|
return winner.getName() + " Won!";
|
||||||
}
|
}
|
||||||
@@ -135,15 +136,13 @@ public class ViewWinLose extends FOverlay implements IWinLoseView<FButton> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showGameOutcomeSummary() {
|
private void showGameOutcomeSummary() {
|
||||||
GameLog log = game.getGameLog();
|
for (GameLogEntry o : game.getLogEntriesExact(GameLogEntryType.GAME_OUTCOME)) {
|
||||||
for (GameLogEntry o : log.getLogEntriesExact(GameLogEntryType.GAME_OUTCOME)) {
|
|
||||||
pnlOutcomes.add(new FLabel.Builder().text(o.message).font(FSkinFont.get(14)).build());
|
pnlOutcomes.add(new FLabel.Builder().text(o.message).font(FSkinFont.get(14)).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPlayerScores() {
|
private void showPlayerScores() {
|
||||||
GameLog log = game.getGameLog();
|
for (GameLogEntry o : game.getLogEntriesExact(GameLogEntryType.MATCH_RESULTS)) {
|
||||||
for (GameLogEntry o : log.getLogEntriesExact(GameLogEntryType.MATCH_RESULTS)) {
|
|
||||||
lblStats.setText(removePlayerTypeFromLogMessage(o.message));
|
lblStats.setText(removePlayerTypeFromLogMessage(o.message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
|||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
@@ -179,14 +180,14 @@ public class LoadQuestScreen extends FScreen {
|
|||||||
String questName;
|
String questName;
|
||||||
String oldQuestName = quest.getName();
|
String oldQuestName = quest.getName();
|
||||||
while (true) {
|
while (true) {
|
||||||
questName = SOptionPane.showInputDialog("Enter new name for quest:", "Rename Quest", null, oldQuestName);
|
questName = SOptionPane.showInputDialog(GuiBase.getInterface(), "Enter new name for quest:", "Rename Quest", null, oldQuestName);
|
||||||
if (questName == null) { return; }
|
if (questName == null) { return; }
|
||||||
|
|
||||||
questName = QuestUtil.cleanString(questName);
|
questName = QuestUtil.cleanString(questName);
|
||||||
if (questName.equals(oldQuestName)) { return; } //quit if chose same name
|
if (questName.equals(oldQuestName)) { return; } //quit if chose same name
|
||||||
|
|
||||||
if (questName.isEmpty()) {
|
if (questName.isEmpty()) {
|
||||||
SOptionPane.showMessageDialog("Please specify a quest name.");
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), "Please specify a quest name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ public class LoadQuestScreen extends FScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exists) {
|
if (exists) {
|
||||||
SOptionPane.showMessageDialog("A quest already exists with that name. Please pick another quest name.");
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), "A quest already exists with that name. Please pick another quest name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -215,7 +216,7 @@ public class LoadQuestScreen extends FScreen {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() {
|
ThreadUtil.invokeInGameThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!SOptionPane.showConfirmDialog(
|
if (!SOptionPane.showConfirmDialog(GuiBase.getInterface(),
|
||||||
"Are you sure you want to delete '" + quest.getName() + "'?",
|
"Are you sure you want to delete '" + quest.getName() + "'?",
|
||||||
"Delete Quest", "Delete", "Cancel")) {
|
"Delete Quest", "Delete", "Cancel")) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.apache.commons.lang3.text.WordUtils;
|
|||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
@@ -427,7 +428,8 @@ public class NewQuestScreen extends FScreen {
|
|||||||
|
|
||||||
case CustomFormat:
|
case CustomFormat:
|
||||||
if (customFormatCodes.isEmpty()) {
|
if (customFormatCodes.isEmpty()) {
|
||||||
if (!SOptionPane.showConfirmDialog("You have defined a custom format that doesn't contain any sets.\nThis will start a game without restriction.\n\nContinue?")) {
|
if (!SOptionPane.showConfirmDialog(GuiBase.getInterface(),
|
||||||
|
"You have defined a custom format that doesn't contain any sets.\nThis will start a game without restriction.\n\nContinue?")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,7 +441,8 @@ public class NewQuestScreen extends FScreen {
|
|||||||
case Cube:
|
case Cube:
|
||||||
dckStartPool = getSelectedDeck();
|
dckStartPool = getSelectedDeck();
|
||||||
if (dckStartPool == null) {
|
if (dckStartPool == null) {
|
||||||
SOptionPane.showMessageDialog("You have not selected a deck to start.", "Cannot start a quest", SOptionPane.ERROR_ICON);
|
SOptionPane.showMessageDialog(GuiBase.getInterface(),
|
||||||
|
"You have not selected a deck to start.", "Cannot start a quest", SOptionPane.ERROR_ICON);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -485,7 +488,8 @@ public class NewQuestScreen extends FScreen {
|
|||||||
break;
|
break;
|
||||||
case CustomFormat:
|
case CustomFormat:
|
||||||
if (customPrizeFormatCodes.isEmpty()) {
|
if (customPrizeFormatCodes.isEmpty()) {
|
||||||
if (!SOptionPane.showConfirmDialog("You have defined custom format as containing no sets.\nThis will choose all editions without restriction as prized.\n\nContinue?")) {
|
if (!SOptionPane.showConfirmDialog(GuiBase.getInterface(),
|
||||||
|
"You have defined custom format as containing no sets.\nThis will choose all editions without restriction as prized.\n\nContinue?")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -501,17 +505,17 @@ public class NewQuestScreen extends FScreen {
|
|||||||
|
|
||||||
String questName;
|
String questName;
|
||||||
while (true) {
|
while (true) {
|
||||||
questName = SOptionPane.showInputDialog("Poets will remember your quest as:", "Quest Name");
|
questName = SOptionPane.showInputDialog(GuiBase.getInterface(), "Poets will remember your quest as:", "Quest Name");
|
||||||
if (questName == null) { return; }
|
if (questName == null) { return; }
|
||||||
|
|
||||||
questName = QuestUtil.cleanString(questName);
|
questName = QuestUtil.cleanString(questName);
|
||||||
|
|
||||||
if (questName.isEmpty()) {
|
if (questName.isEmpty()) {
|
||||||
SOptionPane.showMessageDialog("Please specify a quest name.");
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), "Please specify a quest name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (FileUtil.doesFileExist(ForgeConstants.QUEST_SAVE_DIR + questName + ".dat")) {
|
if (FileUtil.doesFileExist(ForgeConstants.QUEST_SAVE_DIR + questName + ".dat")) {
|
||||||
SOptionPane.showMessageDialog("A quest already exists with that name. Please pick another quest name.");
|
SOptionPane.showMessageDialog(GuiBase.getInterface(), "A quest already exists with that name. Please pick another quest name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -521,7 +525,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startNewQuest(final String questName, final GameFormat fmtPrizes, final Deck dckStartPool, final GameFormat fmtStartPool) {
|
private void startNewQuest(final String questName, final GameFormat fmtPrizes, final Deck dckStartPool, final GameFormat fmtStartPool) {
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LoadingOverlay.show("Creating new quest...", new Runnable() {
|
LoadingOverlay.show("Creating new quest...", new Runnable() {
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
|
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FImage;
|
import forge.assets.FImage;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
|
import forge.assets.FSkinProp;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
import forge.quest.QuestUtil;
|
import forge.quest.QuestUtil;
|
||||||
@@ -77,7 +79,7 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
private BazaarPage(QuestStallDefinition stallDef0) {
|
private BazaarPage(QuestStallDefinition stallDef0) {
|
||||||
super(stallDef0.getName(), (FImage)stallDef0.getIcon());
|
super(stallDef0.getName(), (FImage)GuiBase.getInterface().getSkinIcon(stallDef0.getIcon()));
|
||||||
stallDef = stallDef0;
|
stallDef = stallDef0;
|
||||||
|
|
||||||
lblFluff.setFont(FSkinFont.get(12));
|
lblFluff.setFont(FSkinFont.get(12));
|
||||||
@@ -157,7 +159,8 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
|
|||||||
|
|
||||||
lblName.setText(item.getPurchaseName());
|
lblName.setText(item.getPurchaseName());
|
||||||
lblDesc.setText(item.getPurchaseDescription(assets));
|
lblDesc.setText(item.getPurchaseDescription(assets));
|
||||||
lblIcon.setIcon((FImage)item.getIcon(assets));
|
final FSkinProp f = FSkinProp.valueOf(FSkinProp.class, item.getIcon(assets));
|
||||||
|
lblIcon.setIcon((FImage) GuiBase.getInterface().getSkinIcon(f));
|
||||||
lblCost.setText(String.valueOf(buyingPrice));
|
lblCost.setText(String.valueOf(buyingPrice));
|
||||||
|
|
||||||
lblDesc.setFont(FSkinFont.get(12));
|
lblDesc.setFont(FSkinFont.get(12));
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.deck.DeckProxy;
|
import forge.deck.DeckProxy;
|
||||||
import forge.deck.DeckgenUtil;
|
import forge.deck.DeckgenUtil;
|
||||||
@@ -70,10 +71,10 @@ public class QuestDecksScreen extends FScreen {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() { //must run in game thread to prevent blocking UI thread
|
ThreadUtil.invokeInGameThread(new Runnable() { //must run in game thread to prevent blocking UI thread
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!QuestUtil.checkActiveQuest("Create a Deck.")) {
|
if (!QuestUtil.checkActiveQuest(GuiBase.getInterface(), "Create a Deck.")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
QuestDeckEditor editor = new QuestDeckEditor();
|
QuestDeckEditor editor = new QuestDeckEditor();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package forge.screens.quest;
|
package forge.screens.quest;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
|
import forge.interfaces.IGuiBase;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.quest.QuestUtil;
|
import forge.quest.QuestUtil;
|
||||||
import forge.screens.LaunchScreen;
|
import forge.screens.LaunchScreen;
|
||||||
@@ -27,14 +29,15 @@ public abstract class QuestLaunchScreen extends LaunchScreen {
|
|||||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
FThreads.invokeInBackgroundThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (QuestUtil.canStartGame()) {
|
final IGuiBase gui = GuiBase.getInterface();
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
if (QuestUtil.canStartGame(gui)) {
|
||||||
|
FThreads.invokeInEdtLater(gui, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LoadingOverlay.show("Loading new game...", new Runnable() {
|
LoadingOverlay.show("Loading new game...", new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
QuestUtil.finishStartingGame();
|
QuestUtil.finishStartingGame(gui);
|
||||||
creatingMatch = false;
|
creatingMatch = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.io.File;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.FDeckEditor.DeckController;
|
import forge.deck.FDeckEditor.DeckController;
|
||||||
@@ -11,6 +12,7 @@ import forge.deck.FDeckEditor.EditorType;
|
|||||||
import forge.interfaces.IButton;
|
import forge.interfaces.IButton;
|
||||||
import forge.interfaces.ICheckBox;
|
import forge.interfaces.ICheckBox;
|
||||||
import forge.interfaces.IComboBox;
|
import forge.interfaces.IComboBox;
|
||||||
|
import forge.interfaces.IGuiBase;
|
||||||
import forge.menu.FMenuItem;
|
import forge.menu.FMenuItem;
|
||||||
import forge.menu.FPopupMenu;
|
import forge.menu.FPopupMenu;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
@@ -79,13 +81,14 @@ public class QuestMenu extends FPopupMenu implements IVQuestStats {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
private static final FMenuItem unlockSetsItem = new FMenuItem("Unlock Sets", FSkinImage.QUEST_MAP, new FEventHandler() {
|
private static final FMenuItem unlockSetsItem = new FMenuItem("Unlock Sets", FSkinImage.QUEST_MAP, new FEventHandler() {
|
||||||
|
final IGuiBase gui = GuiBase.getInterface();
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
ThreadUtil.invokeInGameThread(new Runnable() { //invoke in background thread so prompts can work
|
ThreadUtil.invokeInGameThread(new Runnable() { //invoke in background thread so prompts can work
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
QuestUtil.chooseAndUnlockEdition();
|
QuestUtil.chooseAndUnlockEdition(gui);
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(gui, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateCurrentQuestScreen();
|
updateCurrentQuestScreen();
|
||||||
@@ -96,13 +99,14 @@ public class QuestMenu extends FPopupMenu implements IVQuestStats {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
private static final FMenuItem travelItem = new FMenuItem("Travel", FSkinImage.QUEST_MAP, new FEventHandler() {
|
private static final FMenuItem travelItem = new FMenuItem("Travel", FSkinImage.QUEST_MAP, new FEventHandler() {
|
||||||
|
final IGuiBase gui = GuiBase.getInterface();
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
ThreadUtil.invokeInGameThread(new Runnable() { //invoke in background thread so prompts can work
|
ThreadUtil.invokeInGameThread(new Runnable() { //invoke in background thread so prompts can work
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
QuestUtil.travelWorld();
|
QuestUtil.travelWorld(gui);
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(gui, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateCurrentQuestScreen();
|
updateCurrentQuestScreen();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.Map;
|
|||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FImage;
|
import forge.assets.FImage;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
@@ -132,7 +133,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
|||||||
ItemPool<InventoryItem> items = new ItemPool<InventoryItem>(InventoryItem.class);
|
ItemPool<InventoryItem> items = new ItemPool<InventoryItem>(InventoryItem.class);
|
||||||
items.add(item, result);
|
items.add(item, result);
|
||||||
activateItems(items);
|
activateItems(items);
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
parentScreen.updateCreditsLabel();
|
parentScreen.updateCreditsLabel();
|
||||||
@@ -180,7 +181,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void activateItems(ItemPool<InventoryItem> items) {
|
protected void activateItems(ItemPool<InventoryItem> items) {
|
||||||
QuestSpellShop.buy(items, itemManager, ((InventoryPage)parentScreen.tabPages[1]).itemManager, true);
|
QuestSpellShop.buy(GuiBase.getInterface(), items, itemManager, ((InventoryPage)parentScreen.tabPages[1]).itemManager, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -210,7 +211,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
QuestSpellShop.sellExtras(((SpellShopPage)parentScreen.tabPages[0]).itemManager, itemManager);
|
QuestSpellShop.sellExtras(((SpellShopPage)parentScreen.tabPages[0]).itemManager, itemManager);
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
parentScreen.updateCreditsLabel();
|
parentScreen.updateCreditsLabel();
|
||||||
@@ -240,7 +241,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void activateItems(ItemPool<InventoryItem> items) {
|
protected void activateItems(ItemPool<InventoryItem> items) {
|
||||||
QuestSpellShop.sell(items, ((SpellShopPage)parentScreen.tabPages[0]).itemManager, itemManager, true);
|
QuestSpellShop.sell(GuiBase.getInterface(), items, ((SpellShopPage)parentScreen.tabPages[0]).itemManager, itemManager, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.screens.quest;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.interfaces.IButton;
|
import forge.interfaces.IButton;
|
||||||
@@ -127,7 +128,7 @@ public class QuestStatsScreen extends FScreen {
|
|||||||
lblZep.setCommand(new FEventHandler() {
|
lblZep.setCommand(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
if (!QuestUtil.checkActiveQuest("Launch a Zeppelin.")) {
|
if (!QuestUtil.checkActiveQuest(GuiBase.getInterface(), "Launch a Zeppelin.")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FModel.getQuest().getAchievements().setCurrentChallenges(null);
|
FModel.getQuest().getAchievements().setCurrentChallenges(null);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.screens.sealed;
|
|||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.deck.DeckGroup;
|
import forge.deck.DeckGroup;
|
||||||
import forge.deck.DeckProxy;
|
import forge.deck.DeckProxy;
|
||||||
@@ -46,10 +47,10 @@ public class SealedScreen extends LaunchScreen {
|
|||||||
ThreadUtil.invokeInGameThread(new Runnable() { //must run in game thread to prevent blocking UI thread
|
ThreadUtil.invokeInGameThread(new Runnable() { //must run in game thread to prevent blocking UI thread
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final DeckGroup sealed = SealedCardPoolGenerator.generateSealedDeck(false);
|
final DeckGroup sealed = SealedCardPoolGenerator.generateSealedDeck(GuiBase.getInterface(), false);
|
||||||
if (sealed == null) { return; }
|
if (sealed == null) { return; }
|
||||||
|
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DeckPreferences.setSealedDeck(sealed.getName());
|
DeckPreferences.setSealedDeck(sealed.getName());
|
||||||
@@ -115,7 +116,7 @@ public class SealedScreen extends LaunchScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int matches = FModel.getDecks().getSealed().get(human.getName()).getAiDecks().size();
|
int matches = FModel.getDecks().getSealed().get(human.getName()).getAiDecks().size();
|
||||||
FModel.getGauntletMini().launch(matches, human.getDeck(), GameType.Sealed);
|
FModel.getGauntletMini(GuiBase.getInterface()).launch(matches, human.getDeck(), GameType.Sealed);
|
||||||
return false; //prevent launching via launch screen since gauntlet handles it
|
return false; //prevent launching via launch screen since gauntlet handles it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.net.Proxy;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.UiCommand;
|
import forge.UiCommand;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.download.GuiDownloadService;
|
import forge.download.GuiDownloadService;
|
||||||
@@ -82,7 +83,7 @@ public class GuiDownloader extends FDialog {
|
|||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
service.initialize(txtAddress, txtPort, progressBar, btnStart, cmdClose, new Runnable() {
|
service.initialize(GuiBase.getInterface(), txtAddress, txtPort, progressBar, btnStart, cmdClose, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Gdx.graphics.setContinuousRendering(false);
|
Gdx.graphics.setContinuousRendering(false);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package forge.toolbox;
|
|||||||
|
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.card.CardRenderer;
|
import forge.card.CardRenderer;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
|
||||||
public class FCardPanel extends FDisplayObject {
|
public class FCardPanel extends FDisplayObject {
|
||||||
public static final float TAPPED_ANGLE = -90;
|
public static final float TAPPED_ANGLE = -90;
|
||||||
@@ -12,7 +12,7 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
public static final float TARGET_ORIGIN_FACTOR_X = 0.15f;
|
public static final float TARGET_ORIGIN_FACTOR_X = 0.15f;
|
||||||
public static final float TARGET_ORIGIN_FACTOR_Y = 0.5f;
|
public static final float TARGET_ORIGIN_FACTOR_Y = 0.5f;
|
||||||
|
|
||||||
private Card card;
|
private CardView card;
|
||||||
private boolean tapped;
|
private boolean tapped;
|
||||||
private float tappedAngle = 0;
|
private float tappedAngle = 0;
|
||||||
private boolean highlighted;
|
private boolean highlighted;
|
||||||
@@ -20,14 +20,14 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
public FCardPanel() {
|
public FCardPanel() {
|
||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
public FCardPanel(Card card0) {
|
public FCardPanel(CardView card0) {
|
||||||
card = card0;
|
card = card0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Card getCard() {
|
public CardView getCard() {
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
public void setCard(Card card0) {
|
public void setCard(CardView card0) {
|
||||||
card = card0;
|
card = card0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ import forge.screens.match.FControl;
|
|||||||
import forge.screens.match.views.VAvatar;
|
import forge.screens.match.views.VAvatar;
|
||||||
import forge.screens.match.views.VStack;
|
import forge.screens.match.views.VStack;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
import forge.view.PlayerView;
|
||||||
|
import forge.view.SpellAbilityView;
|
||||||
|
|
||||||
public class FChoiceList<T> extends FList<T> {
|
public class FChoiceList<T> extends FList<T> {
|
||||||
public static final FSkinColor ITEM_COLOR = FSkinColor.get(Colors.CLR_ZEBRA);
|
public static final FSkinColor ITEM_COLOR = FSkinColor.get(Colors.CLR_ZEBRA);
|
||||||
@@ -347,18 +350,18 @@ public class FChoiceList<T> extends FList<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tap(T value, float x, float y, int count) {
|
public boolean tap(T value, float x, float y, int count) {
|
||||||
return CardRenderer.cardListItemTap((Card)value, x, y, count, compactModeHandler.isCompactMode());
|
return CardRenderer.cardListItemTap((CardView)value, x, y, count, compactModeHandler.isCompactMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(T value, float x, float y) {
|
public boolean longPress(T value, float x, float y) {
|
||||||
CardZoom.show((Card)value);
|
CardZoom.show((CardView)value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
||||||
CardRenderer.drawCardListItem(g, font, foreColor, (Card)value, 0, null, x, y, w, h, compactModeHandler.isCompactMode());
|
CardRenderer.drawCardListItem(g, font, foreColor, (CardView)value, 0, null, x, y, w, h, compactModeHandler.isCompactMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//special renderer for SpellAbilities
|
//special renderer for SpellAbilities
|
||||||
@@ -378,7 +381,7 @@ public class FChoiceList<T> extends FList<T> {
|
|||||||
@Override
|
@Override
|
||||||
public boolean tap(T value, float x, float y, int count) {
|
public boolean tap(T value, float x, float y, int count) {
|
||||||
if (x <= VStack.CARD_WIDTH + 2 * FList.PADDING) {
|
if (x <= VStack.CARD_WIDTH + 2 * FList.PADDING) {
|
||||||
CardZoom.show(((SpellAbility)value).getHostCard());
|
CardZoom.show(((SpellAbilityView)value).getHostCard());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -386,13 +389,13 @@ public class FChoiceList<T> extends FList<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(T value, float x, float y) {
|
public boolean longPress(T value, float x, float y) {
|
||||||
CardZoom.show(((SpellAbility)value).getHostCard());
|
CardZoom.show(((SpellAbilityView)value).getHostCard());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
||||||
SpellAbility spellAbility = (SpellAbility)value;
|
SpellAbilityView spellAbility = (SpellAbilityView)value;
|
||||||
CardRenderer.drawCardWithOverlays(g, spellAbility.getHostCard(), x, y, VStack.CARD_WIDTH, VStack.CARD_HEIGHT);
|
CardRenderer.drawCardWithOverlays(g, spellAbility.getHostCard(), x, y, VStack.CARD_WIDTH, VStack.CARD_HEIGHT);
|
||||||
|
|
||||||
float dx = VStack.CARD_WIDTH + FList.PADDING;
|
float dx = VStack.CARD_WIDTH + FList.PADDING;
|
||||||
@@ -424,7 +427,7 @@ public class FChoiceList<T> extends FList<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
public void drawValue(Graphics g, T value, FSkinFont font, FSkinColor foreColor, boolean pressed, float x, float y, float w, float h) {
|
||||||
Player player = (Player)value;
|
PlayerView player = (PlayerView)value;
|
||||||
g.drawImage(FControl.getPlayerAvatar(player), x - FList.PADDING, y - FList.PADDING, VAvatar.WIDTH, VAvatar.HEIGHT);
|
g.drawImage(FControl.getPlayerAvatar(player), x - FList.PADDING, y - FList.PADDING, VAvatar.WIDTH, VAvatar.HEIGHT);
|
||||||
x += VAvatar.WIDTH;
|
x += VAvatar.WIDTH;
|
||||||
w -= VAvatar.WIDTH;
|
w -= VAvatar.WIDTH;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.ConcurrentModificationException;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.error.BugReporter;
|
import forge.error.BugReporter;
|
||||||
|
|
||||||
public abstract class FContainer extends FDisplayObject {
|
public abstract class FContainer extends FDisplayObject {
|
||||||
@@ -74,7 +75,7 @@ public abstract class FContainer extends FDisplayObject {
|
|||||||
//ignore concurrent modification exceptions during render
|
//ignore concurrent modification exceptions during render
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex, GuiBase.getInterface());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import forge.assets.FSkinImage;
|
|||||||
import forge.assets.ImageUtil;
|
import forge.assets.ImageUtil;
|
||||||
import forge.card.CardRenderer;
|
import forge.card.CardRenderer;
|
||||||
import forge.card.CardZoom;
|
import forge.card.CardZoom;
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.screens.match.views.VPrompt;
|
import forge.screens.match.views.VPrompt;
|
||||||
import forge.toolbox.FEvent.*;
|
import forge.toolbox.FEvent.*;
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
import forge.view.CardView;
|
||||||
|
|
||||||
public class FOptionPane extends FDialog {
|
public class FOptionPane extends FDialog {
|
||||||
public static final FSkinImage QUESTION_ICON = FSkinImage.QUESTION;
|
public static final FSkinImage QUESTION_ICON = FSkinImage.QUESTION;
|
||||||
@@ -89,7 +89,7 @@ public class FOptionPane extends FDialog {
|
|||||||
optionPane.show();
|
optionPane.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showCardOptionDialog(final Card card, String message, String title, FImage icon, String[] options, int defaultOption, final Callback<Integer> callback) {
|
public static void showCardOptionDialog(final CardView card, String message, String title, FImage icon, String[] options, int defaultOption, final Callback<Integer> callback) {
|
||||||
final FDisplayObject cardDisplay;
|
final FDisplayObject cardDisplay;
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cardDisplay = new FDisplayObject() {
|
cardDisplay = new FDisplayObject() {
|
||||||
@@ -110,7 +110,7 @@ public class FOptionPane extends FDialog {
|
|||||||
float x = (getWidth() - w) / 2;
|
float x = (getWidth() - w) / 2;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
|
|
||||||
CardRenderer.drawCard(g, card, true, x, y, w, h);
|
CardRenderer.drawCard(g, card, x, y, w, h);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cardDisplay.setHeight(Utils.SCREEN_HEIGHT / 2);
|
cardDisplay.setHeight(Utils.SCREEN_HEIGHT / 2);
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ package forge.toolbox;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
|
import forge.view.CardView;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
public class GuiChoose {
|
public class GuiChoose {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -240,22 +239,22 @@ public class GuiChoose {
|
|||||||
c.show(selected, false);
|
c.show(selected, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void many(final String title, final String topCaption, int cnt, final List<T> sourceChoices, Card referenceCard, final Callback<List<T>> callback) {
|
public static <T> void many(final String title, final String topCaption, int cnt, final List<T> sourceChoices, CardView referenceCard, final Callback<List<T>> callback) {
|
||||||
order(title, topCaption, cnt, cnt, sourceChoices, null, referenceCard, callback);
|
order(title, topCaption, cnt, cnt, sourceChoices, null, referenceCard, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void many(final String title, final String topCaption, int min, int max, final List<T> sourceChoices, Card referenceCard, final Callback<List<T>> callback) {
|
public static <T> void many(final String title, final String topCaption, int min, int max, final List<T> sourceChoices, CardView referenceCard, final Callback<List<T>> callback) {
|
||||||
int m2 = min >= 0 ? sourceChoices.size() - min : -1;
|
int m2 = min >= 0 ? sourceChoices.size() - min : -1;
|
||||||
int m1 = max >= 0 ? sourceChoices.size() - max : -1;
|
int m1 = max >= 0 ? sourceChoices.size() - max : -1;
|
||||||
order(title, topCaption, m1, m2, sourceChoices, null, referenceCard, callback);
|
order(title, topCaption, m1, m2, sourceChoices, null, referenceCard, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void order(final String title, final String top, final List<T> sourceChoices, Card referenceCard, final Callback<List<T>> callback) {
|
public static <T> void order(final String title, final String top, final List<T> sourceChoices, CardView referenceCard, final Callback<List<T>> callback) {
|
||||||
order(title, top, 0, 0, sourceChoices, null, referenceCard, callback);
|
order(title, top, 0, 0, sourceChoices, null, referenceCard, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
|
public static <T> void order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
|
||||||
final List<T> sourceChoices, final List<T> destChoices, final Card referenceCard, final Callback<List<T>> callback) {
|
final List<T> sourceChoices, final List<T> destChoices, final CardView referenceCard, final Callback<List<T>> callback) {
|
||||||
// An input box for handling the order of choices.
|
// An input box for handling the order of choices.
|
||||||
DualListBox<T> dual = new DualListBox<T>(title, remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, callback);
|
DualListBox<T> dual = new DualListBox<T>(title, remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, callback);
|
||||||
dual.setSecondColumnLabelText(top);
|
dual.setSecondColumnLabelText(top);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package forge.toolbox;
|
package forge.toolbox;
|
||||||
|
|
||||||
import forge.game.card.Card;
|
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
|
import forge.view.CardView;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -12,18 +12,18 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
public class GuiDialog {
|
public class GuiDialog {
|
||||||
private static final String[] defaultConfirmOptions = { "Yes", "No" };
|
private static final String[] defaultConfirmOptions = { "Yes", "No" };
|
||||||
|
|
||||||
public static void confirm(final Card c, final String question, final Callback<Boolean> callback) {
|
public static void confirm(final CardView c, final String question, final Callback<Boolean> callback) {
|
||||||
GuiDialog.confirm(c, question, true, null, callback);
|
GuiDialog.confirm(c, question, true, null, callback);
|
||||||
}
|
}
|
||||||
public static void confirm(final Card c, final String question, final boolean defaultChoice, final Callback<Boolean> callback) {
|
public static void confirm(final CardView c, final String question, final boolean defaultChoice, final Callback<Boolean> callback) {
|
||||||
GuiDialog.confirm(c, question, defaultChoice, null, callback);
|
GuiDialog.confirm(c, question, defaultChoice, null, callback);
|
||||||
}
|
}
|
||||||
public static void confirm(final Card c, final String question, String[] options, final Callback<Boolean> callback) {
|
public static void confirm(final CardView c, final String question, String[] options, final Callback<Boolean> callback) {
|
||||||
GuiDialog.confirm(c, question, true, options, callback);
|
GuiDialog.confirm(c, question, true, options, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void confirm(final Card c, final String question, final boolean defaultIsYes, final String[] options, final Callback<Boolean> callback) {
|
public static void confirm(final CardView c, final String question, final boolean defaultIsYes, final String[] options, final Callback<Boolean> callback) {
|
||||||
final String title = c == null ? "Question" : c.getCardForUi().getName() + " - Ability";
|
final String title = c == null ? "Question" : c + " - Ability";
|
||||||
String questionToUse = StringUtils.isBlank(question) ? "Activate card's ability?" : question;
|
String questionToUse = StringUtils.isBlank(question) ? "Activate card's ability?" : question;
|
||||||
String[] opts = options == null ? defaultConfirmOptions : options;
|
String[] opts = options == null ? defaultConfirmOptions : options;
|
||||||
FOptionPane.showCardOptionDialog(c, questionToUse, title, FOptionPane.QUESTION_ICON, opts, defaultIsYes ? 0 : 1, new Callback<Integer>() {
|
FOptionPane.showCardOptionDialog(c, questionToUse, title, FOptionPane.QUESTION_ICON, opts, defaultIsYes ? 0 : 1, new Callback<Integer>() {
|
||||||
|
|||||||
@@ -21,11 +21,13 @@ package forge.toolbox;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.toolbox.FEvent;
|
import forge.toolbox.FEvent;
|
||||||
import forge.toolbox.FEvent.FEventHandler;
|
import forge.toolbox.FEvent.FEventHandler;
|
||||||
import forge.toolbox.FOptionPane;
|
import forge.toolbox.FOptionPane;
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -69,7 +71,7 @@ public class ListChooser<T> extends FContainer {
|
|||||||
private final Callback<List<T>> callback;
|
private final Callback<List<T>> callback;
|
||||||
|
|
||||||
public ListChooser(final String title, final int minChoices, final int maxChoices, final Collection<T> list0, final Function<T, String> display0, final Callback<List<T>> callback0) {
|
public ListChooser(final String title, final int minChoices, final int maxChoices, final Collection<T> list0, final Function<T, String> display0, final Callback<List<T>> callback0) {
|
||||||
FThreads.assertExecutedByEdt(true);
|
FThreads.assertExecutedByEdt(GuiBase.getInterface(), true);
|
||||||
list = list0;
|
list = list0;
|
||||||
if (list.size() > 25) { //only show search field if more than 25 items
|
if (list.size() > 25) { //only show search field if more than 25 items
|
||||||
txtSearch = add(new FTextField());
|
txtSearch = add(new FTextField());
|
||||||
|
|||||||
35
forge-gui-mobile/src/forge/util/WaitCallback.java
Normal file
35
forge-gui-mobile/src/forge/util/WaitCallback.java
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package forge.util;
|
||||||
|
|
||||||
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
|
|
||||||
|
public abstract class WaitCallback<T> extends Callback<T> implements Runnable {
|
||||||
|
public class Lock {
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Lock lock = new Lock();
|
||||||
|
|
||||||
|
private T result;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void run(T result0) {
|
||||||
|
result = result0;
|
||||||
|
synchronized(lock) {
|
||||||
|
lock.notify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final T invokeAndWait() {
|
||||||
|
FThreads.assertExecutedByEdt(GuiBase.getInterface(), false); //not supported if on UI thread
|
||||||
|
FThreads.invokeInEdtLater(GuiBase.getInterface(), this);
|
||||||
|
try {
|
||||||
|
synchronized(lock) {
|
||||||
|
lock.wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package forge.util;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.GuiBase;
|
||||||
|
|
||||||
public abstract class WaitRunnable implements Runnable {
|
public abstract class WaitRunnable implements Runnable {
|
||||||
public class Lock {
|
public class Lock {
|
||||||
@@ -11,7 +12,7 @@ public abstract class WaitRunnable implements Runnable {
|
|||||||
private final Lock lock = new Lock();
|
private final Lock lock = new Lock();
|
||||||
|
|
||||||
public void invokeAndWait() {
|
public void invokeAndWait() {
|
||||||
FThreads.assertExecutedByEdt(false);
|
FThreads.assertExecutedByEdt(GuiBase.getInterface(), false);
|
||||||
Gdx.app.postRunnable(new Runnable() {
|
Gdx.app.postRunnable(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
Reference in New Issue
Block a user