-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathController.java
37 lines (30 loc) · 993 Bytes
/
Controller.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
public class Controller {
public View[] view;
public RuleEngine ruleEngine;
public Player[] player=new Player[3];
public int windowAmount=1;
public boolean multGUI=false;
public Controller(){
this.ruleEngine=new RuleEngine(this);
if(multGUI){
windowAmount=ruleEngine.playerAmount();
for(int i=0;i<windowAmount;i++){
this.player[i] =new Player(this,i);
this.view[i]=new View(this,player[i],i);
}
}
else{
view=new View[1];
this.view[0]=new View(this, player[0],windowAmount);
this.player[0]=new Player(this,0);
}
}
public void changeText(int _r,int _c, char player){
for(int i=0;i<windowAmount;i++){
view[i].buttons[_r][_c].setText(Character.toString(player));
}
}
public void unitClicked(int _r,int _c,int playersTurn){
player[ruleEngine.getPlayersTurn()].moveMade(_r,_c,playersTurn);
}
}