Merge branch 'master' of https://git.cardforge.org/core-developers/forge into ui-card-translation

This commit is contained in:
Peter
2019-08-27 19:06:25 +02:00
4 changed files with 26 additions and 9 deletions

View File

@@ -55,8 +55,10 @@ public class PowerExchangeEffect extends SpellAbilityEffect {
final int power1 = c1.getNetPower(); final int power1 = c1.getNetPower();
final int power2 = c2.getNetPower(); final int power2 = c2.getNetPower();
c1.addTempPowerBoost(power2 - power1); final long timestamp = game.getNextTimestamp();
c2.addTempPowerBoost(power1 - power2);
c1.addNewPT(power2, null, timestamp);
c2.addNewPT(power1, null, timestamp);
game.fireEvent(new GameEventCardStatsChanged(c1)); game.fireEvent(new GameEventCardStatsChanged(c1));
game.fireEvent(new GameEventCardStatsChanged(c2)); game.fireEvent(new GameEventCardStatsChanged(c2));
@@ -69,8 +71,8 @@ public class PowerExchangeEffect extends SpellAbilityEffect {
@Override @Override
public void run() { public void run() {
c1.addTempPowerBoost(power1 - power2); c1.removeNewPT(timestamp);
c2.addTempPowerBoost(power2 - power1); c2.removeNewPT(timestamp);
game.fireEvent(new GameEventCardStatsChanged(c1)); game.fireEvent(new GameEventCardStatsChanged(c1));
game.fireEvent(new GameEventCardStatsChanged(c2)); game.fireEvent(new GameEventCardStatsChanged(c2));
} }

View File

@@ -50,6 +50,7 @@ public class Forge implements ApplicationListener {
private static int continuousRenderingCount = 1; //initialize to 1 since continuous rendering is the default private static int continuousRenderingCount = 1; //initialize to 1 since continuous rendering is the default
private static final Stack<FScreen> screens = new Stack<FScreen>(); private static final Stack<FScreen> screens = new Stack<FScreen>();
private static boolean textureFiltering = false; private static boolean textureFiltering = false;
private static boolean destroyThis = false;
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) { public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) {
if (GuiBase.getInterface() == null) { if (GuiBase.getInterface() == null) {
@@ -71,7 +72,14 @@ public class Forge implements ApplicationListener {
graphics = new Graphics(); graphics = new Graphics();
splashScreen = new SplashScreen(); splashScreen = new SplashScreen();
Gdx.input.setInputProcessor(new MainInputProcessor()); Gdx.input.setInputProcessor(new MainInputProcessor());
/*
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.setCatchBackKey(true);
destroyThis = true; //Prevent back()
ForgePreferences prefs = new ForgePreferences(); ForgePreferences prefs = new ForgePreferences();
String skinName; String skinName;
@@ -119,7 +127,7 @@ public class Forge implements ApplicationListener {
FSkin.loadFull(splashScreen); FSkin.loadFull(splashScreen);
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS); //start background music SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS); //start background music
destroyThis = false; //Allow back()
Gdx.input.setCatchBackKey(true); Gdx.input.setCatchBackKey(true);
Gdx.input.setCatchMenuKey(true); Gdx.input.setCatchMenuKey(true);
openScreen(HomeScreen.instance); openScreen(HomeScreen.instance);
@@ -171,6 +179,8 @@ public class Forge implements ApplicationListener {
} }
public static void back() { public static void back() {
if(destroyThis)
return;
if (screens.size() < 2) { if (screens.size() < 2) {
exit(false); //prompt to exit if attempting to go back from home screen exit(false); //prompt to exit if attempting to go back from home screen
return; return;
@@ -485,7 +495,12 @@ public class Forge implements ApplicationListener {
touchDown(0,0,0,0); touchDown(0,0,0,0);
return fling(0,1000); return fling(0,1000);
} }
if(keyCode == Keys.BACK){
if (destroyThis)
deviceAdapter.exit();
else if(onHomeScreen())
back();
}
if (keyInputAdapter == null) { if (keyInputAdapter == null) {
if (KeyInputAdapter.isModifierKey(keyCode)) { if (KeyInputAdapter.isModifierKey(keyCode)) {
return false; //don't process modifiers keys for unknown adapter return false; //don't process modifiers keys for unknown adapter

View File

@@ -94,7 +94,7 @@ public class SplashScreen extends FContainer {
String disclaimer = "Forge is not affiliated in any way with Wizards of the Coast.\n" String disclaimer = "Forge is not affiliated in any way with Wizards of the Coast.\n"
+ "Forge is open source software, released under the GNU Public License."; + "Forge is open source software, released under the GNU Public License.";
g.drawText(disclaimer, disclaimerFont, FProgressBar.SEL_FORE_COLOR, g.drawText(disclaimer, disclaimerFont, FProgressBar.SEL_FORE_COLOR,
x, y, w, disclaimerHeight, true, Align.center, true); x, y, w, disclaimerHeight, false, Align.center, true);
float padding = 20f / 450f * w; float padding = 20f / 450f * w;
float pbHeight = 57f / 450f * h; float pbHeight = 57f / 450f * h;

View File

@@ -514,7 +514,7 @@ public class SettingsPage extends TabPage<SettingsScreen> {
g.drawText(value.label, font, foreColor, x, y, w, h, false, Align.left, false); g.drawText(value.label, font, foreColor, x, y, w, h, false, Align.left, false);
value.drawPrefValue(g, font, foreColor, x, y, w, h); value.drawPrefValue(g, font, foreColor, x, y, w, h);
h += SettingsScreen.SETTING_PADDING; h += SettingsScreen.SETTING_PADDING;//TODO: adjust settings page description bounds
g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, Align.left, false); g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, Align.left, false);
} }
} }