Search in sources :

Example 1 with RockPaperScissors

use of dogecade.games.rps.RockPaperScissors 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();
}
Also used : Player(dogecade.games.Player) RockPaperScissors(dogecade.games.rps.RockPaperScissors) ArrayList(java.util.ArrayList) TestingRPSServerImpl(dogecade.networking.TestingRPSServerImpl)

Example 2 with RockPaperScissors

use of dogecade.games.rps.RockPaperScissors 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);
}
Also used : KeyEvent(java.awt.event.KeyEvent) Player(dogecade.games.Player) RockPaperScissors(dogecade.games.rps.RockPaperScissors) ArrayList(java.util.ArrayList) KeyListener(java.awt.event.KeyListener)

Aggregations

Player (dogecade.games.Player)2 RockPaperScissors (dogecade.games.rps.RockPaperScissors)2 ArrayList (java.util.ArrayList)2 TestingRPSServerImpl (dogecade.networking.TestingRPSServerImpl)1 KeyEvent (java.awt.event.KeyEvent)1 KeyListener (java.awt.event.KeyListener)1