diff --git a/forge-gui-mobile/src/forge/Forge.java b/forge-gui-mobile/src/forge/Forge.java index bb3b2c574fe..b295d5c4382 100644 --- a/forge-gui-mobile/src/forge/Forge.java +++ b/forge-gui-mobile/src/forge/Forge.java @@ -303,6 +303,8 @@ public class Forge implements ApplicationListener { startContinuousRendering(); GuiBase.setIsAdventureMode(true); isMobileAdventureMode = true; + if (GuiBase.isAndroid()) //force it for adventure mode + altZoneTabs = true; //pixl cursor for adventure setCursor(null, "0"); try { diff --git a/forge-gui-mobile/src/forge/adventure/scene/InnScene.java b/forge-gui-mobile/src/forge/adventure/scene/InnScene.java index 6d7286f8576..f1c0b60282a 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/InnScene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/InnScene.java @@ -3,6 +3,7 @@ package forge.adventure.scene; import com.badlogic.gdx.Input; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import forge.Forge; +import forge.adventure.stage.GameHUD; import forge.adventure.util.Current; /** @@ -18,6 +19,7 @@ public class InnScene extends UIScene { public void done() { + GameHUD.getInstance().getTouchpad().setVisible(false); Forge.switchToLast(); } public void heal() diff --git a/forge-gui-mobile/src/forge/adventure/scene/RewardScene.java b/forge-gui-mobile/src/forge/adventure/scene/RewardScene.java index 57860287566..21cd76c8220 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/RewardScene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/RewardScene.java @@ -11,6 +11,7 @@ import forge.Forge; import forge.adventure.character.ShopActor; import forge.adventure.player.AdventurePlayer; import forge.adventure.pointofintrest.PointOfInterestChanges; +import forge.adventure.stage.GameHUD; import forge.adventure.util.CardUtil; import forge.adventure.util.Current; import forge.adventure.util.Reward; @@ -45,6 +46,7 @@ public class RewardScene extends UIScene { float flipCountDown=1.0f; public boolean done() { + GameHUD.getInstance().getTouchpad().setVisible(false); if(doneClicked) return true; diff --git a/forge-gui-mobile/src/forge/adventure/scene/SaveLoadScene.java b/forge-gui-mobile/src/forge/adventure/scene/SaveLoadScene.java index b7d45c03855..069e0823247 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/SaveLoadScene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/SaveLoadScene.java @@ -55,7 +55,8 @@ public class SaveLoadScene extends UIScene { private TextButton addSaveSlot(String name, int i) { - layout.add(Controls.newLabel(name)); + layout.add(Controls.newLabel(name)).colspan(1).align(Align.right).expandX(); + layout.add(Controls.newLabel(" ")); TextButton button = Controls.newTextButton("..."); button.addListener(new ClickListener() { @Override @@ -68,7 +69,7 @@ public class SaveLoadScene extends UIScene { } } }); - layout.add(button).expandX(); + layout.add(button).colspan(2).align(Align.left).expandX(); buttons.put(i, button); layout.row(); return button; @@ -223,7 +224,7 @@ public class SaveLoadScene extends UIScene { previewImage = ui.findActor("preview"); header = Controls.newLabel("Save"); header.setHeight(header.getHeight() * 2); - layout.add(header).colspan(2).align(Align.center); + layout.add(header).colspan(3).align(Align.center).expand(); layout.row(); autoSave=addSaveSlot("Auto save", WorldSave.AUTO_SAVE_SLOT); quickSave=addSaveSlot("Quick save", WorldSave.QUICK_SAVE_SLOT); diff --git a/forge-gui-mobile/src/forge/adventure/scene/SettingsScene.java b/forge-gui-mobile/src/forge/adventure/scene/SettingsScene.java index d5079b592f2..f0489a92478 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/SettingsScene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/SettingsScene.java @@ -229,8 +229,11 @@ public class SettingsScene extends UIScene { addCheckBox(localizer.getMessage("cbImageFetcher"), ForgePreferences.FPref.UI_ENABLE_ONLINE_IMAGE_FETCHER); - addCheckBox(localizer.getMessage("lblBattlefieldTextureFiltering"), ForgePreferences.FPref.UI_LIBGDX_TEXTURE_FILTERING); - addCheckBox(localizer.getMessage("lblAltZoneTabs"), ForgePreferences.FPref.UI_ALT_PLAYERZONETABS); + if (!GuiBase.isAndroid()) { + addCheckBox(localizer.getMessage("lblBattlefieldTextureFiltering"), ForgePreferences.FPref.UI_LIBGDX_TEXTURE_FILTERING); + addCheckBox(localizer.getMessage("lblAltZoneTabs"), ForgePreferences.FPref.UI_ALT_PLAYERZONETABS); + } + addCheckBox(localizer.getMessage("lblAnimatedCardTapUntap"), ForgePreferences.FPref.UI_ANIMATED_CARD_TAPUNTAP); if (!GuiBase.isAndroid()) { addCheckBox(localizer.getMessage("lblBorderMaskOption"), ForgePreferences.FPref.UI_ENABLE_BORDER_MASKING); diff --git a/forge-gui-mobile/src/forge/adventure/scene/ShopScene.java b/forge-gui-mobile/src/forge/adventure/scene/ShopScene.java index bda6dcd7a47..72d0e0c3099 100644 --- a/forge-gui-mobile/src/forge/adventure/scene/ShopScene.java +++ b/forge-gui-mobile/src/forge/adventure/scene/ShopScene.java @@ -1,5 +1,6 @@ package forge.adventure.scene; +import forge.adventure.stage.GameHUD; import forge.screens.FScreen; /** @@ -22,6 +23,7 @@ public class ShopScene extends ForgeScene { @Override public void enter() { + GameHUD.getInstance().getTouchpad().setVisible(false); getScreen(); screen.refresh(); super.enter(); diff --git a/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java b/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java index 80430de819a..0407761e4f3 100644 --- a/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java +++ b/forge-gui-mobile/src/forge/adventure/stage/GameHUD.java @@ -139,6 +139,10 @@ public class GameHUD extends Stage { return instance == null ? instance = new GameHUD(WorldStage.getInstance()) : instance; } + public Touchpad getTouchpad() { + return touchpad; + } + @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { touchpad.setVisible(false); diff --git a/forge-gui-mobile/src/forge/adventure/util/RewardActor.java b/forge-gui-mobile/src/forge/adventure/util/RewardActor.java index 3266a7d2dda..6708e3836dc 100644 --- a/forge-gui-mobile/src/forge/adventure/util/RewardActor.java +++ b/forge-gui-mobile/src/forge/adventure/util/RewardActor.java @@ -12,9 +12,12 @@ import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.ui.Image; +import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.Tooltip; +import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; +import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Disposable; import forge.Forge; import forge.adventure.scene.RewardScene; @@ -26,28 +29,27 @@ import forge.util.ImageFetcher; /** * Render the rewards as a card on the reward scene. - * */ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callback { Tooltip tooltip; + HoldTooltip holdTooltip; Reward reward; static TextureRegion backTexture; Texture image; boolean needsToBeDisposed; - float flipProcess=0; - boolean clicked=false; + float flipProcess = 0; + boolean clicked = false; boolean flipOnClick; private boolean hover; static final ImageFetcher fetcher = GuiBase.getInterface().getImageFetcher(); Image toolTipImage; + @Override public void dispose() { - - if(needsToBeDisposed) + if (needsToBeDisposed) image.dispose(); - } public Reward getReward() { @@ -56,53 +58,43 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb @Override public void onImageFetched() { - setCardImage(ImageCache.getImage(reward.getCard().getImageKey(false),false)); + setCardImage(ImageCache.getImage(reward.getCard().getImageKey(false), false)); } - public RewardActor(Reward reward,boolean flippable) - { - - this.flipOnClick=flippable; - this.reward=reward; - if(backTexture==null) - { - backTexture= FSkin.getSleeves().get(0); + public RewardActor(Reward reward, boolean flippable) { + this.flipOnClick = flippable; + this.reward = reward; + if (backTexture == null) { + backTexture = FSkin.getSleeves().get(0); } - switch (reward.type) - { - case Card: - if(ImageCache.imageKeyFileExists(reward.getCard().getImageKey(false))) - { - setCardImage( ImageCache.getImage(reward.getCard().getImageKey(false),false)); - } - else - { + switch (reward.type) { + case Card: { + if (ImageCache.imageKeyFileExists(reward.getCard().getImageKey(false))) { + setCardImage(ImageCache.getImage(reward.getCard().getImageKey(false), false)); + } else { if (!ImageCache.imageKeyFileExists(reward.getCard().getImageKey(false))) { fetcher.fetchImage(reward.getCard().getImageKey(false), this); } } - break; - case Gold: - { + } + case Gold: { + TextureAtlas atlas = Config.instance().getAtlas("sprites/items.atlas"); + Sprite backSprite = atlas.createSprite("CardBack"); + Pixmap drawingMap = new Pixmap((int) backSprite.getWidth(), (int) backSprite.getHeight(), Pixmap.Format.RGBA8888); - TextureAtlas atlas= Config.instance().getAtlas("sprites/items.atlas"); - Sprite backSprite=atlas.createSprite("CardBack"); - Pixmap drawingMap=new Pixmap((int)backSprite.getWidth(),(int)backSprite.getHeight(), Pixmap.Format.RGBA8888); - - DrawOnPixmap.draw(drawingMap,backSprite); - Sprite gold=atlas.createSprite("Gold"); - DrawOnPixmap.draw(drawingMap,(int)((backSprite.getWidth()/2f)-gold.getWidth()/2f),(int)((backSprite.getHeight()/4f)*1f),gold); - DrawOnPixmap.drawText(drawingMap,String.valueOf(reward.getCount()),0,(int)((backSprite.getHeight()/4f)*2f),backSprite.getWidth()); + DrawOnPixmap.draw(drawingMap, backSprite); + Sprite gold = atlas.createSprite("Gold"); + DrawOnPixmap.draw(drawingMap, (int) ((backSprite.getWidth() / 2f) - gold.getWidth() / 2f), (int) ((backSprite.getHeight() / 4f) * 1f), gold); + DrawOnPixmap.drawText(drawingMap, String.valueOf(reward.getCount()), 0, (int) ((backSprite.getHeight() / 4f) * 2f), backSprite.getWidth()); image=new Texture(drawingMap); drawingMap.dispose(); - needsToBeDisposed=true; + needsToBeDisposed = true; break; } - case Life: - { + case Life: { TextureAtlas atlas = Config.instance().getAtlas("sprites/items.atlas"); Sprite backSprite = atlas.createSprite("CardBack"); Pixmap drawingMap = new Pixmap((int) backSprite.getWidth(), (int) backSprite.getHeight(), Pixmap.Format.RGBA8888); @@ -119,33 +111,40 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb } } addListener(new ClickListener() { - @Override - public void clicked(InputEvent event, float x, float y) { - if(flipOnClick) - flip(); - } @Override - public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor){ - hover=true; + public void clicked(InputEvent event, float x, float y) { + if (flipOnClick) + flip(); } + @Override - public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor){ - hover=false; + public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) { + hover = true; } - }); + + @Override + public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor) { + hover = false; + } + }); } private void setCardImage(Texture img) { - image=img; - if(Forge.isTextureFilteringEnabled()) - image.setFilter(Texture.TextureFilter.MipMapLinearLinear,Texture.TextureFilter.Linear); - TextureRegionDrawable drawable=new TextureRegionDrawable(new TextureRegion(image)); - drawable.setMinSize((Scene.GetIntendedHeight()/ RewardScene.CARD_WIDTH_TO_HEIGHT)*0.95f,Scene.GetIntendedHeight()*0.95f); - toolTipImage=new Image(drawable); - tooltip=new Tooltip(toolTipImage); + image = img; + if (Forge.isTextureFilteringEnabled()) + image.setFilter(Texture.TextureFilter.MipMapLinearLinear, Texture.TextureFilter.Linear); + TextureRegionDrawable drawable = new TextureRegionDrawable(ImageCache.croppedBorderImage(image)); + drawable.setMinSize((Scene.GetIntendedHeight() / RewardScene.CARD_WIDTH_TO_HEIGHT) * 0.95f, Scene.GetIntendedHeight() * 0.95f); + toolTipImage = new Image(drawable); + tooltip = new Tooltip(toolTipImage); + holdTooltip = new HoldTooltip(new Image(drawable)); tooltip.setInstant(true); - if(frontSideUp()) - addListener(tooltip); + if (frontSideUp()) { + if (GuiBase.isAndroid()) + addListener(holdTooltip); + else + addListener(tooltip); + } } private boolean frontSideUp() { @@ -153,79 +152,77 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb } public boolean isFlipped() { - - return (clicked&&flipProcess>=1); + return (clicked && flipProcess >= 1); } + public void flip() { - - if(clicked) + if (clicked) return; - clicked=true; - flipProcess=0; + clicked = true; + flipProcess = 0; } - @Override - public void act(float delta) - { - super.act(delta); - if(clicked) - { - if(flipProcess<1) - flipProcess+=delta; - else - flipProcess=1; - if(tooltip!=null&&frontSideUp()&&!getListeners().contains(tooltip,true)) - addListener(tooltip); + @Override + public void act(float delta) { + super.act(delta); + if (clicked) { + if (flipProcess < 1) + flipProcess += delta; + else + flipProcess = 1; + + if (GuiBase.isAndroid()) { + if (holdTooltip != null && frontSideUp() && !getListeners().contains(holdTooltip, true)) { + addListener(holdTooltip); + } + } else { + if (tooltip != null && frontSideUp() && !getListeners().contains(tooltip, true)) { + addListener(tooltip); + } + } // flipProcess=(float)Gdx.input.getX()/ (float)Gdx.graphics.getWidth(); } } - @Override - public void draw (Batch batch, float parentAlpha) { + @Override + public void draw(Batch batch, float parentAlpha) { applyTransform(batch, computeTransform(batch.getTransformMatrix().cpy())); oldProjectionTransform.set(batch.getProjectionMatrix()); applyProjectionMatrix(batch); - if(hover) - batch.setColor(0.5f,0.5f,0.5f,1); + if (hover) + batch.setColor(0.5f, 0.5f, 0.5f, 1); - if(!frontSideUp()) - { - batch.draw(backTexture,-getWidth()/2,-getHeight()/2,getWidth(),getHeight()); - } - else - { + if (!frontSideUp()) { + batch.draw(backTexture, -getWidth() / 2, -getHeight() / 2, getWidth(), getHeight()); + } else { drawFrontSide(batch); } - batch.setColor(1,1,1,1); + batch.setColor(1, 1, 1, 1); resetTransform(batch); batch.setProjectionMatrix(oldProjectionTransform); } private void drawFrontSide(Batch batch) { - float width; float x; - if(flipOnClick) - { - width=-getWidth(); - x=-getWidth()/2+getWidth(); - } - else - { - width=getWidth(); - x=-getWidth()/2; + if (flipOnClick) { + width = -getWidth(); + x = -getWidth() / 2 + getWidth(); + } else { + width = getWidth(); + x = -getWidth() / 2; } - if (image != null) - batch.draw(image,x,-getHeight()/2,width,getHeight()); + if (image != null) { + batch.draw(ImageCache.croppedBorderImage(image), x, -getHeight() / 2, width, getHeight()); + } else - batch.draw(ImageCache.defaultImage,x,-getHeight()/2,width,getHeight()); - switch (reward.getType()) - { + batch.draw(ImageCache.defaultImage, x, -getHeight() / 2, width, getHeight()); + switch (reward.getType()) { case Card: break; @@ -237,23 +234,22 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb } private void applyProjectionMatrix(Batch batch) { - final Vector3 direction = new Vector3(0, 0, -1); final Vector3 up = new Vector3(0, 1, 0); //final Vector3 position = new Vector3( getX()+getWidth()/2 , getY()+getHeight()/2, 0); - final Vector3 position = new Vector3( Scene.GetIntendedWidth() /2f , Scene.GetIntendedHeight()/2f, 0); + final Vector3 position = new Vector3(Scene.GetIntendedWidth() / 2f, Scene.GetIntendedHeight() / 2f, 0); - float fov=67; - Matrix4 projection=new Matrix4(); - Matrix4 view=new Matrix4(); - float hy= Scene.GetIntendedHeight()/2f; - float a= (float) ((hy)/Math.sin(MathUtils.degreesToRadians*(fov/2f))); - float height= (float) Math.sqrt((a*a)-(hy*hy)); - position.z=height*1f; - float far=height*2f; - float near=height*0.8f; + float fov = 67; + Matrix4 projection = new Matrix4(); + Matrix4 view = new Matrix4(); + float hy = Scene.GetIntendedHeight() / 2f; + float a = (float) ((hy) / Math.sin(MathUtils.degreesToRadians * (fov / 2f))); + float height = (float) Math.sqrt((a * a) - (hy * hy)); + position.z = height * 1f; + float far = height * 2f; + float near = height * 0.8f; - float aspect = (float)Scene.GetIntendedWidth() / (float)Scene.GetIntendedHeight(); + float aspect = (float) Scene.GetIntendedWidth() / (float) Scene.GetIntendedHeight(); projection.setToProjection(Math.abs(near), Math.abs(far), fov, aspect); view.setToLookAt(position, position.cpy().add(direction), up); Matrix4.mul(projection.val, view.val); @@ -262,39 +258,69 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb } - private final Matrix4 computedTransform = new Matrix4(); private final Matrix4 oldTransform = new Matrix4(); private final Matrix4 oldProjectionTransform = new Matrix4(); - protected void applyTransform (Batch batch, Matrix4 transform) - { + protected void applyTransform(Batch batch, Matrix4 transform) { oldTransform.set(batch.getTransformMatrix()); batch.setTransformMatrix(transform); } - /** Restores the batch transform to what it was before {@link #applyTransform(Batch, Matrix4)}. Note this causes the batch to - * be flushed. */ - protected void resetTransform (Batch batch) { + /** + * Restores the batch transform to what it was before {@link #applyTransform(Batch, Matrix4)}. Note this causes the batch to + * be flushed. + */ + protected void resetTransform(Batch batch) { batch.setTransformMatrix(oldTransform); } - protected Matrix4 computeTransform (Matrix4 worldTransform) { - - float[] val=worldTransform.getValues(); + protected Matrix4 computeTransform(Matrix4 worldTransform) { + float[] val = worldTransform.getValues(); //val[Matrix4.M32]=0.0002f; worldTransform.set(val); float originX = this.getOriginX(), originY = this.getOriginY(); - worldTransform.translate(getX()+getWidth()/2 , getY()+getHeight()/2,0); - if(clicked) - { - worldTransform.rotate(0,1,0,180*flipProcess); + worldTransform.translate(getX() + getWidth() / 2, getY() + getHeight() / 2, 0); + if (clicked) { + worldTransform.rotate(0, 1, 0, 180 * flipProcess); } computedTransform.set(worldTransform); return computedTransform; - - - } + class HoldTooltip extends ActorGestureListener { + Image tooltip_image; + Table tooltip_actor; + //Vector2 tmp = new Vector2(); + + public HoldTooltip(Image tooltip_image) { + this.tooltip_image = tooltip_image; + + tooltip_actor = new Table(); + tooltip_actor.add(this.tooltip_image); + tooltip_actor.align(Align.center); + tooltip_actor.setSize(this.tooltip_image.getPrefWidth(), this.tooltip_image.getPrefHeight()); + + getGestureDetector().setLongPressSeconds(0.1f); + } + + @Override + public boolean longPress(Actor actor, float x, float y) { + //Vector2 point = actor.localToStageCoordinates(tmp.set(x, y)); + tooltip_actor.setX(actor.getRight()); + if (tooltip_actor.getX() + tooltip_actor.getWidth() > 480) + tooltip_actor.setX(actor.getX() - tooltip_actor.getWidth()); + tooltip_actor.setY(270 / 2 - tooltip_actor.getHeight() / 2); + //tooltip_actor.setX(480/2 - tooltip_actor.getWidth()/2); //480 hud width + //tooltip_actor.setY(270/2-tooltip_actor.getHeight()/2); //270 hud height + actor.getStage().addActor(tooltip_actor); + return super.longPress(actor, x, y); + } + + @Override + public void touchUp(InputEvent event, float x, float y, int pointer, int button) { + tooltip_actor.remove(); + super.touchUp(event, x, y, pointer, button); + } + } } diff --git a/forge-gui-mobile/src/forge/adventure/util/UIActor.java b/forge-gui-mobile/src/forge/adventure/util/UIActor.java index 40e314098a6..31aa69cf44a 100644 --- a/forge-gui-mobile/src/forge/adventure/util/UIActor.java +++ b/forge-gui-mobile/src/forge/adventure/util/UIActor.java @@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; +import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextField; import com.badlogic.gdx.scenes.scene2d.ui.Window; @@ -50,6 +51,10 @@ public class UIActor extends Group { newActor = new Label("", Controls.GetSkin()); readLabelProperties((Label) newActor, new OrderedMap.OrderedMapEntries<>(element)); break; + case "Table": + newActor = new Table(Controls.GetSkin()); + readTableProperties((Table) newActor, new OrderedMap.OrderedMapEntries<>(element)); + break; case "Image": newActor = new Image(); readImageProperties((Image) newActor, new OrderedMap.OrderedMapEntries<>(element)); @@ -161,6 +166,16 @@ public class UIActor extends Group { } } + private void readTableProperties(Table newActor, ObjectMap.Entries entries) { + for (ObjectMap.Entry property : entries) { + switch (property.key.toString()) { + case "font": + newActor.getSkin().get(Label.LabelStyle.class).font = Controls.GetSkin().getFont(property.value.toString()); + break; + } + } + } + private void readSelectorProperties(Selector newActor, ObjectMap.Entries entries) { } diff --git a/forge-gui-mobile/src/forge/screens/TransitionScreen.java b/forge-gui-mobile/src/forge/screens/TransitionScreen.java index 903e6360b7f..7e4ea808f59 100644 --- a/forge-gui-mobile/src/forge/screens/TransitionScreen.java +++ b/forge-gui-mobile/src/forge/screens/TransitionScreen.java @@ -9,6 +9,7 @@ import forge.Graphics; import forge.animation.ForgeAnimation; import forge.assets.FSkin; import forge.assets.FSkinImage; +import forge.assets.FSkinTexture; import forge.gui.GuiBase; import forge.toolbox.FContainer; @@ -34,7 +35,6 @@ public class TransitionScreen extends FContainer { private class BGAnimation extends ForgeAnimation { float DURATION = 0.6f; private float progress = 0; - 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")); public void drawBackground(Graphics g) { float percentage = progress / DURATION; @@ -46,9 +46,9 @@ public class TransitionScreen extends FContainer { } if (isloading) { g.fillRect(Color.BLACK, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); - if (transition_bg != null) { + if (FSkinTexture.BG_TEXTURE != null) { g.setAlphaComposite(percentage); - g.drawImage(transition_bg, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); + g.drawImage(FSkinTexture.BG_TEXTURE, 0, 0, Forge.getScreenWidth(), Forge.getScreenHeight()); g.setAlphaComposite(oldAlpha); } float xmod = Forge.getScreenHeight() > 2000 ? 1.5f : 1f; diff --git a/forge-gui/res/adventure/Shandalar/ui/hud.json b/forge-gui/res/adventure/Shandalar/ui/hud.json index c205ac9c566..7c857877c3c 100644 --- a/forge-gui/res/adventure/Shandalar/ui/hud.json +++ b/forge-gui/res/adventure/Shandalar/ui/hud.json @@ -1,95 +1,93 @@ { - "width": 480, - "height": 270, - "yDown": true, - "elements":[ + "width": 480, + "height": 270, + "yDown": true, + "elements": [ { - "type" : "Image", - "name" : "gamehud", - "width": 64, - "height": 206, - "image":"ui/hud.png", - "x": 416, - "y": 64 - } , + "type": "Image", + "name": "gamehud", + "width": 64, + "height": 206, + "image": "ui/hud.png", + "x": 416, + "y": 64 + }, { - "type" : "Image", - "name" : "map" , - "width": 64, - "height": 64, - "x": 416, - "y": 0 - } , + "type": "Image", + "name": "map", + "width": 64, + "height": 64, + "x": 416, + "y": 0 + }, { - "type" : "Image", - "image" : "ui/minimap.png" , - "width": 64, - "height": 64, - "x": 416, - "y": 0 - } , + "type": "Image", + "image": "ui/minimap.png", + "width": 64, + "height": 64, + "x": 416, + "y": 0 + }, { - "type" : "Image", - "name" : "avatar" , - "width": 32, - "height": 32, - "x": 432, - "y": 80 - } , + "type": "Image", + "name": "avatar", + "width": 32, + "height": 32, + "x": 432, + "y": 80 + }, { - "type" : "Image", - "image" : "ui/avatarhud.png" , - "width": 32, - "height": 32, - "x": 432, - "y": 80 - } , + "type": "Image", + "image": "ui/avatarhud.png", + "width": 32, + "height": 32, + "x": 432, + "y": 80 + }, { - "type" : "Label", - "name" : "lifePoints" , - "font" : "default" , - "width": 64, - "height": 16, - "x": 448, - "y": 128 - } , + "type": "Label", + "name": "lifePoints", + "font": "default", + "width": 64, + "height": 16, + "x": 448, + "y": 128 + }, { - "type" : "Label", - "name" : "money" , - "font" : "default" , - "width": 64, - "height": 16, - "x": 448, - "y": 144 - } , + "type": "Label", + "name": "money", + "font": "default", + "width": 64, + "height": 16, + "x": 448, + "y": 144 + }, { - "type" : "TextButton", - "name" : "deck" , - "text" : "Deck", - "width": 32, - "height": 24, - "x": 432, - "y": 176 - } , + "type": "TextButton", + "name": "deck", + "text": "Deck", + "width": 32, + "height": 24, + "x": 432, + "y": 176 + }, { - "type" : "TextButton", - "name" : "statistic" , - "text" : "Status", - "width": 32, - "height": 24, - "x": 432, - "y": 204 - } , - { - "type" : "TextButton", - "name" : "menu" , - "text" : "Menu", - "width": 32, - "height": 24, - "x": 432, - "y": 232 - } - ] - - + "type": "TextButton", + "name": "statistic", + "text": "Status", + "width": 32, + "height": 24, + "x": 432, + "y": 204 + }, + { + "type": "TextButton", + "name": "menu", + "text": "Menu", + "width": 32, + "height": 24, + "x": 432, + "y": 232 + } + ] } \ No newline at end of file diff --git a/forge-gui/res/adventure/Shandalar/ui/hud_mobile.json b/forge-gui/res/adventure/Shandalar/ui/hud_mobile.json index c64dd1086f9..241a554b0ae 100644 --- a/forge-gui/res/adventure/Shandalar/ui/hud_mobile.json +++ b/forge-gui/res/adventure/Shandalar/ui/hud_mobile.json @@ -1,95 +1,93 @@ { - "width": 480, - "height": 270, - "yDown": true, - "elements":[ + "width": 480, + "height": 270, + "yDown": true, + "elements": [ { - "type" : "Image", - "name" : "gamehud", - "width": 64, - "height": 270, - "image":"ui/hud_mobile.png", - "x": 416, - "y": 0 - } , + "type": "Image", + "name": "gamehud", + "width": 64, + "height": 270, + "image": "ui/hud_mobile.png", + "x": 416, + "y": 0 + }, { - "type" : "Image", - "name" : "map" , - "width": 80, - "height": 80, - "x": 0, - "y": 0 - } , + "type": "Image", + "name": "map", + "width": 80, + "height": 80, + "x": 0, + "y": 0 + }, { - "type" : "Image", - "image" : "ui/minimap.png" , - "width": 80, - "height": 80, - "x": 0, - "y": 0 - } , + "type": "Image", + "image": "ui/minimap.png", + "width": 80, + "height": 80, + "x": 0, + "y": 0 + }, { - "type" : "Image", - "name" : "avatar" , - "width": 46, - "height": 46, - "x": 425, - "y": 10 - } , + "type": "Image", + "name": "avatar", + "width": 46, + "height": 46, + "x": 425, + "y": 10 + }, { - "type" : "Image", - "image" : "ui/avatarhud.png" , - "width": 46, - "height": 46, - "x": 425, - "y": 10 - } , + "type": "Image", + "image": "ui/avatarhud.png", + "width": 46, + "height": 46, + "x": 425, + "y": 10 + }, { - "type" : "Label", - "name" : "lifePoints" , - "font" : "default" , - "width": 64, - "height": 16, - "x": 442, - "y": 64 - } , + "type": "Label", + "name": "lifePoints", + "font": "default", + "width": 64, + "height": 16, + "x": 442, + "y": 64 + }, { - "type" : "Label", - "name" : "money" , - "font" : "default" , - "width": 64, - "height": 16, - "x": 442, - "y": 82 - } , + "type": "Label", + "name": "money", + "font": "default", + "width": 64, + "height": 16, + "x": 442, + "y": 82 + }, { - "type" : "TextButton", - "name" : "deck" , - "text" : "Deck", - "width": 40, - "height": 44, - "x": 428, - "y": 106 - } , + "type": "TextButton", + "name": "deck", + "text": "Deck", + "width": 40, + "height": 44, + "x": 428, + "y": 106 + }, { - "type" : "TextButton", - "name" : "statistic" , - "text" : "Status", - "width": 40, - "height": 44, - "x": 428, - "y": 162 - } , - { - "type" : "TextButton", - "name" : "menu" , - "text" : "Menu", - "width": 40, - "height": 44, - "x": 428, - "y": 216 - } - ] - - + "type": "TextButton", + "name": "statistic", + "text": "Status", + "width": 40, + "height": 44, + "x": 428, + "y": 162 + }, + { + "type": "TextButton", + "name": "menu", + "text": "Menu", + "width": 40, + "height": 44, + "x": 428, + "y": 216 + } + ] } \ No newline at end of file diff --git a/forge-gui/res/adventure/Shandalar/ui/inn.json b/forge-gui/res/adventure/Shandalar/ui/inn.json index c6690c6aa32..9ef4fa3469e 100644 --- a/forge-gui/res/adventure/Shandalar/ui/inn.json +++ b/forge-gui/res/adventure/Shandalar/ui/inn.json @@ -1,44 +1,40 @@ { - "width": 480, - "height": 270, - "yDown": true, - "elements":[ + "width": 480, + "height": 270, + "yDown": true, + "elements": [ { - "type" : "Image", - "name":"lastScreen", + "type": "Image", + "name": "lastScreen", "width": 480, "height": 270 - } - , - + }, { - "type" : "TextButton", - "name" : "heal" , - "text" : "Heal" , - "width": 48, - "height": 16, - "x": 420, - "y": 10 - } , + "type": "TextButton", + "name": "heal", + "text": "Heal", + "width": 48, + "height": 16, + "x": 420, + "y": 10 + }, { - "type" : "TextButton", - "name" : "sell" , - "text" : "Sell cards" , - "width": 48, - "height": 16, - "x": 420, - "y": 34 - } , + "type": "TextButton", + "name": "sell", + "text": "Sell cards", + "width": 48, + "height": 16, + "x": 420, + "y": 34 + }, { - "type" : "TextButton", - "name" : "done" , - "text" : "Leave" , - "width": 48, - "height": 16, - "x": 420, - "y": 58 - } - ] - - + "type": "TextButton", + "name": "done", + "text": "Leave", + "width": 48, + "height": 16, + "x": 420, + "y": 58 + } + ] } \ No newline at end of file diff --git a/forge-gui/res/adventure/Shandalar/ui/items.json b/forge-gui/res/adventure/Shandalar/ui/items.json index 0d51f0cedd7..2b18c1e8f6a 100644 --- a/forge-gui/res/adventure/Shandalar/ui/items.json +++ b/forge-gui/res/adventure/Shandalar/ui/items.json @@ -1,33 +1,29 @@ { - "width": 480, - "height": 270, - "yDown": true, - "elements":[ + "width": 480, + "height": 270, + "yDown": true, + "elements": [ { - "type" : "Image", - "name":"lastScreen", + "type": "Image", + "name": "lastScreen", "width": 480, "height": 270 - } - , - - { + }, + { "name": "cards", - "x": 5, - "y": 5 , + "x": 5, + "y": 5, "width": 405, "height": 265 - } , + }, { - "type" : "TextButton", - "name" : "done" , - "text" : "Take all" , - "width": 48, - "height": 16, - "x": 420, - "y": 10 - } - ] - - + "type": "TextButton", + "name": "done", + "text": "Take all", + "width": 48, + "height": 16, + "x": 420, + "y": 10 + } + ] } \ No newline at end of file diff --git a/forge-gui/res/adventure/Shandalar/ui/new_game.json b/forge-gui/res/adventure/Shandalar/ui/new_game.json index 2b1fdbc1d65..83dbc5cadb4 100644 --- a/forge-gui/res/adventure/Shandalar/ui/new_game.json +++ b/forge-gui/res/adventure/Shandalar/ui/new_game.json @@ -1,166 +1,162 @@ { - "width": 480, - "height": 270, - "yDown": true, - "elements":[ + "width": 480, + "height": 270, + "yDown": true, + "elements": [ { - "type" : "Image", - "image":"ui/title_bg.png", + "type": "Image", + "image": "ui/title_bg.png", "width": 480, "height": 270 - } - , + }, { - "type" : "Scroll", - "style":"paper", - "x": 10, + "type": "Scroll", + "style": "paper", + "x": 10, "y": 10, "width": 256, "height": 236 - } - , + }, { - "type" : "Label", - "text" : "Create a Character", - "width": 128, - "height": 32, - "font":"blackbig", - "x": 16, - "y": 16 - } , + "type": "Label", + "text": "Create a Character", + "width": 128, + "height": 32, + "font": "blackbig", + "x": 16, + "y": 16 + }, { - "type" : "Label", - "text" : "Avatar:" , - "width": 128, - "height": 32, - "x": 16, - "y": 64 - } , + "type": "Label", + "text": "Avatar:", + "width": 128, + "height": 32, + "x": 16, + "y": 64 + }, { - "type" : "Label", - "text" : "Name:" , - "width": 128, - "height": 32, - "x": 16, - "y": 96 - } , + "type": "Label", + "text": "Name:", + "width": 128, + "height": 32, + "x": 16, + "y": 96 + }, { - "type" : "Label", - "text" : "Race:" , - "width": 128, - "height": 32, - "x": 16, - "y": 128 - } , + "type": "Label", + "text": "Race:", + "width": 128, + "height": 32, + "x": 16, + "y": 128 + }, { - "type" : "Label", - "text" : "Gender:" , - "width": 128, - "height": 32, - "x": 16, - "y": 160 - } , + "type": "Label", + "text": "Gender:", + "width": 128, + "height": 32, + "x": 16, + "y": 160 + }, { - "type" : "Label", - "text" : "Difficulty:" , - "width": 128, - "height": 32, - "x": 16, - "y": 192 - } , + "type": "Label", + "text": "Difficulty:", + "width": 128, + "height": 32, + "x": 16, + "y": 192 + }, { - "type" : "Label", - "text" : "Deck:" , - "width": 128, - "height": 32, - "x": 16, - "y": 224 - } , + "type": "Label", + "text": "Deck:", + "width": 128, + "height": 32, + "x": 16, + "y": 224 + }, { - "type" : "ImageButton", - "name" : "leftAvatar" , - "style" : "leftarrow" , - "width": 16, - "height": 16, - "x": 96, - "y": 64 - } , + "type": "ImageButton", + "name": "leftAvatar", + "style": "leftarrow", + "width": 16, + "height": 16, + "x": 96, + "y": 64 + }, { - "type" : "Image", - "name" : "avatarPreview" , - "width": 48, - "height": 48, - "x": 128, - "y": 48 - } , + "type": "Image", + "name": "avatarPreview", + "width": 48, + "height": 48, + "x": 128, + "y": 48 + }, { - "type" : "ImageButton", - "name" : "rightAvatar" , - "style" : "rightarrow" , - "width": 16, - "height": 16, - "x": 192, - "y": 64 - } , + "type": "ImageButton", + "name": "rightAvatar", + "style": "rightarrow", + "width": 16, + "height": 16, + "x": 192, + "y": 64 + }, { - "type" : "TextField", - "name" : "nameField" , - "width": 112, - "height": 16, - "x": 96, - "y": 96 - } , + "type": "TextField", + "name": "nameField", + "width": 112, + "height": 16, + "x": 96, + "y": 96 + }, { - "type" : "Selector", - "name" : "race" , - "width": 112, - "height": 16, - "x": 96, - "y": 128 - } , + "type": "Selector", + "name": "race", + "width": 112, + "height": 16, + "x": 96, + "y": 128 + }, { - "type" : "Selector", - "name" : "gender" , - "width": 112, - "height": 16, - "x": 96, - "y": 160 - } , + "type": "Selector", + "name": "gender", + "width": 112, + "height": 16, + "x": 96, + "y": 160 + }, { - "type" : "Selector", - "name" : "difficulty" , - "width": 112, - "height": 16, - "x": 96, - "y": 192 - } , + "type": "Selector", + "name": "difficulty", + "width": 112, + "height": 16, + "x": 96, + "y": 192 + }, { - "type" : "Selector", - "name" : "deck" , - "width": 112, - "height": 16, - "x": 96, - "y": 224 - } , + "type": "Selector", + "name": "deck", + "width": 112, + "height": 16, + "x": 96, + "y": 224 + }, { - "type" : "TextButton", - "name" : "back" , - "text" : "Back" , - "width": 38, - "height": 16, - "x": 352, - "y": 240 - } , + "type": "TextButton", + "name": "back", + "text": "Back", + "width": 38, + "height": 16, + "x": 352, + "y": 240 + }, { - "type" : "TextButton", - "name" : "start" , - "text" : "Start" , - "width": 38, - "height": 16, - "x": 416, - "y": 240 - } - ] - - + "type": "TextButton", + "name": "start", + "text": "Start", + "width": 38, + "height": 16, + "x": 416, + "y": 240 + } + ] } \ No newline at end of file diff --git a/forge-gui/res/adventure/Shandalar/ui/save_load.json b/forge-gui/res/adventure/Shandalar/ui/save_load.json index cb856c72996..a89b02dd8e7 100644 --- a/forge-gui/res/adventure/Shandalar/ui/save_load.json +++ b/forge-gui/res/adventure/Shandalar/ui/save_load.json @@ -1,51 +1,51 @@ { - "width": 480, - "height": 270, - "yDown": true, - "elements":[ + "width": 480, + "height": 270, + "yDown": true, + "elements": [ { - "type" : "Image", - "image":"ui/title_bg.png", + "type": "Image", + "image": "ui/title_bg.png", "width": 480, "height": 270 - } , - + }, { - "type" : "Image", + "type": "Image", "name": "preview", - "x": 364, - "y": 10 , + "x": 364, + "y": 10, "width": 96, "height": 54 - } , - + }, { - "type" : "Scroll", + "type": "Scroll", "name": "saveSlots", - "x": 10, - "y": 10 , + "x": 10, + "y": 10, "width": 344, "height": 235 - } , + }, { - "type" : "TextButton", - "name" : "return" , - "text" : "Back" , - "width": 48, - "height": 16, - "x": 15, - "y": 250 - } , + "type": "TextButton", + "name": "return", + "text": "Back", + "width": 48, + "height": 16, + "x": 15, + "y": 250 + }, { - "type" : "TextButton", - "name" : "save" , - "text" : "saveLoad" , - "width": 48, - "height": 16, - "x": 115, - "y": 250 - } - ] - - + "type": "TextButton", + "name": "save", + "text": "saveLoad", + "width": 48, + "height": 16, + "x": 115, + "y": 250 + }, + { + "type": "Table", + "font": "default" + } + ] } \ No newline at end of file diff --git a/forge-gui/res/adventure/Shandalar/ui/settings.json b/forge-gui/res/adventure/Shandalar/ui/settings.json index ec4fb69f80f..19824ddb3d3 100644 --- a/forge-gui/res/adventure/Shandalar/ui/settings.json +++ b/forge-gui/res/adventure/Shandalar/ui/settings.json @@ -1,33 +1,30 @@ { - "width": 480, - "height": 270, - "yDown": true, - "elements":[ + "width": 480, + "height": 270, + "yDown": true, + "elements": [ { - "type" : "Image", - "image":"ui/title_bg.png", + "type": "Image", + "image": "ui/title_bg.png", "width": 480, "height": 270 - } , - + }, { - "type" : "Scroll", + "type": "Scroll", "name": "settings", - "x": 10, - "y": 10 , + "x": 10, + "y": 10, "width": 450, "height": 235 - } , + }, { - "type" : "TextButton", - "name" : "return" , - "text" : "Back" , - "width": 48, - "height": 16, - "x": 15, - "y": 250 - } - ] - - + "type": "TextButton", + "name": "return", + "text": "Back", + "width": 48, + "height": 16, + "x": 15, + "y": 250 + } + ] } \ No newline at end of file diff --git a/forge-gui/res/adventure/Shandalar/ui/statistic.json b/forge-gui/res/adventure/Shandalar/ui/statistic.json index 2de78c04541..729111c988d 100644 --- a/forge-gui/res/adventure/Shandalar/ui/statistic.json +++ b/forge-gui/res/adventure/Shandalar/ui/statistic.json @@ -2,96 +2,103 @@ "width": 480, "height": 270, "yDown": true, - "elements":[ + "elements": [ { - "type" : "Image", - "image":"ui/title_bg.png", + "type": "Image", + "image": "ui/title_bg.png", "width": 480, "height": 270 - } , - + }, { - "type" : "Scroll", + "type": "Scroll", "name": "enemies", "x": 206, - "y": 10 , + "y": 10, "width": 256, "height": 235 - } , + }, { - "type" : "Image", + "type": "Image", "name": "avatar", "x": 10, - "y": 10 , + "y": 10, "width": 64, "height": 64 - } , + }, { - "type" : "Label", + "type": "Label", "name": "totalWins", "x": 90, - "y": 84 , + "y": 84, "width": 80, - "height": 24 - } , + "height": 24, + "font": "default" + }, { - "type" : "Label", + "type": "Label", "text": "Win:", "x": 10, - "y": 84 , + "y": 84, "width": 80, - "height": 24 - } , + "height": 24, + "font": "default" + }, { - "type" : "Label", + "type": "Label", "name": "totalLoss", "x": 90, - "y": 104 , + "y": 104, "width": 80, - "height": 24 - } , + "height": 24, + "font": "default" + }, { - "type" : "Label", + "type": "Label", "text": "Loss:", "x": 10, - "y": 104 , + "y": 104, "width": 80, - "height": 24 - } , + "height": 24, + "font": "default" + }, { - "type" : "Label", + "type": "Label", "name": "lossWinRatio", "x": 90, - "y": 124 , + "y": 124, "width": 80, - "height": 24 - } , + "height": 24, + "font": "default" + }, { - "type" : "Label", + "type": "Label", "text": "Win Loss Ratio:", "x": 10, - "y": 124 , + "y": 124, "width": 80, - "height": 24 - } , + "height": 24, + "font": "default" + }, { - "type" : "Image", - "image" : "ui/avatarhud.png" , + "type": "Image", + "image": "ui/avatarhud.png", "x": 10, - "y": 10 , + "y": 10, "width": 64, "height": 64 - } , + }, { - "type" : "TextButton", - "name" : "return" , - "text" : "Back" , + "type": "TextButton", + "name": "return", + "text": "Back", "width": 48, "height": 16, "x": 15, "y": 250 + }, + { + "type": "Table", + "font": "default" } ] - - } \ No newline at end of file