mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge origin/master
This commit is contained in:
commit
c6f8d09229
5 changed files with 54 additions and 44 deletions
|
@ -4,7 +4,10 @@ import java.awt.BorderLayout;
|
|||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JPanel;
|
||||
|
@ -57,23 +60,12 @@ public class ColorPane extends JEditorPane {
|
|||
try {
|
||||
final Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
|
||||
if (e.getEventType() == EventType.EXITED) {
|
||||
setPopupVisibility(null, container, false);
|
||||
setPopupVisibility(container, false);
|
||||
}
|
||||
if (e.getEventType() == EventType.ENTERED) {
|
||||
CardInfoPane cardInfoPane = (CardInfoPane) MageFrame.getUI().getComponent(MageComponents.CARD_INFO_PANE);
|
||||
cardInfoPane.setCard(new CardView(card.getMockCard()), container);
|
||||
Point mousePosition = MageFrame.getDesktop().getMousePosition();
|
||||
int popupY = 0;
|
||||
if (mousePosition == null) { // switched to another window
|
||||
popupY = getLocationOnScreen().y;
|
||||
} else {
|
||||
popupY = mousePosition.y;
|
||||
}
|
||||
Point location = new Point(getLocationOnScreen().x - container.getWidth(), popupY);
|
||||
Component parentComponent = MageFrame.getInstance();
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentComponent.getLocationOnScreen(),
|
||||
container, parentComponent);
|
||||
setPopupVisibility(location, container, true);
|
||||
setPopupVisibility(container, true);
|
||||
}
|
||||
} catch (InterruptedException e1) {
|
||||
e1.printStackTrace();
|
||||
|
@ -83,20 +75,37 @@ public class ColorPane extends JEditorPane {
|
|||
});
|
||||
}
|
||||
|
||||
private void setPopupVisibility(final Point location, final Component container, final boolean show)
|
||||
throws InterruptedException {
|
||||
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (location != null) {
|
||||
container.setLocation(location);
|
||||
}
|
||||
tooltipCounter += show ? 1 : -1;
|
||||
container.setVisible(tooltipCounter > 0);
|
||||
c.repaint();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
tooltipCounter = 1; // will decrement and become effectively zero on leaving the pane
|
||||
try {
|
||||
setPopupVisibility(MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER), false);
|
||||
} catch (InterruptedException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setPopupVisibility(final Component container, final boolean show)
|
||||
throws InterruptedException {
|
||||
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Point location = new Point(getLocationOnScreen().x - container.getWidth(), MouseInfo.getPointerInfo().getLocation().y);
|
||||
Component parentComponent = MageFrame.getInstance();
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentComponent.getLocationOnScreen(), container, parentComponent);
|
||||
container.setLocation(location);
|
||||
tooltipCounter += show ? 1 : -1;
|
||||
if (tooltipCounter < 0) {
|
||||
tooltipCounter = 0;
|
||||
}
|
||||
container.setVisible(tooltipCounter > 0);
|
||||
c.repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -182,24 +182,14 @@ public class MageActionCallback implements ActionCallback {
|
|||
|
||||
((CardInfoPane) popup2).setCard(data.card, popupContainer);
|
||||
|
||||
if (data.locationOnScreen == null) {
|
||||
data.locationOnScreen = data.component.getLocationOnScreen();
|
||||
}
|
||||
|
||||
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, popup2, parentComponent);
|
||||
location.translate(-parentPoint.x, -parentPoint.y);
|
||||
|
||||
ThreadUtils.sleep(200);
|
||||
|
||||
showPopup(popupContainer, location);
|
||||
showPopup(popupContainer, popup2);
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.warn(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void showPopup(final Component popupContainer, final Point location) throws InterruptedException {
|
||||
public void showPopup(final Component popupContainer, final Component infoPane) throws InterruptedException {
|
||||
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
@ -207,6 +197,13 @@ public class MageActionCallback implements ActionCallback {
|
|||
if (!popupTextWindowOpen || !enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
||||
return;
|
||||
}
|
||||
if (data.locationOnScreen == null) {
|
||||
data.locationOnScreen = data.component.getLocationOnScreen();
|
||||
}
|
||||
|
||||
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, infoPane, parentComponent);
|
||||
location.translate(-parentPoint.x, -parentPoint.y);
|
||||
popupContainer.setLocation(location);
|
||||
popupContainer.setVisible(true);
|
||||
c.repaint();
|
||||
|
|
|
@ -8,7 +8,6 @@ import mage.client.util.GUISizeHelper;
|
|||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.GuiDisplayUtil.TextLines;
|
||||
import mage.components.CardInfoPane;
|
||||
import mage.utils.ThreadUtils;
|
||||
import mage.view.CardView;
|
||||
import org.mage.card.arcane.UI;
|
||||
|
||||
|
|
|
@ -113,7 +113,12 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} or another Ally enters the battlefield under your control, you may destroy target artifact. If that artifact is put into a graveyard this way, {this} deals damage to that artifact's controller equal to the number of Allies you control.";
|
||||
|
||||
// originally returned fullText, user reported that because the trigger text is so lengthy, they cannot click Yes/No buttons
|
||||
//String fullText = "Whenever {this} or another Ally enters the battlefield under your control, you may destroy target artifact. If that artifact is put into a graveyard this way, {this} deals damage to that artifact's controller equal to the number of Allies you control.";
|
||||
String condensedText = "Whenever {this} or another Ally you enters the battlefield under your control, you may destroy target artifact. If you do, {this} deals damage to that controller equal to the number of Allies you control.";
|
||||
|
||||
return condensedText;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
cd ./client
|
||||
cd ./mage-client
|
||||
./startClient.sh
|
||||
cd ../server
|
||||
./startServer.sh
|
||||
cd ../mage-server
|
||||
./startServer.sh
|
||||
|
|
Loading…
Reference in a new issue