mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Prevent card zoom crash
This commit is contained in:
@@ -16,9 +16,7 @@ import forge.assets.FSkinFont;
|
|||||||
import forge.assets.ImageCache;
|
import forge.assets.ImageCache;
|
||||||
import forge.error.BugReporter;
|
import forge.error.BugReporter;
|
||||||
import forge.error.ExceptionHandler;
|
import forge.error.ExceptionHandler;
|
||||||
import forge.game.GameView;
|
|
||||||
import forge.interfaces.IDeviceAdapter;
|
import forge.interfaces.IDeviceAdapter;
|
||||||
import forge.match.HostedMatch;
|
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
@@ -26,6 +24,7 @@ import forge.properties.ForgePreferences.FPref;
|
|||||||
import forge.screens.FScreen;
|
import forge.screens.FScreen;
|
||||||
import forge.screens.SplashScreen;
|
import forge.screens.SplashScreen;
|
||||||
import forge.screens.home.HomeScreen;
|
import forge.screens.home.HomeScreen;
|
||||||
|
import forge.screens.match.MatchController;
|
||||||
import forge.sound.MusicPlaylist;
|
import forge.sound.MusicPlaylist;
|
||||||
import forge.sound.SoundSystem;
|
import forge.sound.SoundSystem;
|
||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.FContainer;
|
||||||
@@ -52,7 +51,6 @@ public class Forge implements ApplicationListener {
|
|||||||
private static boolean exited;
|
private static boolean exited;
|
||||||
private static int continuousRenderingCount = 1; //initialize to 1 since continuous rendering is the default
|
private static int continuousRenderingCount = 1; //initialize to 1 since continuous rendering is the default
|
||||||
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
||||||
public static HostedMatch hostedMatch;
|
|
||||||
|
|
||||||
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) {
|
||||||
@@ -302,15 +300,15 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pause() {
|
public void pause() {
|
||||||
if (hostedMatch != null) {
|
if (MatchController.getHostedMatch() != null) {
|
||||||
hostedMatch.pause();
|
MatchController.getHostedMatch().pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resume() {
|
public void resume() {
|
||||||
if (hostedMatch != null) {
|
if (MatchController.getHostedMatch() != null) {
|
||||||
hostedMatch.resume();
|
MatchController.getHostedMatch().resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,8 +649,4 @@ public class Forge implements ApplicationListener {
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameView getGameView() {
|
|
||||||
return hostedMatch == null ? null : hostedMatch.getGameView();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,7 +280,6 @@ public class GuiMobile implements IGuiBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostedMatch hostMatch() {
|
public HostedMatch hostMatch() {
|
||||||
return Forge.hostedMatch = new HostedMatch();
|
return MatchController.hostMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.Map.Entry;
|
|||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
|
||||||
import forge.Forge;
|
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
import forge.ImageKeys;
|
import forge.ImageKeys;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
@@ -168,7 +167,7 @@ public class CardZoom extends FOverlay {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawOverlay(Graphics g) {
|
public void drawOverlay(Graphics g) {
|
||||||
final GameView gameView = Forge.getGameView();
|
final GameView gameView = MatchController.instance.getGameView();
|
||||||
|
|
||||||
float w = getWidth();
|
float w = getWidth();
|
||||||
float h = getHeight();
|
float h = getHeight();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import forge.game.zone.ZoneType;
|
|||||||
import forge.interfaces.IButton;
|
import forge.interfaces.IButton;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.match.AbstractGuiGame;
|
import forge.match.AbstractGuiGame;
|
||||||
|
import forge.match.HostedMatch;
|
||||||
import forge.match.MatchButtonType;
|
import forge.match.MatchButtonType;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
@@ -65,6 +66,7 @@ public class MatchController extends AbstractGuiGame {
|
|||||||
|
|
||||||
private static final Map<String, FImage> avatarImages = new HashMap<String, FImage>();
|
private static final Map<String, FImage> avatarImages = new HashMap<String, FImage>();
|
||||||
|
|
||||||
|
private static HostedMatch hostedMatch;
|
||||||
private static MatchScreen view;
|
private static MatchScreen view;
|
||||||
|
|
||||||
public static MatchScreen getView() {
|
public static MatchScreen getView() {
|
||||||
@@ -128,7 +130,7 @@ public class MatchController extends AbstractGuiGame {
|
|||||||
@Override
|
@Override
|
||||||
public void buildTouchListeners(float screenX, float screenY, ArrayList<FDisplayObject> listeners) {
|
public void buildTouchListeners(float screenX, float screenY, ArrayList<FDisplayObject> listeners) {
|
||||||
if (screenY < view.getHeight() - VPrompt.HEIGHT) {
|
if (screenY < view.getHeight() - VPrompt.HEIGHT) {
|
||||||
Forge.hostedMatch.pause();
|
hostedMatch.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -501,4 +503,12 @@ public class MatchController extends AbstractGuiGame {
|
|||||||
return !view.stopAtPhase(playerTurn, phase);
|
return !view.stopAtPhase(playerTurn, phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HostedMatch hostMatch() {
|
||||||
|
hostedMatch = new HostedMatch();
|
||||||
|
return hostedMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HostedMatch getHostedMatch() {
|
||||||
|
return hostedMatch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package forge.screens.match.views;
|
package forge.screens.match.views;
|
||||||
|
|
||||||
import forge.Forge;
|
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.FDeckViewer;
|
import forge.deck.FDeckViewer;
|
||||||
@@ -46,7 +45,7 @@ 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) {
|
||||||
final Deck deck = Forge.hostedMatch.getGame().getPhaseHandler().getPlayerTurn().getRegisteredPlayer().getDeck();
|
final Deck deck = MatchController.getHostedMatch().getGame().getPhaseHandler().getPlayerTurn().getRegisteredPlayer().getDeck();
|
||||||
if (deck != null) {
|
if (deck != null) {
|
||||||
FDeckViewer.show(deck);
|
FDeckViewer.show(deck);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package forge.screens.match.winlose;
|
package forge.screens.match.winlose;
|
||||||
|
|
||||||
import forge.Forge;
|
|
||||||
import forge.game.GameView;
|
import forge.game.GameView;
|
||||||
import forge.screens.match.MatchController;
|
import forge.screens.match.MatchController;
|
||||||
import forge.toolbox.FEvent;
|
import forge.toolbox.FEvent;
|
||||||
@@ -54,21 +53,21 @@ public class ControlWinLose {
|
|||||||
view.hide();
|
view.hide();
|
||||||
saveOptions();
|
saveOptions();
|
||||||
|
|
||||||
Forge.hostedMatch.continueMatch();
|
MatchController.getHostedMatch().continueMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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();
|
||||||
Forge.hostedMatch.restartMatch();
|
MatchController.getHostedMatch().restartMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
/** Action performed when "quit" button is pressed in default win/lose UI. */
|
||||||
public void actionOnQuit() {
|
public void actionOnQuit() {
|
||||||
// Reset other stuff
|
// Reset other stuff
|
||||||
saveOptions();
|
saveOptions();
|
||||||
Forge.hostedMatch.endCurrentGame();
|
MatchController.getHostedMatch().endCurrentGame();
|
||||||
view.hide();
|
view.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user