Skip to content

Commit

Permalink
main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
amf14004 committed Apr 21, 2017
2 parents c175f75 + 597b3db commit 4795507
Show file tree
Hide file tree
Showing 34 changed files with 294 additions and 63 deletions.
3 changes: 0 additions & 3 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
/.DS_Store
/controller/
/model/
/view/
Binary file modified bin/controller/Cashflow.class
Binary file not shown.
Binary file modified bin/model/DoodadTile.class
Binary file not shown.
Binary file modified bin/model/DownsizeTile.class
Binary file not shown.
Binary file modified bin/model/FinancialStatement.class
Binary file not shown.
Binary file modified bin/model/GameBoard.class
Binary file not shown.
Binary file modified bin/model/Tile.class
Binary file not shown.
Binary file modified bin/model/TileCircularLinkedList.class
Binary file not shown.
Binary file modified bin/view/CharityWindow$2.class
Binary file not shown.
Binary file modified bin/view/CharityWindow$3.class
Binary file not shown.
Binary file modified bin/view/CharityWindow.class
Binary file not shown.
Binary file modified bin/view/DoodadCardWindow$1.class
Binary file not shown.
Binary file modified bin/view/DoodadCardWindow$2.class
Binary file not shown.
Binary file modified bin/view/DoodadCardWindow.class
Binary file not shown.
Binary file modified bin/view/DownSizeWindow.class
Binary file not shown.
Binary file modified bin/view/FSWindow.class
Binary file not shown.
Binary file modified bin/view/MainWindow$1.class
Binary file not shown.
Binary file modified bin/view/MainWindow.class
Binary file not shown.
Binary file added gameboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions src/controller/Cashflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ public boolean isWinner()

private static void testGamePlay()
{
Player p = new Player();
System.out.println(p.getFinancialStatement().getProfession().getName());
GameBoard g = new GameBoard();
Player p1 = new Player();
Player p2 = new Player();
GameBoard g = new GameBoard(p1, p2);
System.out.println(p1.getLocation());
g.movePlayer(p1, 5);
System.out.println(p1.getLocation());

}

Expand Down
6 changes: 6 additions & 0 deletions src/model/DoodadTile.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package model;

import view.*;

public class DoodadTile extends Tile
{
private static DoodadStack _doodadStack;
Expand All @@ -15,6 +17,10 @@ public void getLandedOn(Player p)
{
FinancialStatement f = p.getFinancialStatement();
DoodadCard dc = _doodadStack.pickCard();

DoodadCardWindow DoodadCardWindow = new DoodadCardWindow();
DoodadCardWindow.showButtonDemo();

int amount = dc.getValue();
if (f.getCashBalance() > amount)
{
Expand Down
8 changes: 8 additions & 0 deletions src/model/DownsizeTile.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package model;

import view.DownSizeWindow;

public class DownsizeTile extends Tile{
public DownsizeTile(String type, int boardIndex)
{
Expand All @@ -10,5 +12,11 @@ public DownsizeTile(String type, int boardIndex)
public void getLandedOn(Player p)
{
p.increaseDownsizeCount();

DownSizeWindow DownSizeWindow = new DownSizeWindow();
DownSizeWindow.showButtonDemo();

// TODO
System.out.println("Player landed on downsized");
}
}
110 changes: 100 additions & 10 deletions src/model/FinancialStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,27 +205,117 @@ public int getTotalIncome()
return _totalIncome;
}

public int getSalary()
<<<<<<< HEAD

=======
//income getters
public int getIncome()
{
return _income;
}
public int getSalary()
{
return _salary;
}
public int getREcashFlow()
{
return _REcashFlow;
}

public int getSalary()
//expense getters
public int getExpenses()
{
return _salary;
return _expenses;
}
public int getTaxes()
{
return _taxes;
}
public int getHomeMortgagePayment()
{
return _homeMortgagePayment;
}
public int getSchoolLoanPayment()
{
return _schoolLoanPayment;
}
public int getCarLoanPayment()
{
return _carLoanPayment;
}
public int getCreditCardPayment()
{
return _creditCardPayment;
}
public int getOtherExpenses()
{
return _otherExpenses;
}
public int getPerChildExpense()
{
return _perChildExpense;
}
public int getNumChildren()
{
return _numChildren;
}

public int getSalary()
//assets getters
public int getAssets()
{
return _salary;
}
public int getSalary()
return _assets;
}
public int getSavings()
{
return _salary;
return _savings;
}
public int getSalary()

public int getStock()
{
return _salary;
return _stock.getNumShares() * _stock.getSharePrice();
}
//for realestate,maybe
// public int get()
// {
// return _;
// }

//liabilities getters
public int getLiabilities()
{
return _liabilities;
}
public int getHomeMortgage()
{
return _homeMortgage;
}
public int getSchoolLoans()
{
return _schoolLoans;
}
public int getCarLoans()
{
return _carLoans;
}
public int getCreditCardDebt()
{
return _creditCardDebt;
}

//additonal cash flow getters
public int getMonthlySalary()
{
return _monthlySalary;
}

public int getTotalExpenses()
{
return _totalExpenses;
}

public int getMonthlyCashflow() {
// TODO Auto-generated method stub
return _monthlyCashFlow;
}

}
Expand Down
17 changes: 9 additions & 8 deletions src/model/GameBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ public GameBoard(Player... players)
{
_profs = new Professions();
_tiles = new TileCircularLinkedList();
_tiles.addTiles(t1, t2, t3, t4);
_tiles.addTiles(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24);
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);


public Tile getTile(int index) {
return _tiles.get(index).getData();
}

// TODO This method will move the player and returns the number of pay days they passed along the way.
Expand All @@ -70,6 +67,10 @@ public int movePlayer(Player p, int distance)
{
passedPaydays++;
}

// TODO update player location on board each iteration and maybe add delay
System.out.println("Player is at tile number: " + currentNode.getData().getBoardIndex());

currentNode = nextNode;
}
currentNode.getData().addPlayers(p);
Expand Down
1 change: 1 addition & 0 deletions src/model/Stock.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ public int getNumShares()
return _numShares;
}


}
1 change: 1 addition & 0 deletions src/model/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Tile

public Tile(String name, int boardIndex)
{
_players = new ArrayList<Player>();
_name = name;
_boardIndex = boardIndex;
}
Expand Down
4 changes: 2 additions & 2 deletions src/model/TileCircularLinkedList.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Node get(int index){
return null;
}
Node n = head;
while(index-1!=0){
while(index!=0){
n=n.next;
index--;
}
Expand All @@ -76,7 +76,7 @@ public Tile elementAt(int index){
return null;
}
Node n = head;
while(index-1!=0){
while(index!=0){
n=n.next;
index--;
}
Expand Down
Binary file added src/view/.DS_Store
Binary file not shown.
10 changes: 3 additions & 7 deletions src/view/CharityWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,21 @@ private void showButtonDemo(){

Donate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//put message that they donated xx dollars after 10 seconds, close window
//update cashbalance for player
try {
Thread.sleep(1000);
Thread.sleep(1);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

statusLabel.setText("Good Job! You donated all your savings!");


System.exit(0);
}
});

DontDonate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//put message that they are greedy. after 10 seconds, close window
System.exit(0);
System.exit(0);
}
});
controlPanel.add(Donate);
Expand Down
8 changes: 5 additions & 3 deletions src/view/DoodadCardWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import model.DoodadCard;

public class DoodadCardWindow {
private JFrame mainFrame;
private JLabel headerLabel;
private JLabel statusLabel;
private JPanel controlPanel;

public DoodadCardWindow(){
prepareGUI();
prepareGUI(null);
}
public static void main(String[] args){
DoodadCardWindow DoodadCardWindow = new DoodadCardWindow();
DoodadCardWindow.showButtonDemo();
}
private void prepareGUI(){
private void prepareGUI(DoodadCard dc){
mainFrame = new JFrame("Doodad");
mainFrame.getContentPane().setBackground(new Color(250, 51, 51));
mainFrame.setSize(350,250);
Expand All @@ -56,7 +58,7 @@ public void windowClosing(WindowEvent windowEvent){
mainFrame.setVisible(true);
}

private void showButtonDemo(){
public void showButtonDemo(){
headerLabel.setText("Call Doodad Title here");
statusLabel.setText("Call Doodad Description here");
//resources folder should be inside SWING folder.
Expand Down
2 changes: 1 addition & 1 deletion src/view/DownSizeWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void prepareGUI(){
mainFrame.setVisible(true);
}

private void showButtonDemo(){
public void showButtonDemo(){
headerLabel.setText("Downsize");
statusLabel.setText("You lose 3 turns.");
//resources folder should be inside SWING folder.
Expand Down
Loading

0 comments on commit 4795507

Please sign in to comment.