mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Make mouseover on prompt pane show cardview of the controlling card if there is one
This commit is contained in:
@@ -791,6 +791,10 @@ public final class CMatchUI
|
||||
public void showPromptMessage(final PlayerView playerView, final String message) {
|
||||
cPrompt.setMessage(message);
|
||||
}
|
||||
// no override for now
|
||||
public void showPromptMessage(final PlayerView playerView, final String message, final SpellAbilityView sav ) {
|
||||
cPrompt.setMessage(message,sav);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showManaPool(final PlayerView player) {
|
||||
|
||||
@@ -28,6 +28,8 @@ import javax.swing.JButton;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.game.GameView;
|
||||
import forge.game.card.CardView;
|
||||
import forge.game.spellability.SpellAbilityView;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.framework.SDisplayUtil;
|
||||
import forge.screens.match.CMatchUI;
|
||||
@@ -47,6 +49,9 @@ public class CPrompt implements ICDoc {
|
||||
this.view = new VPrompt(this);
|
||||
}
|
||||
|
||||
public final CMatchUI getMatchUI() {
|
||||
return matchUI;
|
||||
}
|
||||
public final VPrompt getView() {
|
||||
return view;
|
||||
}
|
||||
@@ -100,6 +105,11 @@ public class CPrompt implements ICDoc {
|
||||
|
||||
public void setMessage(final String s0) {
|
||||
view.getTarMessage().setText(FSkin.encodeSymbols(s0, false));
|
||||
view.setSpellAbilityView(null);
|
||||
}
|
||||
public void setMessage(final String s0, final SpellAbilityView sav) {
|
||||
view.getTarMessage().setText(FSkin.encodeSymbols(s0, false));
|
||||
view.setSpellAbilityView(sav);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge.screens.match.views;
|
||||
|
||||
import forge.game.card.CardView;
|
||||
import forge.game.spellability.SpellAbilityView;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
@@ -33,6 +35,8 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of message report.
|
||||
@@ -52,6 +56,11 @@ public class VPrompt implements IVDoc<CPrompt> {
|
||||
private final FScrollPane messageScroller = new FScrollPane(tarMessage, false,
|
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
private final JLabel lblGames;
|
||||
private SpellAbilityView sav = null ;
|
||||
|
||||
public void setSpellAbilityView(final SpellAbilityView sav) {
|
||||
this.sav = sav ;
|
||||
}
|
||||
|
||||
private KeyAdapter buttonKeyAdapter = new KeyAdapter() {
|
||||
@Override
|
||||
@@ -84,6 +93,15 @@ public class VPrompt implements IVDoc<CPrompt> {
|
||||
|
||||
tarMessage.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
tarMessage.setMargin(new Insets(3, 3, 3, 3));
|
||||
|
||||
messageScroller.getViewport().getView().addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
if ( sav != null ) {
|
||||
controller.getMatchUI().setCard(sav.getHostCard());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//========== Overridden methods
|
||||
|
||||
Reference in New Issue
Block a user