mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
package forge.adventure;
|
package forge.adventure;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.ApplicationListener;
|
||||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Clipboard;
|
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Clipboard;
|
||||||
|
import com.badlogic.gdx.graphics.glutils.HdpiMode;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.adventure.util.Config;
|
import forge.adventure.util.Config;
|
||||||
import forge.util.BuildInfo;
|
import forge.util.BuildInfo;
|
||||||
@@ -34,11 +36,20 @@ public class Main {
|
|||||||
|
|
||||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||||
config.setResizable(false);
|
config.setResizable(false);
|
||||||
|
ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new DesktopAdapter(""), Files.exists(Paths.get("./res"))?"./":"../forge-gui/", true, false, 0, true, 0, "", "");
|
||||||
|
|
||||||
//todo icon config && fullscreen mode
|
if (Config.instance().getSettingData().fullScreen) {
|
||||||
config.setWindowedMode(1280, 720);
|
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
|
||||||
|
config.setAutoIconify(true);
|
||||||
|
config.setHdpiMode(HdpiMode.Logical);
|
||||||
|
} else {
|
||||||
|
config.setWindowedMode(Config.instance().getSettingData().width, Config.instance().getSettingData().height);
|
||||||
|
}
|
||||||
|
config.setTitle("Forge Mobile");
|
||||||
|
config.setWindowIcon(Config.instance().getFilePath("forge-adventure.png"));
|
||||||
|
|
||||||
new Lwjgl3Application(Forge.getApp(new Lwjgl3Clipboard(), new DesktopAdapter(""), Files.exists(Paths.get("./res"))?"./":"../forge-gui/", true, false, 0, true, 0, "", "", true), config);
|
|
||||||
|
new Lwjgl3Application(start, config);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class Main extends AndroidApplication {
|
|||||||
new BreadcrumbBuilder().setMessage(message).build()
|
new BreadcrumbBuilder().setMessage(message).build()
|
||||||
);
|
);
|
||||||
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
||||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, true, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName(), false));
|
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, true, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName()));
|
||||||
displayMessage(adapter, true, message);
|
displayMessage(adapter, true, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ public class Main extends AndroidApplication {
|
|||||||
new BreadcrumbBuilder().setMessage(message).build()
|
new BreadcrumbBuilder().setMessage(message).build()
|
||||||
);
|
);
|
||||||
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
||||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, true, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName(), false));
|
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, true, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName()));
|
||||||
displayMessage(adapter, true, message);
|
displayMessage(adapter, true, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,7 @@ public class Main extends AndroidApplication {
|
|||||||
isPortrait = true;
|
isPortrait = true;
|
||||||
//fake init for permission instruction
|
//fake init for permission instruction
|
||||||
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
||||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, isPortrait, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName(), false));
|
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, isPortrait, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName()));
|
||||||
displayMessage(adapter, false, "");
|
displayMessage(adapter, false, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class Main extends IOSApplication.Delegate {
|
|||||||
config.useCompass = false;
|
config.useCompass = false;
|
||||||
ForgePreferences prefs = FModel.getPreferences();
|
ForgePreferences prefs = FModel.getPreferences();
|
||||||
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);//todo get totalRAM && isTabletDevice
|
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);//todo get totalRAM && isTabletDevice
|
||||||
final ApplicationListener app = Forge.getApp(new IOSClipboard(), new IOSAdapter(), assetsDir, propertyConfig, false, 0, false, 0, "", "", false);
|
final ApplicationListener app = Forge.getApp(new IOSClipboard(), new IOSAdapter(), assetsDir, propertyConfig, false, 0, false, 0, "", "");
|
||||||
final IOSApplication iosApp = new IOSApplication(app, config);
|
final IOSApplication iosApp = new IOSApplication(app, config);
|
||||||
return iosApp;
|
return iosApp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class Main {
|
|||||||
ForgePreferences prefs = FModel.getPreferences();
|
ForgePreferences prefs = FModel.getPreferences();
|
||||||
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
|
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
|
||||||
new Lwjgl3Application(Forge.getApp(new Lwjgl3Clipboard(), new DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
|
new Lwjgl3Application(Forge.getApp(new Lwjgl3Clipboard(), new DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
|
||||||
desktopMode ? desktopModeAssetsDir : assetsDir, propertyConfig, false, 0, false, 0, "", "", false), config);
|
desktopMode ? desktopModeAssetsDir : assetsDir, propertyConfig, false, 0, false, 0, "", ""), config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DesktopAdapter implements IDeviceAdapter {
|
private static class DesktopAdapter implements IDeviceAdapter {
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ public class Forge implements ApplicationListener {
|
|||||||
public static boolean gameInProgress = false;
|
public static boolean gameInProgress = false;
|
||||||
public static boolean disposeTextures = false;
|
public static boolean disposeTextures = false;
|
||||||
public static boolean isMobileAdventureMode = false;
|
public static boolean isMobileAdventureMode = false;
|
||||||
public static boolean isDesktopAdventureMode = false;
|
|
||||||
public static int cacheSize = 400;
|
public static int cacheSize = 400;
|
||||||
public static int totalDeviceRAM = 0;
|
public static int totalDeviceRAM = 0;
|
||||||
public static int androidVersion = 0;
|
public static int androidVersion = 0;
|
||||||
@@ -101,7 +100,7 @@ public class Forge implements ApplicationListener {
|
|||||||
public static boolean afterDBloaded = false;
|
public static boolean afterDBloaded = false;
|
||||||
public static int mouseButtonID = 0;
|
public static int mouseButtonID = 0;
|
||||||
|
|
||||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean value, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName, boolean startAdventure) {
|
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean value, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName) {
|
||||||
app = new Forge();
|
app = new Forge();
|
||||||
if (GuiBase.getInterface() == null) {
|
if (GuiBase.getInterface() == null) {
|
||||||
clipboard = clipboard0;
|
clipboard = clipboard0;
|
||||||
@@ -113,7 +112,6 @@ public class Forge implements ApplicationListener {
|
|||||||
totalDeviceRAM = totalRAM;
|
totalDeviceRAM = totalRAM;
|
||||||
isTabletDevice = isTablet;
|
isTabletDevice = isTablet;
|
||||||
androidVersion = AndroidAPI;
|
androidVersion = AndroidAPI;
|
||||||
isDesktopAdventureMode=startAdventure;
|
|
||||||
}
|
}
|
||||||
GuiBase.setDeviceInfo(deviceName, AndroidRelease, AndroidAPI, totalRAM);
|
GuiBase.setDeviceInfo(deviceName, AndroidRelease, AndroidAPI, totalRAM);
|
||||||
return app;
|
return app;
|
||||||
@@ -158,7 +156,7 @@ public class Forge implements ApplicationListener {
|
|||||||
else {
|
else {
|
||||||
skinName = "default"; //use default skin if preferences file doesn't exist yet
|
skinName = "default"; //use default skin if preferences file doesn't exist yet
|
||||||
}
|
}
|
||||||
FSkin.loadLight(isDesktopAdventureMode ? "default" : skinName, splashScreen);
|
FSkin.loadLight(skinName, splashScreen);
|
||||||
|
|
||||||
textureFiltering = prefs.getPrefBoolean(FPref.UI_LIBGDX_TEXTURE_FILTERING);
|
textureFiltering = prefs.getPrefBoolean(FPref.UI_LIBGDX_TEXTURE_FILTERING);
|
||||||
showFPS = prefs.getPrefBoolean(FPref.UI_SHOW_FPS);
|
showFPS = prefs.getPrefBoolean(FPref.UI_SHOW_FPS);
|
||||||
@@ -278,31 +276,15 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
public static void openAdventure() {
|
public static void openAdventure() {
|
||||||
startContinuousRendering();
|
startContinuousRendering();
|
||||||
if (!isDesktopAdventureMode) {
|
|
||||||
final LoadingOverlay loader = new LoadingOverlay("Loading Adventure");
|
|
||||||
loader.show();
|
|
||||||
}
|
|
||||||
GuiBase.setIsAdventureMode(true);
|
GuiBase.setIsAdventureMode(true);
|
||||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
splashScreen = null;
|
||||||
@Override
|
isMobileAdventureMode = true;
|
||||||
public void run() {
|
try {
|
||||||
FThreads.invokeInEdtLater(new Runnable() {
|
for (SceneType sceneType : SceneType.values()) {
|
||||||
@Override
|
sceneType.instance.resLoaded();
|
||||||
public void run() {
|
|
||||||
//FSkin.loadLight("default", null, Config.instance().getFile("skin"));
|
|
||||||
//FSkin.loadFull(splashScreen);
|
|
||||||
splashScreen = null;
|
|
||||||
isMobileAdventureMode = true;
|
|
||||||
try {
|
|
||||||
for (SceneType sceneType : SceneType.values()) {
|
|
||||||
sceneType.instance.resLoaded();
|
|
||||||
}
|
|
||||||
switchScene(SceneType.StartScene.instance);
|
|
||||||
} catch (Exception e) { e.printStackTrace(); }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
switchScene(SceneType.StartScene.instance);
|
||||||
|
} catch (Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
protected void afterDbLoaded() {
|
protected void afterDbLoaded() {
|
||||||
stopContinuousRendering(); //save power consumption by disabling continuous rendering once assets loaded
|
stopContinuousRendering(); //save power consumption by disabling continuous rendering once assets loaded
|
||||||
@@ -314,15 +296,11 @@ public class Forge implements ApplicationListener {
|
|||||||
Gdx.input.setCatchKey(Keys.MENU, true);
|
Gdx.input.setCatchKey(Keys.MENU, true);
|
||||||
|
|
||||||
afterDBloaded = true;
|
afterDBloaded = true;
|
||||||
if (isDesktopAdventureMode) {
|
//selection
|
||||||
openAdventure();
|
if (isLandscapeMode() && !GuiBase.isAndroid())
|
||||||
} else {
|
splashScreen.setShowModeSelector(true);
|
||||||
//open splashscreen mode selector if landscape..
|
else
|
||||||
if (isLandscapeMode())
|
openHomeDefault();
|
||||||
splashScreen.setShowModeSelector(true);
|
|
||||||
else
|
|
||||||
openHomeDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
//adjust height modifier
|
//adjust height modifier
|
||||||
adjustHeightModifier(getScreenWidth(), getScreenHeight());
|
adjustHeightModifier(getScreenWidth(), getScreenHeight());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package forge.adventure.scene;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.gui.GuiBase;
|
||||||
import forge.gui.error.BugReporter;
|
import forge.gui.error.BugReporter;
|
||||||
import forge.screens.match.MatchController;
|
import forge.screens.match.MatchController;
|
||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.FContainer;
|
||||||
@@ -280,6 +281,20 @@ public class ForgeInput extends FGestureAdapter {
|
|||||||
public boolean mouseMoved(int x, int y) {
|
public boolean mouseMoved(int x, int y) {
|
||||||
mouseMovedX = x;
|
mouseMovedX = x;
|
||||||
mouseMovedY = y;
|
mouseMovedY = y;
|
||||||
|
//todo: mouse listener for android?
|
||||||
|
if (GuiBase.isAndroid())
|
||||||
|
return true;
|
||||||
|
Forge.hoveredCount = 0;
|
||||||
|
//reset
|
||||||
|
try {
|
||||||
|
for (FDisplayObject listener : potentialListeners) {
|
||||||
|
listener.setHovered(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
BugReporter.reportException(ex);
|
||||||
|
}
|
||||||
|
updatePotentialListeners(x, y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package forge.adventure.scene;
|
package forge.adventure.scene;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.Graphics;
|
||||||
import forge.animation.ForgeAnimation;
|
import forge.animation.ForgeAnimation;
|
||||||
import forge.assets.ImageCache;
|
import forge.assets.ImageCache;
|
||||||
import forge.gamemodes.match.LobbySlotType;
|
import forge.gamemodes.match.LobbySlotType;
|
||||||
@@ -18,6 +20,7 @@ import java.util.List;
|
|||||||
public abstract class ForgeScene extends Scene implements IUpdateable {
|
public abstract class ForgeScene extends Scene implements IUpdateable {
|
||||||
|
|
||||||
//GameLobby lobby;
|
//GameLobby lobby;
|
||||||
|
Graphics localGraphics;
|
||||||
ForgeInput input=new ForgeInput(this);
|
ForgeInput input=new ForgeInput(this);
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@@ -25,6 +28,37 @@ public abstract class ForgeScene extends Scene implements IUpdateable {
|
|||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
|
|
||||||
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear the screen.
|
||||||
|
if (getScreen() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
localGraphics.begin(Forge.getScreenWidth(), Forge.getScreenHeight());
|
||||||
|
getScreen().screenPos.setSize(Forge.getScreenWidth(), Forge.getScreenHeight());
|
||||||
|
if (getScreen().getRotate180()) {
|
||||||
|
localGraphics.startRotateTransform( Forge.getScreenWidth() / 2f, Forge.getScreenHeight() / 2f, 180);
|
||||||
|
}
|
||||||
|
getScreen().draw(localGraphics);
|
||||||
|
if (getScreen().getRotate180()) {
|
||||||
|
localGraphics.endTransform();
|
||||||
|
}
|
||||||
|
for (FOverlay overlay : FOverlay.getOverlays()) {
|
||||||
|
if (overlay.isVisibleOnScreen(getScreen())) {
|
||||||
|
overlay.screenPos.setSize(Forge.getScreenWidth(), Forge.getScreenHeight());
|
||||||
|
overlay.setSize(Forge.getScreenWidth(), Forge.getScreenHeight()); //update overlay sizes as they're rendered
|
||||||
|
if (overlay.getRotate180()) {
|
||||||
|
localGraphics.startRotateTransform(Forge.getScreenWidth() / 2f, Forge.getScreenHeight() / 2f, 180);
|
||||||
|
}
|
||||||
|
overlay.draw(localGraphics);
|
||||||
|
if (overlay.getRotate180()) {
|
||||||
|
localGraphics.endTransform();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
localGraphics.end();
|
||||||
|
|
||||||
|
//Batch.end();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void act(float delta) {
|
public void act(float delta) {
|
||||||
@@ -53,7 +87,7 @@ public abstract class ForgeScene extends Scene implements IUpdateable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resLoaded() {
|
public void resLoaded() {
|
||||||
|
localGraphics = Forge.getGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -171,31 +171,29 @@ public class SettingsScene extends UIScene {
|
|||||||
addLabel("Plane");
|
addLabel("Plane");
|
||||||
settingGroup.add(plane).align(Align.right);
|
settingGroup.add(plane).align(Align.right);
|
||||||
|
|
||||||
if (!Forge.isMobileAdventureMode) {
|
addSettingField("Fullscreen", Config.instance().getSettingData().fullScreen, new ChangeListener() {
|
||||||
addSettingField("Fullscreen", Config.instance().getSettingData().fullScreen, new ChangeListener() {
|
@Override
|
||||||
@Override
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
Config.instance().getSettingData().fullScreen=((CheckBox) actor).isChecked();
|
||||||
Config.instance().getSettingData().fullScreen=((CheckBox) actor).isChecked();
|
Config.instance().saveSettings();
|
||||||
Config.instance().saveSettings();
|
}
|
||||||
}
|
});
|
||||||
});
|
addSettingField("Screen width", Config.instance().getSettingData().width, new ChangeListener() {
|
||||||
addSettingField("Screen width", Config.instance().getSettingData().width, new ChangeListener() {
|
@Override
|
||||||
@Override
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
String text=((TextField) actor).getText();
|
||||||
String text=((TextField) actor).getText();
|
Config.instance().getSettingData().width=text==null||text.isEmpty()?0:Integer.valueOf(text);
|
||||||
Config.instance().getSettingData().width=text==null||text.isEmpty()?0:Integer.valueOf(text);
|
Config.instance().saveSettings();
|
||||||
Config.instance().saveSettings();
|
}
|
||||||
}
|
});
|
||||||
});
|
addSettingField("Screen height", Config.instance().getSettingData().height, new ChangeListener() {
|
||||||
addSettingField("Screen height", Config.instance().getSettingData().height, new ChangeListener() {
|
@Override
|
||||||
@Override
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
String text=((TextField) actor).getText();
|
||||||
String text=((TextField) actor).getText();
|
Config.instance().getSettingData().height=text==null||text.isEmpty()?0:Integer.valueOf(text);
|
||||||
Config.instance().getSettingData().height=text==null||text.isEmpty()?0:Integer.valueOf(text);
|
Config.instance().saveSettings();
|
||||||
Config.instance().saveSettings();
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
addCheckBox(localizer.getMessage("lblCardName"), ForgePreferences.FPref.UI_OVERLAY_CARD_NAME);
|
addCheckBox(localizer.getMessage("lblCardName"), ForgePreferences.FPref.UI_OVERLAY_CARD_NAME);
|
||||||
addSettingSlider(localizer.getMessage("cbAdjustMusicVolume"), ForgePreferences.FPref.UI_VOL_MUSIC,0,100);
|
addSettingSlider(localizer.getMessage("cbAdjustMusicVolume"), ForgePreferences.FPref.UI_VOL_MUSIC,0,100);
|
||||||
addSettingSlider(localizer.getMessage("cbAdjustSoundsVolume"), ForgePreferences.FPref.UI_VOL_SOUNDS, 0,100);
|
addSettingSlider(localizer.getMessage("cbAdjustSoundsVolume"), ForgePreferences.FPref.UI_VOL_SOUNDS, 0,100);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.files.FileHandle;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.utils.Json;
|
import com.badlogic.gdx.utils.Json;
|
||||||
import com.badlogic.gdx.utils.JsonWriter;
|
import com.badlogic.gdx.utils.JsonWriter;
|
||||||
|
import forge.Forge;
|
||||||
import forge.adventure.data.ConfigData;
|
import forge.adventure.data.ConfigData;
|
||||||
import forge.adventure.data.SettingData;
|
import forge.adventure.data.SettingData;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
@@ -40,10 +41,8 @@ public class Config {
|
|||||||
}
|
}
|
||||||
private Config() {
|
private Config() {
|
||||||
|
|
||||||
String path= Files.exists(Paths.get("./res"))?"./":"../forge-gui/";
|
String path= GuiBase.isAndroid() ? ForgeConstants.ASSETS_DIR : Files.exists(Paths.get("./res"))?"./":"../forge-gui/";
|
||||||
if (GuiBase.isAndroid())
|
adventures = new File(GuiBase.isAndroid() ? ForgeConstants.ADVENTURE_DIR : path + "/res/adventure").list();
|
||||||
path = GuiBase.getInterface().getAssetsDir();
|
|
||||||
adventures = new File(path + "/res/adventure").list();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
settingsData = new Json().fromJson(SettingData.class, new FileHandle(ForgeConstants.USER_DIR + "/adventure/settings.json"));
|
settingsData = new Json().fromJson(SettingData.class, new FileHandle(ForgeConstants.USER_DIR + "/adventure/settings.json"));
|
||||||
|
|||||||
@@ -359,17 +359,17 @@ public class MatchScreen extends FScreen {
|
|||||||
if (viewWinLose == null) {
|
if (viewWinLose == null) {
|
||||||
gameMenu.getChildAt(0).setEnabled(!game.isMulligan());
|
gameMenu.getChildAt(0).setEnabled(!game.isMulligan());
|
||||||
gameMenu.getChildAt(1).setEnabled(!game.isMulligan());
|
gameMenu.getChildAt(1).setEnabled(!game.isMulligan());
|
||||||
gameMenu.getChildAt(2).setEnabled(!game.isMulligan());
|
if (!Forge.isMobileAdventureMode) {
|
||||||
if (Forge.isMobileAdventureMode)
|
gameMenu.getChildAt(2).setEnabled(!game.isMulligan());
|
||||||
gameMenu.getChildAt(2).setEnabled(false);
|
gameMenu.getChildAt(3).setEnabled(false);
|
||||||
gameMenu.getChildAt(3).setEnabled(false);
|
}
|
||||||
} else {
|
} else {
|
||||||
gameMenu.getChildAt(0).setEnabled(false);
|
gameMenu.getChildAt(0).setEnabled(false);
|
||||||
gameMenu.getChildAt(1).setEnabled(false);
|
gameMenu.getChildAt(1).setEnabled(false);
|
||||||
gameMenu.getChildAt(2).setEnabled(false);
|
if (!Forge.isMobileAdventureMode) {
|
||||||
if (Forge.isMobileAdventureMode)
|
|
||||||
gameMenu.getChildAt(2).setEnabled(false);
|
gameMenu.getChildAt(2).setEnabled(false);
|
||||||
gameMenu.getChildAt(3).setEnabled(true);
|
gameMenu.getChildAt(3).setEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,22 +68,24 @@ public class VGameMenu extends FDropDownMenu {
|
|||||||
autoYields.show();
|
autoYields.show();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
addItem(new FMenuItem(localizer.getMessage("lblSettings"), Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS, new FEventHandler() {
|
if (!Forge.isMobileAdventureMode) {
|
||||||
@Override
|
addItem(new FMenuItem(localizer.getMessage("lblSettings"), Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS, new FEventHandler() {
|
||||||
public void handleEvent(FEvent e) {
|
@Override
|
||||||
//pause game when spectating AI Match
|
public void handleEvent(FEvent e) {
|
||||||
if (!MatchController.instance.hasLocalPlayers()) {
|
//pause game when spectating AI Match
|
||||||
if(!MatchController.instance.isGamePaused())
|
if (!MatchController.instance.hasLocalPlayers()) {
|
||||||
MatchController.instance.pauseMatch();
|
if(!MatchController.instance.isGamePaused())
|
||||||
|
MatchController.instance.pauseMatch();
|
||||||
|
}
|
||||||
|
SettingsScreen.show(false);
|
||||||
}
|
}
|
||||||
SettingsScreen.show(false);
|
}));
|
||||||
}
|
addItem(new FMenuItem(localizer.getMessage("lblShowWinLoseOverlay"), FSkinImage.ENDTURN, new FEventHandler() {
|
||||||
}));
|
@Override
|
||||||
addItem(new FMenuItem(localizer.getMessage("lblShowWinLoseOverlay"), FSkinImage.ENDTURN, new FEventHandler() {
|
public void handleEvent(FEvent e) {
|
||||||
@Override
|
MatchController.instance.showWinlose();
|
||||||
public void handleEvent(FEvent e) {
|
}
|
||||||
MatchController.instance.showWinlose();
|
}));
|
||||||
}
|
}
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public final class ForgeConstants {
|
|||||||
public static final String PROFILE_TEMPLATE_FILE = PROFILE_FILE + ".example";
|
public static final String PROFILE_TEMPLATE_FILE = PROFILE_FILE + ".example";
|
||||||
|
|
||||||
public static final String RES_DIR = ASSETS_DIR + "res" + PATH_SEPARATOR;
|
public static final String RES_DIR = ASSETS_DIR + "res" + PATH_SEPARATOR;
|
||||||
|
public static final String ADVENTURE_DIR = RES_DIR + "adventure" + PATH_SEPARATOR;
|
||||||
public static final String LISTS_DIR = RES_DIR + "lists" + PATH_SEPARATOR;
|
public static final String LISTS_DIR = RES_DIR + "lists" + PATH_SEPARATOR;
|
||||||
public static final String SETLOOKUP_DIR = RES_DIR + "setlookup" + PATH_SEPARATOR;
|
public static final String SETLOOKUP_DIR = RES_DIR + "setlookup" + PATH_SEPARATOR;
|
||||||
public static final String KEYWORD_LIST_FILE = LISTS_DIR + "NonStackingKWList.txt";
|
public static final String KEYWORD_LIST_FILE = LISTS_DIR + "NonStackingKWList.txt";
|
||||||
|
|||||||
Reference in New Issue
Block a user