forked from External/mage
GUI: reworked GUI to support non-blocking UI:
- GUI: added non-blocking UI to almost all app and game dialogs; - GUI: it allows to switch between UI dialogs and use any UI elements at any moment; - GUI: it allows to use chat, card popup, battlefield, concede and other features while choosing (related to #12670); - GUI: it allows to download images while playing (related to #4160, not fully tested); - GUI: enabled by default, can be disabled by java option: -Dxmage.guiModalMode=true - connection: auto-connect will be visible in main menu on startup; - connection: removed some unused features (auto-connect by command line); - connection: added <ESC> button to close connection dialog; - download: added background images download (see non-blocking UI); - download: improved cancel stability and fixes that it can't stop preparing/downloading process in some use cases; - app: fixed freezes on macOS systems in some use cases (related to #12431, #11292, #9300, #4920);
This commit is contained in:
parent
2fc4e94b3a
commit
6625db1be1
40 changed files with 614 additions and 532 deletions
|
|
@ -23,15 +23,15 @@ import java.util.TreeSet;
|
|||
/**
|
||||
* App GUI: adding new lands to the deck, uses in deck editor and drafting
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @author BetaSteward_at_googlemail.com, JayDi85
|
||||
*/
|
||||
public class AddLandDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MageDialog.class);
|
||||
|
||||
private Deck deck;
|
||||
|
||||
private DeckEditorMode mode;
|
||||
private AddLandCallback callback = null;
|
||||
|
||||
private static final int DEFAULT_SEALED_DECK_CARD_NUMBER = 40;
|
||||
|
||||
|
|
@ -40,9 +40,14 @@ public class AddLandDialog extends MageDialog {
|
|||
this.setModal(true);
|
||||
}
|
||||
|
||||
public void showDialog(Deck deck, DeckEditorMode mode) {
|
||||
public interface AddLandCallback {
|
||||
void onLandsAdded();
|
||||
}
|
||||
|
||||
public void showDialog(Deck deck, DeckEditorMode mode, AddLandCallback callback) {
|
||||
this.deck = deck;
|
||||
this.mode = mode;
|
||||
this.callback = callback;
|
||||
SortedSet<String> landSetNames = new TreeSet<>();
|
||||
String defaultSetName = null;
|
||||
if (mode != DeckEditorMode.FREE_BUILDING) {
|
||||
|
|
@ -126,11 +131,7 @@ public class AddLandDialog extends MageDialog {
|
|||
|
||||
// windows settings
|
||||
MageFrame.getDesktop().remove(this);
|
||||
if (this.isModal()) {
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.MODAL_LAYER);
|
||||
} else {
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
|
||||
}
|
||||
MageFrame.getDesktop().add(this, this.isModal() ? JLayeredPane.MODAL_LAYER : JLayeredPane.PALETTE_LAYER);
|
||||
this.makeWindowCentered();
|
||||
|
||||
// Close on "ESC"
|
||||
|
|
@ -214,7 +215,11 @@ public class AddLandDialog extends MageDialog {
|
|||
addLands("Plains", nPlains, useFullArt);
|
||||
addLands("Swamp", nSwamp, useFullArt);
|
||||
|
||||
this.removeDialog();
|
||||
if (this.callback != null) {
|
||||
callback.onLandsAdded();
|
||||
}
|
||||
|
||||
onCancel();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue