Dungeon improves:

* Dungeons: added dungeon name hint to room's game log and choices (part of #12274);
* GUI, game: added card popup hints support in feedback panel (yes/no choices);
* Images: fixed miss images for dungeons in command zone, game logs and choice dialogs;
This commit is contained in:
Oleg Agafonov 2024-09-19 13:42:23 +04:00
parent cd51954208
commit b40e7222b3
9 changed files with 94 additions and 26 deletions

View file

@ -8,10 +8,12 @@ import mage.client.cards.BigCard;
import mage.client.cards.VirtualCardInfo;
import mage.client.dialog.PreferencesDialog;
import mage.client.game.GamePanel;
import mage.game.command.Dungeon;
import mage.game.command.Plane;
import mage.util.CardUtil;
import mage.util.GameLog;
import mage.view.CardView;
import mage.view.DungeonView;
import mage.view.PlaneView;
import javax.swing.*;
@ -156,7 +158,7 @@ public class MageEditorPane extends JEditorPane {
// show real object by priority (workable card hints and actual info)
CardView cardView = needCard;
// if no game object found then show default card
// if no game object found then show default card/object
if (cardView == null) {
CardInfo card = CardRepository.instance.findCards(cardName).stream().findFirst().orElse(null);
if (card != null) {
@ -172,6 +174,14 @@ public class MageEditorPane extends JEditorPane {
}
}
// dungeon
if (cardView == null) {
Dungeon dungeon = Dungeon.createDungeon(cardName, false);
if (dungeon != null) {
cardView = new CardView(new DungeonView(dungeon));
}
}
// TODO: add other objects like dungeon, emblem, commander
if (cardView != null) {

View file

@ -314,7 +314,7 @@ public class PickChoiceDialog extends MageDialog {
cardInfo.init(item.getHint(), this.bigCard, this.gameId);
} else if (item.getHintType() == ChoiceHintType.CARD_DUNGEON) {
// as card name
CardView cardView = new CardView(new DungeonView(Dungeon.createDungeon(item.getHint())));
CardView cardView = new CardView(new DungeonView(Dungeon.createDungeon(item.getHint(), true)));
cardInfo.init(cardView, this.bigCard, this.gameId);
} else if (item.getHintType() == ChoiceHintType.GAME_OBJECT) {
// as object

View file

@ -2,6 +2,7 @@ package mage.client.game;
import mage.client.MageFrame;
import mage.client.SessionHandler;
import mage.client.cards.BigCard;
import mage.client.chat.ChatPanelBasic;
import mage.client.dialog.MageDialog;
import mage.client.util.audio.AudioManager;
@ -56,9 +57,9 @@ public class FeedbackPanel extends javax.swing.JPanel {
customInitComponents();
}
public void init(UUID gameId) {
public void init(UUID gameId, BigCard bigCard) {
this.gameId = gameId;
helper.init(gameId);
helper.init(gameId, bigCard);
setGUISize();
}

View file

@ -196,11 +196,20 @@ public final class GamePanel extends javax.swing.JPanel {
player.getGraveyard().values().forEach(c -> this.allCardsIndex.put(c.getId(), c));
Optional.ofNullable(player.getTopCard()).ifPresent(c -> this.allCardsIndex.put(c.getId(), c));
// TODO: add support of dungeon, emblem all another non-card objects
// commanders and custom emblems
player.getCommandObjectList()
.stream()
.filter(c -> c instanceof CardView)
.map(c -> (CardView) c)
.forEach(c -> this.allCardsIndex.put(c.getId(), c));
.forEach(object -> {
if (object instanceof CardView) {
// commanders and custom emblems
this.allCardsIndex.put(object.getId(), (CardView) object);
} else if (object instanceof DungeonView) {
// dungeons
this.allCardsIndex.put(object.getId(), new CardView((DungeonView) object));
} else {
// TODO: enable after all view types added here?
//throw new IllegalArgumentException("Unsupported object type: " + object.getName() + " - " + object.getClass().getSimpleName());
}
});
});
}
@ -808,7 +817,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.gamePane = gamePane;
this.playerId = playerId;
MageFrame.addGame(gameId, this);
this.feedbackPanel.init(gameId);
this.feedbackPanel.init(gameId, bigCard);
this.feedbackPanel.clear();
this.abilityPicker.init(gameId, bigCard);
this.btnConcede.setVisible(true);
@ -851,7 +860,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.gamePane = gamePane;
this.playerId = null;
MageFrame.addGame(gameId, this);
this.feedbackPanel.init(gameId);
this.feedbackPanel.init(gameId, bigCard);
this.feedbackPanel.clear();
this.btnConcede.setVisible(false);
@ -886,7 +895,7 @@ public final class GamePanel extends javax.swing.JPanel {
this.gameId = gameId;
this.playerId = null;
MageFrame.addGame(gameId, this);
this.feedbackPanel.init(gameId);
this.feedbackPanel.init(gameId, bigCard);
this.feedbackPanel.clear();
this.btnConcede.setVisible(false);
this.btnSkipToNextTurn.setVisible(false);

View file

@ -1,6 +1,7 @@
package mage.client.game;
import mage.client.SessionHandler;
import mage.client.cards.BigCard;
import mage.client.components.MageTextArea;
import mage.client.constants.Constants;
import mage.client.dialog.PreferencesDialog;
@ -89,8 +90,9 @@ public class HelperPanel extends JPanel {
initComponents();
}
public void init(UUID gameId) {
public void init(UUID gameId, BigCard bigCard) {
this.gameId = gameId;
this.dialogTextArea.setGameData(gameId, bigCard);
}
public void changeGUISize() {