mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
GUI: fixed error on closing dialogs/games (#7507);
This commit is contained in:
parent
ece9108695
commit
c256aa59f7
1 changed files with 31 additions and 5 deletions
|
@ -74,7 +74,7 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
private boolean showCastingCost;
|
private boolean showCastingCost;
|
||||||
private float alpha = 1.0f;
|
private float alpha = 1.0f;
|
||||||
|
|
||||||
private ActionCallback callback;
|
private ActionCallback callback; // callback can be null after closed game/dialog, so you must check it before call
|
||||||
|
|
||||||
protected boolean tooltipShowing;
|
protected boolean tooltipShowing;
|
||||||
protected final TextPopup tooltipText;
|
protected final TextPopup tooltipText;
|
||||||
|
@ -596,6 +596,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
data.setComponent(this);
|
data.setComponent(this);
|
||||||
data.setCard(this.getGameCard());
|
data.setCard(this.getGameCard());
|
||||||
data.setGameId(this.gameId);
|
data.setGameId(this.gameId);
|
||||||
|
@ -624,11 +627,13 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
mouseResetTimer.schedule(new TimerTask() {
|
mouseResetTimer.schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (callback != null) {
|
||||||
if (mouseClicksCount == 1) {
|
if (mouseClicksCount == 1) {
|
||||||
callback.mouseClicked(e, data, false);
|
callback.mouseClicked(e, data, false);
|
||||||
} else if (mouseClicksCount > 1) {
|
} else if (mouseClicksCount > 1) {
|
||||||
callback.mouseClicked(e, data, true);
|
callback.mouseClicked(e, data, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mouseClicksCount = 0;
|
mouseClicksCount = 0;
|
||||||
}
|
}
|
||||||
}, MOUSE_DOUBLE_CLICK_RESET_MS);
|
}, MOUSE_DOUBLE_CLICK_RESET_MS);
|
||||||
|
@ -637,6 +642,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (getGameCard().hideInfo()) {
|
if (getGameCard().hideInfo()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -655,6 +663,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (getGameCard().hideInfo()) {
|
if (getGameCard().hideInfo()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -673,6 +684,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
data.setComponent(this);
|
data.setComponent(this);
|
||||||
data.setCard(this.getGameCard());
|
data.setCard(this.getGameCard());
|
||||||
data.setGameId(this.gameId);
|
data.setGameId(this.gameId);
|
||||||
|
@ -681,6 +695,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent e) {
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
data.setComponent(this);
|
data.setComponent(this);
|
||||||
data.setCard(this.getGameCard());
|
data.setCard(this.getGameCard());
|
||||||
data.setGameId(this.gameId);
|
data.setGameId(this.gameId);
|
||||||
|
@ -689,6 +706,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDragged(MouseEvent e) {
|
public void mouseDragged(MouseEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
data.setComponent(this);
|
data.setComponent(this);
|
||||||
data.setCard(this.getGameCard());
|
data.setCard(this.getGameCard());
|
||||||
data.setGameId(this.gameId);
|
data.setGameId(this.gameId);
|
||||||
|
@ -697,6 +717,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (getGameCard().hideInfo()) {
|
if (getGameCard().hideInfo()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -708,6 +731,9 @@ public abstract class CardPanel extends MagePermanent implements ComponentListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (getGameCard().hideInfo()) {
|
if (getGameCard().hideInfo()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue