update controls to be playable

This commit is contained in:
Anthony Calosa
2022-02-06 22:40:33 +08:00
parent 08fa608237
commit 8878fe2c4c
22 changed files with 110 additions and 82 deletions

View File

@@ -31,6 +31,7 @@ import forge.localinstance.properties.ForgePreferences;
import forge.localinstance.properties.ForgePreferences.FPref; import forge.localinstance.properties.ForgePreferences.FPref;
import forge.model.FModel; import forge.model.FModel;
import forge.screens.FScreen; import forge.screens.FScreen;
import forge.screens.LoadingOverlay;
import forge.screens.SplashScreen; import forge.screens.SplashScreen;
import forge.screens.home.HomeScreen; import forge.screens.home.HomeScreen;
import forge.screens.home.NewGameMenu; import forge.screens.home.NewGameMenu;
@@ -88,7 +89,7 @@ public class Forge implements ApplicationListener {
public static boolean isPortraitMode = false; public static boolean isPortraitMode = false;
public static boolean gameInProgress = false; public static boolean gameInProgress = false;
public static boolean disposeTextures = false; public static boolean disposeTextures = false;
public static boolean isAdventureMode = false; public static boolean isMobileAdventureMode = 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;
@@ -240,6 +241,10 @@ public class Forge implements ApplicationListener {
}); });
} }
public static Graphics getGraphics() {
return graphics;
}
private void preloadExtendedArt() { private void preloadExtendedArt() {
if (!enablePreloadExtendedArt||!enableUIMask.equals("Full")) if (!enablePreloadExtendedArt||!enableUIMask.equals("Full"))
return; return;
@@ -279,10 +284,18 @@ public class Forge implements ApplicationListener {
} }
public static void openAdventure() { public static void openAdventure() {
startContinuousRendering(); startContinuousRendering();
final LoadingOverlay loader = new LoadingOverlay("Loading Adventure");
loader.show();
FThreads.invokeInBackgroundThread(new Runnable() {
@Override
public void run() {
FThreads.invokeInEdtLater(new Runnable() {
@Override
public void run() {
FSkin.loadLight("default", null, Config.instance().getFile("skin")); FSkin.loadLight("default", null, Config.instance().getFile("skin"));
FSkin.loadFull(splashScreen); FSkin.loadFull(splashScreen);
splashScreen = null; splashScreen = null;
isAdventureMode = true; isMobileAdventureMode = true;
try { try {
for (SceneType sceneType : SceneType.values()) { for (SceneType sceneType : SceneType.values()) {
sceneType.instance.resLoaded(); sceneType.instance.resLoaded();
@@ -292,7 +305,10 @@ public class Forge implements ApplicationListener {
animationBatch=new SpriteBatch(); animationBatch=new SpriteBatch();
transitionTexture =new Texture(Config.instance().getFile("ui/transition.png")); transitionTexture =new Texture(Config.instance().getFile("ui/transition.png"));
} catch (Exception e) { e.printStackTrace(); } } 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
@@ -526,6 +542,9 @@ public class Forge implements ApplicationListener {
return currentScreen; return currentScreen;
} }
public static void clearCurrentScreen() {
currentScreen = null;
}
private static void setCurrentScreen(FScreen screen0) { private static void setCurrentScreen(FScreen screen0) {
String toNewScreen = screen0 != null ? screen0.toString() : ""; String toNewScreen = screen0 != null ? screen0.toString() : "";
String previousScreen = currentScreen != null ? currentScreen.toString() : ""; String previousScreen = currentScreen != null ? currentScreen.toString() : "";
@@ -565,7 +584,7 @@ public class Forge implements ApplicationListener {
if (screen == null) { if (screen == null) {
screen = splashScreen; screen = splashScreen;
if (screen == null) { if (screen == null) {
if (isAdventureMode) { if (isMobileAdventureMode) {
float delta=Gdx.graphics.getDeltaTime(); float delta=Gdx.graphics.getDeltaTime();
float transitionTime = 0.2f; float transitionTime = 0.2f;
if(sceneWasSwapped) if(sceneWasSwapped)
@@ -731,7 +750,7 @@ public class Forge implements ApplicationListener {
} }
public Scene switchToLast() { public static Scene switchToLast() {
if(lastScene.size!=0) if(lastScene.size!=0)
{ {

View File

@@ -9,10 +9,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Clipboard; import com.badlogic.gdx.utils.Clipboard;
import com.badlogic.gdx.utils.ScreenUtils;
import forge.Forge; import forge.Forge;
import forge.Graphics;
import forge.adventure.scene.ForgeScene;
import forge.adventure.scene.Scene; import forge.adventure.scene.Scene;
import forge.adventure.scene.SceneType; import forge.adventure.scene.SceneType;
import forge.adventure.util.Config; import forge.adventure.util.Config;
@@ -32,14 +29,6 @@ public class AdventureApplicationAdapter extends Forge {
Texture transitionTexture; Texture transitionTexture;
TextureRegion lastScreenTexture; TextureRegion lastScreenTexture;
private boolean sceneWasSwapped =false; private boolean sceneWasSwapped =false;
private Graphics graphics;
public Graphics getGraphics()
{
if(graphics==null)
graphics=new Graphics();
return graphics;
}
public TextureRegion getLastScreenTexture() { public TextureRegion getLastScreenTexture() {
return lastScreenTexture; return lastScreenTexture;

View File

@@ -1,7 +1,7 @@
package forge.adventure.character; package forge.adventure.character;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.scene.RewardScene; import forge.adventure.scene.RewardScene;
import forge.adventure.scene.SceneType; import forge.adventure.scene.SceneType;
import forge.adventure.stage.MapStage; import forge.adventure.stage.MapStage;
@@ -34,7 +34,7 @@ public class ShopActor extends MapActor{
stage.GetPlayer().stop(); stage.GetPlayer().stop();
((RewardScene) SceneType.RewardScene.instance).loadRewards(rewardData, RewardScene.Type.Shop,this); ((RewardScene) SceneType.RewardScene.instance).loadRewards(rewardData, RewardScene.Type.Shop,this);
AdventureApplicationAdapter.instance.switchScene(SceneType.RewardScene.instance); Forge.switchScene(SceneType.RewardScene.instance);
} }
public int getObjectID() { public int getObjectID() {

View File

@@ -5,7 +5,6 @@ import com.badlogic.gdx.utils.Align;
import com.google.common.base.Function; import com.google.common.base.Function;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.adventure.AdventureApplicationAdapter;
import forge.adventure.player.AdventurePlayer; import forge.adventure.player.AdventurePlayer;
import forge.assets.FImage; import forge.assets.FImage;
import forge.assets.FSkinFont; import forge.assets.FSkinFont;
@@ -104,7 +103,8 @@ import java.util.Map;
boolean isShop=false; boolean isShop=false;
public AdventureDeckEditor(boolean createAsShop) { public AdventureDeckEditor(boolean createAsShop) {
super(e -> {AdventurePlayer.current().getNewCards().clear();AdventureApplicationAdapter.instance.switchToLast();},getPages()); super(e -> {AdventurePlayer.current().getNewCards().clear();
Forge.switchToLast();},getPages());
isShop=createAsShop; isShop=createAsShop;

View File

@@ -12,7 +12,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.IntMap; import com.badlogic.gdx.utils.IntMap;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.player.AdventurePlayer; import forge.adventure.player.AdventurePlayer;
import forge.adventure.util.Controls; import forge.adventure.util.Controls;
import forge.adventure.util.Current; import forge.adventure.util.Current;
@@ -56,7 +56,7 @@ public class DeckSelectScene extends UIScene {
} }
public void back() { public void back() {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
} }
public boolean select(int slot) { public boolean select(int slot) {
@@ -144,6 +144,6 @@ public class DeckSelectScene extends UIScene {
} }
private void edit() { private void edit() {
AdventureApplicationAdapter.instance.switchScene(SceneType.DeckEditScene.instance); Forge.switchScene(SceneType.DeckEditScene.instance);
} }
} }

View File

@@ -1,8 +1,8 @@
package forge.adventure.scene; package forge.adventure.scene;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import forge.Forge;
import forge.LobbyPlayer; import forge.LobbyPlayer;
import forge.adventure.AdventureApplicationAdapter;
import forge.adventure.character.EnemySprite; import forge.adventure.character.EnemySprite;
import forge.adventure.character.PlayerSprite; import forge.adventure.character.PlayerSprite;
import forge.adventure.player.AdventurePlayer; import forge.adventure.player.AdventurePlayer;
@@ -56,7 +56,7 @@ public class DuelScene extends ForgeScene {
String enemyName=enemy.getData().name; String enemyName=enemy.getData().name;
Gdx.app.postRunnable(() -> { Gdx.app.postRunnable(() -> {
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS); //start background music SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS); //start background music
Scene last= AdventureApplicationAdapter.instance.switchToLast(); Scene last= Forge.switchToLast();
if(last instanceof HudScene) if(last instanceof HudScene)
{ {

View File

@@ -35,10 +35,13 @@ public abstract class ForgeScene extends Scene implements IUpdateable {
} }
localGraphics.begin(AdventureApplicationAdapter.instance.getCurrentWidth(), AdventureApplicationAdapter.instance.getCurrentHeight()); localGraphics.begin(Forge.isMobileAdventureMode ? Forge.getScreenWidth() : AdventureApplicationAdapter.instance.getCurrentWidth(),
getScreen().screenPos.setSize(AdventureApplicationAdapter.instance.getCurrentWidth(), AdventureApplicationAdapter.instance.getCurrentHeight()); Forge.isMobileAdventureMode ? Forge.getScreenHeight() : AdventureApplicationAdapter.instance.getCurrentHeight());
getScreen().screenPos.setSize(Forge.isMobileAdventureMode ? Forge.getScreenWidth() : AdventureApplicationAdapter.instance.getCurrentWidth(),
Forge.isMobileAdventureMode ? Forge.getScreenHeight() : AdventureApplicationAdapter.instance.getCurrentHeight());
if (getScreen().getRotate180()) { if (getScreen().getRotate180()) {
localGraphics.startRotateTransform(AdventureApplicationAdapter.instance.getCurrentWidth() / 2f, AdventureApplicationAdapter.instance.getCurrentHeight() / 2f, 180); localGraphics.startRotateTransform( Forge.isMobileAdventureMode ? Forge.getScreenWidth() / 2f : AdventureApplicationAdapter.instance.getCurrentWidth() / 2f,
Forge.isMobileAdventureMode ? Forge.getScreenHeight() / 2f : AdventureApplicationAdapter.instance.getCurrentHeight() / 2f, 180);
} }
getScreen().draw(localGraphics); getScreen().draw(localGraphics);
if (getScreen().getRotate180()) { if (getScreen().getRotate180()) {
@@ -46,8 +49,10 @@ public abstract class ForgeScene extends Scene implements IUpdateable {
} }
for (FOverlay overlay : FOverlay.getOverlays()) { for (FOverlay overlay : FOverlay.getOverlays()) {
if (overlay.isVisibleOnScreen(getScreen())) { if (overlay.isVisibleOnScreen(getScreen())) {
overlay.screenPos.setSize(AdventureApplicationAdapter.instance.getCurrentWidth(), AdventureApplicationAdapter.instance.getCurrentHeight()); overlay.screenPos.setSize(Forge.isMobileAdventureMode ? Forge.getScreenWidth() : AdventureApplicationAdapter.instance.getCurrentWidth(),
overlay.setSize(AdventureApplicationAdapter.instance.getCurrentWidth(), AdventureApplicationAdapter.instance.getCurrentHeight()); //update overlay sizes as they're rendered Forge.isMobileAdventureMode ? Forge.getScreenHeight() : AdventureApplicationAdapter.instance.getCurrentHeight());
overlay.setSize(Forge.isMobileAdventureMode ? Forge.getScreenWidth() : AdventureApplicationAdapter.instance.getCurrentWidth(),
Forge.isMobileAdventureMode ? Forge.getScreenHeight() : AdventureApplicationAdapter.instance.getCurrentHeight()); //update overlay sizes as they're rendered
if (overlay.getRotate180()) { if (overlay.getRotate180()) {
localGraphics.startRotateTransform(AdventureApplicationAdapter.instance.getCurrentHeight() / 2f, AdventureApplicationAdapter.instance.getCurrentHeight() / 2f, 180); localGraphics.startRotateTransform(AdventureApplicationAdapter.instance.getCurrentHeight() / 2f, AdventureApplicationAdapter.instance.getCurrentHeight() / 2f, 180);
} }
@@ -73,7 +78,8 @@ public abstract class ForgeScene extends Scene implements IUpdateable {
public void enter() { public void enter() {
FOverlay.hideAll(); FOverlay.hideAll();
if(getScreen()!=null) if(getScreen()!=null)
getScreen().setSize(AdventureApplicationAdapter.instance.getCurrentWidth(), AdventureApplicationAdapter.instance.getCurrentHeight()); getScreen().setSize(Forge.isMobileAdventureMode ? Forge.getScreenWidth() : AdventureApplicationAdapter.instance.getCurrentWidth(),
Forge.isMobileAdventureMode ? Forge.getScreenHeight() : AdventureApplicationAdapter.instance.getCurrentHeight());
Forge.openScreen(getScreen()); Forge.openScreen(getScreen());
Gdx.input.setInputProcessor(input); Gdx.input.setInputProcessor(input);
@@ -88,8 +94,7 @@ public abstract class ForgeScene extends Scene implements IUpdateable {
@Override @Override
public void resLoaded() { public void resLoaded() {
if (!Forge.isAdventureMode) localGraphics = Forge.getGraphics();
localGraphics = AdventureApplicationAdapter.instance.getGraphics();
} }

View File

@@ -2,7 +2,7 @@ package forge.adventure.scene;
import com.badlogic.gdx.Input; import com.badlogic.gdx.Input;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.util.Current; import forge.adventure.util.Current;
/** /**
@@ -18,7 +18,7 @@ public class InnScene extends UIScene {
public void done() public void done()
{ {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
} }
public void heal() public void heal()
{ {
@@ -40,7 +40,7 @@ public class InnScene extends UIScene {
} }
private void sell() { private void sell() {
AdventureApplicationAdapter.instance.switchScene(SceneType.ShopScene.instance); Forge.switchScene(SceneType.ShopScene.instance);
} }
@Override @Override

View File

@@ -5,7 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.TextField; import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.data.DifficultyData; import forge.adventure.data.DifficultyData;
import forge.adventure.data.HeroListData; import forge.adventure.data.HeroListData;
import forge.adventure.util.Config; import forge.adventure.util.Config;
@@ -47,12 +47,12 @@ public class NewGameScene extends UIScene {
GamePlayerUtil.getGuiPlayer().setName(selectedName.getText()); GamePlayerUtil.getGuiPlayer().setName(selectedName.getText());
//image = new Texture(img); //image = new Texture(img);
AdventureApplicationAdapter.instance.switchScene(SceneType.GameScene.instance); Forge.switchScene(SceneType.GameScene.instance);
return true; return true;
} }
public boolean back() { public boolean back() {
AdventureApplicationAdapter.instance.switchScene(SceneType.StartScene.instance); Forge.switchScene(SceneType.StartScene.instance);
return true; return true;
} }

View File

@@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.character.EnemySprite; import forge.adventure.character.EnemySprite;
import forge.adventure.data.EnemyData; import forge.adventure.data.EnemyData;
import forge.adventure.data.WorldData; import forge.adventure.data.WorldData;
@@ -46,7 +46,7 @@ public class PlayerStatisticScene extends UIScene {
return true; return true;
} }
public boolean back() { public boolean back() {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
return true; return true;
} }
@Override @Override

View File

@@ -7,7 +7,7 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.character.ShopActor; import forge.adventure.character.ShopActor;
import forge.adventure.player.AdventurePlayer; import forge.adventure.player.AdventurePlayer;
import forge.adventure.pointofintrest.PointOfInterestChanges; import forge.adventure.pointofintrest.PointOfInterestChanges;
@@ -73,12 +73,12 @@ public class RewardScene extends UIScene {
} }
else else
{ {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
} }
} }
else else
{ {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
} }
return true; return true;
} }
@@ -93,7 +93,7 @@ public class RewardScene extends UIScene {
flipCountDown-=Gdx.graphics.getDeltaTime(); flipCountDown-=Gdx.graphics.getDeltaTime();
if(flipCountDown<=0) if(flipCountDown<=0)
{ {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
} }
} }
} }

View File

@@ -16,7 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.GdxRuntimeException; import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.IntMap; import com.badlogic.gdx.utils.IntMap;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.util.Controls; import forge.adventure.util.Controls;
import forge.adventure.world.WorldSave; import forge.adventure.world.WorldSave;
import forge.adventure.world.WorldSaveHeader; import forge.adventure.world.WorldSaveHeader;
@@ -75,7 +75,7 @@ public class SaveLoadScene extends UIScene {
} }
public void back() { public void back() {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
} }
public boolean select(int slot) { public boolean select(int slot) {
@@ -106,7 +106,7 @@ public class SaveLoadScene extends UIScene {
stage.setKeyboardFocus(textInput); stage.setKeyboardFocus(textInput);
} else { } else {
if(WorldSave.load(currentSlot)) if(WorldSave.load(currentSlot))
AdventureApplicationAdapter.instance.switchScene(SceneType.GameScene.instance); Forge.switchScene(SceneType.GameScene.instance);
} }
} }
@@ -130,7 +130,7 @@ public class SaveLoadScene extends UIScene {
if( WorldSave.getCurrentSave().save(textInput.getText(), currentSlot)) if( WorldSave.getCurrentSave().save(textInput.getText(), currentSlot))
{ {
updateFiles(); updateFiles();
AdventureApplicationAdapter.instance.switchScene(SceneType.GameScene.instance); Forge.switchScene(SceneType.GameScene.instance);
} }

View File

@@ -15,7 +15,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextField; import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.util.Config; import forge.adventure.util.Config;
import forge.adventure.util.Controls; import forge.adventure.util.Controls;
import forge.localinstance.properties.ForgePreferences; import forge.localinstance.properties.ForgePreferences;
@@ -70,7 +70,7 @@ public class SettingsScene extends UIScene {
return true; return true;
} }
public boolean back() { public boolean back() {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
return true; return true;
} }
private void addInputField(String name, ForgePreferences.FPref pref) { private void addInputField(String name, ForgePreferences.FPref pref) {

View File

@@ -3,7 +3,7 @@ package forge.adventure.scene;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input; import com.badlogic.gdx.Input;
import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Actor;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.world.WorldSave; import forge.adventure.world.WorldSave;
/** /**
@@ -20,29 +20,29 @@ public class StartScene extends UIScene {
} }
public boolean NewGame() { public boolean NewGame() {
AdventureApplicationAdapter.instance.switchScene(SceneType.NewGameScene.instance); Forge.switchScene(SceneType.NewGameScene.instance);
return true; return true;
} }
public boolean Save() { public boolean Save() {
((SaveLoadScene) SceneType.SaveLoadScene.instance).setSaveGame(true); ((SaveLoadScene) SceneType.SaveLoadScene.instance).setSaveGame(true);
AdventureApplicationAdapter.instance.switchScene(SceneType.SaveLoadScene.instance); Forge.switchScene(SceneType.SaveLoadScene.instance);
return true; return true;
} }
public boolean Load() { public boolean Load() {
((SaveLoadScene) SceneType.SaveLoadScene.instance).setSaveGame(false); ((SaveLoadScene) SceneType.SaveLoadScene.instance).setSaveGame(false);
AdventureApplicationAdapter.instance.switchScene(SceneType.SaveLoadScene.instance); Forge.switchScene(SceneType.SaveLoadScene.instance);
return true; return true;
} }
public boolean Resume() { public boolean Resume() {
AdventureApplicationAdapter.instance.switchToLast(); Forge.switchToLast();
return true; return true;
} }
public boolean settings() { public boolean settings() {
AdventureApplicationAdapter.instance.switchScene(SceneType.SettingsScene.instance); Forge.switchScene(SceneType.SettingsScene.instance);
return true; return true;
} }

View File

@@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.FitViewport;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.player.AdventurePlayer; import forge.adventure.player.AdventurePlayer;
import forge.adventure.scene.Scene; import forge.adventure.scene.Scene;
import forge.adventure.scene.SceneType; import forge.adventure.scene.SceneType;
@@ -44,7 +44,7 @@ public class GameHUD extends Stage {
avatar = ui.findActor("avatar"); avatar = ui.findActor("avatar");
ui.onButtonPress("menu", () -> menu()); ui.onButtonPress("menu", () -> menu());
ui.onButtonPress("statistic",()-> AdventureApplicationAdapter.instance.switchScene(SceneType.PlayerStatisticScene.instance)); ui.onButtonPress("statistic",()-> Forge.switchScene(SceneType.PlayerStatisticScene.instance));
ui.onButtonPress("deck", () -> openDeck()); ui.onButtonPress("deck", () -> openDeck());
lifePoints = ui.findActor("lifePoints"); lifePoints = ui.findActor("lifePoints");
lifePoints.setText("20/20"); lifePoints.setText("20/20");
@@ -109,7 +109,7 @@ public class GameHUD extends Stage {
private Object openDeck() { private Object openDeck() {
AdventureApplicationAdapter.instance.switchScene(SceneType.DeckSelectScene.instance); Forge.switchScene(SceneType.DeckSelectScene.instance);
return null; return null;
} }

View File

@@ -8,7 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.viewport.StretchViewport; import com.badlogic.gdx.utils.viewport.StretchViewport;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.character.MapActor; import forge.adventure.character.MapActor;
import forge.adventure.character.PlayerSprite; import forge.adventure.character.PlayerSprite;
import forge.adventure.scene.Scene; import forge.adventure.scene.Scene;
@@ -283,7 +283,7 @@ public abstract class GameStage extends Stage {
public void openMenu() { public void openMenu() {
WorldSave.getCurrentSave().header.createPreview(); WorldSave.getCurrentSave().header.createPreview();
AdventureApplicationAdapter.instance.switchScene(SceneType.StartScene.instance); Forge.switchScene(SceneType.StartScene.instance);
} }
public void enter() { public void enter() {

View File

@@ -11,7 +11,7 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.character.CharacterSprite; import forge.adventure.character.CharacterSprite;
import forge.adventure.character.EnemySprite; import forge.adventure.character.EnemySprite;
import forge.adventure.character.EntryActor; import forge.adventure.character.EntryActor;
@@ -241,7 +241,7 @@ public class MapStage extends GameStage {
addMapActor(obj, mob); addMapActor(obj, mob);
break; break;
case "inn": case "inn":
addMapActor(obj, new OnCollide(() -> AdventureApplicationAdapter.instance.switchScene(SceneType.InnScene.instance))); addMapActor(obj, new OnCollide(() -> Forge.switchScene(SceneType.InnScene.instance)));
break; break;
case "exit": case "exit":
addMapActor(obj, new OnCollide(() -> exit())); addMapActor(obj, new OnCollide(() -> exit()));
@@ -296,7 +296,7 @@ public class MapStage extends GameStage {
public boolean exit() { public boolean exit() {
isInMap=false; isInMap=false;
AdventureApplicationAdapter.instance.switchScene(SceneType.GameScene.instance); Forge.switchScene(SceneType.GameScene.instance);
return true; return true;
} }
@@ -334,7 +334,7 @@ public class MapStage extends GameStage {
actors.removeValue(currentMob,true); actors.removeValue(currentMob,true);
changes.deleteObject(currentMob.getId()); changes.deleteObject(currentMob.getId());
currentMob = null; currentMob = null;
AdventureApplicationAdapter.instance.switchScene(SceneType.RewardScene.instance); Forge.switchScene(SceneType.RewardScene.instance);
} }
@Override @Override
protected void onActing(float delta) { protected void onActing(float delta) {
@@ -363,7 +363,7 @@ public class MapStage extends GameStage {
{ {
((DuelScene) SceneType.DuelScene.instance).setEnemy(mob); ((DuelScene) SceneType.DuelScene.instance).setEnemy(mob);
((DuelScene) SceneType.DuelScene.instance).setPlayer(player); ((DuelScene) SceneType.DuelScene.instance).setPlayer(player);
AdventureApplicationAdapter.instance.switchScene(SceneType.DuelScene.instance); Forge.switchScene(SceneType.DuelScene.instance);
}); });
} }

View File

@@ -3,7 +3,7 @@ package forge.adventure.stage;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Actor;
import forge.adventure.AdventureApplicationAdapter; import forge.Forge;
import forge.adventure.character.CharacterSprite; import forge.adventure.character.CharacterSprite;
import forge.adventure.character.EnemySprite; import forge.adventure.character.EnemySprite;
import forge.adventure.data.BiomeData; import forge.adventure.data.BiomeData;
@@ -79,7 +79,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
((DuelScene) SceneType.DuelScene.instance).setEnemy(currentMob); ((DuelScene) SceneType.DuelScene.instance).setEnemy(currentMob);
((DuelScene) SceneType.DuelScene.instance).setPlayer(player); ((DuelScene) SceneType.DuelScene.instance).setPlayer(player);
AdventureApplicationAdapter.instance.switchScene(SceneType.DuelScene.instance); Forge.switchScene(SceneType.DuelScene.instance);
}); });
currentMob = mob; currentMob = mob;
WorldSave.getCurrentSave().autoSave(); WorldSave.getCurrentSave().autoSave();
@@ -117,7 +117,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
((RewardScene)SceneType.RewardScene.instance).loadRewards(currentMob.getRewards(), RewardScene.Type.Loot, null); ((RewardScene)SceneType.RewardScene.instance).loadRewards(currentMob.getRewards(), RewardScene.Type.Loot, null);
removeEnemy(currentMob); removeEnemy(currentMob);
currentMob = null; currentMob = null;
AdventureApplicationAdapter.instance.switchScene(SceneType.RewardScene.instance); Forge.switchScene(SceneType.RewardScene.instance);
} ); } );
} else { } else {
player.setAnimation(CharacterSprite.AnimationTypes.Hit); player.setAnimation(CharacterSprite.AnimationTypes.Hit);
@@ -142,7 +142,7 @@ public class WorldStage extends GameStage implements SaveFileContent {
continue; continue;
} }
((TileMapScene) SceneType.TileMapScene.instance).load(point.getPointOfInterest()); ((TileMapScene) SceneType.TileMapScene.instance).load(point.getPointOfInterest());
AdventureApplicationAdapter.instance.switchScene(SceneType.TileMapScene.instance); Forge.switchScene(SceneType.TileMapScene.instance);
} else { } else {
if (point == collidingPoint) { if (point == collidingPoint) {
collidingPoint = null; collidingPoint = null;

View File

@@ -106,16 +106,22 @@ public class SplashScreen extends FContainer {
if (!init) { if (!init) {
btnAdventure = new FButton(Localizer.getInstance().getMessageorUseDefault("lblAdventureMode", "Adventure Mode")); btnAdventure = new FButton(Localizer.getInstance().getMessageorUseDefault("lblAdventureMode", "Adventure Mode"));
btnAdventure.setEnabled(true);
btnAdventure.setCommand(new FEvent.FEventHandler() { btnAdventure.setCommand(new FEvent.FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
btnHome.setEnabled(false);
btnAdventure.setEnabled(false);
Forge.openAdventure(); Forge.openAdventure();
} }
}); });
btnHome = new FButton(Localizer.getInstance().getMessageorUseDefault("lblClassicMode", "Classic Mode")); btnHome = new FButton(Localizer.getInstance().getMessageorUseDefault("lblClassicMode", "Classic Mode"));
btnHome.setEnabled(true);
btnHome.setCommand(new FEvent.FEventHandler() { btnHome.setCommand(new FEvent.FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {
btnHome.setEnabled(false);
btnAdventure.setEnabled(false);
Forge.openHomeDefault(); Forge.openHomeDefault();
} }
}); });

View File

@@ -304,6 +304,10 @@ public class MatchController extends AbstractGuiGame {
@Override @Override
public void finishGame() { public void finishGame() {
if (Forge.isMobileAdventureMode) {
Forge.clearCurrentScreen();
return;
}
if (hasLocalPlayers() || getGameView().isMatchOver()) { if (hasLocalPlayers() || getGameView().isMatchOver()) {
view.setViewWinLose(new ViewWinLose(getGameView())); view.setViewWinLose(new ViewWinLose(getGameView()));
view.getViewWinLose().setVisible(true); view.getViewWinLose().setVisible(true);

View File

@@ -360,11 +360,15 @@ public class MatchScreen extends FScreen {
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()); gameMenu.getChildAt(2).setEnabled(!game.isMulligan());
if (Forge.isMobileAdventureMode)
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); gameMenu.getChildAt(2).setEnabled(false);
if (Forge.isMobileAdventureMode)
gameMenu.getChildAt(2).setEnabled(false);
gameMenu.getChildAt(3).setEnabled(true); gameMenu.getChildAt(3).setEnabled(true);
} }
} }

View File

@@ -55,6 +55,7 @@ public class VPlayers extends FDropDown {
player = player0; player = player0;
playerDeck = MatchController.getPlayerDeck(player0); playerDeck = MatchController.getPlayerDeck(player0);
btnDeck = new FLabel.ButtonBuilder().opaque(true).iconScaleFactor(0.99f).selectable().alphaComposite(1).iconInBackground(true).build(); btnDeck = new FLabel.ButtonBuilder().opaque(true).iconScaleFactor(0.99f).selectable().alphaComposite(1).iconInBackground(true).build();
btnDeck.setEnabled(!Forge.isMobileAdventureMode);
btnDeck.setCommand(new FEvent.FEventHandler() { btnDeck.setCommand(new FEvent.FEventHandler() {
@Override @Override
public void handleEvent(FEvent e) { public void handleEvent(FEvent e) {