From ad513a2e36cb61ae1b545f164c3764084380d763 Mon Sep 17 00:00:00 2001 From: jackie Date: Fri, 14 Apr 2017 00:54:08 -0400 Subject: [PATCH] lotsa stuff --- Stuff We Still Need to Do | 4 + bin/.gitignore | 2 - bin/model/GameBoard.class | Bin 1088 -> 3928 bytes bin/model/Player.class | Bin 1737 -> 1832 bytes src/model/DownsizeTile.java | 14 ++++ src/model/GameBoard.java | 16 +++- src/model/Handler.java | 25 ++++++ src/model/Player.java | 5 +- src/view/GameboardWindow.java | 138 ++++++++++++++++++++++++++++++---- src/view/TileButton.java | 49 ++++++++++++ 10 files changed, 235 insertions(+), 18 deletions(-) create mode 100644 Stuff We Still Need to Do create mode 100644 src/model/DownsizeTile.java create mode 100644 src/model/Handler.java create mode 100644 src/view/TileButton.java 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 66905d0..dc15b6b 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,4 +1,2 @@ -/.DS_Store -/controller/ /model/ /view/ diff --git a/bin/model/GameBoard.class b/bin/model/GameBoard.class index b2bb7bc8491f84cf129df2f147abdc8bf1bdad87..7276b09c481d83225e5b6d9c7539a347f28f406c 100644 GIT binary patch literal 3928 zcmaJ^d014}75_bE;0?nChEXsWlWNe&qN0ds0ksGci3ple>_i*$V4gBM%#fKuC2eXJ zO;eJz=^nc$UD73O%_9tnRGZq`v^L%MG~M@o?;rj8HT~Ut-wdPH!uQ?ZefOMm&ppe% z=gfuwoIVSn8UHX*V4!>?5wT;9H&`R~ri7J@nD8119JCHwjWH{Jps|1Opgoi}P_%C} znb@B)FsD~bZ0Dz)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UF@O#co>Yax_kk5xda-Zwqd6CCq zTWgq@GB}(!F=0@}zfsMPe^J)JpYUhxUP{Yk1q$iUdt@Z^HI_`kZgprG8#1_uF2G+D R*I)5BqMx+$Y-aura^ delta 464 zcmaja%}N6?5C`yox}|PIK`01 zcPM#Bn9ckdL43znhA=}ge8t<`lU&ukJ!7UN>f zIQj50J{FP$%ep8MO#Hh+*mL*8(d1j#!L7BYKrr3^zk`@PX%Ct6boL(kC!57EZ)3u~ y0n#YgnCjmt7U0>8U=d3Z!LhY3Vfh!K7!{5NL2iGHb$C2IY-FE)#<$kmLf=3=D2S+MPiQ$l`%0Wzc5O q0rD6boG06}sfl|b$+5!aTqf7B=_m#O^#&rzbHn9bfhI69xB&n^a2$>R delta 68 zcmZ3%caoRu)W2Q(7#J8#7~D2;9c7yQoT-tKXLBa=d#1_r*;E 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 diff --git a/src/model/Handler.java b/src/model/Handler.java new file mode 100644 index 0000000..ffceb1c --- /dev/null +++ b/src/model/Handler.java @@ -0,0 +1,25 @@ +package model; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + + +public class Handler implements ActionListener { + public int rent, price, locationOnBoard; + private Tile tile; + + public Handler(int price, int rent, Tile tile, int locationOnBoard, + GameBoard board) { + this.price = price; + this.rent = rent; + this.tile = tile; + this.locationOnBoard = locationOnBoard; + + } + + public void actionPerformed(ActionEvent event) { + // refer to getLandedOn? Or one of the decision/card windows? How do i do this i am tired + + } + +} diff --git a/src/model/Player.java b/src/model/Player.java index 57994ff..5d2fbcb 100644 --- a/src/model/Player.java +++ b/src/model/Player.java @@ -65,7 +65,10 @@ public class Player _charityCount--; } - + public void increaseDownsizeCount() + { + _downsizeCount = _downsizeCount + 2; + } public int getDownsizeCount() { return _downsizeCount; diff --git a/src/view/GameboardWindow.java b/src/view/GameboardWindow.java index 55a3275..29b0969 100644 --- a/src/view/GameboardWindow.java +++ b/src/view/GameboardWindow.java @@ -5,7 +5,7 @@ import java.awt.Graphics; import java.awt.Image; import java.awt.Point; - +import java.awt.geom.Path2D; import java.util.ArrayList; import javax.swing.ImageIcon; @@ -18,14 +18,13 @@ public class GameboardWindow extends JPanel { "gameboard.png")).getImage(); private GameBoard board; // - private Point[] points = new Point[40];// location of topleft corner of - // buttons + private Point[] points = new Point[24]; private ArrayList 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 } + + } + +}