Added random generator for the initial letters and sending command
This commit is contained in:
parent
648ea2ef7c
commit
5f8fe0ae2d
19 changed files with 58861 additions and 436 deletions
|
|
@ -16,6 +16,8 @@ public class Game extends Page {
|
|||
|
||||
private TTContainer gameContainer;
|
||||
public GameController gameController;
|
||||
public TTGameBox gameBox;
|
||||
public DefaultListModel<String> words = new DefaultListModel<String>();
|
||||
public DefaultListModel<Point> letterSpawningPoint = new DefaultListModel<Point>();
|
||||
|
||||
public Timer timer = null;
|
||||
|
|
@ -85,7 +87,8 @@ public class Game extends Page {
|
|||
return l;
|
||||
}
|
||||
|
||||
private Callable<Object> getWords(){
|
||||
private Callable<Object> sendWords(String word){
|
||||
System.out.println("SENDDDD" + word);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -100,12 +103,11 @@ public class Game extends Page {
|
|||
-1,
|
||||
root);
|
||||
|
||||
TTGameBox gameBox = new TTGameBox(
|
||||
gameBox = new TTGameBox(
|
||||
new Point(150, 90),
|
||||
new Dimension(250, 40),
|
||||
"Word!",
|
||||
new DefaultListModel(),
|
||||
getWords(),
|
||||
"Insert word and Press ENTER!",
|
||||
words,
|
||||
gameContainer);
|
||||
|
||||
addFooter(root);
|
||||
|
|
|
|||
|
|
@ -110,9 +110,10 @@ public class Page {
|
|||
lblTimer.setText("00:00");
|
||||
((Timer)e.getSource()).stop();
|
||||
} else {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("mm:ss:S");
|
||||
|
||||
lblTimer.setText(dateFormat.format(count));
|
||||
int minutes = count / 60;
|
||||
int seconds = count % 60;
|
||||
String str = String.format("%d:%02d", minutes, seconds);
|
||||
lblTimer.setText(str);
|
||||
count--;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class InvitePlayers extends SwingWorker<Boolean,Void> {
|
|||
|
||||
@Override
|
||||
public void done() {
|
||||
System.out.println("DDDDDDDD22");
|
||||
System.out.println("Done");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ public class StartGame implements Runnable {
|
|||
@Override
|
||||
public void run(){
|
||||
|
||||
//Letters are ready? Polling
|
||||
while(!(this.game.gameController.letters.size() > 0)) {
|
||||
System.out.println(this.game.gameController.letters.size());
|
||||
this.game.gameController.letters = App.matchService.words;
|
||||
}
|
||||
System.out.println(this.game.gameController.letters);
|
||||
game.showLetters();
|
||||
|
||||
if(this.game.gameController.letters.size()>0){
|
||||
this.game.timer.start();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ public class WaitForPlayers extends SwingWorker<DefaultListModel<String>,Default
|
|||
buffer.clear();
|
||||
|
||||
Message msg = Message.toMessage(line);
|
||||
System.out.println("HEY");
|
||||
System.out.println(msg);
|
||||
if (msg.message.equals("TIMEOUT")) {
|
||||
socketChannel.close();
|
||||
loading.dispose();
|
||||
|
|
@ -75,6 +73,6 @@ public class WaitForPlayers extends SwingWorker<DefaultListModel<String>,Default
|
|||
}
|
||||
|
||||
public void done(){
|
||||
System.out.println("DONEEE");
|
||||
System.out.println("Done");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ public class TTGameBox extends TTInputField{
|
|||
Dimension dimension,
|
||||
String placeholer,
|
||||
DefaultListModel listModel,
|
||||
Callable<Object> clickHandler,
|
||||
TTContainer parent){
|
||||
|
||||
super(position, dimension, placeholer, parent);
|
||||
|
|
@ -31,6 +30,15 @@ public class TTGameBox extends TTInputField{
|
|||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
super.keyPressed(e);
|
||||
if(e.getKeyCode() == 10){
|
||||
try {
|
||||
System.out.println(getText());
|
||||
setText("");
|
||||
listModel.addElement(getText());
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
//Every time i press a key, execute a search of users
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue