use of dogecade.games.Player in project dogecade by ebanisadr.
the class RockPaperScissors method endRound.
public void endRound() {
if (!currentRound.isComplete())
return;
Player winner = currentRound.getWinner();
Dogecade.logger.println("round ended:" + currentRound);
Dogecade.logger.println("winner: " + ((winner != null) ? winner.getUsername() : "null") + "\n");
if (winner != null) {
if (winner.equals(p1)) {
p1wins++;
roundsRemaining--;
}
if (winner.equals(p2)) {
p2wins++;
roundsRemaining--;
}
}
window.setCenterPanel(RPSMain.RESULTS);
new Thread(() -> {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (gameOver()) {
endGame();
} else {
startRound();
}
}).start();
}
use of dogecade.games.Player in project dogecade by ebanisadr.
the class RPSTester method main.
public static void main(String... args) {
List<Player> p = new ArrayList<>();
p.add(new Player(Dogecade.server.getUsername(), BigDecimal.valueOf(100)));
p.add(new Player("name2", BigDecimal.valueOf(33)));
RockPaperScissors rps = new RockPaperScissors(p, new TestingRPSServerImpl(), 3);
rps.startGame();
}
use of dogecade.games.Player in project dogecade by ebanisadr.
the class MainMenu method createUIComponents.
private void createUIComponents() {
myAccountButton = new JButton("My MyProfileScreen");
myAccountButton.addActionListener(e -> MyAccountScreen.showMyAccountWindow());
chatTextArea = new JChatBox();
sendButton = new JButton("send");
sendButton.addActionListener(e -> ((JChatBox) chatTextArea).getMessageFromEnterBox());
enterTextField = new JTextField();
enterTextField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
((JChatBox) chatTextArea).getMessageFromEnterBox();
}
}
});
roomsPanel = new JPanel();
JButton startRPSButton = new JButton("play rps against the computer");
startRPSButton.addActionListener(e -> {
List<Player> p = new ArrayList<>();
p.add(new Player(Dogecade.server.getUsername(), BigDecimal.valueOf(100)));
p.add(new Player("name2", BigDecimal.valueOf(33)));
new RockPaperScissors(p, Dogecade.rpsServer, 3).startGame();
});
roomsPanel.add(startRPSButton);
}
Aggregations