mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Merge branch 'master' into 'master'
[Adventure] Adjust Map & Avatar Size for Portrait Mode See merge request core-developers/forge!6327
This commit is contained in:
@@ -335,17 +335,21 @@ public class GameHUD extends Stage {
|
||||
miniMap.setWidth(160);
|
||||
mapborder.setWidth(160);
|
||||
miniMapPlayer.setWidth(10);
|
||||
miniMap.setHeight(70);
|
||||
mapborder.setHeight(70);
|
||||
miniMapPlayer.setHeight(4);
|
||||
gamehud.setVisible(false);
|
||||
blank.setScaleX(2);
|
||||
blank.setX(388);
|
||||
blank.setHeight(80);
|
||||
blank.setHeight(70);
|
||||
blank.setY(miniMap.getY());
|
||||
avatar.setScaleX(2);
|
||||
avatar.setX(388);
|
||||
avatar.setHeight(36);
|
||||
avatarborder.setX(388);
|
||||
avatarborder.setY(miniMap.getY());
|
||||
avatarborder.setScaleX(2);
|
||||
avatarborder.setHeight(80);
|
||||
avatarborder.setHeight(70);
|
||||
money.setX(418);
|
||||
lifePoints.setX(418);
|
||||
lifePoints.setY(avatar.getY()-15);
|
||||
|
||||
@@ -2,6 +2,7 @@ package forge.adventure.util;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
@@ -19,6 +20,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
import forge.Forge;
|
||||
import forge.adventure.data.UIData;
|
||||
|
||||
/**
|
||||
@@ -36,12 +38,9 @@ public class UIActor extends Group {
|
||||
for (OrderedMap<String, String> element : new Array.ArrayIterator<>(data.elements)) {
|
||||
String type = element.get("type");
|
||||
Actor newActor;
|
||||
if(type==null)
|
||||
{
|
||||
if (type == null) {
|
||||
newActor = new Actor();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
switch (type) {
|
||||
case "Selector":
|
||||
newActor = new Selector();
|
||||
@@ -121,6 +120,7 @@ public class UIActor extends Group {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readWindowProperties(Window newActor, ObjectMap.Entries<String, String> entries) {
|
||||
for (ObjectMap.Entry property : entries) {
|
||||
switch (property.key.toString()) {
|
||||
@@ -196,7 +196,15 @@ public class UIActor extends Group {
|
||||
for (ObjectMap.Entry property : entries) {
|
||||
switch (property.key.toString()) {
|
||||
case "image":
|
||||
newActor.setDrawable(new TextureRegionDrawable(new Texture(Config.instance().getFile(property.value.toString()))));
|
||||
Texture t = new Texture(Config.instance().getFile(property.value.toString()));
|
||||
TextureRegion tr = new TextureRegion(t);
|
||||
if (!Forge.isLandscapeMode() && t.toString().contains("title_bg.png")) {
|
||||
float ar = 1.78f;
|
||||
int w = (int) (tr.getRegionHeight() / ar);
|
||||
int x = (int) ((tr.getRegionWidth() - w) / ar);
|
||||
tr.setRegion(x, 0, w, tr.getRegionHeight());
|
||||
}
|
||||
newActor.setDrawable(new TextureRegionDrawable(tr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class SplashScreen extends FContainer {
|
||||
public void setBackground(TextureRegion background0) {
|
||||
background = background0;
|
||||
}
|
||||
|
||||
public void startClassic() {
|
||||
startClassic = true;
|
||||
hideBtn = true;
|
||||
@@ -56,7 +57,9 @@ public class SplashScreen extends FContainer {
|
||||
|
||||
//prepare for showing dialogs on top of splash screen if needed
|
||||
public void prepareForDialogs() {
|
||||
if (preparedForDialogs) { return; }
|
||||
if (preparedForDialogs) {
|
||||
return;
|
||||
}
|
||||
|
||||
//establish fallback colors for before actual colors are loaded
|
||||
Color defaultColor = new Color(0, 0, 0, 0);
|
||||
@@ -85,6 +88,7 @@ public class SplashScreen extends FContainer {
|
||||
public void setShowModeSelector(boolean value) {
|
||||
showModeSelector = value;
|
||||
}
|
||||
|
||||
public boolean isShowModeSelector() {
|
||||
return showModeSelector;
|
||||
}
|
||||
@@ -94,7 +98,9 @@ public class SplashScreen extends FContainer {
|
||||
private float progress = 0;
|
||||
private boolean finished, openAdventure;
|
||||
//for transition image only...
|
||||
Texture transition_bg = new Texture(GuiBase.isAndroid() ? Gdx.files.internal("fallback_skin").child("title_bg_lq.png") : Gdx.files.classpath("fallback_skin").child("title_bg_lq.png"));
|
||||
TextureRegion transition_bg = new TextureRegion(new Texture(GuiBase.isAndroid()
|
||||
? Gdx.files.internal("fallback_skin").child("title_bg_lq.png")
|
||||
: Gdx.files.classpath("fallback_skin").child("title_bg_lq.png")));
|
||||
|
||||
public void drawBackground(Graphics g) {
|
||||
float percentage = progress / DURATION;
|
||||
@@ -169,20 +175,31 @@ public class SplashScreen extends FContainer {
|
||||
bgAnimation.start();
|
||||
bgAnimation.drawBackground(g);
|
||||
}
|
||||
void drawTransition(Graphics g, Texture bg, boolean openAdventure, float percentage) {
|
||||
|
||||
void drawTransition(Graphics g, TextureRegion bg, boolean openAdventure, float percentage) {
|
||||
TextureRegion tr = new TextureRegion(bg.getTexture());
|
||||
if (!Forge.isLandscapeMode() && tr != null) {
|
||||
float ar = 1.78f;
|
||||
int w = (int) (tr.getRegionHeight() / ar);
|
||||
int x = (int) ((tr.getRegionWidth() - w) / ar);
|
||||
tr.setRegion(x, 0, w, tr.getRegionHeight());
|
||||
}
|
||||
float oldAlpha = g.getfloatAlphaComposite();
|
||||
g.setAlphaComposite(percentage);
|
||||
if (openAdventure) {
|
||||
if (bg != null) {
|
||||
g.drawGrayTransitionImage(bg, 0, 0, getWidth(), getHeight(), false, percentage*1);
|
||||
if (tr != null) {
|
||||
g.drawGrayTransitionImage(tr, 0, 0, getWidth(), getHeight(), false, percentage * 1);
|
||||
}
|
||||
} else {
|
||||
g.fillRect(FSkinColor.get(FSkinColor.Colors.CLR_THEME), 0, 0, getWidth(), getHeight());
|
||||
}
|
||||
g.setAlphaComposite(oldAlpha);
|
||||
}
|
||||
|
||||
private void showSelector(Graphics g, float alpha) {
|
||||
if (background == null) { return; }
|
||||
if (background == null) {
|
||||
return;
|
||||
}
|
||||
g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
|
||||
g.drawImage(FSkinTexture.BG_TEXTURE, 0, 0, getWidth(), getHeight());
|
||||
|
||||
@@ -194,8 +211,7 @@ public class SplashScreen extends FContainer {
|
||||
w = getWidth();
|
||||
h = getWidth() * backgroundRatio;
|
||||
y = (getHeight() - h) / 2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
y = 0;
|
||||
h = getHeight();
|
||||
w = getHeight() / backgroundRatio;
|
||||
@@ -259,14 +275,18 @@ public class SplashScreen extends FContainer {
|
||||
add(btnAdventure);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSplash(Graphics g, float alpha) {
|
||||
float oldAlpha = g.getfloatAlphaComposite();
|
||||
g.setAlphaComposite(alpha);
|
||||
drawDisclaimer(g);
|
||||
g.setAlphaComposite(oldAlpha);
|
||||
}
|
||||
|
||||
void drawDisclaimer(Graphics g) {
|
||||
if (background == null) { return; }
|
||||
if (background == null) {
|
||||
return;
|
||||
}
|
||||
g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight());
|
||||
g.drawImage(FSkinTexture.BG_TEXTURE, 0, 0, getWidth(), getHeight());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user