mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
Improved reconnect and tournament handling. Reconnect time is now shown for disconneted players on player list and tournament panel. You can now reconnect (during 3 minutes) to a tournament also if meanwhile new game (after sideboarding ended) or round was started. Conceding the complete match in a tournament can no longer result in a draw, if you won games before. Quitting a tournament does now always end all active games of that quitting player.
This commit is contained in:
parent
c76529bf91
commit
9ff5bcbd92
29 changed files with 282 additions and 109 deletions
|
|
@ -657,7 +657,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
for (JInternalFrame window : desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER)) {
|
||||
if (window instanceof DraftPane) {
|
||||
DraftPane draftPane = (DraftPane) window;
|
||||
draftPane.hideDraft();
|
||||
draftPane.removeDraft();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -997,12 +997,21 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
if (window instanceof DraftPane) {
|
||||
DraftPane draftPane = (DraftPane) window;
|
||||
draftPane.hideDraft();
|
||||
draftPane.removeDraft();
|
||||
}
|
||||
if (window instanceof TournamentPane) {
|
||||
TournamentPane tournamentPane = (TournamentPane) window;
|
||||
tournamentPane.hideTournament();
|
||||
tournamentPane.removeTournament();
|
||||
}
|
||||
// close & remove sideboarding or construction pane if open
|
||||
if (window instanceof DeckEditorPane) {
|
||||
DeckEditorPane deckEditorPane = (DeckEditorPane) window;
|
||||
if (deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.Limited)
|
||||
|| deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.Sideboard)){
|
||||
deckEditorPane.removeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ public class DeckEditorPane extends MagePane {
|
|||
this.repaint();
|
||||
}
|
||||
|
||||
public DeckEditorMode getDeckEditorMode() {
|
||||
return this.deckEditorPanel1.getDeckEditorMode();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
|
|
|
|||
|
|
@ -329,6 +329,10 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public DeckEditorMode getDeckEditorMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
private BigCard getBigCard() {
|
||||
return this.bigCard;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class DraftPane extends MagePane {
|
|||
this.draftPanel1.showDraft(draftId);
|
||||
}
|
||||
|
||||
public void hideDraft() {
|
||||
public void removeDraft() {
|
||||
draftPanel1.cleanUp();
|
||||
this.removeFrame();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
c = c.getParent();
|
||||
}
|
||||
if (c != null) {
|
||||
((DraftPane)c).hideDraft();
|
||||
((DraftPane)c).removeDraft();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class TournamentPane extends MagePane {
|
|||
this.repaint();
|
||||
}
|
||||
|
||||
public void hideTournament() {
|
||||
public void removeTournament() {
|
||||
tournamentPanel.cleanUp();
|
||||
removeFrame();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
c = c.getParent();
|
||||
}
|
||||
if (c != null) {
|
||||
((TournamentPane)c).hideTournament();
|
||||
((TournamentPane)c).removeTournament();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -209,6 +209,9 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
firstInitDone = true;
|
||||
}
|
||||
|
||||
if (txtEndTime == null) {
|
||||
return;
|
||||
}
|
||||
if (txtEndTime.getText().equals("running...") && tournament.getEndTime() != null) {
|
||||
txtEndTime.setText(df.format(tournament.getEndTime()));
|
||||
}
|
||||
|
|
@ -608,14 +611,16 @@ class UpdateTournamentTask extends SwingWorker<Void, TournamentView> {
|
|||
protected Void doInBackground() throws Exception {
|
||||
while (!isCancelled()) {
|
||||
this.publish(session.getTournament(tournamentId));
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void process(List<TournamentView> view) {
|
||||
panel.update(view.get(0));
|
||||
if (view != null) { // if user disconnects, view can be null for a short time
|
||||
panel.update(view.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue