* Planechase: fixed not working plane hint in game logs (now you can see popup with full plane description);

This commit is contained in:
Oleg Agafonov 2020-04-13 21:55:27 +04:00
parent 75334141d9
commit 39b56d525a

View file

@ -6,9 +6,11 @@ import mage.client.MageFrame;
import mage.client.dialog.PreferencesDialog; import mage.client.dialog.PreferencesDialog;
import mage.client.util.gui.GuiDisplayUtil; import mage.client.util.gui.GuiDisplayUtil;
import mage.components.CardInfoPane; import mage.components.CardInfoPane;
import mage.game.command.Plane;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.utils.ThreadUtils; import mage.utils.ThreadUtils;
import mage.view.CardView; import mage.view.CardView;
import mage.view.PlaneView;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.HyperlinkEvent.EventType; import javax.swing.event.HyperlinkEvent.EventType;
@ -75,17 +77,24 @@ public class ColorPane extends JEditorPane {
if (!alternativeName.isEmpty()) { if (!alternativeName.isEmpty()) {
cardName = alternativeName; cardName = alternativeName;
} }
CardInfo card = CardRepository.instance.findCard(cardName);
try { try {
final Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER); final Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
if (e.getEventType() == EventType.EXITED) { if (e.getEventType() == EventType.EXITED) {
setPopupVisibility(container, false); setPopupVisibility(container, false);
} }
if (e.getEventType() == EventType.ENTERED && card != null) { if (e.getEventType() == EventType.ENTERED) {
CardInfoPane cardInfoPane = (CardInfoPane) MageFrame.getUI().getComponent(MageComponents.CARD_INFO_PANE); CardInfoPane cardInfoPane = (CardInfoPane) MageFrame.getUI().getComponent(MageComponents.CARD_INFO_PANE);
// card
CardInfo card = CardRepository.instance.findCard(cardName);
Plane plane = Plane.createPlaneByFullName(cardName);
if (card != null) {
cardInfoPane.setCard(new CardView(card.getMockCard()), container); cardInfoPane.setCard(new CardView(card.getMockCard()), container);
setPopupVisibility(container, true); setPopupVisibility(container, true);
} else if (plane != null) {
cardInfoPane.setCard(new CardView(new PlaneView(plane)), container);
setPopupVisibility(container, true);
}
} }
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
e1.printStackTrace(); e1.printStackTrace();