diff --git a/Stuff We Still Need to Do b/Stuff We Still Need to Do new file mode 100644 index 0000000..037c7d8 --- /dev/null +++ b/Stuff We Still Need to Do @@ -0,0 +1,4 @@ +- Cashflow.java - Initialize the game! +- Finish TileButton / Handler (For landing on tiles & integrating it with the model) +- Finish the Tiles in Model - once again, linking them to decisions from the GUI +- Finish Financial Statement & the rest of the GUI stuff \ No newline at end of file diff --git a/bin/.gitignore b/bin/.gitignore index 6a15f9e..3855033 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,3 +1,6 @@ +<<<<<<< HEAD /controller/ +======= +>>>>>>> branch 'master' of https://github.uconn.edu/joh13010/2102-Group-Project-Spring-2017.git /model/ /view/ diff --git a/bin/model/GameBoard.class b/bin/model/GameBoard.class index b2bb7bc..d75668d 100644 Binary files a/bin/model/GameBoard.class and b/bin/model/GameBoard.class differ diff --git a/bin/model/Player.class b/bin/model/Player.class index d07f60b..980dae0 100644 Binary files a/bin/model/Player.class and b/bin/model/Player.class differ diff --git a/bin/model/Professions.class b/bin/model/Professions.class index 044c822..41ab535 100644 Binary files a/bin/model/Professions.class and b/bin/model/Professions.class differ diff --git a/src/model/DownsizeTile.java b/src/model/DownsizeTile.java new file mode 100644 index 0000000..87a49e8 --- /dev/null +++ b/src/model/DownsizeTile.java @@ -0,0 +1,14 @@ +package model; + +public class DownsizeTile extends Tile{ + public DownsizeTile(String type, int boardIndex) + { + super(type, boardIndex); + + } + + public void getLandedOn(Player p) + { + p.increaseDownsizeCount(); + } +} diff --git a/src/model/GameBoard.java b/src/model/GameBoard.java index 5a30b04..fcb451c 100644 --- a/src/model/GameBoard.java +++ b/src/model/GameBoard.java @@ -1,7 +1,8 @@ package model; -import java.util.LinkedList; -import java.util.Queue; +import java.util.ArrayList; +import java.util.Arrays; + import model.TileCircularLinkedList.Node; public class GameBoard @@ -35,7 +36,7 @@ public class GameBoard private static Tile t23 = new DealTile("Deal Tile", 22); private static Tile t24 = new DoodadTile("Doodad Tile", 23); - + public GameBoard(Player... players) { _profs = new Professions(); @@ -43,11 +44,18 @@ public class GameBoard _tiles.addTiles(t1, t2, t3, t4); t1.addPlayers(players); } - + public Tile getTile(int num) { + ArrayList tileList = new ArrayList(); + Tile[] tileList1 = { + t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24 + }; + tileList.addAll(Arrays.asList(tileList1)); + return tileList.get(num); + } // TODO This method will move the player and returns the number of pay days they passed along the way. // It also removes the player from the _players ArrayList of their initial tile and adds them to the - // arraylist of the tile they land on. + // array list of the tile they land on. public int movePlayer(Player p, int distance) { int currentLocation = p.getLocation(); @@ -58,7 +66,7 @@ public class GameBoard for(int i=0; i Positioners; public GameboardWindow(GameBoard board) { this.board = board; - Dimension size = new Dimension(img.getWidth(null)+250, img.getHeight(null)); + Dimension size = new Dimension(img.getWidth(null), img.getHeight(null)); setPreferredSize(size); setMinimumSize(size); setMaximumSize(size); @@ -44,17 +43,130 @@ public class GameboardWindow extends JPanel { } public void setUpTiles() { -// implement the tiles into the graphical boardspace?? -// Tile t1; -// this.add(t1); -// t1.setBounds(133,521,50,75); //xstart,ystart,width,height -// points[1] = newPoint(133,521); +// implement the tiles into the graphical boardspace +// the buttons are going to be a little off as i couldnt figure out how to rotate jbuttons + TileButton t1 = new TileButton("Deal", 0, board); + this.add(t1); + t1.setBounds(125,532,95,20); //xstart,ystart,width,height + points[0] = new Point(125,531); + + TileButton t2 = new TileButton("Market", 1, board); + this.add(t2); + t2.setBounds(191,586,237-191,637-586); //xstart,ystart,width,height + points[1] = new Point(191,586); + + TileButton t3 = new TileButton("Deal", 2, board); + this.add(t3); + t3.setBounds(266,593,307-266,689-593); //xstart,ystart,width,height + points[2] = new Point(266,593); + + TileButton t4 = new TileButton("PayDay", 3, board); + this.add(t4); + t4.setBounds(334,601,383-334,718-601); //xstart,ystart,width,height + points[3] = new Point(334,601); + + TileButton t5 = new TileButton("Deal", 4, board); + this.add(t5); + t5.setBounds(392,580,440-392,717-580); //xstart,ystart,width,height + points[4] = new Point(392,580); + + TileButton t6 = new TileButton("Downsize", 5, board); + this.add(t6); + t6.setBounds(465,566,522-465,697-566); //xstart,ystart,width,height + points[5] = new Point(465,566); + + TileButton t7 = new TileButton("Deal", 6, board); + this.add(t7); + t7.setBounds(519,555,586-519,639-555); //xstart,ystart,width,height + points[6] = new Point(519,555); + + TileButton t8 = new TileButton("Doodad", 7, board); + this.add(t8); + t8.setBounds(548,500,655-548,89); //xstart,ystart,width,height + points[7] = new Point(548,500); + + TileButton t9 = new TileButton("Deal", 8, board); + this.add(t9); + t9.setBounds(576,451,699-576,526-451); //xstart,ystart,width,height + points[8] = new Point(576,451); + + TileButton t10 = new TileButton("Market", 9, board); + this.add(t10); + t10.setBounds(589,386,719-589,446-386); //xstart,ystart,width,height + points[9] = new Point(589,386); + + TileButton t11 = new TileButton("Deal", 10, board); + this.add(t11); + t11.setBounds(584,328,726-584,376-328); //xstart,ystart,width,height + points[10] = new Point(584,328); + + TileButton t12 = new TileButton("PayDay", 11, board); + this.add(t12); + t12.setBounds(586,266,701-586,290-266); //xstart,ystart,width,height + points[11] = new Point(586,266); + + TileButton t13 = new TileButton("Deal", 12, board); + this.add(t13); + t13.setBounds(577,193,651-577,226-193); //xstart,ystart,width,height + points[12] = new Point(577,193); + + TileButton t14 = new TileButton("Charity", 13, board); + this.add(t14); + t14.setBounds(538,124,572-538,195-124); //xstart,ystart,width,height + points[13] = new Point(538,124); + + TileButton t15 = new TileButton("Deal", 14, board); + this.add(t15); + t15.setBounds(473,73,507-473,171-73); //xstart,ystart,width,height + points[14] = new Point(473,73); + + TileButton t16 = new TileButton("Doodad", 15, board); + this.add(t16); + t16.setBounds(395,39,438-395,180-39); //xstart,ystart,width,height + points[15] = new Point(395,39); + + TileButton t17 = new TileButton("Deal", 16, board); + this.add(t17); + t17.setBounds(325,41,61,138); //xstart,ystart,width,height + points[16] = new Point(325,41); + + TileButton t18 = new TileButton("Market", 17, board); + this.add(t18); + t18.setBounds(247,70,69,112); //xstart,ystart,width,height + points[17] = new Point(247,70); + + TileButton t19 = new TileButton("Deal", 18, board); + this.add(t19); + t19.setBounds(196,92,51,121); //xstart,ystart,width,height + points[18] = new Point(196,192); + + TileButton t20 = new TileButton("PayDay", 19, board); + this.add(t20); + t20.setBounds(108,179,95,57); //xstart,ystart,width,height + points[19] = new Point(108,179); + + TileButton t21 = new TileButton("Deal", 20, board); + this.add(t21); + t21.setBounds(71,250,129,63); //xstart,ystart,width,height + points[20] = new Point(71,250); + + TileButton t22 = new TileButton("Child", 21, board); + this.add(t22); + t22.setBounds(53,312,130,60); //xstart,ystart,width,height + points[21] = new Point(53,312); + + TileButton t23 = new TileButton("Deal", 22, board); + this.add(t23); + t23.setBounds(52,389,138,41); //xstart,ystart,width,height + points[22] = new Point(52,389); + + TileButton t24 = new TileButton("Doodad", 23, board); + this.add(t24); + t24.setBounds(88,463,113,31); //xstart,ystart,width,height + points[23] = new Point(88,463); + -// LocationButton b2 = new LocationButton("name", 21, board); -// this.add(b2); -// b2.setBounds(98, 10, 56, 88);// xStart, Ystart, width, height -// points[21] = new Point(98, 10); diff --git a/src/view/TileButton.java b/src/view/TileButton.java new file mode 100644 index 0000000..20bbca9 --- /dev/null +++ b/src/view/TileButton.java @@ -0,0 +1,49 @@ +package view; + +import model.*; + +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.JButton; + +public class TileButton extends JButton { + + private static final long serialVersionUID = 1L; + private Tile tile; + private int rent, price; + + public TileButton(String name, int TileOnBoard, GameBoard board) { + super(name); + + tile = board.getTile(TileOnBoard); + // this.setOpaque(false); + this.setContentAreaFilled(false); + // this.setBorderPainted(false); + + this.setInts(); + this.setVisible(true); + Handler hand = new Handler(price, rent, tile, TileOnBoard, + board); + this.addActionListener(hand); + + } + + public void setInts() { + + if (this.tile instanceof Tile) { + /* + * i dont actually really like this method + * but i think it should be like that iterator in cashflow + * that determines moving over the tiles and if it's landed on + * the gui should be brought up already in the handler method + */ + } + + } + + public void paint(Graphics g) { // Do nothing here } + + } + +}