update ImageView

show NoSell overlay
This commit is contained in:
Anthony Calosa
2024-11-07 10:34:34 +08:00
parent 7f7248f825
commit 95ca1673b8
5 changed files with 38 additions and 20 deletions

View File

@@ -473,7 +473,8 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
if (data.containsKey("noSellCards")) {
PaperCard[] items = (PaperCard[]) data.readObject("noSellCards");
for (PaperCard item : items) {
noSellCards.add(item);
if (item != null)
noSellCards.add(item.getNoSellVersion());
}
}
if (data.containsKey("autoSellCards")) {
@@ -636,7 +637,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
autoSellCards.add(reward.getCard());
refreshEditor();
} else if (reward.isNoSell()) {
noSellCards.add(reward.getCard());
noSellCards.add(reward.getCard().getNoSellVersion());
refreshEditor();
}
break;

View File

@@ -2,8 +2,6 @@ package forge.adventure.scene;
import com.badlogic.gdx.scenes.scene2d.Stage;
import forge.adventure.data.AdventureEventData;
import forge.adventure.player.AdventurePlayer;
import forge.item.PaperCard;
import forge.screens.FScreen;
/**
@@ -61,12 +59,4 @@ public class DeckEditScene extends ForgeScene {
}
return screen;
}
public boolean isAutoSell(PaperCard pc) {
return AdventurePlayer.current().getAutoSellCards().contains(pc);
}
public boolean isNoSell(PaperCard pc) {
return AdventurePlayer.current().getNoSellCards().contains(pc);
}
}

View File

@@ -222,8 +222,8 @@ public class ConsoleCommandInterpreter {
if (s.length < 1) return "Command needs 1 parameter: Card name.";
PaperCard card = StaticData.instance().getCommonCards().getCard(s[0]);
if (card == null) return "Cannot find card: " + s[0];
Current.player().addCard(card);
Current.player().noSellCards.add(card);
Current.player().addCard(card.getNoSellVersion());
Current.player().noSellCards.add(card.getNoSellVersion());
return "Added card: " + s[0];
});
registerCommand(new String[]{"give", "item"}, s -> {

View File

@@ -1126,13 +1126,11 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
if (cardPrice == null)
cardPrice = ((ShopScene) Forge.getCurrentScene()).getCardPrice((PaperCard) item);
drawCardLabel(g, "$" + cardPrice, Color.GOLD, x, y ,w ,h);
} /*else if (Forge.getCurrentScene() instanceof DeckEditScene) {
if (((DeckEditScene) Forge.getCurrentScene()).isAutoSell((PaperCard) item)) {
drawCardLabel(g, Forge.getLocalizer().getMessage("lblAutoSell"), Color.GREEN, x, y, w, h);
} else if (((DeckEditScene) Forge.getCurrentScene()).isNoSell((PaperCard) item)) {
} else {
if (((PaperCard) item).isNoSell()) {
drawCardLabel(g, Forge.getLocalizer().getMessage("lblNoSell"), Color.RED, x, y, w, h);
}
}*///TODO FIX Distinction
}
}
} else if (item instanceof ConquestCommander) {
CardRenderer.drawCard(g, ((ConquestCommander) item).getCard(), x, y, w, h, pos);