Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of
  • Loading branch information
Joe Hill committed Apr 16, 2017
2 parents 7576eda + ad513a2 commit 1172efd
Show file tree
Hide file tree
Showing 14 changed files with 240 additions and 26 deletions.
4 changes: 4 additions & 0 deletions 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
3 changes: 3 additions & 0 deletions bin/.gitignore
@@ -1,3 +1,6 @@
<<<<<<< HEAD
/controller/
=======
>>>>>>> branch 'master' of https://github.uconn.edu/joh13010/2102-Group-Project-Spring-2017.git
/model/
/view/
Binary file modified bin/model/GameBoard.class
Binary file not shown.
Binary file modified bin/model/Player.class
Binary file not shown.
Binary file modified bin/model/Professions.class
Binary file not shown.
14 changes: 14 additions & 0 deletions 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();
}
}
20 changes: 14 additions & 6 deletions 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
Expand Down Expand Up @@ -35,19 +36,26 @@ 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();
_tiles = new TileCircularLinkedList();
_tiles.addTiles(t1, t2, t3, t4);
t1.addPlayers(players);
}

public Tile getTile(int num) {
ArrayList<Tile> tileList = new ArrayList<Tile>();
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();
Expand All @@ -58,7 +66,7 @@ public class GameBoard
for(int i=0; i<distance; i++)
{
Node nextNode = currentNode.getNext();
if(nextNode.getData().getName().equals("Payday"))
if(nextNode.getData().getName().equals("Payday Tile"))
{
passedPaydays++;
}
Expand Down
25 changes: 25 additions & 0 deletions 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 {
private 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

}

}
5 changes: 4 additions & 1 deletion src/model/Player.java
Expand Up @@ -65,7 +65,10 @@ public class Player
_charityCount--;
}


public void increaseDownsizeCount()
{
_downsizeCount = _downsizeCount + 2;
}
public int getDownsizeCount()
{
return _downsizeCount;
Expand Down
4 changes: 0 additions & 4 deletions src/model/Professions.java
Expand Up @@ -42,7 +42,6 @@ public class Professions
private static Profession[] profs = {Nurse, Teacher, TruckDriver, Secretary, Engineer, BusinessManager,
AirlinePilot, Lawyer, PoliceOfficer, Doctor, Mechanic, Janitor};

public Profession playerProf;

public Professions() {}

Expand All @@ -52,7 +51,4 @@ public class Professions
int n = rand.nextInt(11);
return profs[n];
}



}
2 changes: 1 addition & 1 deletion src/view/DoodadCardWindow.java
Expand Up @@ -61,7 +61,7 @@ public class DoodadCardWindow {
statusLabel.setText("Call Doodad Description here");
//resources folder should be inside SWING folder.

JButton payDoodad = new JButton("Pay");
JButton payDoodad = new JButton("Pay");
// payDoodad.setLayout(null);
// payDoodad.setLocation(10,220);
payDoodad.addActionListener(new ActionListener() {
Expand Down
2 changes: 1 addition & 1 deletion src/view/DownSizeWindow.java
Expand Up @@ -38,7 +38,7 @@ public class DownSizeWindow {
// public void windowClosing(WindowEvent windowEvent){
// System.exit(0);
// }
// });
// });
headerLabel = new JLabel("", JLabel.CENTER);
headerLabel.setFont(headerLabel.getFont().deriveFont(Font.BOLD, 16f));
statusLabel = new JLabel("",JLabel.CENTER);
Expand Down
138 changes: 125 additions & 13 deletions src/view/GameboardWindow.java
Expand Up @@ -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;
Expand All @@ -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<Positioner> 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);
Expand All @@ -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);



Expand Down
49 changes: 49 additions & 0 deletions 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 }

}

}

0 comments on commit 1172efd

Please sign in to comment.