|
|
@ -154,8 +154,74 @@ public class Province extends Actor
|
|
|
|
return eCount;
|
|
|
|
return eCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void redrawProvince() {
|
|
|
|
public void redrawProvince()
|
|
|
|
//Platzhalter
|
|
|
|
{
|
|
|
|
|
|
|
|
GreenfootImage province = new GreenfootImage(100,65);
|
|
|
|
|
|
|
|
GreenfootImage provinceName = new GreenfootImage(displayName,16,new Color(0,0,0),new Color(1.0f,1.0f,1.0f,0.5f));
|
|
|
|
|
|
|
|
province.drawImage(provinceName,0,0);
|
|
|
|
|
|
|
|
eCalculate(province);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void eCalculate(GreenfootImage province)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int eCountTanks = eCount / 5;
|
|
|
|
|
|
|
|
GreenfootImage tryOut = new GreenfootImage("C:\\Users\\samue\\Documents\\GitHub\\zweiundvierzig\\Tank.jpg");
|
|
|
|
|
|
|
|
if(eCountTanks <= 3)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(eCountTanks == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,17);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(eCountTanks == 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,17);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,17,17);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(eCountTanks == 3)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,17);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,17,17);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,34,17);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GreenfootImage eCountTanksImage = new GreenfootImage(Integer.toString(eCountTanks) + "x",16,Color.CYAN,new Color(1.0f,1.0f,1.0f,0.5f));
|
|
|
|
|
|
|
|
province.drawImage(eCountTanksImage,0,17);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,22,18);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int eCountHorse = (eCount - (eCountTanks * 5))/3;
|
|
|
|
|
|
|
|
if(eCountHorse == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,34);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int eCountInf = eCount - (eCountTanks * 5) - (eCountHorse * 3);
|
|
|
|
|
|
|
|
if(eCountInf <= 4)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(eCountInf == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,51);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(eCountInf == 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,51);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,17,51);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(eCountInf == 3)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,51);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,17,51);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,34,51);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(eCountInf == 4)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
province.drawImage(tryOut,0,51);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,17,51);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,34,51);
|
|
|
|
|
|
|
|
province.drawImage(tryOut,51,51);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setImage(province);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|