integrated Textra for Labels and Buttons

fixed executables for release
This commit is contained in:
Grimm
2022-09-18 17:44:28 +02:00
parent a601ef5ec7
commit 93bdec1f2d
50 changed files with 214 additions and 178 deletions

View File

@@ -19,6 +19,13 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>4thline-repo</id>
<url>http://4thline.org/m2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
@@ -62,7 +69,7 @@
<jar>${project.build.finalName}-jar-with-dependencies.jar</jar>
<dontWrapJar>true</dontWrapJar>
<errTitle>forge</errTitle>
<icon>src/main/config/forge-adventure.ico</icon>
<icon>src/main/config/forge-adventure-editor.ico</icon>
<classPath>
<mainClass>forge.adventure.Main</mainClass>
<addDependencies>false</addDependencies>
@@ -110,7 +117,7 @@
<dontWrapJar>true</dontWrapJar>
<errTitle>forge</errTitle>
<downloadUrl>https://www.oracle.com/java/technologies/downloads/</downloadUrl>
<icon>src/main/config/forge-adventure.ico</icon>
<icon>src/main/config/forge-adventure-editor.ico</icon>
<classPath>
<mainClass>forge.adventure.Main</mainClass>
<addDependencies>false</addDependencies>
@@ -297,12 +304,6 @@
<version>22.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>forge</groupId>
<artifactId>forge-gui-mobile</artifactId>
<version>1.6.54-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx-controllers</groupId>
<artifactId>gdx-controllers-desktop</artifactId>

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@@ -560,11 +560,17 @@
<fileset dir="${project.build.directory}" includes="forge-java8.exe" />
<fileset dir="${project.build.directory}" includes="forge.exe" />
<fileset dir="${project.build.directory}" includes="${project.build.finalName}-jar-with-dependencies.jar" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure.exe" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure-java8.exe" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure.sh" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure.command" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure.cmd" />
<fileset dir="${project.build.directory}/../../forge-gui-mobile-dev/target" includes="forge-adventure.exe" />
<fileset dir="${project.build.directory}/../../forge-gui-mobile-dev/target" includes="forge-adventure-java8.exe" />
<fileset dir="${project.build.directory}/../../forge-gui-mobile-dev/target" includes="forge-adventure.sh" />
<fileset dir="${project.build.directory}/../../forge-gui-mobile-dev/target" includes="forge-adventure.command" />
<fileset dir="${project.build.directory}/../../forge-gui-mobile-dev/target" includes="forge-adventure.cmd" />
<fileset dir="${project.build.directory}/../../forge-gui-mobile-dev/target" includes="forge-gui-mobile-dev-${project.version}-jar-with-dependencies.jar" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure-editor.exe" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure-editor-java8.exe" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure-editor.sh" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure-editor.command" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure-editor.cmd" />
<fileset dir="${project.build.directory}/../../forge-adventure/target" includes="forge-adventure-${project.version}-jar-with-dependencies.jar" />
</copy>
<mkdir dir="${project.build.directory}/${project.build.finalName}/res/cardsfolder" />
@@ -575,10 +581,15 @@
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure.sh" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure.command" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure.cmd" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure-editor.sh" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure-editor.command" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure-editor.cmd" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-java8.exe" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge.exe" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure.exe" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure-java8.exe" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure-editor.exe" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge-adventure-editor-java8.exe" perm="a+rx" />
<tar destfile="${project.build.directory}/${project.build.finalName}.tar.bz2" compression="bzip2">
<tarfileset filemode="755" dir="${project.build.directory}/${project.build.finalName}">
<include name="forge.sh" />

View File

@@ -22,6 +22,8 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) {
@@ -46,18 +48,27 @@ public class Main {
}
// Set this to "true" to make the mobile game port run as a full-screen desktop application
boolean desktopMode = cmd.hasOption("fullscreen");
boolean desktopMode = true;//cmd.hasOption("fullscreen");
// Set this to the location where you want the mobile game port to look for assets when working as a full-screen desktop application
// (uncomment the bottom version and comment the top one to load the res folder from the current folder the .jar is in if you would
// like to make the game load from a desktop game folder configuration).
String desktopModeAssetsDir = "../forge-gui/";
//String desktopModeAssetsDir = "./";
//String desktopModeAssetsDir = "../forge-gui/";
String desktopModeAssetsDir = "./";
if(!Files.exists(Paths.get(desktopModeAssetsDir+"res")))
desktopModeAssetsDir = "../forge-gui/";//try IDE run
// Assets directory used when the game fully emulates smartphone/tablet mode (desktopMode = false), useful when debugging from IDE
String assetsDir = AssetsDownloader.SHARE_DESKTOP_ASSETS ? "../forge-gui/" : "testAssets/";
String assetsDir ;
if (!AssetsDownloader.SHARE_DESKTOP_ASSETS) {
assetsDir= "testAssets/";
FileUtil.ensureDirectoryExists(assetsDir);
}
else
{
assetsDir= "./";
if(!Files.exists(Paths.get(assetsDir+"res")))
assetsDir = "../forge-gui/";
}
// Place the file "switch_orientation.ini" to your assets folder to make the game switch to landscape orientation (unless desktopMode = true)
String switchOrientationFile = assetsDir + "switch_orientation.ini";
@@ -73,6 +84,7 @@ public class Main {
screenWidth = Integer.parseInt(res[0].trim());
screenHeight = Integer.parseInt(res[1].trim());
}
desktopMode=false;
}
// Fullscreen width and height for desktop mode (desktopMode = true)

View File

@@ -20,7 +20,7 @@ public class CharacterSprite extends MapActor {
private Animation<TextureRegion> currentAnimation = null;
private AnimationTypes currentAnimationType = AnimationTypes.Idle;
private AnimationDirections currentAnimationDir = AnimationDirections.None;
private Array<Sprite> avatar=new Array<>();
private final Array<Sprite> avatar=new Array<>();
public boolean hidden = false;
public CharacterSprite(int id,String path) {
@@ -40,10 +40,6 @@ public class CharacterSprite extends MapActor {
protected void load(String path) {
if(path==null||path.isEmpty())return;
TextureAtlas atlas = Config.instance().getAtlas(path);
/*
for (Texture texture : new ObjectSet.ObjectSetIterator<>( atlas.getTextures()))
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
*/
animations.clear();
for (AnimationTypes stand : AnimationTypes.values()) {
if (stand == AnimationTypes.Avatar) {

View File

@@ -25,7 +25,7 @@ public class MapActor extends Actor {
removeIfEffectsAreFinished=true;
}
class CurrentEffect
static class CurrentEffect
{
public CurrentEffect(String path,ParticleEffect effect,Vector2 offset,boolean overlay)
{
@@ -35,7 +35,7 @@ public class MapActor extends Actor {
this.overlay=overlay;
}
private String path;
private final String path;
public ParticleEffect effect;
public Vector2 offset;
public boolean overlay=true;
@@ -63,7 +63,7 @@ public class MapActor extends Actor {
{
ParticleEffect effect = new ParticleEffect();
effect.load(Config.instance().getFile(path),Config.instance().getFile(path).parent());
effects.add(new CurrentEffect(path,effect,offset,overlay));
effects.add(new CurrentEffect(path, effect, offset, overlay));
if(duration!=0)//ParticleEffect.setDuration uses an integer for some reason
{
for(ParticleEmitter emitter:effect.getEmitters()){

View File

@@ -11,7 +11,7 @@ import forge.adventure.util.Reward;
*/
public class RewardSprite extends CharacterSprite {
private final String default_reward = "[\n" +
private final static String default_reward = "[\n" +
"\t\t{\n" +
"\t\t\t\"type\": \"gold\",\n" +
"\t\t\t\"count\": 10,\n" +

View File

@@ -26,7 +26,7 @@ public class BiomeSpriteData implements SaveFileContent {
startArea=data.readDouble("startArea");
endArea=data.readDouble("endArea");
density=data.readDouble("density");
resolution=data.readDouble("resolution");;
resolution=data.readDouble("resolution");
layer=data.readInt("layer");
}

View File

@@ -45,10 +45,14 @@ public class BiomeStructureData {
this.structureAtlasPath=biomeStructureData.structureAtlasPath;
this.sourcePath=biomeStructureData.sourcePath;
this.maskPath=biomeStructureData.maskPath;
this.periodicInput=biomeStructureData.periodicInput;
this.x=biomeStructureData.x;
this.y=biomeStructureData.y;
this.width=biomeStructureData.width;
this.height=biomeStructureData.height;
this.periodicOutput=biomeStructureData.periodicOutput;
this.symmetry=biomeStructureData.symmetry;
this.ground=biomeStructureData.ground;
this.randomPosition=biomeStructureData.randomPosition;
if(biomeStructureData.mappingInfo!=null)
{

View File

@@ -65,7 +65,7 @@ public class EffectData implements Serializable {
if(name != null && !name.isEmpty()) description += name + "\n";
if(colorView) description += "Manasight.\n";
if(lifeModifier != 0)
description += "Life: " + ((lifeModifier > 0) ? "+" : "") + lifeModifier + "\n";
description += "[+Life] " + ((lifeModifier > 0) ? "+" : "") + lifeModifier + "\n";
if(startBattleWithCard != null && startBattleWithCard.length != 0)
description+="Cards on battlefield: \n" + cardNames() + "\n";
if(changeStartCards != 0)

View File

@@ -42,6 +42,8 @@ public class EnemyData {
life = enemyData.life;
equipment = enemyData.equipment;
colors = enemyData.colors;
teamNumber = enemyData.teamNumber;
nextEnemy =enemyData.nextEnemy==null?null: new EnemyData(enemyData.nextEnemy);
if(enemyData.rewards == null) {
rewards=null;
} else {

View File

@@ -43,6 +43,9 @@ public class ItemData {
iconName = cpy.iconName;
questItem = cpy.questItem;
cost = cpy.cost;
usableInPoi = cpy.usableInPoi;
usableOnWorldMap = cpy.usableOnWorldMap;
commandOnUse = cpy.commandOnUse;
manaNeeded = cpy.manaNeeded;
}
@@ -62,7 +65,7 @@ public class ItemData {
Json json = new Json();
FileHandle handle = Config.instance().getFile(Paths.ITEMS);
if (handle.exists()) {
Array readJson = json.fromJson(Array.class, ItemData.class, handle);
Array<ItemData> readJson = json.fromJson(Array.class, ItemData.class, handle);
itemList = readJson;
}
@@ -88,7 +91,7 @@ public class ItemData {
if(effect != null)
result += effect.getDescription();
if(manaNeeded != 0)
result += "Mana cost: "+manaNeeded;
result += manaNeeded+" [Mana]";
return result;
}

View File

@@ -58,5 +58,7 @@ public class PointOfInterestData {
sprite=other.sprite;
map=other.map;
radiusFactor=other.radiusFactor;
offsetX=other.offsetX;
offsetY=other.offsetY;
}
}

View File

@@ -66,12 +66,12 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
private boolean announceCustom = false;
// Signals
SignalList onLifeTotalChangeList = new SignalList();
SignalList onManaTotalChangeList = new SignalList();
SignalList onGoldChangeList = new SignalList();
SignalList onPlayerChangeList = new SignalList();
SignalList onEquipmentChange = new SignalList();
SignalList onBlessing = new SignalList();
final SignalList onLifeTotalChangeList = new SignalList();
final SignalList onManaTotalChangeList = new SignalList();
final SignalList onGoldChangeList = new SignalList();
final SignalList onPlayerChangeList = new SignalList();
final SignalList onEquipmentChange = new SignalList();
final SignalList onBlessing = new SignalList();
public AdventurePlayer() { clear(); }
@@ -458,7 +458,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
public boolean fullHeal() {
if (life < maxLife) {
life = Math.max(maxLife, life);
life = maxLife;
onLifeTotalChangeList.emit();
return true;
}

View File

@@ -13,7 +13,7 @@ import java.util.HashSet;
public class PointOfInterestChanges implements SaveFileContent {
private final HashSet<Integer> deletedObjects=new HashSet<>();
private final HashMap<Integer, HashSet<Integer>> cardsBought = new HashMap<>();
private java.util.Map<String, Byte> mapFlags = new HashMap<>();
private final java.util.Map<String, Byte> mapFlags = new HashMap<>();
public static class Map extends HashMap<String,PointOfInterestChanges> implements SaveFileContent {
@Override

View File

@@ -97,7 +97,7 @@ import java.util.Map;
private final FLabel btnMoreOptions = deckHeader.add(new FLabel.Builder().text("...").font(FSkinFont.get(20)).align(Align.center).pressedColor(Header.BTN_PRESSED_COLOR).build());
boolean isShop=false;
boolean isShop;
public AdventureDeckEditor(boolean createAsShop) {
super(e -> leave(),getPages());

View File

@@ -29,7 +29,7 @@ public class ArenaScene extends UIScene implements IAfterMatch {
private static ArenaScene object;
private final float gridSize;
private ArenaData arenaData;
private TextraButton startButton;
private final TextraButton startButton;
public static ArenaScene instance() {
if(object==null)
@@ -37,24 +37,24 @@ public class ArenaScene extends UIScene implements IAfterMatch {
return object;
}
private TextraButton doneButton;
private final TextraButton doneButton;
Dialog startDialog;
Dialog areYouSureDialog;
private TextraLabel goldLabel;
private final TextraLabel goldLabel;
private Group arenaPlane;
private Random rand=new Random();
private final Group arenaPlane;
private final Random rand=new Random();
Sprite fighterSpot;
Sprite lostOverlay;
Sprite up;
Sprite upWin;
Sprite side;
Sprite sideWin;
Sprite edge;
Sprite edgeM;
Sprite edgeWin;
Sprite edgeWinM;
final Sprite fighterSpot;
final Sprite lostOverlay;
final Sprite up;
final Sprite upWin;
final Sprite side;
final Sprite sideWin;
final Sprite edge;
final Sprite edgeM;
final Sprite edgeWin;
final Sprite edgeWinM;
boolean arenaStarted=false;
private ArenaScene() {
super(Forge.isLandscapeMode() ? "ui/arena.json" : "ui/arena_portrait.json");
@@ -98,7 +98,7 @@ public class ArenaScene extends UIScene implements IAfterMatch {
if(object!=null&&object.equals(true))
startArena();
startDialog.hide();
};
}
};
startDialog.text("Do you want to go into the Arena?");
startDialog.button(Forge.getLocalizer().getMessage("lblYes"), true);

View File

@@ -10,14 +10,9 @@ import forge.adventure.stage.WorldStage;
* does render the WorldStage and HUD
*/
public class GameScene extends HudScene {
private float cameraWidth = 0f, cameraHeight = 0f;
public GameScene() {
super(WorldStage.getInstance());
if (cameraWidth == 0f)
cameraWidth = stage.getCamera().viewportWidth;
if (cameraHeight == 0f)
cameraHeight = stage.getCamera().viewportHeight;
}

View File

@@ -30,9 +30,9 @@ public class InventoryScene extends UIScene {
TextraLabel itemDescription;
Dialog confirm;
Dialog useDialog;
private Table inventory;
Array<Button> inventoryButtons=new Array<>();
HashMap<String,Button> equipmentSlots=new HashMap<>();
private final Table inventory;
private final Array<Button> inventoryButtons=new Array<>();
private final HashMap<String,Button> equipmentSlots=new HashMap<>();
HashMap<Button,String> itemLocation=new HashMap<>();
Button selected;
Button deleteButton;
@@ -54,8 +54,6 @@ public class InventoryScene extends UIScene {
itemDescription = ui.findActor("item_description");
itemDescription.setAlignment(Align.topLeft);
inventoryButtons=new Array<>();
equipmentSlots=new HashMap<>();
Array<Actor> children = ui.getChildren();
for (int i = 0, n = children.size; i < n; i++)
@@ -79,7 +77,7 @@ public class InventoryScene extends UIScene {
}
}
String item=Current.player().itemInSlot(slotName);
if(item!=null&&item!="")
if(item!=null&& !item.equals(""))
{
Button changeButton=null;
for(Button invButton:inventoryButtons)
@@ -118,7 +116,7 @@ public class InventoryScene extends UIScene {
if(object!=null&&object.equals(true))
delete();
confirm.hide();
};
}
};
confirm.text( Controls.newLabel(Forge.getLocalizer().getMessage("lblDelete")));
@@ -142,7 +140,7 @@ public class InventoryScene extends UIScene {
triggerUse();
useDialog.getColor().a = 0;
}
};
}
};
useDialog.button(Forge.getLocalizer().getMessage("lblYes"), true);
@@ -178,6 +176,7 @@ public class InventoryScene extends UIScene {
public void equip() {
if(selected == null) return;
ItemData data = ItemData.getItem(itemLocation.get(selected));
if(data==null)return;
Current.player().equip(data);
updateInventory();
}
@@ -192,6 +191,7 @@ public class InventoryScene extends UIScene {
if(selected==null)return;
ItemData data = ItemData.getItem(itemLocation.get(selected));
if(data==null)return;
Current.player().addMana(-data.manaNeeded);
done();
ConsoleCommandInterpreter.getInstance().command(data.commandOnUse);
@@ -199,6 +199,7 @@ public class InventoryScene extends UIScene {
private void use() {
useDialog.getContentTable().clear();
ItemData data = ItemData.getItem(itemLocation.get(selected));
if(data==null)return;
useDialog.text("Use "+data.name+"?\n"+data.getDescription());
useDialog.show(stage);
}
@@ -218,6 +219,8 @@ public class InventoryScene extends UIScene {
return;
}
ItemData data = ItemData.getItem(itemLocation.get(actor));
if(data==null) return;
deleteButton.setDisabled(data.questItem);
boolean isInPoi = MapStage.getInstance().isInMap();
@@ -230,7 +233,7 @@ public class InventoryScene extends UIScene {
if(Current.player().getMana()<data.manaNeeded)
useButton.setDisabled(true);
if(data.equipmentSlot==null||data.equipmentSlot=="")
if(data.equipmentSlot==null|| data.equipmentSlot.equals(""))
{
equipButton.setDisabled(true);
}

View File

@@ -18,9 +18,9 @@ import forge.adventure.world.WorldSave;
public class MapViewScene extends UIScene {
private static MapViewScene object;
private final ScrollPane scroll;
private Image img;
private final Image img;
private Texture miniMapTexture;
private Image miniMapPlayer;
private final Image miniMapPlayer;
public static MapViewScene instance() {
if(object==null)

View File

@@ -36,16 +36,18 @@ import java.util.Random;
public class NewGameScene extends UIScene {
TextField selectedName;
ColorSet[] colorIds;
private Image avatarImage;
private final Image avatarImage;
private int avatarIndex = 0;
private Selector race;
private Selector colorId;
private Selector gender;
private Selector mode;
private Selector difficulty;
private Array<String> stringList, random, custom;
private TextraLabel colorLabel;
private int selected = -1;
private final Selector race;
private final Selector colorId;
private final Selector gender;
private final Selector mode;
private final Selector difficulty;
private final Array<String> stringList;
private final Array<String> random;
private final Array<String> custom;
private final TextraLabel colorLabel;
private final int selected = -1;
private NewGameScene() {

View File

@@ -24,8 +24,8 @@ import forge.sound.SoundSystem;
* Displays the rewards of a fight or a treasure
*/
public class RewardScene extends UIScene {
private TextraButton doneButton;
private TextraLabel goldLabel;
private final TextraButton doneButton;
private final TextraLabel goldLabel;
private static RewardScene object;
@@ -399,7 +399,7 @@ public class RewardScene extends UIScene {
}
public BuyButton(int id, int i, PointOfInterestChanges ch, RewardActor actor, TextraButton style) {
super("", style.getStyle());
super("", style.getStyle(),Controls.getTextraFont());
this.objectID = id;
this.index = i;
this.changes = ch;
@@ -410,7 +410,7 @@ public class RewardScene extends UIScene {
setY(actor.getY() - getHeight());
price = CardUtil.getRewardPrice(actor.getReward());
price *= Current.player().goldModifier();
setText("$ " + price);
setText(price+"[+Gold]");
addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
@@ -424,7 +424,7 @@ public class RewardScene extends UIScene {
SoundSystem.instance.play(SoundEffectType.FlipCoin, false);
updateBuyButtons();
goldLabel.setText("Gold: " + String.valueOf(AdventurePlayer.current().getGold()));
goldLabel.setText(AdventurePlayer.current().getGold()+"[+Gold]");
if(changes==null)
return;
setDisabled(true);

View File

@@ -64,7 +64,6 @@ public class SaveLoadScene extends UIScene {
diffList[c] = diff.name;
c++;
}
;
difficulty = Controls.newComboBox(diffList, null, o -> {
//DifficultyData difficulty1 = Config.instance().getConfigData().difficulties[difficulty.getSelectedIndex()];

View File

@@ -23,7 +23,7 @@ public class SettingsScene extends UIScene {
static public ForgePreferences Preference;
Stage stage;
Texture Background;
private Table settingGroup;
private final Table settingGroup;
TextraButton backButton;
ScrollPane scrollPane;

View File

@@ -38,9 +38,9 @@ public class SpellSmithScene extends UIScene {
}
private List<PaperCard> cardPool = new ArrayList<>();
private TextraLabel goldLabel;
private TextraButton pullButton;
private ScrollPane rewardDummy;
private final TextraLabel goldLabel;
private final TextraButton pullButton;
private final ScrollPane rewardDummy;
private RewardActor rewardActor;
SelectBox<CardEdition> editionList;
//Button containers.
@@ -53,7 +53,7 @@ public class SpellSmithScene extends UIScene {
private int cost_low = -1;
private int cost_high = 9999;
//Other
private float basePrice = 125f;
private final float basePrice = 125f;
private int currentPrice = 0;
private SpellSmithScene() { super(Forge.isLandscapeMode() ? "ui/spellsmith.json" : "ui/spellsmith_portrait.json");

View File

@@ -24,7 +24,6 @@ public class TileMapScene extends HudScene {
PointOfInterestMapRenderer tiledMapRenderer;
private String nextMap;
private boolean autoheal = false;
private float cameraWidth = 0f, cameraHeight = 0f;
private TileMapScene() {
super(MapStage.getInstance());
@@ -32,10 +31,6 @@ public class TileMapScene extends HudScene {
//set initial camera width and height
if (cameraWidth == 0f)
cameraWidth = stage.getCamera().viewportWidth;
if (cameraHeight == 0f)
cameraHeight = stage.getCamera().viewportHeight;
MapStage.getInstance().setDialogStage(hud);
}

View File

@@ -31,9 +31,9 @@ public class UIScene extends Scene {
Stage stage;
String uiFile;
private Dialog keyboardDialog;
private Label kbLabel;
private TextraButton keyA, keyB, keyC, keyD, keyE, keyF, keyG, keyH, keyI, keyJ, keyK, keyL, keyM, keyN, keyO, keyP,
private final Dialog keyboardDialog;
private final Label kbLabel;
private final TextraButton keyA, keyB, keyC, keyD, keyE, keyF, keyG, keyH, keyI, keyJ, keyK, keyL, keyM, keyN, keyO, keyP,
keyQ, keyR, keyS, keyT, keyU, keyV, keyW, keyX, keyY, keyZ, key1, key2, key3, key4, key5, key6, key7, key8,
key9, key0, keyDot, keyComma, keyShift, keyBackspace, keySpace, keyOK;
public Actor lastInputField;

View File

@@ -22,8 +22,8 @@ public class Console extends Window {
}
}
class InputLine extends TextField {
private Console console;
static class InputLine extends TextField {
private final Console console;
public InputLine(Console console) {
super("", Controls.getSkin());
@@ -43,8 +43,15 @@ public class Console extends Window {
case BACKSPACE:
break;
case TAB:
if(self.getText().isEmpty())
{
self.setText(console.last);
}
else
{
self.setText(console.complete(self.getText()));
self.setCursorPosition(Integer.MAX_VALUE);
}
break;
case NEWLINE:
case CARRIAGE_RETURN:

View File

@@ -28,7 +28,7 @@ public class ConsoleCommandInterpreter {
private static ConsoleCommandInterpreter instance;
Command root = new Command();
class Command {
static class Command {
HashMap<String, Command> children = new HashMap<>();
Function<String[], String> function;
}
@@ -93,7 +93,7 @@ public class ConsoleCommandInterpreter {
for(String name:path) {
if(!currentCommand.children.containsKey(name))
currentCommand.children.put(name,new Command());
currentCommand.children.put(name, new Command());
currentCommand = currentCommand.children.get(name);
}
currentCommand.function = function;

View File

@@ -50,10 +50,13 @@ public class GameHUD extends Stage implements ControllerListener {
private final Image miniMap, gamehud, mapborder, avatarborder, blank;
private final InputEvent eventTouchDown;
private final InputEvent eventTouchUp;
private TextraButton deckActor, menuActor, statsActor, inventoryActor;
private UIActor ui;
private Touchpad touchpad;
private Console console;
private final TextraButton deckActor;
private final TextraButton menuActor;
private final TextraButton statsActor;
private final TextraButton inventoryActor;
private final UIActor ui;
private final Touchpad touchpad;
private final Console console;
float TOUCHPAD_SCALE = 70f, referenceX;
boolean isHiding = false, isShowing = false;
float opacity = 1f;

View File

@@ -256,10 +256,13 @@ public abstract class GameStage extends Stage {
if (keycode == Input.Keys.F2) {
TileMapScene S = TileMapScene.instance();
PointOfInterestData P = PointOfInterestData.getPointOfInterest("DEBUGZONE");
if( P != null)
{
PointOfInterest PoI = new PointOfInterest(P,new Vector2(0,0), MyRandom.getRandom());
S.load(PoI);
Forge.switchScene(S);
}
}
if (keycode == Input.Keys.F11) {
debugCollision(false);
for (Actor actor : foregroundSprites.getChildren()) {

View File

@@ -1,5 +1,5 @@
package forge.adventure.stage;
public interface IAfterMatch {
public void setWinner(boolean winner);
void setWinner(boolean winner);
}

View File

@@ -54,10 +54,6 @@ public class MapStage extends GameStage {
TiledMap map;
Array<Rectangle> collisionRect=new Array<>();
private float tileHeight;
private float tileWidth;
private float width;
private float height;
private boolean isInMap = false;
MapLayer spriteLayer;
private PointOfInterestChanges changes;
@@ -93,7 +89,7 @@ public class MapStage extends GameStage {
}
public boolean canEscape() {
return (preventEscape ? true : false);
return !preventEscape;
} //Check if escape is possible.
public void clearIsInMap() {
@@ -266,10 +262,10 @@ public class MapStage extends GameStage {
actors.clear();
collisionRect.clear();
width = Float.parseFloat(map.getProperties().get("width").toString());
height = Float.parseFloat(map.getProperties().get("height").toString());
tileHeight = Float.parseFloat(map.getProperties().get("tileheight").toString());
tileWidth = Float.parseFloat(map.getProperties().get("tilewidth").toString());
float width = Float.parseFloat(map.getProperties().get("width").toString());
float height = Float.parseFloat(map.getProperties().get("height").toString());
float tileHeight = Float.parseFloat(map.getProperties().get("tileheight").toString());
float tileWidth = Float.parseFloat(map.getProperties().get("tilewidth").toString());
setBounds(width * tileWidth, height * tileHeight);
//collision = new Array[(int) width][(int) height];

View File

@@ -1,7 +1,6 @@
package forge.adventure.stage;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.maps.MapLayer;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;

View File

@@ -46,10 +46,10 @@ public class WorldStage extends GameStage implements SaveFileContent {
protected Random rand = MyRandom.getRandom();
WorldBackground background;
private float spawnDelay = 0;
private final float spawnInterval = 4;//todo config
private static final float spawnInterval = 4;//todo config
private PointOfInterestMapSprite collidingPoint;
protected ArrayList<Pair<Float, EnemySprite>> enemies = new ArrayList<>();
private final Float dieTimer=20f;//todo config
private final static Float dieTimer=20f;//todo config
private Float globalTimer=0f;
public WorldStage() {

View File

@@ -273,7 +273,7 @@ public class Controls {
return Color.PURPLE;
if(upperCase.equals("VIOLET"))
return Color.VIOLET;
if(upperCase.equals("PINK"))
if(upperCase.equals("MAROON"))
return Color.MAROON;
return Color.BLACK;
}

View File

@@ -19,9 +19,9 @@ import forge.util.Localizer;
public class MapDialog {
private final MapStage stage;
private Array<DialogData> data;
private final Array<DialogData> data;
private final int parentID;
private final float WIDTH = 260f;
private final static float WIDTH = 260f;
static private final String defaultJSON = "[\n" +
" {\n" +
" \"effect\":[],\n" +

View File

@@ -115,7 +115,6 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
if (toolTipImage.getDrawable() instanceof TextureRegionDrawable) {
((TextureRegionDrawable) toolTipImage.getDrawable()).getRegion().getTexture().dispose();
}
}
toolTipImage.remove();
toolTipImage = new Image(processDrawable(image));
if (GuiBase.isAndroid()||Forge.hasGamepad()) {
@@ -127,6 +126,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
} else {
tooltip.setActor(toolTipImage);
}
}
if (T != null)
T.dispose();
ImageCache.updateSynqCount(imageFile, count);
@@ -721,8 +721,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
tooltip_actor.setX(Scene.getIntendedWidth() / 2 - tooltip_actor.getWidth() / 2);
}
tooltip_actor.setY(Scene.getIntendedHeight() / 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);
}

View File

@@ -162,7 +162,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return (SaveFileData)objStream.readObject();
} catch (IOException | ClassNotFoundException e) {
@@ -177,7 +177,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return objStream.readObject();
} catch (IOException | ClassNotFoundException e) {
@@ -193,7 +193,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return objStream.readUTF();
} catch (IOException e) {
@@ -208,7 +208,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return objStream.readLong();
} catch (IOException e) {
@@ -223,7 +223,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return objStream.readFloat();
} catch (IOException e) {
@@ -239,7 +239,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return objStream.readDouble();
} catch (IOException e) {
@@ -254,7 +254,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
float x= objStream.readFloat();
float y= objStream.readFloat();
return new Vector2(x,y);
@@ -271,7 +271,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
float x= objStream.readFloat();
float y= objStream.readFloat();
float width= objStream.readFloat();
@@ -299,7 +299,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return objStream.readInt();
} catch (IOException e) {
@@ -314,7 +314,7 @@ public class SaveFileData extends HashMap<String,byte[]>
try {
ByteArrayInputStream stream=new ByteArrayInputStream(get(key));
ObjectInputStream objStream=new DecompressibleInputStream(stream);
ObjectInputStream objStream= new DecompressibleInputStream(stream);
return objStream.readBoolean();
} catch (IOException e) {
@@ -326,7 +326,7 @@ public class SaveFileData extends HashMap<String,byte[]>
class DecompressibleInputStream extends ObjectInputStream {
static class DecompressibleInputStream extends ObjectInputStream {
/*https://stackoverflow.com/questions/1816559/make-java-runtime-ignore-serialversionuids*/
@@ -355,8 +355,7 @@ public class SaveFileData extends HashMap<String,byte[]>
final StringBuffer s = new StringBuffer("Overriding serialized class version mismatch: ");
s.append("local serialVersionUID = ").append(localSUID);
s.append(" stream serialVersionUID = ").append(streamSUID);
//Exception e = new InvalidClassException(s.toString());
//logger.error("Potentially Fatal Deserialization Operation.", e);
System.err.println("[Invalid Class Exception]\n"+s);
resultClassDescriptor = localClassDescriptor; // Use local class descriptor for deserialization
}

View File

@@ -20,9 +20,6 @@ public class BiomeSprites {
public Sprite getSprite(String name, int seed) {
if (textureAtlasBuffer == null) {
textureAtlasBuffer = Config.instance().getAtlas(textureAtlas);
/*for (Texture texture : new ObjectSet.ObjectSetIterator<>(textureAtlasBuffer.getTextures())) {
texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
}*/
}
if (!spriteBuffer.containsKey(name)) {
spriteBuffer.put(name, new Array<Sprite>());

View File

@@ -9,12 +9,12 @@ import java.util.HashMap;
public class BiomeStructure {
private BiomeStructureData data;
long seed;
private int biomeWidth;
private int biomeHeight;
private int dataMap[][];
private boolean collisionMap[][];
private final BiomeStructureData data;
final long seed;
private final int biomeWidth;
private final int biomeHeight;
private int[][] dataMap;
private boolean[][] collisionMap;
boolean init=false;
private TextureAtlas structureAtlas;
public ColorMap image;
@@ -61,7 +61,7 @@ public class BiomeStructure {
init=true;
int targetWidth=(int) (data.width* biomeWidth);
int targetHeight=(int) (data.width* biomeWidth);
int targetHeight=(int) (data.height* biomeHeight);
dataMap=new int[targetWidth][ targetHeight];
collisionMap=new boolean[targetWidth][ targetHeight];
ColorMap finalImage=new ColorMap(targetWidth, targetHeight);

View File

@@ -285,6 +285,7 @@ public class BiomeTexture implements Serializable {
}
}
}
//noinspection ConstantConditions
if (false)//debug neighbors
{
subPixmap.setColor(Color.GREEN);
@@ -340,7 +341,7 @@ public class BiomeTexture implements Serializable {
BottomEdge(10),
RightBottomEdge(11);
public int value;
public final int value;
BigPictures(int i) {
value = i;
@@ -398,7 +399,7 @@ public class BiomeTexture implements Serializable {
RightBottomEdge01(46),
RightBottomEdge11(47);
public int value;
public final int value;
SmallPictures(int i) {
value = i;

View File

@@ -17,7 +17,7 @@ public class OverlappingModel extends Model {
@FunctionalInterface
interface Agrees<One, Two, Three, Four, Five> {
public Five apply(One one, Two two, Three three, Four four);
Five apply(One one, Two two, Three three, Four four);
}
/**

View File

@@ -14,7 +14,7 @@ import java.util.List;
* Class that hold all sprites as a list for each chunk
*/
public class SpritesDataMap implements SaveFileContent {
public class BiomeSpriteDataMap extends HashMap<Integer, BiomeSpriteData> implements SaveFileContent
public static class BiomeSpriteDataMap extends HashMap<Integer, BiomeSpriteData> implements SaveFileContent
{
@Override
public void load(SaveFileData data) {

View File

@@ -140,7 +140,7 @@ public class World implements Disposable, SaveFileContent {
return mapObjectIds.get(id);
}
private class DrawingInformation {
private static class DrawingInformation {
private int neighbors;
private final BiomeTexture regions;
@@ -407,8 +407,7 @@ public class World implements Disposable, SaveFileContent {
int structureIndex = structure.objectID(structureXStart, structureYStart);
if (structureIndex >= 0) {
//pix.setColor(data.mappingInfo[structureIndex].getColor());
//pix.fillRectangle(x*data.miniMapTileSize, y*data.miniMapTileSize,data.miniMapTileSize,data.miniMapTileSize);
terrainMap[x][y] = terrainCounter + structureIndex;
if (structure.collision(structureXStart, structureYStart))
terrainMap[x][y] |= collisionBit;
@@ -804,7 +803,7 @@ public class World implements Disposable, SaveFileContent {
}
class DrawInfo
static class DrawInfo
{
Pixmap mapMarkerPixmap;
int regionX;
@@ -818,7 +817,7 @@ public class World implements Disposable, SaveFileContent {
}
final Array<DrawInfo> storedInfo=new Array<>();
private void drawPixmapLater(Pixmap mapMarkerPixmap, int regionX, int regionY, int regionWidth, int regionHeight, int x, int y, int regionWidth1, int regionHeight1) {
DrawInfo info=new DrawInfo();
DrawInfo info= new DrawInfo();
info.mapMarkerPixmap=mapMarkerPixmap;
info.regionX=regionX;
info.regionY=regionY;

8
local.properties Normal file
View File

@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Sep 18 16:22:42 CEST 2022
sdk.dir=H\:\\Develop\\Android\\sdk\\current