mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>forge</artifactId>
|
||||
<groupId>forge</groupId>
|
||||
<version>1.6.43-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>forge-adventure</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-platform</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<classifier>natives-desktop</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-backend-lwjgl3</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-freetype</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.badlogicgames.gdx</groupId>
|
||||
<artifactId>gdx-backend-lwjgl3</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>forge</groupId>
|
||||
<artifactId>forge-gui</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>forge</groupId>
|
||||
<artifactId>forge-gui-mobile</artifactId>
|
||||
<version>1.6.43-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>forge</groupId>
|
||||
<artifactId>forge-gui-mobile</artifactId>
|
||||
<version>1.6.43-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -1,10 +0,0 @@
|
||||
package forge.adventure;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||
|
||||
public class AdventureApplication extends Lwjgl3Application{
|
||||
public AdventureApplication( AdventureApplicationConfiguration config) {
|
||||
super(new AdventureApplicationAdapter(config.Plane), config);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package forge.adventure;
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import forge.adventure.scene.*;
|
||||
import forge.adventure.util.Res;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AdventureApplicationAdapter extends ApplicationAdapter {
|
||||
public static AdventureApplicationAdapter CurrentAdapter;
|
||||
String strPlane;
|
||||
Scene currentScene=null;
|
||||
HashMap<SceneType,Scene> allScenes= new HashMap<>();
|
||||
Res resourcesLoader;
|
||||
public AdventureApplicationAdapter(String plane) {
|
||||
CurrentAdapter=this;
|
||||
strPlane=plane;
|
||||
allScenes.put(SceneType.StartScene,new StartScene());
|
||||
allScenes.put(SceneType.NewGameScene,new NewGameScene());
|
||||
allScenes.put(SceneType.GameScene,new GameScene());
|
||||
allScenes.put(SceneType.DuelScene,new DuelScene());
|
||||
}
|
||||
public boolean SwitchScene(SceneType newScene)
|
||||
{
|
||||
if(currentScene!=null)
|
||||
{
|
||||
if(!currentScene.Leave())
|
||||
return false;
|
||||
}
|
||||
currentScene=allScenes.get(newScene);
|
||||
currentScene.Enter();
|
||||
return true;
|
||||
}
|
||||
public Res GetRes()
|
||||
{
|
||||
return resourcesLoader;
|
||||
}
|
||||
@Override
|
||||
public void create ()
|
||||
{
|
||||
resourcesLoader=new Res(strPlane);
|
||||
for(HashMap.Entry<SceneType, Scene> entry:allScenes.entrySet())
|
||||
{
|
||||
entry.getValue().create();
|
||||
}
|
||||
SwitchScene(SceneType.StartScene);
|
||||
}
|
||||
@Override
|
||||
public void render(){
|
||||
currentScene.render();
|
||||
}
|
||||
@Override
|
||||
public void dispose(){
|
||||
currentScene.dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package forge.adventure;
|
||||
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||
|
||||
|
||||
public class AdventureApplicationConfiguration extends Lwjgl3ApplicationConfiguration {
|
||||
public AdventureApplicationConfiguration(){
|
||||
setResizable(false);
|
||||
|
||||
}
|
||||
public String Plane;
|
||||
public void SetPlane(String plane)
|
||||
{
|
||||
Plane=plane;
|
||||
}
|
||||
public void setFullScreen(boolean fullS){
|
||||
if(fullS)
|
||||
{
|
||||
setFullscreenMode(getDisplayMode());
|
||||
}
|
||||
else
|
||||
setWindowedMode((int)(1920/1.5),(int)(1080/1.5));
|
||||
}
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
package forge.adventure;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Clipboard;
|
||||
import com.badlogic.gdx.utils.Clipboard;
|
||||
import forge.Forge;
|
||||
import forge.FrameRate;
|
||||
import forge.Graphics;
|
||||
import forge.GuiMobile;
|
||||
import forge.assets.AssetsDownloader;
|
||||
import forge.assets.FSkin;
|
||||
import forge.assets.FSkinFont;
|
||||
import forge.assets.ImageCache;
|
||||
import forge.error.ExceptionHandler;
|
||||
import forge.gui.FThreads;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.interfaces.IDeviceAdapter;
|
||||
import forge.localinstance.properties.ForgeConstants;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.model.FModel;
|
||||
import forge.screens.FScreen;
|
||||
import forge.screens.SplashScreen;
|
||||
import forge.sound.MusicPlaylist;
|
||||
import forge.sound.SoundSystem;
|
||||
import forge.util.CardTranslation;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
|
||||
class StartAdvanture extends AdventureApplicationAdapter
|
||||
{
|
||||
private static Clipboard clipboard;
|
||||
private static IDeviceAdapter deviceAdapter;
|
||||
private static int screenWidth;
|
||||
private static int screenHeight;
|
||||
private static Graphics graphics;
|
||||
private static FrameRate frameRate;
|
||||
private static FScreen currentScreen;
|
||||
private static SplashScreen splashScreen;
|
||||
private static Forge.KeyInputAdapter keyInputAdapter;
|
||||
private static boolean exited;
|
||||
private static int continuousRenderingCount = 1; //initialize to 1 since continuous rendering is the default
|
||||
private static final Deque<FScreen> Dscreens = new ArrayDeque<>();
|
||||
private static boolean textureFiltering = false;
|
||||
private static boolean destroyThis = false;
|
||||
public static String extrawide = "default";
|
||||
public static float heigtModifier = 0.0f;
|
||||
private static boolean isloadingaMatch = false;
|
||||
public static boolean showFPS = false;
|
||||
public static boolean altPlayerLayout = false;
|
||||
public static boolean altZoneTabs = false;
|
||||
public static String enableUIMask = "Crop";
|
||||
public static boolean enablePreloadExtendedArt = false;
|
||||
public static boolean isTabletDevice = false;
|
||||
public static String locale = "en-US";
|
||||
public static boolean hdbuttons = false;
|
||||
public static boolean hdstart = false;
|
||||
public static boolean isPortraitMode = false;
|
||||
public static boolean gameInProgress = false;
|
||||
public static boolean disposeTextures = false;
|
||||
public static int cacheSize = 400;
|
||||
public static int totalDeviceRAM = 0;
|
||||
public static int androidVersion = 0;
|
||||
public static boolean autoCache = false;
|
||||
public static int lastButtonIndex = 0;
|
||||
public static String CJK_Font = "";
|
||||
public StartAdvanture(String plane) {
|
||||
|
||||
super(plane);
|
||||
clipboard = new Lwjgl3Clipboard();
|
||||
GuiBase.setUsingAppDirectory(false); //obb directory on android uses the package name as entrypoint
|
||||
GuiBase.setInterface(new GuiMobile("../forge-gui/"));
|
||||
GuiBase.enablePropertyConfig(true);
|
||||
isPortraitMode = true;
|
||||
totalDeviceRAM = 0;
|
||||
}
|
||||
@Override
|
||||
public void create()
|
||||
{
|
||||
//install our error handler
|
||||
ExceptionHandler.registerErrorHandling();
|
||||
|
||||
GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android);
|
||||
|
||||
graphics = new Graphics();
|
||||
splashScreen = new SplashScreen();
|
||||
frameRate = new FrameRate();
|
||||
/*
|
||||
Set CatchBackKey here and exit the app when you hit the
|
||||
back button while the textures,fonts,etc are still loading,
|
||||
to prevent rendering issue when you try to restart
|
||||
the app again (seems it doesnt dispose correctly...?!?)
|
||||
*/
|
||||
Gdx.input.setCatchKey(Input.Keys.BACK, true);
|
||||
destroyThis = true; //Prevent back()
|
||||
ForgePreferences prefs = new ForgePreferences();
|
||||
|
||||
String skinName;
|
||||
if (FileUtil.doesFileExist(ForgeConstants.MAIN_PREFS_FILE)) {
|
||||
skinName = prefs.getPref(ForgePreferences.FPref.UI_SKIN);
|
||||
}
|
||||
else {
|
||||
skinName = "default"; //use default skin if preferences file doesn't exist yet
|
||||
}
|
||||
FSkin.loadLight(skinName, splashScreen);
|
||||
|
||||
textureFiltering = prefs.getPrefBoolean(ForgePreferences.FPref.UI_LIBGDX_TEXTURE_FILTERING);
|
||||
showFPS = prefs.getPrefBoolean(ForgePreferences.FPref.UI_SHOW_FPS);
|
||||
altPlayerLayout = prefs.getPrefBoolean(ForgePreferences.FPref.UI_ALT_PLAYERINFOLAYOUT);
|
||||
altZoneTabs = prefs.getPrefBoolean(ForgePreferences.FPref.UI_ALT_PLAYERZONETABS);
|
||||
enableUIMask = prefs.getPref(ForgePreferences.FPref.UI_ENABLE_BORDER_MASKING);
|
||||
if (prefs.getPref(ForgePreferences.FPref.UI_ENABLE_BORDER_MASKING).equals("true")) //override old settings if not updated
|
||||
enableUIMask = "Full";
|
||||
else if (prefs.getPref(ForgePreferences.FPref.UI_ENABLE_BORDER_MASKING).equals("false"))
|
||||
enableUIMask = "Off";
|
||||
enablePreloadExtendedArt = prefs.getPrefBoolean(ForgePreferences.FPref.UI_ENABLE_PRELOAD_EXTENDED_ART);
|
||||
locale = prefs.getPref(ForgePreferences.FPref.UI_LANGUAGE);
|
||||
autoCache = prefs.getPrefBoolean(ForgePreferences.FPref.UI_AUTO_CACHE_SIZE);
|
||||
disposeTextures = prefs.getPrefBoolean(ForgePreferences.FPref.UI_ENABLE_DISPOSE_TEXTURES);
|
||||
CJK_Font = prefs.getPref(ForgePreferences.FPref.UI_CJK_FONT);
|
||||
|
||||
if (autoCache) {
|
||||
//increase cacheSize for devices with RAM more than 5GB, default is 400. Some phones have more than 10GB RAM (Mi 10, OnePlus 8, S20, etc..)
|
||||
if (totalDeviceRAM>5000) //devices with more than 10GB RAM will have 800 Cache size, 600 Cache size for morethan 5GB RAM
|
||||
cacheSize = totalDeviceRAM>10000 ? 800: 600;
|
||||
}
|
||||
//init cache
|
||||
ImageCache.initCache(cacheSize);
|
||||
final Localizer localizer = Localizer.getInstance();
|
||||
|
||||
//load model on background thread (using progress bar to report progress)
|
||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//see if app or assets need updating
|
||||
AssetsDownloader.checkForUpdates(splashScreen);
|
||||
if (exited) { return; } //don't continue if user chose to exit or couldn't download required assets
|
||||
|
||||
FModel.initialize(splashScreen.getProgressBar(), null);
|
||||
|
||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblLoadingFonts"));
|
||||
FSkinFont.preloadAll(locale);
|
||||
|
||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblLoadingCardTranslations"));
|
||||
CardTranslation.preloadTranslation(locale, ForgeConstants.LANG_DIR);
|
||||
|
||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblFinishingStartup"));
|
||||
|
||||
//add reminder to preload
|
||||
if (enablePreloadExtendedArt) {
|
||||
if(autoCache)
|
||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblPreloadExtendedArt")+"\nDetected RAM: " +totalDeviceRAM+"MB. Cache size: "+cacheSize);
|
||||
else
|
||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblPreloadExtendedArt"));
|
||||
} else {
|
||||
if(autoCache)
|
||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblFinishingStartup")+"\nDetected RAM: " +totalDeviceRAM+"MB. Cache size: "+cacheSize);
|
||||
else
|
||||
splashScreen.getProgressBar().setDescription(localizer.getMessage("lblFinishingStartup"));
|
||||
}
|
||||
|
||||
Gdx.app.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
FSkin.loadFull(splashScreen);
|
||||
|
||||
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS); //start background music
|
||||
destroyThis = false; //Allow back()
|
||||
Gdx.input.setCatchKey(Input.Keys.MENU, true);
|
||||
splashScreen = null;
|
||||
|
||||
if (!enablePreloadExtendedArt)
|
||||
return;
|
||||
List<String> borderlessCardlistkeys = FileUtil.readFile(ForgeConstants.BORDERLESS_CARD_LIST_FILE);
|
||||
if(borderlessCardlistkeys.isEmpty())
|
||||
return;
|
||||
List<String> filteredkeys = new ArrayList<>();
|
||||
for (String cardname : borderlessCardlistkeys){
|
||||
File image = new File(ForgeConstants.CACHE_CARD_PICS_DIR+ForgeConstants.PATH_SEPARATOR+cardname+".jpg");
|
||||
if (image.exists())
|
||||
filteredkeys.add(cardname);
|
||||
}
|
||||
if (!filteredkeys.isEmpty())
|
||||
ImageCache.preloadCache(filteredkeys);
|
||||
/* call preloadExtendedArt here, if we put it above we will *
|
||||
* get error: No OpenGL context found in the current thread. */
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
super.create();
|
||||
}
|
||||
}
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AdventureApplicationConfiguration config=new AdventureApplicationConfiguration();
|
||||
|
||||
config.SetPlane("Shandalar");
|
||||
config.setFullScreen(false);
|
||||
|
||||
new Lwjgl3Application(new StartAdvanture(config.Plane), config);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package forge.adventure.character;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
|
||||
public class CharacterSprite extends Actor {
|
||||
|
||||
private Sprite Standing;
|
||||
public CharacterSprite(FileHandle atlas)
|
||||
{
|
||||
Standing=new TextureAtlas(atlas).createSprite("Standing");
|
||||
|
||||
setWidth(Standing.getWidth());
|
||||
setHeight(Standing.getHeight());
|
||||
}
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha)
|
||||
{
|
||||
Standing.setPosition(getX(),getY());
|
||||
Standing.draw(batch);
|
||||
}
|
||||
public Rectangle BoundingRect()
|
||||
{
|
||||
return new Rectangle(getX(),getY(),getWidth(),getHeight());
|
||||
}
|
||||
|
||||
public boolean collideWith(CharacterSprite other) {
|
||||
if(BoundingRect().overlaps(other.BoundingRect()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package forge.adventure.character;
|
||||
|
||||
import forge.adventure.util.Res;
|
||||
|
||||
public class MobSprite extends CharacterSprite {
|
||||
public MobSprite() {
|
||||
super(Res.CurrentRes.GetFile("sprites/mob.atlas"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package forge.adventure.character;
|
||||
|
||||
import forge.adventure.util.Res;
|
||||
|
||||
public class PlayerSprite extends CharacterSprite {
|
||||
public PlayerSprite() {
|
||||
super(Res.CurrentRes.GetFile("sprites/player.atlas"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,314 +0,0 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
import forge.Forge;
|
||||
import forge.gamemodes.match.HostedMatch;
|
||||
import forge.gui.error.BugReporter;
|
||||
import forge.screens.match.MatchController;
|
||||
import forge.toolbox.FContainer;
|
||||
import forge.toolbox.FDisplayObject;
|
||||
import forge.toolbox.FGestureAdapter;
|
||||
import forge.toolbox.FOverlay;
|
||||
import forge.util.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class DuelInput extends FGestureAdapter {
|
||||
private static final List<FDisplayObject> potentialListeners = new ArrayList<>();
|
||||
private static char lastKeyTyped;
|
||||
private static boolean keyTyped, shiftKeyDown;
|
||||
private Forge.KeyInputAdapter keyInputAdapter=null;
|
||||
|
||||
public DuelInput(HostedMatch hMatch) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyDown(int keyCode) {
|
||||
if (keyCode == Input.Keys.MENU) {
|
||||
//showMenu();
|
||||
return true;
|
||||
}
|
||||
if (keyCode == Input.Keys.SHIFT_LEFT || keyCode == Input.Keys.SHIFT_RIGHT) {
|
||||
shiftKeyDown = true;
|
||||
}
|
||||
|
||||
// Cursor keys emulate swipe gestures
|
||||
// First we touch the screen and later swipe (fling) in the direction of the key pressed
|
||||
if (keyCode == Input.Keys.LEFT) {
|
||||
touchDown(0,0,0,0);
|
||||
return fling(1000,0);
|
||||
}
|
||||
if (keyCode == Input.Keys.RIGHT) {
|
||||
touchDown(0,0,0,0);
|
||||
return fling(-1000,0);
|
||||
}
|
||||
if (keyCode == Input.Keys.UP) {
|
||||
touchDown(0,0,0,0);
|
||||
return fling(0,-1000);
|
||||
}
|
||||
if (keyCode == Input.Keys.DOWN) {
|
||||
touchDown(0,0,0,0);
|
||||
return fling(0,1000);
|
||||
}
|
||||
/*
|
||||
if(keyCode == Input.Keys.BACK){
|
||||
if (destroyThis)
|
||||
deviceAdapter.exit();
|
||||
else if(onHomeScreen() && isLandscapeMode())
|
||||
back();
|
||||
}
|
||||
*/
|
||||
if (keyInputAdapter == null) {
|
||||
if (Forge.KeyInputAdapter.isModifierKey(keyCode)) {
|
||||
return false; //don't process modifiers keys for unknown adapter
|
||||
}
|
||||
//if no active key input adapter, give current screen or overlay a chance to handle key
|
||||
FContainer container = FOverlay.getTopOverlay();
|
||||
if (container == null) {
|
||||
container = MatchController.getView();;;
|
||||
if (container == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return container.keyDown(keyCode);
|
||||
}
|
||||
return keyInputAdapter.keyDown(keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keyCode) {
|
||||
keyTyped = false; //reset on keyUp
|
||||
if (keyCode == Input.Keys.SHIFT_LEFT || keyCode == Input.Keys.SHIFT_RIGHT) {
|
||||
shiftKeyDown = false;
|
||||
}
|
||||
if (keyInputAdapter != null) {
|
||||
return keyInputAdapter.keyUp(keyCode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char ch) {
|
||||
if (keyInputAdapter != null) {
|
||||
if (ch >= ' ' && ch <= '~') { //only process this event if character is printable
|
||||
//prevent firing this event more than once for the same character on the same key down, otherwise it fires too often
|
||||
if (lastKeyTyped != ch || !keyTyped) {
|
||||
keyTyped = true;
|
||||
lastKeyTyped = ch;
|
||||
return keyInputAdapter.keyTyped(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updatePotentialListeners(int x, int y) {
|
||||
potentialListeners.clear();
|
||||
|
||||
//base potential listeners on object containing touch down point
|
||||
for (FOverlay overlay : FOverlay.getOverlaysTopDown()) {
|
||||
if (overlay.isVisibleOnScreen(MatchController.getView())) {
|
||||
overlay.buildTouchListeners(x, y, potentialListeners);
|
||||
if (overlay.preventInputBehindOverlay()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MatchController.getView() != null) {
|
||||
MatchController.getView().buildTouchListeners(x, y, potentialListeners);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean touchDown(int x, int y, int pointer, int button) {
|
||||
if (pointer == 0) { //don't change listeners when second finger goes down for zoom
|
||||
updatePotentialListeners(x, y);
|
||||
if (keyInputAdapter != null) {
|
||||
if (!keyInputAdapter.allowTouchInput() || !potentialListeners.contains(keyInputAdapter.getOwner())) {
|
||||
//endKeyInput(); //end key input if needed
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.touchDown(x, y, pointer, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean press(float x, float y) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.press(listener.screenToLocalX(x), listener.screenToLocalY(y))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean release(float x, float y) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.release(listener.screenToLocalX(x), listener.screenToLocalY(y))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean longPress(float x, float y) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.longPress(listener.screenToLocalX(x), listener.screenToLocalY(y))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tap(float x, float y, int count) {
|
||||
if (shiftKeyDown && flick(x, y)) {
|
||||
return true; //give flick logic a chance to handle Shift+click
|
||||
}
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.tap(listener.screenToLocalX(x), listener.screenToLocalY(y), count)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean flick(float x, float y) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.flick(listener.screenToLocalX(x), listener.screenToLocalY(y))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fling(float velocityX, float velocityY) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.fling(velocityX, velocityY)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pan(float x, float y, float deltaX, float deltaY, boolean moreVertical) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.pan(listener.screenToLocalX(x), listener.screenToLocalY(y), deltaX, deltaY, moreVertical)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean panStop(float x, float y) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.panStop(listener.screenToLocalX(x), listener.screenToLocalY(y))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean zoom(float x, float y, float amount) {
|
||||
try {
|
||||
for (FDisplayObject listener : potentialListeners) {
|
||||
if (listener.zoom(listener.screenToLocalX(x), listener.screenToLocalY(y), amount)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BugReporter.reportException(ex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//mouseMoved and scrolled events for desktop version
|
||||
private int mouseMovedX, mouseMovedY;
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved(int x, int y) {
|
||||
mouseMovedX = x;
|
||||
mouseMovedY = y;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
updatePotentialListeners(mouseMovedX, mouseMovedY);
|
||||
|
||||
if (Forge.KeyInputAdapter.isCtrlKeyDown()) { //zoom in or out based on amount
|
||||
return zoom(mouseMovedX, mouseMovedY, -Utils.AVG_FINGER_WIDTH * amountY);
|
||||
}
|
||||
|
||||
boolean handled;
|
||||
if (Forge.KeyInputAdapter.isShiftKeyDown()) {
|
||||
handled = pan(mouseMovedX, mouseMovedY, -Utils.AVG_FINGER_WIDTH * amountX, 0, false);
|
||||
}
|
||||
else {
|
||||
handled = pan(mouseMovedX, mouseMovedY, 0, -Utils.AVG_FINGER_HEIGHT * amountY, true);
|
||||
}
|
||||
if (panStop(mouseMovedX, mouseMovedY)) {
|
||||
handled = true;
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.utils.viewport.StretchViewport;
|
||||
import forge.Graphics;
|
||||
import forge.deck.io.DeckSerializer;
|
||||
import forge.game.GameType;
|
||||
import forge.game.player.RegisteredPlayer;
|
||||
import forge.gamemodes.match.GameLobby;
|
||||
import forge.gamemodes.match.HostedMatch;
|
||||
import forge.gamemodes.match.LobbySlotType;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.gui.interfaces.IGuiGame;
|
||||
import forge.interfaces.IUpdateable;
|
||||
import forge.player.GamePlayerUtil;
|
||||
import forge.screens.FScreen;
|
||||
import forge.screens.match.MatchController;
|
||||
import forge.toolbox.FOverlay;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class DuelScene extends Scene implements IUpdateable {
|
||||
|
||||
//GameLobby lobby;
|
||||
FScreen screen;
|
||||
Graphics graphics;
|
||||
HostedMatch hostedMatch;
|
||||
public DuelScene() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
Stage.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
//Batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
/*
|
||||
Gdx.gl.glClearColor(0,1,1,1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
Stage.getBatch().begin();
|
||||
Stage.getBatch().end();
|
||||
Stage.act(Gdx.graphics.getDeltaTime());
|
||||
Stage.draw();
|
||||
*/
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear the screen.
|
||||
if(hostedMatch== null || hostedMatch .getGameView()==null)
|
||||
return;
|
||||
if (screen==null)
|
||||
{
|
||||
|
||||
screen = MatchController.getView();
|
||||
screen.setSize(IntendedWidth, IntendedHeight);
|
||||
}
|
||||
|
||||
graphics.begin(IntendedWidth, IntendedHeight);
|
||||
screen.screenPos.setSize(IntendedWidth, IntendedHeight);
|
||||
if (screen.getRotate180()) {
|
||||
graphics.startRotateTransform(IntendedWidth / 2, IntendedHeight / 2, 180);
|
||||
}
|
||||
screen.draw(graphics);
|
||||
if (screen.getRotate180()) {
|
||||
graphics.endTransform();
|
||||
}
|
||||
for (FOverlay overlay : FOverlay.getOverlays()) {
|
||||
if (overlay.isVisibleOnScreen(screen)) {
|
||||
overlay.screenPos.setSize(IntendedWidth, IntendedHeight);
|
||||
overlay.setSize(IntendedWidth, IntendedHeight); //update overlay sizes as they're rendered
|
||||
if (overlay.getRotate180()) {
|
||||
graphics.startRotateTransform(IntendedWidth / 2, IntendedHeight / 2, 180);
|
||||
}
|
||||
overlay.draw(graphics);
|
||||
if (overlay.getRotate180()) {
|
||||
graphics.endTransform();
|
||||
}
|
||||
}
|
||||
}
|
||||
graphics.end();
|
||||
|
||||
|
||||
//Batch.end();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void Enter()
|
||||
{
|
||||
Set<GameType> appliedVariants = new HashSet<>();
|
||||
appliedVariants.add(GameType.Constructed);
|
||||
|
||||
List<RegisteredPlayer> players = new ArrayList<>();
|
||||
RegisteredPlayer humanPlayer = RegisteredPlayer.forVariants(2, appliedVariants, DeckSerializer.fromFile(new File("../forge-gui/res/quest/duels/Agent K 1.dck")), null, false, null, null);
|
||||
humanPlayer.setPlayer(GamePlayerUtil.getGuiPlayer());
|
||||
RegisteredPlayer aiPlayer = RegisteredPlayer.forVariants(2, appliedVariants, DeckSerializer.fromFile(new File("../forge-gui/res/quest/duels/Agent K 1.dck")), null, false, null, null);
|
||||
aiPlayer.setPlayer(GamePlayerUtil.createAiPlayer());
|
||||
players.add(humanPlayer);
|
||||
players.add(aiPlayer);
|
||||
|
||||
final Map<RegisteredPlayer, IGuiGame> guiMap = new HashMap<>();
|
||||
guiMap.put(humanPlayer, MatchController.instance);
|
||||
|
||||
hostedMatch = GuiBase.getInterface().hostMatch();
|
||||
hostedMatch.startMatch(GameType.Constructed, appliedVariants, players, guiMap);
|
||||
|
||||
Gdx.input.setInputProcessor(new DuelInput(hostedMatch));
|
||||
|
||||
}
|
||||
public boolean Resume()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean Exit()
|
||||
{
|
||||
Gdx.app.exit();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void create() {
|
||||
Stage = new Stage(new StretchViewport(IntendedWidth,IntendedHeight));
|
||||
//lobby = new LocalLobby();
|
||||
graphics=new Graphics();
|
||||
//initLobby(lobby);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
protected void initLobby(GameLobby lobby) {
|
||||
lobby.setListener(this);
|
||||
|
||||
boolean hasControl = lobby.hasControl();
|
||||
while (lobby.getNumberOfSlots() < 2){
|
||||
lobby.addSlot();
|
||||
}
|
||||
for(int i=0;i<lobby.getNumberOfSlots();i++)
|
||||
{
|
||||
lobby.getSlot(i).setDeck(DeckSerializer.fromFile(new File("../forge-gui/res/quest/duels/Agent K 1.dck")));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(boolean fullUpdate) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(int slot, LobbySlotType type) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import forge.adventure.stage.GameStage;
|
||||
|
||||
public class GameScene extends Scene {
|
||||
|
||||
public GameScene() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
Stage.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
//Batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
Gdx.gl.glClearColor(0,1,1,1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
Stage.getBatch().begin();
|
||||
Stage.getBatch().end();
|
||||
Stage.act(Gdx.graphics.getDeltaTime());
|
||||
Stage.draw();
|
||||
//Batch.end();
|
||||
}
|
||||
|
||||
public boolean NewGame()
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
public boolean Load()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean Resume()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean Exit()
|
||||
{
|
||||
Gdx.app.exit();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void create() {
|
||||
Stage = new GameStage();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.utils.viewport.StretchViewport;
|
||||
import forge.adventure.AdventureApplicationAdapter;
|
||||
|
||||
public class NewGameScene extends Scene {
|
||||
Texture Background;
|
||||
|
||||
public NewGameScene( ) {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
Stage.dispose();
|
||||
Background.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
//Batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
Gdx.gl.glClearColor(1,0,1,1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
Stage.getBatch().begin();
|
||||
Stage.getBatch().disableBlending();
|
||||
Stage.getBatch().draw(Background,0,0,IntendedWidth,IntendedHeight);
|
||||
Stage.getBatch().enableBlending();
|
||||
Stage.getBatch().end();
|
||||
Stage.act(Gdx.graphics.getDeltaTime());
|
||||
Stage.draw();
|
||||
//Batch.end();
|
||||
}
|
||||
|
||||
public boolean Start()
|
||||
{
|
||||
|
||||
AdventureApplicationAdapter.CurrentAdapter.SwitchScene(SceneType.GameScene);
|
||||
return true;
|
||||
}
|
||||
public boolean Back()
|
||||
{
|
||||
AdventureApplicationAdapter.CurrentAdapter.SwitchScene(SceneType.StartScene);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void create() {
|
||||
Stage = new Stage(new StretchViewport(IntendedWidth,IntendedHeight));
|
||||
Background = new Texture(AdventureApplicationAdapter.CurrentAdapter.GetRes().GetFile("img/title_bg.png"));
|
||||
|
||||
|
||||
|
||||
TextButton button = new TextButton("Start",AdventureApplicationAdapter.CurrentAdapter.GetRes().GetSkin()) ;
|
||||
button.setPosition(100,600);
|
||||
button.setSize(400,150);
|
||||
button.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
try {
|
||||
Start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}});
|
||||
|
||||
Stage.addActor(button);
|
||||
|
||||
button = new TextButton("Back",AdventureApplicationAdapter.CurrentAdapter.GetRes().GetSkin()) ;
|
||||
button.setPosition(100,400);
|
||||
button.setSize(400,150);
|
||||
button.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
try {
|
||||
Back();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}});
|
||||
Stage.addActor(button);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
import forge.adventure.AdventureApplicationAdapter;
|
||||
|
||||
public abstract class Scene implements Disposable {
|
||||
|
||||
public static int IntendedWidth = 1920;
|
||||
public static int IntendedHeight = 1080;
|
||||
protected com.badlogic.gdx.scenes.scene2d.Stage Stage;
|
||||
Scene()
|
||||
{
|
||||
|
||||
}
|
||||
public abstract void render() ;
|
||||
|
||||
public abstract void create();
|
||||
|
||||
public Drawable DrawableImage(String path)
|
||||
{
|
||||
return new TextureRegionDrawable(new Texture(AdventureApplicationAdapter.CurrentAdapter.GetRes().GetFile(path)));
|
||||
}
|
||||
|
||||
public boolean Leave(){return true;}
|
||||
public void Enter()
|
||||
{
|
||||
Gdx.input.setInputProcessor(GetStage()); //Start taking input from the ui
|
||||
}
|
||||
|
||||
public com.badlogic.gdx.scenes.scene2d.Stage GetStage() {
|
||||
return Stage;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
public enum SceneType {
|
||||
StartScene,
|
||||
NewGameScene,
|
||||
GameScene,
|
||||
DuelScene
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Button;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.utils.viewport.StretchViewport;
|
||||
import forge.adventure.AdventureApplicationAdapter;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class StartScene extends Scene {
|
||||
Texture Background;
|
||||
Texture Title;
|
||||
|
||||
public StartScene() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
Stage.dispose();
|
||||
Background.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
//Batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
Gdx.gl.glClearColor(1,0,1,1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
Stage.getBatch().begin();
|
||||
Stage.getBatch().disableBlending();
|
||||
Stage.getBatch().draw(Background,0,0,IntendedWidth,IntendedHeight);
|
||||
Stage.getBatch().enableBlending();
|
||||
int width=Title.getWidth();
|
||||
Stage.getBatch().draw(Title,(IntendedWidth/2)-(Title.getWidth()/2), IntendedHeight-IntendedHeight/4);
|
||||
Stage.getBatch().end();
|
||||
Stage.act(Gdx.graphics.getDeltaTime());
|
||||
Stage.draw();
|
||||
//Batch.end();
|
||||
}
|
||||
|
||||
private void AddButton(String name, Callable func, int ypos)
|
||||
{
|
||||
|
||||
ImageButton button = new ImageButton(DrawableImage("img/title_"+name+".png")) ;
|
||||
Button.ButtonStyle style=new ImageButton.ImageButtonStyle();
|
||||
style.up=DrawableImage("img/title_"+name+".png");
|
||||
style.down=DrawableImage("img/title_"+name+"_pressed.png");
|
||||
style.over=DrawableImage("img/title_"+name+"_hover.png");
|
||||
button.setStyle(style);
|
||||
button.setPosition((IntendedWidth/2)-(button.getWidth()/2),ypos);
|
||||
button.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
try {
|
||||
func.call();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}});
|
||||
Stage.addActor(button);
|
||||
}
|
||||
public boolean NewGame()
|
||||
{
|
||||
AdventureApplicationAdapter.CurrentAdapter.SwitchScene(SceneType.NewGameScene);
|
||||
return true;
|
||||
}
|
||||
public boolean Load()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean Resume()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean Exit()
|
||||
{
|
||||
Gdx.app.exit();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void create() {
|
||||
Stage = new Stage(new StretchViewport(IntendedWidth,IntendedHeight));
|
||||
Background = new Texture( AdventureApplicationAdapter.CurrentAdapter.GetRes().GetFile("img/title_bg.png"));
|
||||
Title = new Texture( AdventureApplicationAdapter.CurrentAdapter.GetRes().GetFile("img/title.png"));
|
||||
|
||||
AddButton("new_game", () -> NewGame(), (IntendedHeight / 6) * 3);
|
||||
AddButton("load",() -> Load(),(IntendedHeight/6)*2);
|
||||
AddButton("resume",() -> Resume(),(IntendedHeight/6)*1);
|
||||
AddButton("exit",() -> Exit(),0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package forge.adventure.stage;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.utils.viewport.StretchViewport;
|
||||
import forge.adventure.AdventureApplicationAdapter;
|
||||
import forge.adventure.character.MobSprite;
|
||||
import forge.adventure.character.PlayerSprite;
|
||||
import forge.adventure.scene.Scene;
|
||||
import forge.adventure.scene.SceneType;
|
||||
|
||||
|
||||
public class GameStage extends Stage {
|
||||
|
||||
private int playerMovementX;
|
||||
private int playerMovementY;
|
||||
private int playerSpeed=6;
|
||||
MobSprite mob;
|
||||
PlayerSprite player;
|
||||
public GameStage()
|
||||
{
|
||||
super(new StretchViewport(Scene.IntendedWidth,Scene.IntendedHeight));
|
||||
player=new PlayerSprite();
|
||||
player.setPosition(200,200);
|
||||
addActor(player);
|
||||
mob=new MobSprite();
|
||||
mob.setPosition(1000,400);
|
||||
addActor(mob);
|
||||
}
|
||||
@Override
|
||||
public void act(float delta)
|
||||
{
|
||||
super.act(delta);
|
||||
player.moveBy(playerMovementX,playerMovementY);
|
||||
|
||||
if(player.collideWith(mob))
|
||||
{
|
||||
|
||||
AdventureApplicationAdapter.CurrentAdapter.SwitchScene(SceneType.DuelScene);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean keyDown(int keycode) {
|
||||
|
||||
if(keycode == Input.Keys.LEFT||keycode==Input.Keys.A)//todo config
|
||||
{
|
||||
playerMovementX=-playerSpeed;
|
||||
}
|
||||
if(keycode == Input.Keys.RIGHT||keycode==Input.Keys.D)//todo config
|
||||
{
|
||||
playerMovementX=+playerSpeed;
|
||||
}
|
||||
if(keycode == Input.Keys.UP||keycode==Input.Keys.W)//todo config
|
||||
{
|
||||
playerMovementY=+playerSpeed;
|
||||
}
|
||||
if(keycode == Input.Keys.DOWN||keycode==Input.Keys.S)//todo config
|
||||
{
|
||||
playerMovementY=-playerSpeed;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean keyUp(int keycode) {
|
||||
if(keycode == Input.Keys.LEFT||keycode==Input.Keys.A||keycode == Input.Keys.RIGHT||keycode==Input.Keys.D)//todo config
|
||||
{
|
||||
playerMovementX=0;
|
||||
}
|
||||
if(keycode == Input.Keys.UP||keycode==Input.Keys.W||keycode == Input.Keys.DOWN||keycode==Input.Keys.S)//todo config
|
||||
{
|
||||
playerMovementY=0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package forge.adventure.util;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.model.FModel;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
public class Res {
|
||||
public static Res CurrentRes;
|
||||
private String Prefix;
|
||||
private String Lang="en-us";
|
||||
private Skin SelectedSkin=null;
|
||||
private HashMap<String,FileHandle> Cache=new HashMap<String,FileHandle>();
|
||||
public Res(String plane) {
|
||||
CurrentRes=this;
|
||||
Prefix= GuiBase.getInterface().getAssetsDir()+"/res/adventure/"+plane+"/";
|
||||
if(FModel.getPreferences()!=null)
|
||||
Lang= FModel.getPreferences().getPref(ForgePreferences.FPref.UI_LANGUAGE);
|
||||
|
||||
}
|
||||
|
||||
public FileHandle GetFile(String path)
|
||||
{
|
||||
String fullPath=Prefix+path;
|
||||
if(!Cache.containsKey(fullPath))
|
||||
{
|
||||
String fileName = fullPath.replaceFirst("[.][^.]+$", "");
|
||||
String ext= fullPath.substring(fullPath.lastIndexOf('.'));
|
||||
String langFile=fileName+"-"+Lang+ext;
|
||||
if(Files.exists(Paths.get(langFile) ))
|
||||
{
|
||||
Cache.put(fullPath,new FileHandle(langFile));
|
||||
}
|
||||
else
|
||||
{
|
||||
Cache.put(fullPath,new FileHandle(fullPath));
|
||||
}
|
||||
}
|
||||
return Cache.get(fullPath);
|
||||
}
|
||||
|
||||
public Skin GetSkin() {
|
||||
|
||||
if(SelectedSkin==null)
|
||||
SelectedSkin=new Skin(GetFile("skin/uiskin.json"));
|
||||
return SelectedSkin;
|
||||
}
|
||||
}
|
||||
@@ -183,11 +183,6 @@
|
||||
<artifactId>imageio-jpeg</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>forge</groupId>
|
||||
<artifactId>forge-adventure</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -15,7 +15,6 @@ import forge.screens.deckeditor.views.VOathbreakerDecks;
|
||||
import forge.screens.deckeditor.views.VProbabilities;
|
||||
import forge.screens.deckeditor.views.VStatistics;
|
||||
import forge.screens.deckeditor.views.VTinyLeadersDecks;
|
||||
import forge.screens.home.adventure.VSubmenuAdventureLoadData;
|
||||
import forge.screens.home.gauntlet.VSubmenuGauntletBuild;
|
||||
import forge.screens.home.gauntlet.VSubmenuGauntletContests;
|
||||
import forge.screens.home.gauntlet.VSubmenuGauntletLoad;
|
||||
@@ -77,7 +76,6 @@ public enum EDocID {
|
||||
HOME_QUESTDUELS (VSubmenuDuels.SINGLETON_INSTANCE),
|
||||
HOME_QUESTDECKS (VSubmenuQuestDecks.SINGLETON_INSTANCE),
|
||||
HOME_QUESTPREFS (VSubmenuQuestPrefs.SINGLETON_INSTANCE),
|
||||
HOME_ADVANTURELOADDATA(VSubmenuAdventureLoadData.SINGLETON_INSTANCE),
|
||||
HOME_GAUNTLETBUILD (VSubmenuGauntletBuild.SINGLETON_INSTANCE),
|
||||
HOME_GAUNTLETLOAD (VSubmenuGauntletLoad.SINGLETON_INSTANCE),
|
||||
HOME_GAUNTLETQUICK (VSubmenuGauntletQuick.SINGLETON_INSTANCE),
|
||||
|
||||
@@ -11,7 +11,6 @@ public enum EMenuGroup {
|
||||
SANCTIONED ("lblSanctionedFormats"),
|
||||
ONLINE ("lblOnlineMultiplayer"),
|
||||
QUEST ("lblQuestMode"),
|
||||
ADVENTURE ("lblAdventureMode"),
|
||||
PUZZLE ("lblPuzzleMode"),
|
||||
GAUNTLET ("lblGauntlets"),
|
||||
SETTINGS ("lblGameSettings");
|
||||
|
||||
@@ -41,7 +41,6 @@ import forge.gui.framework.IVTopLevelUI;
|
||||
import forge.localinstance.properties.ForgePreferences.FPref;
|
||||
import forge.localinstance.skin.FSkinProp;
|
||||
import forge.model.FModel;
|
||||
import forge.screens.home.adventure.VSubmenuAdventureLoadData;
|
||||
import forge.screens.home.gauntlet.VSubmenuGauntletBuild;
|
||||
import forge.screens.home.gauntlet.VSubmenuGauntletContests;
|
||||
import forge.screens.home.gauntlet.VSubmenuGauntletLoad;
|
||||
@@ -133,9 +132,6 @@ public enum VHomeUI implements IVTopLevelUI {
|
||||
allSubmenus.add(VSubmenuQuestDraft.SINGLETON_INSTANCE);
|
||||
allSubmenus.add(VSubmenuQuestPrefs.SINGLETON_INSTANCE);
|
||||
|
||||
|
||||
allSubmenus.add(VSubmenuAdventureLoadData.SINGLETON_INSTANCE);
|
||||
|
||||
allSubmenus.add(VSubmenuGauntletQuick.SINGLETON_INSTANCE);
|
||||
allSubmenus.add(VSubmenuGauntletBuild.SINGLETON_INSTANCE);
|
||||
allSubmenus.add(VSubmenuGauntletLoad.SINGLETON_INSTANCE);
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
package forge.screens.home.adventure;
|
||||
|
||||
import forge.gamemodes.quest.QuestController;
|
||||
import forge.gamemodes.quest.data.QuestData;
|
||||
import forge.gamemodes.quest.io.QuestDataIO;
|
||||
import forge.gui.UiCommand;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.localinstance.properties.ForgeConstants;
|
||||
import forge.model.FModel;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Controls the adventure data submenu in the home UI.
|
||||
*
|
||||
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public enum CSubmenuAdventureLoadData implements ICDoc {
|
||||
SINGLETON_INSTANCE;
|
||||
|
||||
private final Map<String, QuestData> arrAdventures = new HashMap<>();
|
||||
|
||||
private final UiCommand cmdAdventureSelect = new UiCommand() {
|
||||
@Override public void run() {
|
||||
changeAdventure();
|
||||
}
|
||||
};
|
||||
private final UiCommand cmdAdventureUpdate = new UiCommand() {
|
||||
@Override public void run() {
|
||||
update();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.control.home.IControlSubmenu#update()
|
||||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.control.home.IControlSubmenu#update()
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
final VSubmenuAdventureLoadData view = VSubmenuAdventureLoadData.SINGLETON_INSTANCE;
|
||||
final File dirAdventures = new File(ForgeConstants.QUEST_SAVE_DIR);
|
||||
final QuestController qc = FModel.getQuest();
|
||||
ArrayList<String> restorableAdventures = new ArrayList<>();
|
||||
|
||||
// Iterate over files and load adventure data for each.
|
||||
final FilenameFilter takeDatFiles = new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(final File dir, final String name) {
|
||||
return name.endsWith(".dat");
|
||||
}
|
||||
};
|
||||
final File[] arrFiles = dirAdventures.listFiles(takeDatFiles);
|
||||
arrAdventures.clear();
|
||||
for (final File f : arrFiles) {
|
||||
try {
|
||||
System.out.println(String.format("About to load adventure (%s)... ", f.getName()));
|
||||
arrAdventures.put(f.getName(), QuestDataIO.loadData(f));
|
||||
} catch(IOException ex) {
|
||||
ex.printStackTrace();
|
||||
System.out.println(String.format("Error loading adventure data (%s).. skipping for now..", f.getName()));
|
||||
restorableAdventures.add(f.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** Changes between adventure data files. */
|
||||
private void changeAdventure() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private Map<String, QuestData> getAllAdventures() {
|
||||
return arrAdventures;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
package forge.screens.home.adventure;
|
||||
|
||||
import forge.adventure.AdventureApplicationConfiguration;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
import forge.localinstance.properties.ForgeConstants;
|
||||
import forge.screens.home.EMenuGroup;
|
||||
import forge.screens.home.IVSubmenu;
|
||||
import forge.screens.home.VHomeUI;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FSkin;
|
||||
import forge.util.Localizer;
|
||||
import forge.screens.home.quest.QuestFileLister;
|
||||
import forge.adventure.AdventureApplication;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of adventrue data submenu singleton.
|
||||
*
|
||||
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||
*/
|
||||
public enum VSubmenuAdventureLoadData implements IVSubmenu<CSubmenuAdventureLoadData> {
|
||||
SINGLETON_INSTANCE;
|
||||
final Localizer localizer = Localizer.getInstance();
|
||||
|
||||
// Fields used with interface IVDoc
|
||||
private DragCell parentCell;
|
||||
private final DragTab tab = new DragTab("todo");
|
||||
|
||||
private final FLabel lblTitle = new FLabel.Builder()
|
||||
.text("Start Adventure").fontAlign(SwingConstants.CENTER)//TODO localizer
|
||||
.opaque(true).fontSize(16).build();
|
||||
|
||||
String str= ForgeConstants.QUEST_SAVE_DIR.replace('\\', '/');
|
||||
private final QuestFileLister lstAdventures = new QuestFileLister();
|
||||
private final JComboBox<String> boxPlane = new JComboBox<String>(new String[]{"Shandalar"}); //TODO load list from a configuration file
|
||||
private final JButton bttnStart = new JButton("Start Adventure");//TODO localizer
|
||||
private final FLabel lblPlane = new FLabel.Builder().text("Plane").build();//TODO localizer
|
||||
private final JCheckBox boxFullScreen = new JCheckBox("Fullscreen");//TODO localizer
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
VSubmenuAdventureLoadData() {
|
||||
|
||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||
bttnStart.addActionListener(arg0 -> start());
|
||||
}
|
||||
private final void start()
|
||||
{
|
||||
AdventureApplicationConfiguration config=new AdventureApplicationConfiguration();
|
||||
|
||||
config.SetPlane(boxPlane.getSelectedItem().toString());
|
||||
config.setFullScreen(boxFullScreen.isSelected());
|
||||
|
||||
AdventureApplication advanture=new AdventureApplication(config);
|
||||
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see forge.view.home.IViewSubmenu#populate()
|
||||
*/
|
||||
@Override
|
||||
public void populate() {
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().removeAll();
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout("","[50%][50%]"));
|
||||
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblTitle, "cell 0 0 4 1");
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(bttnStart, "cell 0 1 2 1");
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblPlane,"cell 0 2");
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(boxPlane, "cell 1 2");
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(boxFullScreen,"cell 0 3");
|
||||
|
||||
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().repaintSelf();
|
||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.view.home.IViewSubmenu#getGroup()
|
||||
*/
|
||||
@Override
|
||||
public EMenuGroup getGroupEnum() {
|
||||
return EMenuGroup.ADVENTURE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.IVSubmenu#getMenuTitle()
|
||||
*/
|
||||
@Override
|
||||
public String getMenuTitle() { return "Start Adventure"; }//TODO localizer
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.home.IVSubmenu#getMenuName()
|
||||
*/
|
||||
@Override
|
||||
public EDocID getItemEnum() {
|
||||
return EDocID.HOME_ADVANTURELOADDATA;
|
||||
}
|
||||
|
||||
|
||||
//========== Overridden from IVDoc
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getDocumentID()
|
||||
*/
|
||||
@Override
|
||||
public EDocID getDocumentID() {
|
||||
return EDocID.HOME_ADVANTURELOADDATA;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getTabLabel()
|
||||
*/
|
||||
@Override
|
||||
public DragTab getTabLabel() {
|
||||
return tab;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getLayoutControl()
|
||||
*/
|
||||
@Override
|
||||
public CSubmenuAdventureLoadData getLayoutControl() {
|
||||
return CSubmenuAdventureLoadData.SINGLETON_INSTANCE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#setParentCell(forge.gui.framework.DragCell)
|
||||
*/
|
||||
@Override
|
||||
public void setParentCell(final DragCell cell0) {
|
||||
this.parentCell = cell0;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.IVDoc#getParentCell()
|
||||
*/
|
||||
@Override
|
||||
public DragCell getParentCell() {
|
||||
return parentCell;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,18 @@
|
||||
package forge.deck;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.assets.ImageCache;
|
||||
import forge.deck.FDeckEditor.EditorType;
|
||||
@@ -30,15 +41,18 @@ import forge.screens.FScreen;
|
||||
import forge.screens.LoadingOverlay;
|
||||
import forge.screens.home.NewGameMenu.NewGameScreen;
|
||||
import forge.screens.match.MatchController;
|
||||
import forge.toolbox.*;
|
||||
import forge.toolbox.FButton;
|
||||
import forge.toolbox.FComboBox;
|
||||
import forge.toolbox.FContainer;
|
||||
import forge.toolbox.FEvent;
|
||||
import forge.toolbox.FEvent.FEventHandler;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import forge.toolbox.GuiChoose;
|
||||
import forge.toolbox.ListChooser;
|
||||
import forge.util.Callback;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.Utils;
|
||||
import forge.util.storage.IStorage;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class FDeckChooser extends FScreen {
|
||||
public static final float PADDING = Utils.scale(5);
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
package forge.screens.match;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.ai.GameState;
|
||||
import forge.item.IPaperCard;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.Graphics;
|
||||
import forge.LobbyPlayer;
|
||||
import forge.ai.GameState;
|
||||
import forge.assets.*;
|
||||
import forge.assets.FImage;
|
||||
import forge.assets.FSkin;
|
||||
import forge.assets.FSkinImage;
|
||||
import forge.assets.FTextureRegionImage;
|
||||
import forge.assets.ImageCache;
|
||||
import forge.card.CardAvatarImage;
|
||||
import forge.card.GameEntityPicker;
|
||||
import forge.deck.CardPool;
|
||||
@@ -27,7 +41,6 @@ import forge.gui.FThreads;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.gui.util.SGuiChoose;
|
||||
import forge.gui.util.SOptionPane;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.PaperCard;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.localinstance.properties.ForgePreferences.FPref;
|
||||
@@ -35,9 +48,13 @@ import forge.localinstance.skin.FSkinProp;
|
||||
import forge.model.FModel;
|
||||
import forge.player.PlayerZoneUpdate;
|
||||
import forge.player.PlayerZoneUpdates;
|
||||
import forge.screens.match.views.*;
|
||||
import forge.screens.match.views.VAssignCombatDamage;
|
||||
import forge.screens.match.views.VAssignGenericAmount;
|
||||
import forge.screens.match.views.VPhaseIndicator;
|
||||
import forge.screens.match.views.VPhaseIndicator.PhaseLabel;
|
||||
import forge.screens.match.views.VPlayerPanel;
|
||||
import forge.screens.match.views.VPlayerPanel.InfoTab;
|
||||
import forge.screens.match.views.VPrompt;
|
||||
import forge.screens.match.winlose.ViewWinLose;
|
||||
import forge.toolbox.FButton;
|
||||
import forge.toolbox.FDisplayObject;
|
||||
@@ -48,9 +65,6 @@ import forge.util.Localizer;
|
||||
import forge.util.MessageUtil;
|
||||
import forge.util.WaitCallback;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class MatchController extends AbstractGuiGame {
|
||||
private MatchController() { }
|
||||
@@ -165,6 +179,7 @@ public class MatchController extends AbstractGuiGame {
|
||||
|
||||
actuateMatchPreferences();
|
||||
|
||||
Forge.openScreen(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -253,7 +253,6 @@ OKresetMatchScreenLayout=Match Screen layout has been reset.
|
||||
lblSanctionedFormats=Sanctioned Formats
|
||||
lblOnlineMultiplayer=Online Multiplayer
|
||||
lblQuestMode=Quest Mode
|
||||
lblAdventureMode=Adventure Mode
|
||||
lblPuzzleMode=Puzzle Mode
|
||||
lblGauntlets=Gauntlets
|
||||
lblGameSettings=Game Settings
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
package forge.gamemodes.match;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import forge.LobbyPlayer;
|
||||
import forge.game.*;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameRules;
|
||||
import forge.game.GameType;
|
||||
import forge.game.GameView;
|
||||
import forge.game.Match;
|
||||
import forge.game.event.GameEvent;
|
||||
import forge.game.event.GameEventSubgameEnd;
|
||||
import forge.game.event.GameEventSubgameStart;
|
||||
@@ -19,7 +35,11 @@ import forge.gui.GuiBase;
|
||||
import forge.gui.control.FControlGameEventHandler;
|
||||
import forge.gui.control.FControlGamePlayback;
|
||||
import forge.gui.control.WatchLocalGame;
|
||||
import forge.gui.events.*;
|
||||
import forge.gui.events.IUiEventVisitor;
|
||||
import forge.gui.events.UiEvent;
|
||||
import forge.gui.events.UiEventAttackerDeclared;
|
||||
import forge.gui.events.UiEventBlockerAssigned;
|
||||
import forge.gui.events.UiEventNextGameDecision;
|
||||
import forge.gui.interfaces.IGuiGame;
|
||||
import forge.interfaces.IGameController;
|
||||
import forge.localinstance.properties.ForgeConstants;
|
||||
@@ -37,10 +57,6 @@ import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.maps.HashMapOfLists;
|
||||
import forge.util.maps.MapOfLists;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class HostedMatch {
|
||||
private Match match;
|
||||
@@ -279,7 +295,7 @@ public class HostedMatch {
|
||||
public Game getGame() {
|
||||
return game;
|
||||
}
|
||||
public GameView getGameView() {
|
||||
public GameView getGameView() {
|
||||
return game == null ? null : game.getView();
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,6 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
SUBMENU_PUZZLE("false"),
|
||||
SUBMENU_SETTINGS ("false"),
|
||||
SUBMENU_UTILITIES ("false"),
|
||||
SUBMENU_ADVENTURE("false"),
|
||||
|
||||
MATCH_SIDEBOARD_FOR_AI("true"), // TODO What do when AI knows how to SIdeboard?
|
||||
ENFORCE_DECK_LEGALITY ("true"),
|
||||
|
||||
Reference in New Issue
Block a user