mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Merge pull request #3566 from kevlahnota/newmaster2
add Bookmark to GameHUD
This commit is contained in:
@@ -2,14 +2,11 @@ package forge.adventure.data;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.util.Paths;
|
||||
|
||||
import static forge.adventure.util.Paths.ITEMS_ATLAS;
|
||||
|
||||
/**
|
||||
* Data class that will be used to read Json configuration files
|
||||
* ItemData
|
||||
@@ -49,16 +46,9 @@ public class ItemData {
|
||||
shardsNeeded = cpy.shardsNeeded;
|
||||
}
|
||||
|
||||
public Sprite sprite()
|
||||
{
|
||||
if(itemAtlas==null)
|
||||
{
|
||||
itemAtlas=Config.instance().getAtlas(ITEMS_ATLAS);
|
||||
public Sprite sprite() {
|
||||
return Config.instance().getItemSprite(iconName);
|
||||
}
|
||||
return itemAtlas.createSprite(iconName);
|
||||
}
|
||||
|
||||
private static TextureAtlas itemAtlas;
|
||||
private static Array<ItemData> itemList;
|
||||
public static Array<ItemData> getAllItems() {
|
||||
if (itemList == null) {
|
||||
|
||||
@@ -376,8 +376,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
for (Deck d : decks) {
|
||||
if (d != null && !d.isEmpty()) {
|
||||
boostersOwned.add(d);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
System.err.printf("Null or empty booster %s\n", d);
|
||||
System.out.println("You have an empty booster pack in your inventory.");
|
||||
}
|
||||
@@ -1075,6 +1074,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
public ItemPool<PaperCard> getAutoSellCards() {
|
||||
return autoSellCards;
|
||||
}
|
||||
|
||||
public ItemPool<PaperCard> getNoSellCards() {
|
||||
return noSellCards;
|
||||
}
|
||||
@@ -1112,7 +1112,6 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public CardPool getCollectionCards(boolean allCards) {
|
||||
CardPool collectionCards = new CardPool();
|
||||
collectionCards.addAll(cards);
|
||||
|
||||
@@ -18,6 +18,7 @@ public class PointOfInterestChanges implements SaveFileContent {
|
||||
private final java.util.Map<Integer, Long> shopSeeds = new HashMap<>();
|
||||
private final java.util.Map<Integer, Float> shopModifiers = new HashMap<>();
|
||||
private final java.util.Map<Integer, Integer> reputation = new HashMap<>();
|
||||
private Boolean isBookmarked;
|
||||
|
||||
public static class Map extends HashMap<String,PointOfInterestChanges> implements SaveFileContent {
|
||||
@Override
|
||||
@@ -62,6 +63,7 @@ public class PointOfInterestChanges implements SaveFileContent {
|
||||
mapFlags.putAll((java.util.Map<String, Byte>) data.readObject("mapFlags"));
|
||||
shopModifiers.clear();
|
||||
shopModifiers.putAll((java.util.Map<Integer, Float>) data.readObject("shopModifiers"));
|
||||
isBookmarked = (Boolean) data.readObject("isBookmarked");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,6 +74,7 @@ public class PointOfInterestChanges implements SaveFileContent {
|
||||
data.storeObject("mapFlags", mapFlags);
|
||||
data.storeObject("shopSeeds", shopSeeds);
|
||||
data.storeObject("shopModifiers", shopModifiers);
|
||||
data.storeObject("isBookmarked", isBookmarked);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -159,6 +162,14 @@ public class PointOfInterestChanges implements SaveFileContent {
|
||||
public boolean hasDeletedObjects() {
|
||||
return deletedObjects != null && !deletedObjects.isEmpty();
|
||||
}
|
||||
public boolean isBookmarked() {
|
||||
if (isBookmarked == null)
|
||||
return false;
|
||||
return isBookmarked;
|
||||
}
|
||||
public void setIsBookmarked(boolean val) {
|
||||
isBookmarked = val;
|
||||
}
|
||||
|
||||
public void clearDeletedObjects() {
|
||||
// reset map when assigning as a quest target that needs enemies
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.GL20;
|
||||
import com.google.common.collect.Sets;
|
||||
import forge.Forge;
|
||||
import forge.adventure.data.BiomeData;
|
||||
import forge.adventure.pointofintrest.PointOfInterest;
|
||||
import forge.adventure.stage.MapStage;
|
||||
import forge.adventure.stage.WorldStage;
|
||||
import forge.adventure.util.Current;
|
||||
@@ -80,6 +81,13 @@ public class GameScene extends HudScene {
|
||||
return location;
|
||||
}
|
||||
|
||||
public PointOfInterest getMapPOI() {
|
||||
if (MapStage.getInstance().isInMap()) {
|
||||
return TileMapScene.instance().rootPoint;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isNotInWorldMap() {
|
||||
String location = getAdventurePlayerLocation(false, true);
|
||||
Set<String> locationTypes = Sets.newHashSet("capital", "castle", "cave", "dungeon", "town");
|
||||
|
||||
@@ -2,7 +2,6 @@ package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.*;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
@@ -24,8 +23,6 @@ import forge.deck.Deck;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static forge.adventure.util.Paths.ITEMS_ATLAS;
|
||||
|
||||
public class InventoryScene extends UIScene {
|
||||
TextraButton leave;
|
||||
Button equipButton;
|
||||
@@ -350,8 +347,7 @@ public class InventoryScene extends UIScene {
|
||||
System.err.print("Can not add null / empty booster " + Current.player().getBoostersOwned().get(i) + "\n");
|
||||
continue;
|
||||
}
|
||||
TextureAtlas atlas = Config.instance().getAtlas(ITEMS_ATLAS);
|
||||
Sprite deckSprite = atlas.createSprite("Deck");
|
||||
Sprite deckSprite = Config.instance().getItemSprite("Deck");
|
||||
|
||||
Image img = new Image(deckSprite);
|
||||
img.setX((newActor.getWidth() - img.getWidth()) / 2);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.adventure.scene;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.Group;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image;
|
||||
@@ -9,6 +10,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||
import com.github.tommyettinger.textra.TextraButton;
|
||||
import com.github.tommyettinger.textra.TypingLabel;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import forge.Forge;
|
||||
import forge.adventure.data.AdventureQuestData;
|
||||
import forge.adventure.pointofintrest.PointOfInterest;
|
||||
@@ -19,6 +21,7 @@ import forge.adventure.util.Current;
|
||||
import forge.adventure.world.WorldSave;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Displays the rewards of a fight or a treasure
|
||||
@@ -33,6 +36,8 @@ public class MapViewScene extends UIScene {
|
||||
private final List<TypingLabel> labels;
|
||||
private int index = -1;
|
||||
private float avatarX = 0, avatarY = 0;
|
||||
private Set<Vector2> positions;
|
||||
private Set<PointOfInterest> bookmark;
|
||||
|
||||
public static MapViewScene instance() {
|
||||
if (object == null)
|
||||
@@ -46,6 +51,8 @@ public class MapViewScene extends UIScene {
|
||||
ui.onButtonPress("quest", this::scroll);
|
||||
scroll = ui.findActor("map");
|
||||
labels = Lists.newArrayList();
|
||||
positions = Sets.newHashSet();
|
||||
bookmark = Sets.newHashSet();
|
||||
table = new Group();
|
||||
scroll.setActor(table);
|
||||
img = new Image();
|
||||
@@ -62,11 +69,24 @@ public class MapViewScene extends UIScene {
|
||||
a.remove();
|
||||
}
|
||||
labels.clear();
|
||||
positions.clear();
|
||||
index = -1;
|
||||
Forge.switchToLast();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addBookmark(PointOfInterest point) {
|
||||
if (point == null)
|
||||
return;
|
||||
bookmark.add(point);
|
||||
}
|
||||
|
||||
public void removeBookmark(PointOfInterest point) {
|
||||
if (point == null)
|
||||
return;
|
||||
bookmark.remove(point);
|
||||
}
|
||||
|
||||
public boolean scroll() {
|
||||
if (!labels.isEmpty()) {
|
||||
index++;
|
||||
@@ -99,13 +119,22 @@ public class MapViewScene extends UIScene {
|
||||
for (AdventureQuestData adq : Current.player().getQuests()) {
|
||||
PointOfInterest poi = adq.getTargetPOI();
|
||||
if (poi != null) {
|
||||
if (positions.contains(poi.getPosition()))
|
||||
continue; //don't map duplicate position to prevent stacking
|
||||
TypingLabel label = Controls.newTypingLabel("[%?BLACKEN][+GPS]{GRADIENT=RED;WHITE;1;1}>" + adq.name + "{ENDGRADIENT}");
|
||||
labels.add(label);
|
||||
table.addActor(label);
|
||||
label.setPosition(getMapX(poi.getPosition().x) - label.getWidth() / 2, getMapY(poi.getPosition().y) - label.getHeight() / 2);
|
||||
label.skipToTheEnd();
|
||||
positions.add(poi.getPosition());
|
||||
}
|
||||
}
|
||||
for (PointOfInterest poi : bookmark) {
|
||||
TypingLabel label = Controls.newTypingLabel("[%70][+Star]");
|
||||
table.addActor(label);
|
||||
label.setPosition(getMapX(poi.getPosition().x) - label.getWidth() / 2, getMapY(poi.getPosition().y) - label.getHeight() / 2);
|
||||
label.skipToTheEnd();
|
||||
}
|
||||
TextraButton questButton = ui.findActor("quest");
|
||||
if (questButton != null) {
|
||||
questButton.setDisabled(labels.isEmpty());
|
||||
|
||||
@@ -518,9 +518,9 @@ public class RewardScene extends UIScene {
|
||||
if (Type.Shop != type)
|
||||
return;
|
||||
if (collectionPool != null && Reward.Type.Card.equals(reward.getType()))
|
||||
setText("[%75]" + price + " [+Gold]\n" + Forge.getLocalizer().getMessage("lblOwned") + ": " + collectionPool.count(reward.getCard()));
|
||||
setText("[%75][+GoldCoin] " + price + "\n" + Forge.getLocalizer().getMessage("lblOwned") + ": " + collectionPool.count(reward.getCard()));
|
||||
else if (Reward.Type.Item.equals(reward.getType()))
|
||||
setText("[%75]" + price + " [+Gold]\n" + Forge.getLocalizer().getMessage("lblOwned") + ": " + AdventurePlayer.current().countItem(reward.getItem().name));
|
||||
setText("[%75][+GoldCoin] " + price + "\n" + Forge.getLocalizer().getMessage("lblOwned") + ": " + AdventurePlayer.current().countItem(reward.getItem().name));
|
||||
}
|
||||
|
||||
public BuyButton(int id, int i, RewardActor actor, Reward reward, TextraButton style, float shopModifier) {
|
||||
@@ -536,7 +536,7 @@ public class RewardScene extends UIScene {
|
||||
price = CardUtil.getRewardPrice(actor.getReward());
|
||||
price *= Current.player().goldModifier();
|
||||
price *= shopModifier;
|
||||
setText(price + " [+Gold]");
|
||||
setText("[+GoldCoin] " + price);
|
||||
updateOwned();
|
||||
addListener(new ClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GameHUD extends Stage {
|
||||
private final TextraLabel lifePoints, money, shards, keys;
|
||||
private final Image miniMap, gamehud, mapborder, avatarborder, blank;
|
||||
private final InputEvent eventTouchDown, eventTouchUp;
|
||||
private final TextraButton deckActor, openMapActor, menuActor, logbookActor, inventoryActor, exitToWorldMapActor;
|
||||
private final TextraButton deckActor, openMapActor, menuActor, logbookActor, inventoryActor, exitToWorldMapActor, bookmarkActor;
|
||||
public final UIActor ui;
|
||||
private final Touchpad touchpad;
|
||||
private final Console console;
|
||||
@@ -89,6 +89,7 @@ public class GameHUD extends Stage {
|
||||
inventoryActor = ui.findActor("inventory");
|
||||
gamehud = ui.findActor("gamehud");
|
||||
exitToWorldMapActor = ui.findActor("exittoworldmap");
|
||||
bookmarkActor = ui.findActor("bookmark");
|
||||
dialog = Controls.newDialog("");
|
||||
|
||||
miniMapPlayer = new Image(Forge.getAssets().getTexture(Config.instance().getFile("ui/minimap_player.png")));
|
||||
@@ -120,6 +121,7 @@ public class GameHUD extends Stage {
|
||||
ui.onButtonPress("logbook", this::logbook);
|
||||
ui.onButtonPress("deck", this::openDeck);
|
||||
ui.onButtonPress("exittoworldmap", this::exitToWorldMap);
|
||||
ui.onButtonPress("bookmark", this::bookmark);
|
||||
lifePoints = ui.findActor("lifePoints");
|
||||
shards = ui.findActor("shards");
|
||||
money = ui.findActor("money");
|
||||
@@ -236,6 +238,7 @@ public class GameHUD extends Stage {
|
||||
&& !(Controls.actorContainsVector(logbookActor, touch)) //not inside stats button
|
||||
&& !(Controls.actorContainsVector(inventoryActor, touch)) //not inside inventory button
|
||||
&& !(Controls.actorContainsVector(exitToWorldMapActor, touch)) //not inside exit button
|
||||
&& !(Controls.actorContainsVector(bookmarkActor, touch)) //not inside bookmark button
|
||||
&& !(Controls.actorContainsVector(abilityButtonMap, touch)) //not inside abilityButtonMap
|
||||
&& (Controls.actorContainsVector(ui, touch)) //inside display bounds
|
||||
&& pointer < 1) { //not more than 1 pointer
|
||||
@@ -356,6 +359,8 @@ public class GameHUD extends Stage {
|
||||
openMapActor.setText(val);
|
||||
openMapActor.layout();
|
||||
}
|
||||
if (MapStage.getInstance().isInMap())
|
||||
updateBookmarkActor(MapStage.getInstance().getChanges().isBookmarked());
|
||||
}
|
||||
|
||||
void clearAbility() {
|
||||
@@ -370,7 +375,7 @@ public class GameHUD extends Stage {
|
||||
setAbilityButton(AdventurePlayer.current().getEquippedAbility1());
|
||||
setAbilityButton(AdventurePlayer.current().getEquippedAbility2());
|
||||
float x = Forge.isLandscapeMode() ? 426f : 216f;
|
||||
float y = 10f;
|
||||
float y = Forge.isLandscapeMode() ? 10f : 60f;
|
||||
float w = 45f;
|
||||
float h = 35f;
|
||||
for (TextraButton button : abilityButtonMap) {
|
||||
@@ -499,9 +504,9 @@ public class GameHUD extends Stage {
|
||||
private void setAudio(MusicPlaylist playlist) {
|
||||
if (playlist.equals(currentAudioPlaylist))
|
||||
return;
|
||||
System.out.println("Playlist: "+playlist);
|
||||
//System.out.println("Playlist: "+playlist);
|
||||
unloadAudio();
|
||||
System.out.println("Playlist: "+playlist);
|
||||
//System.out.println("Playlist: "+playlist);
|
||||
audio = getMusic(playlist);
|
||||
}
|
||||
|
||||
@@ -561,6 +566,42 @@ public class GameHUD extends Stage {
|
||||
showDialog();
|
||||
}
|
||||
|
||||
private void bookmark() {
|
||||
if (console.isVisible())
|
||||
return;
|
||||
if (!GameScene.instance().isNotInWorldMap())
|
||||
return;
|
||||
if (!MapStage.getInstance().canEscape())
|
||||
return;
|
||||
if (Forge.restrictAdvMenus)
|
||||
return;
|
||||
if (MapStage.getInstance().isInMap()) {
|
||||
if (MapStage.getInstance().getChanges().isBookmarked()) {
|
||||
MapStage.getInstance().getChanges().setIsBookmarked(false);
|
||||
PointOfInterestMapSprite mapSprite = WorldStage.getInstance().getMapSprite(GameScene.instance().getMapPOI());
|
||||
if (mapSprite != null) {
|
||||
MapStage.getInstance().getChanges().save();
|
||||
mapSprite.setBookmarked(false, mapSprite.getPointOfInterest());
|
||||
updateBookmarkActor(false);
|
||||
}
|
||||
} else {
|
||||
MapStage.getInstance().getChanges().setIsBookmarked(true);
|
||||
PointOfInterestMapSprite mapSprite = WorldStage.getInstance().getMapSprite(GameScene.instance().getMapPOI());
|
||||
if (mapSprite != null) {
|
||||
MapStage.getInstance().getChanges().save();
|
||||
mapSprite.setBookmarked(true, mapSprite.getPointOfInterest());
|
||||
updateBookmarkActor(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBookmarkActor(boolean value) {
|
||||
if (bookmarkActor == null)
|
||||
return;
|
||||
bookmarkActor.setText("[%120][+" + (value ? "Bookmark" : "Unmark") + "]");
|
||||
}
|
||||
|
||||
private void exitDungeonCallback() {
|
||||
hideDialog(true);
|
||||
}
|
||||
@@ -582,9 +623,9 @@ public class GameHUD extends Stage {
|
||||
actor.setVisible(visible);
|
||||
}
|
||||
|
||||
private void setDisabled(Actor actor, boolean enable, String enabled, String disabled) {
|
||||
private void setDisabled(Actor actor, boolean value, String enabled, String disabled) {
|
||||
if (actor instanceof TextraButton) {
|
||||
((TextraButton) actor).setDisabled(enable);
|
||||
((TextraButton) actor).setDisabled(value);
|
||||
((TextraButton) actor).setText(((TextraButton) actor).isDisabled() ? disabled : enabled);
|
||||
}
|
||||
}
|
||||
@@ -609,6 +650,7 @@ public class GameHUD extends Stage {
|
||||
setVisibility(money, visible);
|
||||
setVisibility(blank, visible);
|
||||
setDisabled(exitToWorldMapActor, !GameScene.instance().isNotInWorldMap(), "[%120][+ExitToWorldMap]", "---");
|
||||
setDisabled(bookmarkActor, !GameScene.instance().isNotInWorldMap(), "[%120][+Bookmark]", "---");
|
||||
setAlpha(avatarborder, visible);
|
||||
setAlpha(avatar, visible);
|
||||
setAlpha(deckActor, visible);
|
||||
@@ -616,6 +658,7 @@ public class GameHUD extends Stage {
|
||||
setAlpha(logbookActor, visible);
|
||||
setAlpha(inventoryActor, visible);
|
||||
setAlpha(exitToWorldMapActor, visible);
|
||||
setAlpha(bookmarkActor, visible);
|
||||
for (TextraButton button : abilityButtonMap) {
|
||||
setAlpha(button, visible);
|
||||
}
|
||||
@@ -723,6 +766,7 @@ public class GameHUD extends Stage {
|
||||
if (exitDungeon) {
|
||||
MapStage.getInstance().exitDungeon();
|
||||
setDisabled(exitToWorldMapActor, true, "[%120][+ExitToWorldMap]", "---");
|
||||
setDisabled(bookmarkActor, true, "[%120][+Bookmark]", "---");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,11 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.github.tommyettinger.textra.TextraLabel;
|
||||
import forge.adventure.data.BiomeSpriteData;
|
||||
import forge.adventure.pointofintrest.PointOfInterest;
|
||||
import forge.adventure.util.Controls;
|
||||
import forge.adventure.pointofintrest.PointOfInterestChanges;
|
||||
import forge.adventure.scene.MapViewScene;
|
||||
import forge.adventure.util.Config;
|
||||
import forge.adventure.world.WorldSave;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -23,15 +24,19 @@ public class MapSprite extends Actor {
|
||||
static public int BackgroundLayer = -1;
|
||||
static public int SpriteLayer = 0;
|
||||
TextureRegion texture;
|
||||
TextraLabel searchPost = Controls.newTextraLabel("[%80][+SearchPost]");
|
||||
boolean isCaveDungeon, isOldorVisited;
|
||||
|
||||
Sprite bookmark = Config.instance().getItemSprite("Star");
|
||||
Sprite magnifier = Config.instance().getItemSprite("Magnifier");
|
||||
boolean isCaveDungeon, isOldorVisited, isBookmarked;
|
||||
public MapSprite(Vector2 pos, TextureRegion sprite, PointOfInterest point) {
|
||||
if (point != null) {
|
||||
PointOfInterestChanges changes = WorldSave.getCurrentSave().getPointOfInterestChanges(point.getID() + point.getData().map);
|
||||
setBookmarked(changes.isBookmarked(), point);
|
||||
isCaveDungeon = "cave".equalsIgnoreCase(point.getData().type) || "dungeon".equalsIgnoreCase(point.getData().type);
|
||||
if (point.getData().map != null && point.getID() != null) {
|
||||
isOldorVisited = WorldSave.getCurrentSave().getPointOfInterestChanges(point.getID() + point.getData().map).hasDeletedObjects();
|
||||
isOldorVisited = changes.hasDeletedObjects();
|
||||
}
|
||||
} else {
|
||||
setBookmarked(false, null);
|
||||
}
|
||||
texture = sprite;
|
||||
setPosition(pos.x, pos.y);
|
||||
@@ -43,6 +48,15 @@ public class MapSprite extends Actor {
|
||||
isOldorVisited = true;
|
||||
}
|
||||
|
||||
public void setBookmarked(boolean val, PointOfInterest poi) {
|
||||
isBookmarked = val;
|
||||
if (isBookmarked)
|
||||
MapViewScene.instance().addBookmark(poi);
|
||||
else
|
||||
MapViewScene.instance().removeBookmark(poi);
|
||||
|
||||
}
|
||||
|
||||
public static Array<Actor> getMapSprites(int chunkX, int chunkY, int layer) {
|
||||
Array<Actor> actorGroup = new Array<>();
|
||||
List<Pair<Vector2, Integer>> objects = WorldSave.getCurrentSave().getWorld().GetMapObjects(chunkX, chunkY);
|
||||
@@ -72,9 +86,15 @@ public class MapSprite extends Actor {
|
||||
if (texture == null)
|
||||
return;
|
||||
batch.draw(texture, getX(), getY());
|
||||
if (isCaveDungeon && !isOldorVisited) {
|
||||
searchPost.setPosition(getX() - 7, getY() + 7);
|
||||
searchPost.draw(batch, parentAlpha);
|
||||
if (isCaveDungeon && !isOldorVisited && magnifier != null) {
|
||||
magnifier.setScale(0.7f, 0.7f);
|
||||
magnifier.setPosition(getX() - 7, getY() + 2);
|
||||
magnifier.draw(batch, parentAlpha);
|
||||
}
|
||||
if (isBookmarked && bookmark != null) {
|
||||
bookmark.setScale(0.7f, 0.7f);
|
||||
bookmark.setPosition(getRight() - 8, getY() + getHeight() / 1.5f);
|
||||
bookmark.draw(batch, parentAlpha);
|
||||
}
|
||||
//font.draw(batch,String.valueOf(getZIndex()),getX()-(getWidth()/2),getY());
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.Forge;
|
||||
import forge.adventure.character.CharacterSprite;
|
||||
import forge.adventure.character.EnemySprite;
|
||||
import forge.adventure.data.*;
|
||||
import forge.adventure.pointofintrest.PointOfInterest;
|
||||
import forge.adventure.scene.DuelScene;
|
||||
import forge.adventure.scene.RewardScene;
|
||||
import forge.adventure.scene.Scene;
|
||||
@@ -338,6 +339,19 @@ public class WorldStage extends GameStage implements SaveFileContent {
|
||||
directlyEnterPOI = true; //On a new game, we want to automatically enter any POI the player overlaps with.
|
||||
}
|
||||
|
||||
public PointOfInterestMapSprite getMapSprite(PointOfInterest poi) {
|
||||
if (poi == null)
|
||||
return null;
|
||||
for (Actor actor : foregroundSprites.getChildren()) {
|
||||
if (actor.getClass() == PointOfInterestMapSprite.class) {
|
||||
PointOfInterestMapSprite point = (PointOfInterestMapSprite) actor;
|
||||
if (poi == point.getPointOfInterest() && poi.getPosition() == point.getPointOfInterest().getPosition())
|
||||
return point;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
getPlayerSprite().LoadPos();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.adventure.util;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
@@ -50,6 +51,7 @@ public class Config {
|
||||
private SettingData settingsData;
|
||||
private String Lang = "en-us";
|
||||
private final String plane;
|
||||
private ObjectMap<String, Sprite> itemSprites = new ObjectMap<>();
|
||||
|
||||
static public Config instance() {
|
||||
if (currentConfig == null)
|
||||
@@ -245,6 +247,15 @@ public class Config {
|
||||
return atlas;
|
||||
}
|
||||
|
||||
public Sprite getItemSprite(String itemName) {
|
||||
Sprite sprite = itemSprites.get(itemName);
|
||||
if (sprite == null) {
|
||||
sprite = getAtlas(forge.adventure.util.Paths.ITEMS_ATLAS).createSprite(itemName);
|
||||
if (sprite != null)
|
||||
itemSprites.put(itemName, sprite);
|
||||
}
|
||||
return sprite;
|
||||
}
|
||||
public SettingData getSettingData() {
|
||||
return settingsData;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@ package forge.adventure.util;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||
import com.badlogic.gdx.graphics.g2d.*;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
@@ -431,7 +429,6 @@ public class Controls {
|
||||
return Forge.getAssets().getTextraFont(name, getSkin().getFont(name), Config.instance().getAtlas(Paths.ITEMS_ATLAS));
|
||||
}
|
||||
|
||||
|
||||
static public class AccountingLabel extends TextraLabel {
|
||||
private TextraLabel label;
|
||||
private final TextraLabel placeholder;
|
||||
|
||||
@@ -18,6 +18,7 @@ public enum KeyBinding {
|
||||
Map("Map", Input.Keys.M,Input.Keys.BUTTON_SELECT),
|
||||
Equip("Equip", Input.Keys.E,Input.Keys.BUTTON_X),
|
||||
ExitToWorldMap("ExitToWorldMap", Input.Keys.F4,Input.Keys.BUTTON_L2),
|
||||
Bookmark("Bookmark", Input.Keys.B, Input.Keys.BUTTON_R2),
|
||||
Use("Use", Input.Keys.ENTER,Input.Keys.BUTTON_A),
|
||||
Back("Back", Input.Keys.ESCAPE,Input.Keys.BUTTON_B),
|
||||
ScrollUp("ScrollUp", Input.Keys.PAGE_UP,Input.Keys.BUTTON_L1),
|
||||
|
||||
@@ -50,8 +50,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static forge.adventure.util.Paths.ITEMS_ATLAS;
|
||||
|
||||
/**
|
||||
* Render the rewards as a card on the reward scene.
|
||||
*/
|
||||
@@ -296,8 +294,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
break;
|
||||
}
|
||||
case Item: {
|
||||
TextureAtlas atlas = Config.instance().getAtlas(ITEMS_ATLAS);
|
||||
Sprite backSprite = atlas.createSprite("CardBack");
|
||||
Sprite backSprite = Config.instance().getItemSprite("CardBack");
|
||||
if (reward.getItem() == null) {
|
||||
needsToBeDisposed = true;
|
||||
processSprite(backSprite, null, null, 0, 0, false);
|
||||
@@ -311,8 +308,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
break;
|
||||
}
|
||||
case CardPack: {
|
||||
TextureAtlas atlas = Config.instance().getAtlas(ITEMS_ATLAS);
|
||||
Sprite backSprite = atlas.createSprite("CardBack");
|
||||
Sprite backSprite = Config.instance().getItemSprite("CardBack");
|
||||
if (reward.getDeck() == null) {
|
||||
needsToBeDisposed = true;
|
||||
processSprite(backSprite, null, null, 0, 0, false);
|
||||
@@ -342,7 +338,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
item = new Sprite(new TextureRegion(t));
|
||||
isBooster = true;
|
||||
} else {
|
||||
item = atlas.createSprite("Deck");
|
||||
item = Config.instance().getItemSprite("Deck");
|
||||
}
|
||||
|
||||
setItemTooltips(item, backSprite, isBooster);
|
||||
@@ -356,9 +352,8 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
case Life:
|
||||
case Shards:
|
||||
case Gold: {
|
||||
TextureAtlas atlas = Config.instance().getAtlas(ITEMS_ATLAS);
|
||||
Sprite backSprite = atlas.createSprite("CardBack");
|
||||
Sprite item = atlas.createSprite(reward.type.toString());
|
||||
Sprite backSprite = Config.instance().getItemSprite("CardBack");
|
||||
Sprite item = Config.instance().getItemSprite(reward.type.toString());
|
||||
setItemTooltips(item, backSprite, false);
|
||||
boolean isShop = RewardScene.Type.Shop.equals(type);
|
||||
processSprite(backSprite, item, isShop ? null :
|
||||
|
||||
@@ -444,6 +444,18 @@ GreenLeaf
|
||||
GreenLeaf2
|
||||
xy: 112, 608
|
||||
size: 16, 16
|
||||
GoldCoin
|
||||
xy: 464, 63
|
||||
size: 16, 16
|
||||
Magnifier
|
||||
xy: 448, 63
|
||||
size: 16, 16
|
||||
Bookmark
|
||||
xy: 432, 63
|
||||
size: 16, 16
|
||||
Unmark
|
||||
xy: 416, 63
|
||||
size: 16, 16
|
||||
SearchPost
|
||||
xy: 384, 63
|
||||
size: 16, 16
|
||||
@@ -456,6 +468,12 @@ LogBook
|
||||
GPS
|
||||
xy: 464, 0
|
||||
size: 16, 16
|
||||
Star
|
||||
xy: 464, 16
|
||||
size: 16, 16
|
||||
TreasureChest
|
||||
xy: 464, 32
|
||||
size: 16, 16
|
||||
UnderworldCookbook
|
||||
xy: 304, 960
|
||||
size: 16, 16
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 280 KiB After Width: | Height: | Size: 275 KiB |
@@ -89,7 +89,7 @@
|
||||
"binding": "Deck",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 175,
|
||||
"x": 198,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
@@ -99,7 +99,7 @@
|
||||
"binding": "Inventory",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 220,
|
||||
"x": 243,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
@@ -109,7 +109,7 @@
|
||||
"binding": "Status",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 265,
|
||||
"x": 288,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
@@ -119,7 +119,7 @@
|
||||
"binding": "Menu",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 130,
|
||||
"x": 108,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
@@ -139,7 +139,17 @@
|
||||
"binding": "ExitToWorldMap",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 310,
|
||||
"x": 333,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"type": "TextButton",
|
||||
"name": "bookmark",
|
||||
"text": "[%120][+Bookmark]",
|
||||
"binding": "Bookmark",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 153,
|
||||
"y": 0
|
||||
}
|
||||
]
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
"binding": "Deck",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 175,
|
||||
"x": 198,
|
||||
"y": 240
|
||||
},
|
||||
{
|
||||
@@ -99,7 +99,7 @@
|
||||
"binding": "Inventory",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 220,
|
||||
"x": 243,
|
||||
"y": 240
|
||||
},
|
||||
{
|
||||
@@ -109,7 +109,7 @@
|
||||
"binding": "Status",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 265,
|
||||
"x": 288,
|
||||
"y": 240
|
||||
},
|
||||
{
|
||||
@@ -119,7 +119,7 @@
|
||||
"binding": "Menu",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 130,
|
||||
"x": 108,
|
||||
"y": 240
|
||||
},
|
||||
{
|
||||
@@ -139,7 +139,17 @@
|
||||
"binding": "ExitToWorldMap",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 310,
|
||||
"x": 333,
|
||||
"y": 240
|
||||
},
|
||||
{
|
||||
"type": "TextButton",
|
||||
"name": "bookmark",
|
||||
"text": "[%120][+Bookmark]",
|
||||
"binding": "Bookmark",
|
||||
"width": 45,
|
||||
"height": 25,
|
||||
"x": 153,
|
||||
"y": 240
|
||||
}
|
||||
]
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
"text": "[%120][+Deck]",
|
||||
"width": 25,
|
||||
"height": 25,
|
||||
"x": 105,
|
||||
"x": 118,
|
||||
"y": 450
|
||||
},
|
||||
{
|
||||
@@ -96,7 +96,7 @@
|
||||
"text": "[%120][+Item]",
|
||||
"width": 25,
|
||||
"height": 25,
|
||||
"x": 130,
|
||||
"x": 143,
|
||||
"y": 450
|
||||
},
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
"text": "[%120][+Logbook]",
|
||||
"width": 25,
|
||||
"height": 25,
|
||||
"x": 155,
|
||||
"x": 168,
|
||||
"y": 450
|
||||
},
|
||||
{
|
||||
@@ -115,7 +115,7 @@
|
||||
"text": "[%120][+Menu]",
|
||||
"width": 25,
|
||||
"height": 25,
|
||||
"x": 80,
|
||||
"x": 68,
|
||||
"y": 450
|
||||
},
|
||||
{
|
||||
@@ -133,7 +133,16 @@
|
||||
"text": "[%120][+ExitToWorldMap]",
|
||||
"width": 25,
|
||||
"height": 25,
|
||||
"x": 180,
|
||||
"x": 193,
|
||||
"y": 450
|
||||
},
|
||||
{
|
||||
"type": "TextButton",
|
||||
"name": "bookmark",
|
||||
"text": "[%120][+Bookmark]",
|
||||
"width": 25,
|
||||
"height": 25,
|
||||
"x": 93,
|
||||
"y": 450
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user