feat: ajout de la gestion de l'argent.
This commit is contained in:
parent
487bf7d021
commit
9a537e2839
|
@ -32,8 +32,15 @@ public class IconValue extends ImageTextButton{
|
||||||
this.setVisible(worlds.getInformations().Tech>=1);
|
this.setVisible(worlds.getInformations().Tech>=1);
|
||||||
break;
|
break;
|
||||||
case cout:
|
case cout:
|
||||||
|
worlds.getInformations().Cout=worlds.getInformations().Cout_orig-worlds.getInformations().Cout_copperfiber-worlds.getInformations().Cout_transmuter;
|
||||||
this.setText(String.valueOf(worlds.getInformations().Cout));
|
this.setText(String.valueOf(worlds.getInformations().Cout));
|
||||||
this.setVisible(worlds.getInformations().Cout>0);
|
if (worlds.getInformations().Cout>0.25*worlds.getInformations().Cout_orig)
|
||||||
|
this.setColor(1f, 1f, 1f, 1f);
|
||||||
|
else if (worlds.getInformations().Cout>0)
|
||||||
|
this.setColor(1f, 0.5f, 0.5f, 1f);
|
||||||
|
else
|
||||||
|
this.setColor(1f, 0, 0, 1f);
|
||||||
|
this.setVisible(worlds.getInformations().Cout_orig>0);
|
||||||
break;
|
break;
|
||||||
case research:
|
case research:
|
||||||
this.setText(String.valueOf(worlds.ReadResearch()));
|
this.setText(String.valueOf(worlds.ReadResearch()));
|
||||||
|
|
|
@ -22,10 +22,15 @@ public class Grid implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tiling_transmuter() {
|
public int tiling_transmuter() {
|
||||||
|
int result=0;
|
||||||
for (int x = 0; x < this.sizeX; x++)
|
for (int x = 0; x < this.sizeX; x++)
|
||||||
for (int y = 0; y < this.sizeY; y++)
|
for (int y = 0; y < this.sizeY; y++)
|
||||||
|
{
|
||||||
GetXY(x, y).Transmuter_calc = 0;
|
GetXY(x, y).Transmuter_calc = 0;
|
||||||
|
if (GetXY(x, y).Transmuter!=null)
|
||||||
|
result+=GetXY(x, y).Transmuter.getPrice();
|
||||||
|
}
|
||||||
for (int x = 0; x < this.sizeX; x++)
|
for (int x = 0; x < this.sizeX; x++)
|
||||||
for (int y = 0; y < this.sizeY; y++) {
|
for (int y = 0; y < this.sizeY; y++) {
|
||||||
Transmuter transmuter = getTransmuter(x, y);
|
Transmuter transmuter = getTransmuter(x, y);
|
||||||
|
@ -48,12 +53,19 @@ public class Grid implements Serializable {
|
||||||
Gdx.app.debug("info", x + "," + y + ">"
|
Gdx.app.debug("info", x + "," + y + ">"
|
||||||
+ GetXY(x, y).Transmuter_calc);
|
+ GetXY(x, y).Transmuter_calc);
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tiling_copper() {
|
public int tiling_copper() {
|
||||||
|
int result=0;
|
||||||
for (int x = 0; x < this.sizeX; x++)
|
for (int x = 0; x < this.sizeX; x++)
|
||||||
for (int y = 0; y < this.sizeY; y++)
|
for (int y = 0; y < this.sizeY; y++) {
|
||||||
|
if (getFiber(x,y))
|
||||||
|
result+=5;
|
||||||
if (getCopper(x, y)) {
|
if (getCopper(x, y)) {
|
||||||
|
result++;
|
||||||
|
if (getFiber(x,y))
|
||||||
|
result+=45;
|
||||||
int value = 0;
|
int value = 0;
|
||||||
if (getCopper(x, y + 1))
|
if (getCopper(x, y + 1))
|
||||||
value++;
|
value++;
|
||||||
|
@ -66,6 +78,7 @@ public class Grid implements Serializable {
|
||||||
GetXY(x, y).Copper_calc = value;
|
GetXY(x, y).Copper_calc = value;
|
||||||
} else
|
} else
|
||||||
GetXY(x, y).Copper_calc = -1;
|
GetXY(x, y).Copper_calc = -1;
|
||||||
|
}
|
||||||
for (int x = 0; x < this.sizeX; x++)
|
for (int x = 0; x < this.sizeX; x++)
|
||||||
for (int y = 0; y < this.sizeY; y++) {
|
for (int y = 0; y < this.sizeY; y++) {
|
||||||
int value = 0;
|
int value = 0;
|
||||||
|
@ -199,7 +212,7 @@ public class Grid implements Serializable {
|
||||||
GetXY(x, y).Copper_calc = value;
|
GetXY(x, y).Copper_calc = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
return;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cell GetXY(float X, float Y) {
|
public Cell GetXY(float X, float Y) {
|
||||||
|
|
|
@ -30,7 +30,9 @@ public class Level implements Serializable {
|
||||||
public int Nrj_orig;
|
public int Nrj_orig;
|
||||||
|
|
||||||
public transient int[] Victory;
|
public transient int[] Victory;
|
||||||
public transient int Cout;
|
public transient int Cout_transmuter;
|
||||||
|
public transient int Cout_copperfiber;
|
||||||
|
public transient int Cout;
|
||||||
public transient Grid Grid;
|
public transient Grid Grid;
|
||||||
public transient int Cycle;
|
public transient int Cycle;
|
||||||
public transient int Temp;
|
public transient int Temp;
|
||||||
|
|
|
@ -309,6 +309,7 @@ public class Worlds extends Actor {
|
||||||
|
|
||||||
public int getMaxUnlockWorlds() {
|
public int getMaxUnlockWorlds() {
|
||||||
int maxworld=0;
|
int maxworld=0;
|
||||||
|
if (levels!=null)
|
||||||
for (Level level : levels)
|
for (Level level : levels)
|
||||||
if (!level.Locked && level.aWorld>maxworld)
|
if (!level.Locked && level.aWorld>maxworld)
|
||||||
maxworld=level.aWorld;
|
maxworld=level.aWorld;
|
||||||
|
@ -319,6 +320,7 @@ public class Worlds extends Actor {
|
||||||
Array<Level> tempworld=getLevels();
|
Array<Level> tempworld=getLevels();
|
||||||
int maxlevel=0;
|
int maxlevel=0;
|
||||||
Level themaxlevel=null;
|
Level themaxlevel=null;
|
||||||
|
if (tempworld!=null)
|
||||||
for (Level level : tempworld)
|
for (Level level : tempworld)
|
||||||
if (!level.Locked && level.aLevel>maxlevel) {
|
if (!level.Locked && level.aLevel>maxlevel) {
|
||||||
maxlevel=level.aLevel;
|
maxlevel=level.aLevel;
|
||||||
|
|
|
@ -447,7 +447,7 @@ public class GameScreen implements Screen {
|
||||||
level.Grid.GetXY(x, y).Transmuter = (Transmuter) menu.getTransmuter()
|
level.Grid.GetXY(x, y).Transmuter = (Transmuter) menu.getTransmuter()
|
||||||
.clone();
|
.clone();
|
||||||
if (alone)
|
if (alone)
|
||||||
level.Grid.tiling_transmuter();
|
level.Cout_transmuter=level.Grid.tiling_transmuter();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
Gdx.input.vibrate(new long[] { 0, 200, 200, 200 }, -1);
|
Gdx.input.vibrate(new long[] { 0, 200, 200, 200 }, -1);
|
||||||
}
|
}
|
||||||
|
@ -516,13 +516,13 @@ public class GameScreen implements Screen {
|
||||||
for (x = 0; x < level.Grid.sizeX; x++)
|
for (x = 0; x < level.Grid.sizeX; x++)
|
||||||
for (y = 0; y < level.Grid.sizeY; y++)
|
for (y = 0; y < level.Grid.sizeY; y++)
|
||||||
map_transmuter_eraser(0, 0, x, y, false, button, call);
|
map_transmuter_eraser(0, 0, x, y, false, button, call);
|
||||||
level.Grid.tiling_transmuter();
|
level.Cout_transmuter=level.Grid.tiling_transmuter();
|
||||||
for (x = 0; x < level.Grid.sizeX; x++)
|
for (x = 0; x < level.Grid.sizeX; x++)
|
||||||
for (y = 0; y < level.Grid.sizeY; y++) {
|
for (y = 0; y < level.Grid.sizeY; y++) {
|
||||||
map_fiber_eraser(0, 0, x, y, false, button, call);
|
map_fiber_eraser(0, 0, x, y, false, button, call);
|
||||||
map_copper_eraser(0, 0, x, y, false, button, call);
|
map_copper_eraser(0, 0, x, y, false, button, call);
|
||||||
}
|
}
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ public class GameScreen implements Screen {
|
||||||
+ (y + level.Grid.GetXY(x, y).Transmuter_movey));
|
+ (y + level.Grid.GetXY(x, y).Transmuter_movey));
|
||||||
}
|
}
|
||||||
if (alone) {
|
if (alone) {
|
||||||
level.Grid.tiling_transmuter();
|
level.Cout_transmuter=level.Grid.tiling_transmuter();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -555,7 +555,7 @@ public class GameScreen implements Screen {
|
||||||
if (level.Grid.GetXY(x, y).Transmuter_calc == 0) {
|
if (level.Grid.GetXY(x, y).Transmuter_calc == 0) {
|
||||||
level.Grid.GetXY(x, y).Fiber = 0;
|
level.Grid.GetXY(x, y).Fiber = 0;
|
||||||
if (alone) {
|
if (alone) {
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ public class GameScreen implements Screen {
|
||||||
level.Grid.GetXY(x, y).Fiber = -1 * level.Grid.GetXY(x, y).Fiber
|
level.Grid.GetXY(x, y).Fiber = -1 * level.Grid.GetXY(x, y).Fiber
|
||||||
+ 1;
|
+ 1;
|
||||||
if (alone) {
|
if (alone) {
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ public class GameScreen implements Screen {
|
||||||
if (level.Grid.GetXY(x, y).Transmuter_calc == 0)
|
if (level.Grid.GetXY(x, y).Transmuter_calc == 0)
|
||||||
level.Grid.GetXY(x, y).Fiber = 1;
|
level.Grid.GetXY(x, y).Fiber = 1;
|
||||||
if (alone) {
|
if (alone) {
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,7 @@ public class GameScreen implements Screen {
|
||||||
if (level.Grid.GetXY(x, y).Transmuter_calc == 0) {
|
if (level.Grid.GetXY(x, y).Transmuter_calc == 0) {
|
||||||
level.Grid.GetXY(x, y).Copper = false;
|
level.Grid.GetXY(x, y).Copper = false;
|
||||||
if (alone) {
|
if (alone) {
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@ public class GameScreen implements Screen {
|
||||||
if (level.Grid.GetXY(x, y).Transmuter_calc == 0)
|
if (level.Grid.GetXY(x, y).Transmuter_calc == 0)
|
||||||
level.Grid.GetXY(x, y).Copper = !level.Grid.GetXY(x, y).Copper;
|
level.Grid.GetXY(x, y).Copper = !level.Grid.GetXY(x, y).Copper;
|
||||||
if (alone) {
|
if (alone) {
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ public class GameScreen implements Screen {
|
||||||
if (level.Grid.GetXY(x, y).Transmuter_calc == 0)
|
if (level.Grid.GetXY(x, y).Transmuter_calc == 0)
|
||||||
level.Grid.GetXY(x, y).Copper = true;
|
level.Grid.GetXY(x, y).Copper = true;
|
||||||
if (alone) {
|
if (alone) {
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,7 +699,6 @@ public class GameScreen implements Screen {
|
||||||
menu.EraseSurtile();
|
menu.EraseSurtile();
|
||||||
hideInfo();
|
hideInfo();
|
||||||
if (caller == "run") {
|
if (caller == "run") {
|
||||||
worlds.getInformations().Cout-=15;
|
|
||||||
} else if (caller == "stop") {
|
} else if (caller == "stop") {
|
||||||
} else if (caller == "speed") {
|
} else if (caller == "speed") {
|
||||||
} else if (caller == "move") {
|
} else if (caller == "move") {
|
||||||
|
@ -877,8 +876,8 @@ public class GameScreen implements Screen {
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
if (this.getTapCount() > 1)
|
if (this.getTapCount() > 1)
|
||||||
worlds.ReadGrid(selSaved.getSelectedIndex());
|
worlds.ReadGrid(selSaved.getSelectedIndex());
|
||||||
level.Grid.tiling_copper();
|
level.Cout_copperfiber=level.Grid.tiling_copper();
|
||||||
level.Grid.tiling_transmuter();
|
level.Cout_transmuter=level.Grid.tiling_transmuter();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
map.tempclear();
|
map.tempclear();
|
||||||
hideInfo();
|
hideInfo();
|
||||||
|
|
Loading…
Reference in New Issue