diff --git a/bin/controller/Cashflow.class b/bin/controller/Cashflow.class index cd2f0f3..6ee27eb 100644 Binary files a/bin/controller/Cashflow.class and b/bin/controller/Cashflow.class differ diff --git a/bin/model/CardStack.class b/bin/model/CardStack.class index 1a7713a..ce4fd7a 100644 Binary files a/bin/model/CardStack.class and b/bin/model/CardStack.class differ diff --git a/bin/model/CharityTile.class b/bin/model/CharityTile.class index f8d159f..80cfd97 100644 Binary files a/bin/model/CharityTile.class and b/bin/model/CharityTile.class differ diff --git a/bin/model/ChildTile.class b/bin/model/ChildTile.class index e2fc4d2..54da5e4 100644 Binary files a/bin/model/ChildTile.class and b/bin/model/ChildTile.class differ diff --git a/bin/model/DealTile.class b/bin/model/DealTile.class index a1678a6..7d9238f 100644 Binary files a/bin/model/DealTile.class and b/bin/model/DealTile.class differ diff --git a/bin/model/DoodadTile.class b/bin/model/DoodadTile.class index 096bde6..d47f229 100644 Binary files a/bin/model/DoodadTile.class and b/bin/model/DoodadTile.class differ diff --git a/bin/model/FinancialStatement.class b/bin/model/FinancialStatement.class index 43b4be5..e23f6f4 100644 Binary files a/bin/model/FinancialStatement.class and b/bin/model/FinancialStatement.class differ diff --git a/bin/model/GameBoard.class b/bin/model/GameBoard.class index 41e8300..c0f3e02 100644 Binary files a/bin/model/GameBoard.class and b/bin/model/GameBoard.class differ diff --git a/bin/model/PaydayTile.class b/bin/model/PaydayTile.class index 631fb20..fde1634 100644 Binary files a/bin/model/PaydayTile.class and b/bin/model/PaydayTile.class differ diff --git a/bin/model/Player.class b/bin/model/Player.class index f6c8e85..2b7f7ea 100644 Binary files a/bin/model/Player.class and b/bin/model/Player.class differ diff --git a/bin/model/Tile.class b/bin/model/Tile.class index 521077c..1c963de 100644 Binary files a/bin/model/Tile.class and b/bin/model/Tile.class differ diff --git a/bin/model/TileCircularLinkedList$Node.class b/bin/model/TileCircularLinkedList$Node.class index 06495c6..64dfb0f 100644 Binary files a/bin/model/TileCircularLinkedList$Node.class and b/bin/model/TileCircularLinkedList$Node.class differ diff --git a/bin/model/TileCircularLinkedList.class b/bin/model/TileCircularLinkedList.class index 51b60d5..1d7bd34 100644 Binary files a/bin/model/TileCircularLinkedList.class and b/bin/model/TileCircularLinkedList.class differ diff --git a/bin/view/DealCardWindow$1.class b/bin/view/DealCardWindow$1.class index ac4aceb..698118b 100644 Binary files a/bin/view/DealCardWindow$1.class and b/bin/view/DealCardWindow$1.class differ diff --git a/bin/view/DealCardWindow$2.class b/bin/view/DealCardWindow$2.class index 62114ff..69547f0 100644 Binary files a/bin/view/DealCardWindow$2.class and b/bin/view/DealCardWindow$2.class differ diff --git a/bin/view/DealCardWindow$3$1.class b/bin/view/DealCardWindow$3$1.class index e0a922b..96db31e 100644 Binary files a/bin/view/DealCardWindow$3$1.class and b/bin/view/DealCardWindow$3$1.class differ diff --git a/bin/view/DealCardWindow$3$2.class b/bin/view/DealCardWindow$3$2.class index 75eab6a..7af86cd 100644 Binary files a/bin/view/DealCardWindow$3$2.class and b/bin/view/DealCardWindow$3$2.class differ diff --git a/bin/view/DealCardWindow$3.class b/bin/view/DealCardWindow$3.class index 9906e71..a57b468 100644 Binary files a/bin/view/DealCardWindow$3.class and b/bin/view/DealCardWindow$3.class differ diff --git a/bin/view/DealCardWindow$4$1.class b/bin/view/DealCardWindow$4$1.class index a938d08..2d1cd22 100644 Binary files a/bin/view/DealCardWindow$4$1.class and b/bin/view/DealCardWindow$4$1.class differ diff --git a/bin/view/DealCardWindow$4$2.class b/bin/view/DealCardWindow$4$2.class index 111e7c7..f06db03 100644 Binary files a/bin/view/DealCardWindow$4$2.class and b/bin/view/DealCardWindow$4$2.class differ diff --git a/bin/view/DealCardWindow$4.class b/bin/view/DealCardWindow$4.class index dad01a2..e4ed6d3 100644 Binary files a/bin/view/DealCardWindow$4.class and b/bin/view/DealCardWindow$4.class differ diff --git a/bin/view/DealCardWindow.class b/bin/view/DealCardWindow.class index f81b2f9..bd6667d 100644 Binary files a/bin/view/DealCardWindow.class and b/bin/view/DealCardWindow.class differ diff --git a/bin/view/DoodadCardWindow$1.class b/bin/view/DoodadCardWindow$1.class index bdc151b..8817738 100644 Binary files a/bin/view/DoodadCardWindow$1.class and b/bin/view/DoodadCardWindow$1.class differ diff --git a/bin/view/DoodadCardWindow$2.class b/bin/view/DoodadCardWindow$2.class index a37a3bc..848faa7 100644 Binary files a/bin/view/DoodadCardWindow$2.class and b/bin/view/DoodadCardWindow$2.class differ diff --git a/bin/view/DoodadCardWindow.class b/bin/view/DoodadCardWindow.class index 0be9d16..4339f2b 100644 Binary files a/bin/view/DoodadCardWindow.class and b/bin/view/DoodadCardWindow.class differ diff --git a/bin/view/FSWindow.class b/bin/view/FSWindow.class index 9f939a7..babae76 100644 Binary files a/bin/view/FSWindow.class and b/bin/view/FSWindow.class differ diff --git a/bin/view/MainWindow$1.class b/bin/view/MainWindow$1.class index cd197be..419bfb4 100644 Binary files a/bin/view/MainWindow$1.class and b/bin/view/MainWindow$1.class differ diff --git a/bin/view/MainWindow.class b/bin/view/MainWindow.class index 48940ab..6f8e8c7 100644 Binary files a/bin/view/MainWindow.class and b/bin/view/MainWindow.class differ diff --git a/src/controller/Cashflow.java b/src/controller/Cashflow.java index 3c875b2..9d1d3c1 100644 --- a/src/controller/Cashflow.java +++ b/src/controller/Cashflow.java @@ -12,16 +12,27 @@ public class Cashflow public GameboardWindow gameboard; public static int numPlayers; - + public static void main(String[] args) + { + go(); + } public static void go() { - System.out.println("Start game"); // Joe // Initialize players (pick professions) + MainMenu mm = new MainMenu(); + String[] names = mm.makeMainMenu(); + ArrayList players = new ArrayList(); + for(String name : names) + { + players.add(new Player(name)); + } // Initialize game board - _board = new GameBoard(); + _board = new GameBoard(players); + + System.out.println("hello"); // Initialize GUI diff --git a/src/model/GameBoard.java b/src/model/GameBoard.java index 91f967d..2711657 100644 --- a/src/model/GameBoard.java +++ b/src/model/GameBoard.java @@ -37,7 +37,7 @@ public class GameBoard private static Tile t24 = new DoodadTile("Doodad Tile", 23); - public GameBoard(Player... players) + public GameBoard(ArrayList players) { _profs = new Professions(); _tiles = new TileCircularLinkedList(); diff --git a/src/model/Player.java b/src/model/Player.java index 5afc969..e76a40b 100644 --- a/src/model/Player.java +++ b/src/model/Player.java @@ -7,11 +7,14 @@ public class Player private int _charityCount; //charity counter private int _downsizeCount; //down size counter private int _location;//refers to a tile number + private String _name; private boolean _hasWon; + private String _playerName; - public Player() + public Player(String name) { Professions p = new Professions(); + _name = name; _fs = new FinancialStatement(p.getProfession()); _charityCount = 0; _downsizeCount = 0; @@ -80,7 +83,24 @@ public class Player _downsizeCount--; } + public void setPlayerName(String playerName) + { + _playerName = playerName; + } - + public String getPlayerName() + { + return _playerName; + } + + + public String getName() { + return _name; + } + + + public void setName(String _name) { + this._name = _name; + } } diff --git a/src/model/Tile.java b/src/model/Tile.java index dac1f40..5518930 100644 --- a/src/model/Tile.java +++ b/src/model/Tile.java @@ -27,7 +27,7 @@ public class Tile public void getLandedOn(Player p) {} - public void addPlayers(Player... players) + public void addPlayers(ArrayList players) { for(Player p : players) { diff --git a/src/view/MainMenu.java b/src/view/MainMenu.java index 3211902..da5d9af 100644 --- a/src/view/MainMenu.java +++ b/src/view/MainMenu.java @@ -3,6 +3,8 @@ package view; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.*; @@ -11,273 +13,277 @@ import javax.swing.*; import controller.Cashflow; import model.Instructions; +import model.Player; public class MainMenu { - public MainMenu() - { - final JFrame frame = new JFrame("CashFlow"); - - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setSize(650,530); - Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); - int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2); - int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2) -100; - frame.setLocation(x, y); - - final JPanel panel1 = new JPanel(); - panel1.setSize(140, 45); - panel1.setLocation(255, 125); - panel1.setOpaque(false); - //Font font = new Font ("Times New Roman", Font.BOLD, 30); - //panel1.setFont(font); - - final JPanel panel2 = new JPanel(); - panel2.setSize(140, 45); - panel2.setLocation(255, 160); - panel2.setOpaque(false); - - final JPanel panel3 = new JPanel(); - panel3.setSize(140, 45); - panel3.setLocation(255, 260); - panel3.setOpaque(false); - - final JPanel panel4 = new JPanel(); - panel4.setSize(140, 45); - panel4.setLocation(255, 295); - panel4.setOpaque(false); - - final JPanel panel5 = new JPanel(); - panel5.setSize(140, 45); - panel5.setLocation(255, 330); - panel5.setOpaque(false); - - final JPanel panel6 = new JPanel(); - panel6.setSize(140, 45); - panel6.setLocation(180, 158); - panel6.setOpaque(false); - - final JPanel panel7 = new JPanel(); - panel7.setSize(140, 45); - panel7.setLocation(260, 158); - panel7.setOpaque(false); - - final JPanel panel8 = new JPanel(); - panel8.setSize(140, 45); - panel8.setLocation(340, 158); - panel8.setOpaque(false); - - final JPanel panel9 = new JPanel(); - panel9.setSize(300, 45); - panel9.setLocation(185, 140); - panel9.setOpaque(false); - - final JPanel panel10 = new JPanel(); - panel10.setSize(300, 45); - panel10.setLocation(175, 120); - panel10.setOpaque(false); - - final JPanel panel11 = new JPanel(); - panel11.setSize(300, 50); - panel11.setLocation(175, 125); - panel11.setOpaque(false); - - final JPanel panel12 = new JPanel(); - panel12.setSize(300, 50); - panel12.setLocation(175, 160); - panel12.setOpaque(false); - - final JPanel panel13 = new JPanel(); - panel13.setSize(300, 50); - panel13.setLocation(125, 260); - panel13.setOpaque(false); - - final JPanel panel14 = new JPanel(); - panel14.setSize(300, 50); - panel14.setLocation(250, 260); - panel14.setOpaque(false); - - final JPanel panel15 = new JPanel(); - panel15.setSize(300, 50); - panel15.setLocation(175, 295); - panel15.setOpaque(false); - - JLabel choose = new JLabel("Choose"); - JLabel players = new JLabel("number of players"); - choose.setFont(new Font("Verdana", 1, 16)); - players.setFont(new Font("Verdana", 1, 16)); - - - JButton newGame = new JButton("New Game"); - JButton savedGame = new JButton("Saved Game"); - JButton rules = new JButton("Rules"); - JButton settings = new JButton("Settings"); - JButton exit = new JButton("Exit"); - JButton four = new JButton ("Four"); - JButton five = new JButton ("Five"); - JButton six = new JButton ("Six"); - JTextField player1 = new JTextField("Player 1"); - JTextField player2 = new JTextField("Player 2"); - JTextField player3 = new JTextField("Player 3"); - JTextField player4 = new JTextField("Player 4"); - JButton start = new JButton("Start"); - - newGame.setPreferredSize(new Dimension(140,40)); - newGame.setForeground(Color.MAGENTA); - - savedGame.setPreferredSize(new Dimension(130,40)); - savedGame.setForeground(Color.MAGENTA); - - rules.setPreferredSize(new Dimension(80,40)); - rules.setForeground(Color.MAGENTA); - - settings.setPreferredSize(new Dimension(120,40)); - settings.setForeground(Color.MAGENTA); - - exit.setPreferredSize(new Dimension(100,40)); - exit.setForeground(Color.MAGENTA); - - four.setPreferredSize(new Dimension(80,40)); - four.setForeground(Color.MAGENTA); - - five.setPreferredSize(new Dimension(80,40)); - five.setForeground(Color.MAGENTA); - - six.setPreferredSize(new Dimension(80,40)); - six.setForeground(Color.MAGENTA); - - start.setPreferredSize(new Dimension(100,40)); - start.setForeground(Color.MAGENTA); - - player1.setPreferredSize(new Dimension(125,40)); - player2.setPreferredSize(new Dimension(125,40)); - player3.setPreferredSize(new Dimension(125,40)); - player4.setPreferredSize(new Dimension(125,40)); - - - - BufferedImage img = null; - try { - img = ImageIO.read(new File("gameboard.png")); - } catch (IOException e) { - e.printStackTrace(); - } - Image dimg = img.getScaledInstance(800, 508, Image.SCALE_SMOOTH); - ImageIcon imageIcon = new ImageIcon(dimg); - frame.setContentPane(new JLabel(imageIcon)); - frame.getContentPane().add(new JLabel(imageIcon)); - - - panel1.add(newGame); - panel2.add(savedGame); - panel3.add(rules); - panel4.add(settings); - panel5.add(exit); - panel6.add(four); - panel7.add(five); - panel8.add(six); - panel9.add(players); - panel10.add(choose); - panel11.add(player1); - panel12.add(player2); - panel13.add(player3); - panel14.add(player4); - panel15.add(start); - - frame.add(panel1); - frame.add(panel2); - frame.add(panel3); - frame.add(panel4); - frame.add(panel5); - frame.setVisible(true); - - newGame.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.setVisible(false); - frame.remove(panel1); - frame.remove(panel2); - - frame.add(panel6); - frame.add(panel7); - frame.add(panel8); - frame.add(panel9); - frame.add(panel10); - frame.setVisible(true); - } - }); - - rules.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - Instructions.getClicked(); - } - }); - - four.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.setVisible(false); - frame.remove(panel3); - frame.remove(panel4); - frame.remove(panel6); - frame.remove(panel7); - frame.remove(panel8); - frame.remove(panel9); - frame.remove(panel10); - - frame.add(panel11); - frame.add(panel12); - frame.add(panel13); - frame.add(panel14); - frame.add(panel15); - frame.setVisible(true); - } - }); - - exit.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - System.exit(0); - } -}); - - player1.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - - System.exit(0); - } -}); - - player2.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - - System.exit(0); - } -}); - player3.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - - System.exit(0); - } -}); - - player4.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - - System.exit(0); - } -}); - - start.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - frame.dispose(); - System.exit(0); - } -}); - + public MainMenu(){} + public String[] makeMainMenu() + { + final String[] playerNames = new String[4]; + + final JFrame frame = new JFrame("CashFlow"); + + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(650,530); + Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); + int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2); + int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2) -100; + frame.setLocation(x, y); + + final JPanel panel1 = new JPanel(); + panel1.setSize(140, 45); + panel1.setLocation(255, 125); + panel1.setOpaque(false); + //Font font = new Font ("Times New Roman", Font.BOLD, 30); + //panel1.setFont(font); + + final JPanel panel2 = new JPanel(); + panel2.setSize(140, 45); + panel2.setLocation(255, 160); + panel2.setOpaque(false); + + final JPanel panel3 = new JPanel(); + panel3.setSize(140, 45); + panel3.setLocation(255, 260); + panel3.setOpaque(false); + + final JPanel panel4 = new JPanel(); + panel4.setSize(140, 45); + panel4.setLocation(255, 295); + panel4.setOpaque(false); + + final JPanel panel5 = new JPanel(); + panel5.setSize(140, 45); + panel5.setLocation(255, 330); + panel5.setOpaque(false); + + final JPanel panel6 = new JPanel(); + panel6.setSize(140, 45); + panel6.setLocation(180, 158); + panel6.setOpaque(false); + + final JPanel panel7 = new JPanel(); + panel7.setSize(140, 45); + panel7.setLocation(260, 158); + panel7.setOpaque(false); + + final JPanel panel8 = new JPanel(); + panel8.setSize(140, 45); + panel8.setLocation(340, 158); + panel8.setOpaque(false); + + final JPanel panel9 = new JPanel(); + panel9.setSize(300, 45); + panel9.setLocation(185, 140); + panel9.setOpaque(false); + + final JPanel panel10 = new JPanel(); + panel10.setSize(300, 45); + panel10.setLocation(175, 120); + panel10.setOpaque(false); + + final JPanel panel11 = new JPanel(); + panel11.setSize(300, 50); + panel11.setLocation(175, 125); + panel11.setOpaque(false); + + final JPanel panel12 = new JPanel(); + panel12.setSize(300, 50); + panel12.setLocation(175, 160); + panel12.setOpaque(false); + + final JPanel panel13 = new JPanel(); + panel13.setSize(300, 50); + panel13.setLocation(125, 260); + panel13.setOpaque(false); + + final JPanel panel14 = new JPanel(); + panel14.setSize(300, 50); + panel14.setLocation(250, 260); + panel14.setOpaque(false); + + final JPanel panel15 = new JPanel(); + panel15.setSize(300, 50); + panel15.setLocation(175, 295); + panel15.setOpaque(false); + + JLabel choose = new JLabel("Choose"); + JLabel players = new JLabel("number of players"); + choose.setFont(new Font("Verdana", 1, 16)); + players.setFont(new Font("Verdana", 1, 16)); + + + JButton newGame = new JButton("New Game"); + JButton savedGame = new JButton("Saved Game"); + JButton rules = new JButton("Rules"); + JButton settings = new JButton("Settings"); + JButton exit = new JButton("Exit"); + JButton four = new JButton ("Four"); + JButton five = new JButton ("Five"); + JButton six = new JButton ("Six"); + final JTextField player1 = new JTextField("Player 1"); + final JTextField player2 = new JTextField("Player 2"); + final JTextField player3 = new JTextField("Player 3"); + final JTextField player4 = new JTextField("Player 4"); + JButton start = new JButton("Start"); + + newGame.setPreferredSize(new Dimension(140,40)); + newGame.setForeground(Color.MAGENTA); + + savedGame.setPreferredSize(new Dimension(130,40)); + savedGame.setForeground(Color.MAGENTA); + + rules.setPreferredSize(new Dimension(80,40)); + rules.setForeground(Color.MAGENTA); + + settings.setPreferredSize(new Dimension(120,40)); + settings.setForeground(Color.MAGENTA); + + exit.setPreferredSize(new Dimension(100,40)); + exit.setForeground(Color.MAGENTA); + + four.setPreferredSize(new Dimension(80,40)); + four.setForeground(Color.MAGENTA); + + five.setPreferredSize(new Dimension(80,40)); + five.setForeground(Color.MAGENTA); + + six.setPreferredSize(new Dimension(80,40)); + six.setForeground(Color.MAGENTA); + + start.setPreferredSize(new Dimension(100,40)); + start.setForeground(Color.MAGENTA); + + player1.setPreferredSize(new Dimension(125,40)); + player2.setPreferredSize(new Dimension(125,40)); + player3.setPreferredSize(new Dimension(125,40)); + player4.setPreferredSize(new Dimension(125,40)); + + + + BufferedImage img = null; + try { + img = ImageIO.read(new File("gameboard.png")); + } catch (IOException e) { + e.printStackTrace(); + } + Image dimg = img.getScaledInstance(800, 508, Image.SCALE_SMOOTH); + ImageIcon imageIcon = new ImageIcon(dimg); + frame.setContentPane(new JLabel(imageIcon)); + frame.getContentPane().add(new JLabel(imageIcon)); + + + panel1.add(newGame); + panel2.add(savedGame); + panel3.add(rules); + panel4.add(settings); + panel5.add(exit); + panel6.add(four); + panel7.add(five); + panel8.add(six); + panel9.add(players); + panel10.add(choose); + panel11.add(player1); + panel12.add(player2); + panel13.add(player3); + panel14.add(player4); + panel15.add(start); + + frame.add(panel1); + frame.add(panel2); + frame.add(panel3); + frame.add(panel4); + frame.add(panel5); + frame.setVisible(true); + + newGame.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + frame.setVisible(false); + frame.remove(panel1); + frame.remove(panel2); + + frame.add(panel6); + frame.add(panel7); + frame.add(panel8); + frame.add(panel9); + frame.add(panel10); + frame.setVisible(true); + } + }); + + rules.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + frame.dispose(); + Instructions.getClicked(); + } + }); + + four.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + frame.setVisible(false); + frame.remove(panel3); + frame.remove(panel4); + frame.remove(panel6); + frame.remove(panel7); + frame.remove(panel8); + frame.remove(panel9); + frame.remove(panel10); + + frame.add(panel11); + frame.add(panel12); + frame.add(panel13); + frame.add(panel14); + frame.add(panel15); + frame.setVisible(true); + } + }); + + exit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + System.exit(0); + } + }); + + player1.addKeyListener(new KeyAdapter(){ + public void keyTyped(KeyEvent evt){ + String p1name = ((JTextField)evt.getSource()).getText() + String.valueOf(evt.getKeyChar()); + playerNames[0] = p1name; + } + }); + + player2.addKeyListener(new KeyAdapter(){ + public void keyTyped(KeyEvent evt){ + String p2name = ((JTextField)evt.getSource()).getText() + String.valueOf(evt.getKeyChar()); + playerNames[1] = p2name; + } + }); + + player3.addKeyListener(new KeyAdapter(){ + public void keyTyped(KeyEvent evt){ + String p3name = ((JTextField)evt.getSource()).getText() + String.valueOf(evt.getKeyChar()); + playerNames[2] = p3name; + } + }); + + player4.addKeyListener(new KeyAdapter(){ + public void keyTyped(KeyEvent evt){ + String p4Name = ((JTextField)evt.getSource()).getText() + String.valueOf(evt.getKeyChar()); + playerNames[3] = p4Name; + } + }); + + start.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + frame.dispose(); + + //Cashflow.go(playerNames); + System.exit(0); + } + }); + return playerNames; + } }