Merge pull request #1944 from kevlahnota/newmaster2

update ClosingScreen & GameHud
This commit is contained in:
Anthony Calosa
2022-11-22 21:08:54 +08:00
committed by GitHub
6 changed files with 28 additions and 20 deletions

View File

@@ -73,6 +73,7 @@ public class Forge implements ApplicationListener {
public static KeyInputAdapter keyInputAdapter; public static KeyInputAdapter keyInputAdapter;
private static boolean exited; private static boolean exited;
public boolean needsUpdate = false; public boolean needsUpdate = false;
public static boolean advStartup = false;
public static boolean safeToClose = true; public static boolean safeToClose = true;
public static boolean magnify = false; public static boolean magnify = false;
public static boolean magnifyToggle = true; public static boolean magnifyToggle = true;

View File

@@ -42,9 +42,9 @@ import java.util.Map;
public static FSkinImage MAIN_DECK_ICON = Forge.hdbuttons ? FSkinImage.HDLIBRARY :FSkinImage.DECKLIST; public static FSkinImage MAIN_DECK_ICON = Forge.hdbuttons ? FSkinImage.HDLIBRARY :FSkinImage.DECKLIST;
public static FSkinImage SIDEBOARD_ICON = Forge.hdbuttons ? FSkinImage.HDSIDEBOARD : FSkinImage.FLASHBACK; public static FSkinImage SIDEBOARD_ICON = Forge.hdbuttons ? FSkinImage.HDSIDEBOARD : FSkinImage.FLASHBACK;
private static final float HEADER_HEIGHT = Math.round(Utils.AVG_FINGER_HEIGHT * 0.8f); private static final float HEADER_HEIGHT = Math.round(Utils.AVG_FINGER_HEIGHT * 0.8f);
private static final FileHandle tomeIcon = Config.instance().getFile("ui/tome.png"); private static final FileHandle binderIcon = Config.instance().getFile("ui/binder.png");
private static Texture tomeIconTexture = tomeIcon.exists() ? new Texture(tomeIcon) : null; private static Texture binderTexture = binderIcon.exists() ? new Texture(binderIcon) : null;
private static FImage CATALOG_ICON = tomeIcon.exists() ? new FImage() { private static FImage CATALOG_ICON = binderIcon.exists() ? new FImage() {
@Override @Override
public float getWidth() { public float getWidth() {
return 100f; return 100f;
@@ -55,7 +55,7 @@ import java.util.Map;
} }
@Override @Override
public void draw(Graphics g, float x, float y, float w, float h) { public void draw(Graphics g, float x, float y, float w, float h) {
g.drawImage(tomeIconTexture, x, y, w, h); g.drawImage(binderTexture, x, y, w, h);
} }
} : FSkinImage.QUEST_BOX; } : FSkinImage.QUEST_BOX;
private static final FileHandle sellIcon = Config.instance().getFile("ui/sell.png"); private static final FileHandle sellIcon = Config.instance().getFile("ui/sell.png");

View File

@@ -111,12 +111,12 @@ public class GameHUD extends Stage {
lifePoints = ui.findActor("lifePoints"); lifePoints = ui.findActor("lifePoints");
mana = ui.findActor("mana"); mana = ui.findActor("mana");
money = ui.findActor("money"); money = ui.findActor("money");
mana.setText("0/0"); mana.setText("{Scale=80%}0/0");
lifePoints.setText("20/20"); lifePoints.setText("{Scale=80%}20/20");
AdventurePlayer.current().onLifeChange(() -> lifePoints.setText(AdventurePlayer.current().getLife() + "/" + AdventurePlayer.current().getMaxLife())); AdventurePlayer.current().onLifeChange(() -> lifePoints.setText("{Scale=80%}"+AdventurePlayer.current().getLife() + "/" + AdventurePlayer.current().getMaxLife()));
AdventurePlayer.current().onManaChange(() -> mana.setText(AdventurePlayer.current().getMana() + "/" + AdventurePlayer.current().getMaxMana())); AdventurePlayer.current().onManaChange(() -> mana.setText("{Scale=80%}"+AdventurePlayer.current().getMana() + "/" + AdventurePlayer.current().getMaxMana()));
WorldSave.getCurrentSave().getPlayer().onGoldChange(() -> money.setText(String.valueOf(AdventurePlayer.current().getGold()))); WorldSave.getCurrentSave().getPlayer().onGoldChange(() -> money.setText("{Scale=80%}"+String.valueOf(AdventurePlayer.current().getGold())));
addActor(ui); addActor(ui);
addActor(miniMapPlayer); addActor(miniMapPlayer);
console = new Console(); console = new Console();

View File

@@ -1,6 +1,9 @@
package forge.screens; package forge.screens;
import static forge.assets.FSkin.getDefaultSkinFile;
import static forge.assets.FSkin.getSkinFile;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import forge.Forge; import forge.Forge;
import forge.Graphics; import forge.Graphics;
import forge.animation.ForgeAnimation; import forge.animation.ForgeAnimation;
@@ -16,6 +19,9 @@ public class ClosingScreen extends FContainer {
private StaticAnimation staticAnimation; private StaticAnimation staticAnimation;
private boolean restart = false; private boolean restart = false;
private boolean drawStatic = false; private boolean drawStatic = false;
private FileHandle adv_logo = getSkinFile("adv_logo.png");
private FileHandle existingLogo = adv_logo.exists() ? adv_logo : getDefaultSkinFile("adv_logo.png");
private Texture logo = existingLogo.exists() && Forge.advStartup ? new Texture(existingLogo) : FSkin.getLogo();
public ClosingScreen(boolean restart0) { public ClosingScreen(boolean restart0) {
bgAnimation = new BGAnimation(); bgAnimation = new BGAnimation();
@@ -48,11 +54,12 @@ public class ClosingScreen extends FContainer {
} }
g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
g.setAlphaComposite(1-percentage); g.setAlphaComposite(1-percentage);
g.drawImage(Forge.isMobileAdventureMode ? FSkinTexture.ADV_BG_TEXTURE : FSkinTexture.BG_TEXTURE, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); g.drawImage(Forge.isMobileAdventureMode || Forge.advStartup ? FSkinTexture.ADV_BG_TEXTURE : FSkinTexture.BG_TEXTURE, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
g.setAlphaComposite(oldAlpha); g.setAlphaComposite(oldAlpha);
float xmod = Forge.getScreenHeight() > 2000 ? 1.5f : 1f; float xmod = Forge.getScreenHeight() > 2000 ? 1.5f : 1f;
if (FSkin.getLogo() != null) {
g.drawImage(FSkin.getLogo(), Forge.getScreenWidth()/2 - (FSkin.getLogo().getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (FSkin.getLogo().getHeight()*xmod)/2, FSkin.getLogo().getWidth()*xmod, FSkin.getLogo().getHeight()*xmod); if (logo != null) {
g.drawImage(logo, Forge.getScreenWidth()/2 - (logo.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (logo.getHeight()*xmod)/2, logo.getWidth()*xmod, logo.getHeight()*xmod);
} else { } else {
g.drawImage(FSkinImage.LOGO, Forge.getScreenWidth()/2 - (FSkinImage.LOGO.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (FSkinImage.LOGO.getHeight()*xmod)/1.5f, FSkinImage.LOGO.getWidth()*xmod, FSkinImage.LOGO.getHeight()*xmod); g.drawImage(FSkinImage.LOGO, Forge.getScreenWidth()/2 - (FSkinImage.LOGO.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (FSkinImage.LOGO.getHeight()*xmod)/1.5f, FSkinImage.LOGO.getWidth()*xmod, FSkinImage.LOGO.getHeight()*xmod);
} }
@@ -87,12 +94,12 @@ public class ClosingScreen extends FContainer {
} }
g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
g.setAlphaComposite(percentage); g.setAlphaComposite(percentage);
g.drawImage(Forge.isMobileAdventureMode ? FSkinTexture.ADV_BG_TEXTURE : FSkinTexture.BG_TEXTURE, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); g.drawImage(Forge.isMobileAdventureMode || Forge.advStartup ? FSkinTexture.ADV_BG_TEXTURE : FSkinTexture.BG_TEXTURE, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
g.setAlphaComposite(oldAlpha); g.setAlphaComposite(oldAlpha);
float xmod = Forge.getScreenHeight() > 2000 ? 1.5f : 1f; float xmod = Forge.getScreenHeight() > 2000 ? 1.5f : 1f;
xmod *= 21-(20*percentage); xmod *= 21-(20*percentage);
if (FSkin.getLogo() != null) { if (logo != null) {
g.drawImage(FSkin.getLogo(), Forge.getScreenWidth()/2 - (FSkin.getLogo().getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (FSkin.getLogo().getHeight()*xmod)/2, FSkin.getLogo().getWidth()*xmod, FSkin.getLogo().getHeight()*xmod); g.drawImage(logo, Forge.getScreenWidth()/2 - (logo.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (logo.getHeight()*xmod)/2, logo.getWidth()*xmod, logo.getHeight()*xmod);
} else { } else {
g.drawImage(FSkinImage.LOGO,Forge.getScreenWidth()/2 - (FSkinImage.LOGO.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (FSkinImage.LOGO.getHeight()*xmod)/1.5f, FSkinImage.LOGO.getWidth()*xmod, FSkinImage.LOGO.getHeight()*xmod); g.drawImage(FSkinImage.LOGO,Forge.getScreenWidth()/2 - (FSkinImage.LOGO.getWidth()*xmod)/2, Forge.getScreenHeight()/2 - (FSkinImage.LOGO.getHeight()*xmod)/1.5f, FSkinImage.LOGO.getWidth()*xmod, FSkinImage.LOGO.getHeight()*xmod);
} }

View File

@@ -19,7 +19,7 @@ public class TransitionScreen extends FContainer {
Runnable runnable; Runnable runnable;
TextureRegion textureRegion; TextureRegion textureRegion;
private String message = ""; private String message = "";
boolean matchTransition, isloading, isIntro, isFadeMusic, advStartup; boolean matchTransition, isloading, isIntro, isFadeMusic;
public TransitionScreen(Runnable proc, TextureRegion screen, boolean enterMatch, boolean loading) { public TransitionScreen(Runnable proc, TextureRegion screen, boolean enterMatch, boolean loading) {
this(proc, screen, enterMatch, loading, false, false); this(proc, screen, enterMatch, loading, false, false);
@@ -43,7 +43,7 @@ public class TransitionScreen extends FContainer {
isIntro = intro; isIntro = intro;
isFadeMusic = fadeMusic; isFadeMusic = fadeMusic;
message = loadingMessage; message = loadingMessage;
advStartup = Forge.selector.equals("Adventure"); Forge.advStartup = Forge.selector.equals("Adventure");
} }
public FProgressBar getProgressBar() { public FProgressBar getProgressBar() {
@@ -111,7 +111,7 @@ public class TransitionScreen extends FContainer {
g.drawWarpImage(textureRegion, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight(), percentage); g.drawWarpImage(textureRegion, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight(), percentage);
} else if (isIntro) { } else if (isIntro) {
if (textureRegion != null) { if (textureRegion != null) {
if (advStartup) { if (Forge.advStartup) {
g.drawGrayTransitionImage(Forge.getAssets().fallback_skins().get(0), 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight(), false, percentage); g.drawGrayTransitionImage(Forge.getAssets().fallback_skins().get(0), 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight(), false, percentage);
g.setAlphaComposite(1-percentage); g.setAlphaComposite(1-percentage);
g.drawImage(textureRegion, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); g.drawImage(textureRegion, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB