mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
[client] Autoclosing game windows after 8 seconds they finished
This commit is contained in:
parent
ec123fee33
commit
e0de28693b
1 changed files with 19 additions and 0 deletions
|
|
@ -49,6 +49,9 @@ import java.awt.event.ActionEvent;
|
|||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -69,6 +72,8 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
private MageDialog connectedDialog;
|
||||
private ChatPanel connectedChatPanel;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
/** Creates new form FeedbackPanel */
|
||||
public FeedbackPanel() {
|
||||
//initComponents();
|
||||
|
|
@ -124,6 +129,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
this.btnRight.setText("OK");
|
||||
this.helper.setState("", false, "OK", true);
|
||||
ArrowBuilder.removeAllArrows();
|
||||
endWithTimeout();
|
||||
break;
|
||||
}
|
||||
this.btnSpecial.setVisible(special);
|
||||
|
|
@ -147,6 +153,19 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
this.helper.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close game window by pressing OK button after 5 seconds
|
||||
*/
|
||||
private void endWithTimeout() {
|
||||
Runnable task = new Runnable() {
|
||||
public void run() {
|
||||
logger.info("Ending game...");
|
||||
FeedbackPanel.this.btnRight.doClick();
|
||||
}
|
||||
};
|
||||
worker.schedule(task, 8, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void handleOptions(Map<String, Serializable> options) {
|
||||
if (options != null) {
|
||||
if (options.containsKey("UI.right.btn.text")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue