AllAround Patch

master
Felix Stupp 8 years ago committed by GitHub
parent 3287759eff
commit 4f1279aae6

@ -37,15 +37,19 @@ public abstract class GeneralMap extends World implements ButtonEvent
VERSCHIEBEN
}
protected Province[] provinces;
protected Province[] provinces = new Province[] {null};
protected int[] continentBoni;
protected Player[] players;
protected int currentPlayer = 0;
private int statPlayer = -1;
protected GameStates status = GameStates.SETZEN;
protected int provinceCount;
protected int armyMinimum;
private Label statLabel1 = new Label("Lade Statistiken ...",20);
private Label statLabel2 = new Label("Lade Statistiken ...",20);
/**
Erstellt eine GeneralMap mit allen Eigenschaften und initialisiert die Arrays für Provinzen und Spieler.
@ -60,11 +64,12 @@ public abstract class GeneralMap extends World implements ButtonEvent
modus.setSize(100,100);
modus.setBackColor(Color.white);
modus.setForeColor(Color.black);
addObject(statLabel1, 270, 800);
addObject(statLabel2, 500, 800);
addObject( modus, 1500, 808);
for (int i = 0; i < playerList.length; i++) {
players[i] = new Player(i,playerList[i],colorList[i]);
addObject(players[i],0,0);
players[i].redrawPlayer();
}
createPlayerObjects(playerList.length);
@ -131,15 +136,15 @@ public abstract class GeneralMap extends World implements ButtonEvent
}
switch (playerCount) {
case 6:
players[5].setLocation(1512,350);
players[5].setLocation(1512,450);
case 5:
players[4].setLocation(1512,230);
players[4].setLocation(1512,280);
case 4:
players[3].setLocation(1512,110);
case 3:
players[2].setLocation(82,350);
players[2].setLocation(82,450);
case 2:
players[1].setLocation(82,230);
players[1].setLocation(82,280);
}
players[0].setLocation(82,110);
}
@ -286,6 +291,28 @@ public abstract class GeneralMap extends World implements ButtonEvent
}
}
public void reloadPlayerStat() {
Player cP = players[(statPlayer == -1) ? currentPlayer : statPlayer];
cP.reloadMaxInfluence();
cP.reloadMaxEntities();
int[] stats = cP.getStatistics();
statLabel1.setText(
"Provinz-Statistik" +
"\nAktuell: " + cP.getProvinceCount() +
"\nErobert: " + stats[0] +
"\nVerloren: " + stats[1] +
"\nMaximum: " + stats[2]
);
statLabel2.setLocation(statLabel1.getX() + statLabel1.getWidth() + 20, statLabel2.getY());
statLabel2.setText(
"Einheiten-Statistik" +
"\nAktuell: " + cP.getEntitiesCount() +
"\nAusgebildet: " + stats[3] +
"\nGefallen: " + stats[4] +
"\nMaximum: " + stats[5]
);
}
public void buttonClicked(Button b) {
if ( modus == b ) {
if(status==GameStates.SETZEN && freeArmies == 0 ) {
@ -317,6 +344,7 @@ public abstract class GeneralMap extends World implements ButtonEvent
}
redrawProvinces();
redrawPlayers();
reloadPlayerStat();
}
}

@ -136,7 +136,6 @@ public class Player extends Actor
if (provinces[x] == id)
{
p++;
redrawPlayer();
}
}
return p;
@ -213,7 +212,6 @@ public class Player extends Actor
public int[] getStatistics()
{
redrawPlayer();
return stats;
}
@ -235,12 +233,17 @@ public class Player extends Actor
public void redrawPlayer()
{
getWorld().reloadPlayerStat();
int textSize = 20;
if(n == null)
{
n = "leererSpieler";
}
GreenfootImage statistics = new GreenfootImage(137,120);
GreenfootImage statistics = new GreenfootImage(137,120);
if(getWorld().getCurrentPlayerID() == id) {
statistics.setColor(new Color(255,255,255));
statistics.fill();
}
GreenfootImage name = new GreenfootImage(n,textSize,getTextCol(),getTransBackCol());
statistics.drawImage(name,0,0);
@ -279,7 +282,8 @@ public class Player extends Actor
{
flag.scale(137,83);
statistics.drawImage(flag,0,textSize);
GreenfootImage playerStatistics = new GreenfootImage(stats[0] + "||" + stats[1] + "||" + stats[2] + "||" +stats[3] + "||" + stats[4] + "||" + stats[5],textSize,getTextCol(),getTransBackCol());
String statTxt = (getWorld().getCurrentPlayerID() == id) ? "Du bist dran!" : stats[0] + " | " + stats[1] + " | " + stats[2] + " | " +stats[3] + " | " + stats[4] + " | " + stats[5];
GreenfootImage playerStatistics = new GreenfootImage(statTxt,textSize,getTextCol(),getTransBackCol());
statistics.drawImage(playerStatistics, 0, 103);
setImage(statistics);

Loading…
Cancel
Save