UPPPP FINISH
This commit is contained in:
parent
e1622dfaa1
commit
ab307b0a97
24 changed files with 857 additions and 526 deletions
|
|
@ -27,6 +27,7 @@ public class GameService {
|
|||
public DefaultListModel<Pair<String,Integer>> globalRanks = new DefaultListModel<>();
|
||||
public DefaultListModel<Pair<String,Integer>> ranks = new DefaultListModel<>();
|
||||
private Boolean gameIsStarted = false;
|
||||
public Boolean isWaiting = false;
|
||||
|
||||
private void addToPendingList(String username) throws IOException {
|
||||
pendingList.addElement(username);
|
||||
|
|
@ -44,7 +45,7 @@ public class GameService {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(!App.gameService.gameIsStarted) {
|
||||
if(!App.gameService.gameIsStarted && !App.gameService.isWaiting) {
|
||||
//Show invite popup
|
||||
new TTDialog("success", "New invite from: " + userName + "!",
|
||||
new Callable() {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
|||
@Override
|
||||
public Void doInBackground() {
|
||||
try {
|
||||
App.gameService.isWaiting = true;
|
||||
ByteBuffer buffer = ByteBuffer.allocate(1024);
|
||||
TTDialog loading = new TTDialog("alert", "Waiting for users joins",null,null);
|
||||
buffer.flip();
|
||||
|
|
@ -42,6 +43,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
|||
Message msg = Message.toMessage(line);
|
||||
if (msg.message.equals("JOIN_TIMEOUT")) {
|
||||
loading.dispose();
|
||||
App.gameService.isWaiting = false;
|
||||
joinTimeout = true;
|
||||
|
||||
new TTDialog("alert", "TIMEOUT!",
|
||||
|
|
@ -58,6 +60,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
|||
if (msg.message.equals("MATCH_NOT_AVAILABLE")) {
|
||||
loading.dispose();
|
||||
joinTimeout = true;
|
||||
App.gameService.isWaiting = false;
|
||||
|
||||
new TTDialog("alert", "THE GAME IS NOT MORE AVAILABLE!",
|
||||
new Callable() {
|
||||
|
|
@ -72,6 +75,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
|||
|
||||
if (msg.message.equals("GAME_STARTED")) {
|
||||
loading.dispose();
|
||||
App.gameService.isWaiting = false;
|
||||
|
||||
if(msg.data !=null ) {
|
||||
DefaultListModel<String> data = msg.data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue