Skip to content
Permalink
Browse files

Merge branch 'master' of

  • Loading branch information
afortuna2016
afortuna2016 committed Apr 25, 2017
2 parents ac8faef + deaa729 commit d27336325d00b06d057ef57e728312c860d6af20
BIN +416 Bytes (110%) bin/controller/Cashflow.class
Binary file not shown.
BIN +473 Bytes (150%) bin/model/CharityTile.class
Binary file not shown.
BIN +528 Bytes (130%) bin/model/DealTile.class
Binary file not shown.
BIN +0 Bytes (100%) bin/view/CharityWindow$1.class
Binary file not shown.
BIN +251 Bytes (130%) bin/view/CharityWindow$2.class
Binary file not shown.
BIN +473 Bytes (170%) bin/view/CharityWindow$3.class
Binary file not shown.
BIN +324 Bytes (110%) bin/view/CharityWindow.class
Binary file not shown.
@@ -40,7 +40,6 @@ public static void go()
// Initialize game board
_board = new GameBoard(_players);


// Initialize GUI


@@ -96,22 +95,15 @@ private static void testGamePlay()
players.add(p2);
GameBoard g = new GameBoard(players);
System.out.println(p1.getLocation());
g.movePlayer(p1, 5);
g.movePlayer(p1, 4);
System.out.println(p1.getLocation());


FSWindow FSWindow = new FSWindow();
FSWindow.prepareGUI(p1);
FSWindow.showButtonDemo();


// Delay to check how the financial statement updates
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


FSWindow.prepareGUI(p2);

@@ -146,33 +138,31 @@ public static void testCards()
}


//
// public void setUpScreen()
// {
// frame = new JFrame("Cashflow");
// frame.setLayout(new FlowLayout());
// window = new GameboardWindow(_board);
//
// sidewindow = new JWindow();
// sidewindow.setLayout(new GridLayout(5, 5));
//
// frame.add(window);
//
//
// frame.pack();
//
// frame.setVisible(true);
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// }
// public static void main(String[] args) {
// new Cashflow(4);
//
// }
// public Cashflow(int numPlayers)
// {
// //this.setUpScreen(); // just did this to test the screen
//
// }

public void setUpScreen()
{
frame = new JFrame("Cashflow");
frame.setLayout(new FlowLayout());
window = new GameboardWindow(_board);

sidewindow = new JWindow();
sidewindow.setLayout(new GridLayout(5, 5));

frame.add(window);


frame.pack();

frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}


public Cashflow(int numPlayers)
{
//this.setUpScreen(); // just did this to test the screen

}


}
@@ -1,5 +1,7 @@
package model;

import view.CharityWindow;

public class CharityTile extends Tile
{

@@ -15,6 +17,24 @@ public void getLandedOn(Player p)
FinancialStatement f = p.getFinancialStatement();
// call view method
// TODO
CharityWindow charityWindow = new CharityWindow();
charityWindow.showButtonDemo();


while(!charityWindow.hasAnswered)
{
try {
Thread.sleep(200);
} catch(InterruptedException e) {

}
}
System.out.println(charityWindow.doesDonate);

// Pick card from big/small deal stack:
Card c;
if(charityWindow.doesDonate)


if (p.donateCharity())
{
@@ -20,19 +20,30 @@ public DealTile(String type, int boardIndex)
public void getLandedOn(Player p)
{
// TODO
// For now, using a scanner to interact with user until GUI is ready:
// Ask user to decide big/small deal:
CharityWindow charityWindow = new CharityWindow();
charityWindow.showButtonDemo();


while(!charityWindow.hasAnswered)
{
try {
Thread.sleep(200);
} catch(InterruptedException e) {

}
}
System.out.println(charityWindow.doesDonate);


// Pick card from big/small deal stack:
Card c;
if(input.equals("1"))
if(charityWindow.doesDonate)
{
c = _smallDealStack.pickCard();
}
else
{
c = _smallDealStack.pickCard();
c = _bigDealStack.pickCard();
}

// If stock, update price, then ask user if they want to buy and ask everyone if they want to sell:
@@ -41,6 +52,8 @@ public void getLandedOn(Player p)
// If property, ask user if they want to do it (and check if they can afford the down payment):
// If yes, call ButIncomeProperty method:
// Else, do nothing:
System.out.println(charityWindow.hasAnswered);
charityWindow = null;
}

public void buyIncomeProperty(Player p, DealCard d)
@@ -9,13 +9,16 @@
private JLabel headerLabel;
private JLabel statusLabel;
private JPanel controlPanel;
public boolean doesDonate;
public boolean hasAnswered = false;

public CharityWindow(){
prepareGUI();
}
public static void main(String[] args){
CharityWindow CharityWindow = new CharityWindow();
CharityWindow.showButtonDemo();
boolean b = CharityWindow.showButtonDemo();
System.out.println(b);
}
private void prepareGUI(){
mainFrame = new JFrame("Charity");
@@ -46,7 +49,7 @@ public void windowClosing(WindowEvent windowEvent){
mainFrame.setVisible(true);
}

private void showButtonDemo(){
public boolean showButtonDemo(){
headerLabel.setText("Charity!");
statusLabel.setText("Charity description");

@@ -57,29 +60,81 @@ private void showButtonDemo(){
JButton DontDonate = new JButton("Don't Donate");
DontDonate.setHorizontalTextPosition(SwingConstants.LEFT);

Donate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//update cashbalance for player
try {
Thread.sleep(1);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
System.exit(0);
}

Donate.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
hasAnswered = true;
doesDonate = true;
mainFrame.dispose();
}

@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub

}
});

DontDonate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//put message that they are greedy. after 10 seconds, close window
System.exit(0);
}
DontDonate.addMouseListener(new MouseListener() {

@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
hasAnswered = true;
doesDonate = false;
mainFrame.dispose();
}

@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub

}

@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub

}
});
controlPanel.add(Donate);

controlPanel.add(DontDonate);

mainFrame.setVisible(true);

return doesDonate;
}
}
@@ -43,7 +43,7 @@ public GameboardWindow(GameBoard board) {
setMaximumSize(size);
setSize(size);
setLayout(null);

setUpTiles();

Positioners = new ArrayList<Positioner>();

0 comments on commit d273363

Please sign in to comment.
You can’t perform that action at this time.