fix: centralisation dans l'objet worlds des informations relatives à la gestion du monde sauvegarde/restauration des transmuteurs gestion des points de recherche sauvegarde/restauration de la grille par l'object worlds evolution des transmuteurs avec debit des points de recherche ajout d'un mode "debogue" qui permet l'édition et l'affichage de tout les transmuteurs
This commit is contained in:
parent
e33cf80443
commit
c99a916297
|
@ -27,6 +27,7 @@ import fr.evolving.assets.AssetLoader;
|
||||||
import fr.evolving.automata.Level;
|
import fr.evolving.automata.Level;
|
||||||
import fr.evolving.automata.Transmuter;
|
import fr.evolving.automata.Transmuter;
|
||||||
import fr.evolving.automata.Transmuter.Angular;
|
import fr.evolving.automata.Transmuter.Angular;
|
||||||
|
import fr.evolving.automata.Worlds;
|
||||||
|
|
||||||
public class Menu extends Actor {
|
public class Menu extends Actor {
|
||||||
|
|
||||||
|
@ -41,7 +42,6 @@ public class Menu extends Actor {
|
||||||
private float decx;
|
private float decx;
|
||||||
private float decy;
|
private float decy;
|
||||||
private int size = 32;
|
private int size = 32;
|
||||||
private Level level;
|
|
||||||
private Actor selected;
|
private Actor selected;
|
||||||
private Transmuter selected_transmuter;
|
private Transmuter selected_transmuter;
|
||||||
private TextureRegion oneselection;
|
private TextureRegion oneselection;
|
||||||
|
@ -49,20 +49,21 @@ public class Menu extends Actor {
|
||||||
private TimerTask RotateTask;
|
private TimerTask RotateTask;
|
||||||
private float rotation;
|
private float rotation;
|
||||||
ChangeEvent event;
|
ChangeEvent event;
|
||||||
|
Worlds worlds;
|
||||||
|
|
||||||
public Menu(Level level) {
|
public Menu(Worlds worlds) {
|
||||||
|
this.worlds=worlds;
|
||||||
this.tilesizex = 4;
|
this.tilesizex = 4;
|
||||||
this.tilesizey = 8;
|
this.tilesizey = 8;
|
||||||
this.nbpages=3;
|
this.nbpages=3;
|
||||||
this.selpage=0;
|
this.selpage=0;
|
||||||
this.seltype=0;
|
this.seltype=0;
|
||||||
this.level=level;
|
|
||||||
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Création du Tiledmap et Maprenderer");
|
Gdx.app.debug(getClass().getSimpleName(), "Création du Tiledmap et Maprenderer");
|
||||||
map = new TiledMap[3][Transmuter.Class.values().length];
|
map = new TiledMap[3][Transmuter.Class.values().length];
|
||||||
clear();
|
initialize();
|
||||||
MapRenderer = new OrthogonalTiledMapRenderer(map[selpage][seltype], 1 / (float) size);
|
MapRenderer = new OrthogonalTiledMapRenderer(map[selpage][seltype], 1 / (float) size);
|
||||||
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Caméra pour tilemap:"+ (tilesizex * size) + "x" + (tilesizey * size));
|
Gdx.app.debug(getClass().getSimpleName(), "Caméra pour tilemap:"+ (tilesizex * size) + "x" + (tilesizey * size));
|
||||||
camera = new OrthographicCamera();
|
camera = new OrthographicCamera();
|
||||||
camera.setToOrtho(false, tilesizex * 32, tilesizex * 32 * AssetLoader.height / AssetLoader.width);
|
camera.setToOrtho(false, tilesizex * 32, tilesizex * 32 * AssetLoader.height / AssetLoader.width);
|
||||||
|
@ -72,10 +73,10 @@ public class Menu extends Actor {
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Décalage:" + decx + "x"+ decy);
|
Gdx.app.debug(getClass().getSimpleName(), "Décalage:" + decx + "x"+ decy);
|
||||||
camera.translate(decx, decy);
|
camera.translate(decx, decy);
|
||||||
|
|
||||||
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Ajout des éléments de menu");
|
Gdx.app.debug(getClass().getSimpleName(), "Ajout des éléments de menu");
|
||||||
init();
|
update();
|
||||||
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer de rotation.");
|
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer de rotation.");
|
||||||
oneselection = AssetLoader.Atlas_level.findRegion("circle");
|
oneselection = AssetLoader.Atlas_level.findRegion("circle");
|
||||||
selected = new Actor();
|
selected = new Actor();
|
||||||
|
@ -88,7 +89,7 @@ public class Menu extends Actor {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
RotateTimer.scheduleAtFixedRate(RotateTask, 0, 30);
|
RotateTimer.scheduleAtFixedRate(RotateTask, 0, 30);
|
||||||
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Ajout de l'évènements clicked");
|
Gdx.app.debug(getClass().getSimpleName(), "Ajout de l'évènements clicked");
|
||||||
this.addListener(new ClickListener() {
|
this.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -118,33 +119,33 @@ public class Menu extends Actor {
|
||||||
Vector2 coords2 = worldtoscreen((int) coords.x,
|
Vector2 coords2 = worldtoscreen((int) coords.x,
|
||||||
(int) coords.y);
|
(int) coords.y);
|
||||||
Gdx.app.debug("menu","Coordonnées:" + x + "x" + y + " Menu:" + coords.x
|
Gdx.app.debug("menu","Coordonnées:" + x + "x" + y + " Menu:" + coords.x
|
||||||
+ "," + coords.y + " Ecran :" + coords2.x
|
+ "," + coords.y + " Ecran :" + coords2.x
|
||||||
+ "x" + coords2.y + " type:"
|
+ "x" + coords2.y + " type:"
|
||||||
+ tile.get("type"));
|
+ tile.get("type"));
|
||||||
selected.setBounds(coords2.x, coords2.y, 60, 60);
|
selected.setBounds(coords2.x, coords2.y, 60, 60);
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSelect() {
|
public void unSelect() {
|
||||||
selected=null;
|
selected=null;
|
||||||
selected_transmuter=null;
|
selected_transmuter=null;
|
||||||
EraseSurtile();
|
EraseSurtile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelection() {
|
public String getSelection() {
|
||||||
if (selected!=null)
|
if (selected!=null)
|
||||||
return selected.getName();
|
return selected.getName();
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transmuter getTransmuter() {
|
public Transmuter getTransmuter() {
|
||||||
return selected_transmuter;
|
return selected_transmuter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onchanged() {
|
public void onchanged() {
|
||||||
ChangeEvent event=new ChangeEvent();
|
ChangeEvent event=new ChangeEvent();
|
||||||
event.setTarget(this);
|
event.setTarget(this);
|
||||||
|
@ -153,7 +154,7 @@ public class Menu extends Actor {
|
||||||
if (event.getStage()!=null)
|
if (event.getStage()!=null)
|
||||||
this.fire(event);
|
this.fire(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPage(int page) {
|
public void setPage(int page) {
|
||||||
selected=null;
|
selected=null;
|
||||||
this.selpage=page;
|
this.selpage=page;
|
||||||
|
@ -161,7 +162,7 @@ public class Menu extends Actor {
|
||||||
EraseSurtile();
|
EraseSurtile();
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageType(int page,int type) {
|
public void setPageType(int page,int type) {
|
||||||
selected=null;
|
selected=null;
|
||||||
this.selpage=page;
|
this.selpage=page;
|
||||||
|
@ -170,20 +171,20 @@ public class Menu extends Actor {
|
||||||
EraseSurtile();
|
EraseSurtile();
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNextEmpty() {
|
public boolean isNextEmpty() {
|
||||||
if (this.selpage>=this.nbpages-2) return true;
|
if (this.selpage>=this.nbpages-2) return true;
|
||||||
TiledMapTileLayer layer=(TiledMapTileLayer)map[selpage+1][seltype].getLayers().get(0);
|
TiledMapTileLayer layer=(TiledMapTileLayer)map[selpage+1][seltype].getLayers().get(0);
|
||||||
boolean test=layer.getProperties().containsKey("noempty");
|
boolean test=layer.getProperties().containsKey("noempty");
|
||||||
return (!layer.getProperties().containsKey("noempty"));
|
return (!layer.getProperties().containsKey("noempty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPreviousEmpty() {
|
public boolean isPreviousEmpty() {
|
||||||
if (this.selpage<1) return true;
|
if (this.selpage<1) return true;
|
||||||
TiledMapTileLayer layer=(TiledMapTileLayer)map[selpage-1][seltype].getLayers().get(0);
|
TiledMapTileLayer layer=(TiledMapTileLayer)map[selpage-1][seltype].getLayers().get(0);
|
||||||
return (!layer.getProperties().containsKey("noempty"));
|
return (!layer.getProperties().containsKey("noempty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NextPage() {
|
public void NextPage() {
|
||||||
if (this.selpage<nbpages-1) {
|
if (this.selpage<nbpages-1) {
|
||||||
selected=null;
|
selected=null;
|
||||||
|
@ -193,7 +194,7 @@ public class Menu extends Actor {
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PreviousPage() {
|
public void PreviousPage() {
|
||||||
if (this.selpage>0) {
|
if (this.selpage>0) {
|
||||||
selected=null;
|
selected=null;
|
||||||
|
@ -203,65 +204,85 @@ public class Menu extends Actor {
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPage() {
|
public int getPage() {
|
||||||
return this.selpage;
|
return this.selpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxPage() {
|
public int getMaxPage() {
|
||||||
return this.nbpages;
|
return this.nbpages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
this.seltype=type;
|
this.seltype=type;
|
||||||
selected=null;
|
selected=null;
|
||||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return this.seltype;
|
return this.seltype;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
public void upate() {
|
||||||
this.setMenuTile(0, 7, 71, "copper_pen",0);
|
|
||||||
this.setMenuTile(1, 7, 72, "copper_brush",0);
|
|
||||||
this.setMenuTile(2, 7, 73, "copper_eraser",0);
|
|
||||||
this.setMenuTile(1, 5, 70, "blank",0);
|
|
||||||
this.setMenuTile(0, 6, 74, "fiber_pen",0);
|
|
||||||
this.setMenuTile(1, 6, 75, "fiber_brush",0);
|
|
||||||
this.setMenuTile(2, 6, 76, "fiber_eraser",0);
|
|
||||||
this.setMenuTile(0, 5, 77, "transmuter_eraser",0);
|
|
||||||
this.setMenuTile(2, 5, 78, "all_eraser",0);
|
|
||||||
this.setMenuTile(3, 3, 79, "cleaner",0);
|
|
||||||
this.setMenuTransmuter(0, 7, "+", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(2, 7, "-", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(0, 6, "++", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(2, 6, "--", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(0, 5, "+++", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(1, 5, "---", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(0, 4, "+-", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(1, 4, "+-+-", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(0, 3, "0", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(1, 3, "00", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(0, 7, ">", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(1, 6, "<>", Angular.A00,1);
|
|
||||||
this.setMenuTransmuter(1, 4, ">33", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(1, 1, ">50", Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(1, 2, ">100", Angular.A00,1);
|
|
||||||
this.setMenuTransmuter(0, 7, "+/",Angular.A00,0);
|
|
||||||
this.setMenuTransmuter(1, 7, "-/",Angular.A00,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void update() {
|
||||||
|
clearall();
|
||||||
|
this.setMenuTile(0, 7, 71, "copper_pen",0);
|
||||||
|
this.setMenuTile(1, 7, 72, "copper_brush",0);
|
||||||
|
this.setMenuTile(2, 7, 73, "copper_eraser",0);
|
||||||
|
this.setMenuTile(1, 5, 70, "blank",0);
|
||||||
|
this.setMenuTile(0, 6, 74, "fiber_pen",0);
|
||||||
|
this.setMenuTile(1, 6, 75, "fiber_brush",0);
|
||||||
|
this.setMenuTile(2, 6, 76, "fiber_eraser",0);
|
||||||
|
this.setMenuTile(0, 5, 77, "transmuter_eraser",0);
|
||||||
|
this.setMenuTile(2, 5, 78, "all_eraser",0);
|
||||||
|
this.setMenuTile(3, 3, 79, "cleaner",0);
|
||||||
|
this.setMenuTransmuter(0, 7, "+", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(2, 7, "-", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(0, 6, "++", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(2, 6, "--", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(0, 5, "+++", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(2, 5, "---", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(2, 4, "+-", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(3, 4, "+-+-", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(0, 4, "0", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(1, 4, "00", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(0, 7, ">", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(1, 6, "<>", Angular.A00,1);
|
||||||
|
this.setMenuTransmuter(1, 4, ">33", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(1, 1, ">50", Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(1, 2, ">100", Angular.A00,1);
|
||||||
|
this.setMenuTransmuter(0, 7, "+/",Angular.A00,0);
|
||||||
|
this.setMenuTransmuter(1, 7, "-/",Angular.A00,0);
|
||||||
|
this.unSelect();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearall() {
|
||||||
|
for (int k=0;k<Transmuter.Class.values().length;k++)
|
||||||
|
for (int j=0;j<nbpages;j++){
|
||||||
|
map[j][k].getTileSets().addTileSet(AssetLoader.tileSet);
|
||||||
|
for (int i = 0; i < map[j][k].getLayers().getCount(); i++) {
|
||||||
|
TiledMapTileLayer layer = (TiledMapTileLayer) map[j][k].getLayers().get(i);
|
||||||
|
for (int x = 0; x < layer.getWidth(); x++) {
|
||||||
|
for (int y = 0; y < layer.getHeight(); y++) {
|
||||||
|
layer.getCell(x, y).setTile(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
for (int k=0;k<Transmuter.Class.values().length;k++)
|
for (int k=0;k<Transmuter.Class.values().length;k++)
|
||||||
for (int j=0;j<nbpages;j++){
|
for (int j=0;j<nbpages;j++){
|
||||||
map[j][k]=new TiledMap();
|
map[j][k]=new TiledMap();
|
||||||
map[j][k].getTileSets().addTileSet(AssetLoader.tileSet);
|
map[j][k].getTileSets().addTileSet(AssetLoader.tileSet);
|
||||||
MapLayers layers = map[j][k].getLayers();
|
MapLayers layers = map[j][k].getLayers();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
TiledMapTileLayer layer = new TiledMapTileLayer(tilesizex,
|
TiledMapTileLayer layer = new TiledMapTileLayer(tilesizex,tilesizey, 128, 128);
|
||||||
tilesizey, 128, 128);
|
|
||||||
for (int x = 0; x < layer.getWidth(); x++) {
|
for (int x = 0; x < layer.getWidth(); x++) {
|
||||||
for (int y = 0; y < layer.getHeight(); y++) {
|
for (int y = 0; y < layer.getHeight(); y++) {
|
||||||
Cell cell = new Cell();
|
Cell cell = new Cell();
|
||||||
|
@ -273,6 +294,7 @@ public class Menu extends Actor {
|
||||||
layers.add(layer);
|
layers.add(layer);
|
||||||
}
|
}
|
||||||
map[j][k].getLayers().get(1).setOpacity(0.5f);
|
map[j][k].getLayers().get(1).setOpacity(0.5f);
|
||||||
|
map[j][k].getLayers().get(2).setOpacity(0.25f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,12 +318,8 @@ public class Menu extends Actor {
|
||||||
Entries<Vector2, Integer> iterator = tiles.iterator();
|
Entries<Vector2, Integer> iterator = tiles.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entry<Vector2, Integer> all = iterator.next();
|
Entry<Vector2, Integer> all = iterator.next();
|
||||||
Cell subcell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(1))
|
Cell subcell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(1)).getCell((int) (x + all.key.x), (int) (y + all.key.y));
|
||||||
.getCell((int) (x + all.key.x), (int) (y + all.key.y));
|
subcell.setTile(AssetLoader.tileSet.getTile(transmuter.getTilestype(tiles.keys().toArray().indexOf(all.key, false)) .ordinal() + 80));
|
||||||
subcell.setTile(AssetLoader.tileSet.getTile(transmuter
|
|
||||||
.getTilestype(
|
|
||||||
tiles.keys().toArray().indexOf(all.key, false))
|
|
||||||
.ordinal() + 80));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,32 +341,34 @@ public class Menu extends Actor {
|
||||||
|
|
||||||
private void setMenuTransmuter(int x, int y, String Name, Transmuter.Angular Angle,int page) {
|
private void setMenuTransmuter(int x, int y, String Name, Transmuter.Angular Angle,int page) {
|
||||||
Transmuter transmuter = AssetLoader.getTransmuter(Name);
|
Transmuter transmuter = AssetLoader.getTransmuter(Name);
|
||||||
|
TiledMapTileLayer layer;
|
||||||
if (transmuter != null) {
|
if (transmuter != null) {
|
||||||
int type=transmuter.getaClass().ordinal();
|
int type=transmuter.getaClass().ordinal();
|
||||||
TiledMapTileLayer layer = ((TiledMapTileLayer) map[page][type].getLayers().get(0));
|
Gdx.app.debug(getClass().getSimpleName(), "Transmuter find:"
|
||||||
Cell cell = layer.getCell(x, y);
|
+ transmuter.getName() + " Angle:" + Angle + " coords"
|
||||||
if (cell != null) {
|
+ x + "," + y+" page:"+page+" type:"+type);
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Transmuter find:"
|
if (transmuter.getTechnology()<=worlds.getInformations().Tech || worlds.isDebug()) {
|
||||||
+ transmuter.getName() + " Angle:" + Angle + " coords"
|
Gdx.app.debug(getClass().getSimpleName(), "Autorisé par le niveau");
|
||||||
+ x + "," + y+" page:"+page+" type:"+type);
|
if (!transmuter.isShowed() && transmuter.isUpgraded() && !worlds.isDebug())
|
||||||
if (transmuter.getTechnology()<=level.Tech) {
|
layer = ((TiledMapTileLayer) map[page][type].getLayers().get(2));
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Autorisé par le niveau");
|
else if (transmuter.isShowed() || worlds.isDebug())
|
||||||
|
layer = ((TiledMapTileLayer) map[page][type].getLayers().get(0));
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
Cell cell = layer.getCell(x, y);
|
||||||
|
if (cell != null) {
|
||||||
layer.getProperties().put("noempty", false);
|
layer.getProperties().put("noempty", false);
|
||||||
transmuter.setRotation(Angle);
|
transmuter.setRotation(Angle);
|
||||||
Iterator<Entry<Vector2, Integer>> keySetIterator = transmuter
|
Iterator<Entry<Vector2, Integer>> keySetIterator = transmuter.getTilesidrotated().iterator();
|
||||||
.getTilesidrotated().iterator();
|
|
||||||
while (keySetIterator.hasNext()) {
|
while (keySetIterator.hasNext()) {
|
||||||
Entry<Vector2, Integer> all = keySetIterator.next();
|
Entry<Vector2, Integer> all = keySetIterator.next();
|
||||||
Cell subcell = layer.getCell((int) (x + all.key.x), (int) (y + all.key.y));
|
Cell subcell = layer.getCell((int) (x + all.key.x), (int) (y + all.key.y));
|
||||||
subcell.setTile(AssetLoader.tileSet.getTile(all.value));
|
subcell.setTile(AssetLoader.tileSet.getTile(all.value));
|
||||||
subcell.setRotation(Angle.ordinal());
|
subcell.setRotation(Angle.ordinal());
|
||||||
subcell.getTile().getProperties()
|
subcell.getTile().getProperties().put("movetox", (int) -all.key.x);
|
||||||
.put("movetox", (int) -all.key.x);
|
subcell.getTile().getProperties().put("movetoy", (int) -all.key.y);
|
||||||
subcell.getTile().getProperties()
|
|
||||||
.put("movetoy", (int) -all.key.y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
|
||||||
import fr.evolving.assets.AssetLoader;
|
import fr.evolving.assets.AssetLoader;
|
||||||
import fr.evolving.automata.Transmuter;
|
import fr.evolving.automata.Transmuter;
|
||||||
|
import fr.evolving.automata.Worlds;
|
||||||
import fr.evolving.screens.GameScreen.calling;
|
import fr.evolving.screens.GameScreen.calling;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +22,10 @@ public class VertiBarre extends Actor {
|
||||||
private VerticalGroup table;
|
private VerticalGroup table;
|
||||||
private ImageTextButton[] Barre;
|
private ImageTextButton[] Barre;
|
||||||
private ButtonGroup buttonGroup;
|
private ButtonGroup buttonGroup;
|
||||||
|
Worlds worlds;
|
||||||
|
|
||||||
public VertiBarre() {
|
public VertiBarre(Worlds worlds) {
|
||||||
|
this.worlds=worlds;
|
||||||
table = new VerticalGroup();
|
table = new VerticalGroup();
|
||||||
table.setPosition(AssetLoader.width, AssetLoader.height - 375);
|
table.setPosition(AssetLoader.width, AssetLoader.height - 375);
|
||||||
table.right();
|
table.right();
|
||||||
|
@ -32,38 +35,41 @@ public class VertiBarre extends Actor {
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Menu:" + Barre.length+ " elements");
|
Gdx.app.debug(getClass().getSimpleName(), "Menu:" + Barre.length+ " elements");
|
||||||
for (int i = 0; i < Barre.length; i++)
|
for (int i = 0; i < Barre.length; i++)
|
||||||
{
|
{
|
||||||
Barre[i] = new ImageTextButton(Transmuter.Class.values()[i].toString(), AssetLoader.Skin_level);
|
if (Transmuter.Class.values()[i]!=Transmuter.Class.Scenario || worlds.isDebug())
|
||||||
table.addActor(Barre[i]);
|
{
|
||||||
buttonGroup.add(Barre[i]);
|
Barre[i] = new ImageTextButton(Transmuter.Class.values()[i].toString(), AssetLoader.Skin_level);
|
||||||
Barre[i].setName(String.valueOf(i));
|
table.addActor(Barre[i]);
|
||||||
Barre[i].addListener(new ClickListener() {
|
buttonGroup.add(Barre[i]);
|
||||||
@Override
|
Barre[i].setName(String.valueOf(i));
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
Barre[i].addListener(new ClickListener() {
|
||||||
int caller = Integer.parseInt(event.getListenerActor().getName());
|
@Override
|
||||||
Gdx.app.debug("Barre2", "Selection dans la Barre droite:"+ caller);
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
Method method;
|
int caller = Integer.parseInt(event.getListenerActor().getName());
|
||||||
try {
|
Gdx.app.debug("Barre2", "Selection dans la Barre droite:"+ caller);
|
||||||
Class<?> base = Class.forName("fr.evolving.screens.GameScreen");
|
Method method;
|
||||||
Class<?>[] params = { int.class };
|
try {
|
||||||
method = base.getDeclaredMethod("preparemenu", params);
|
Class<?> base = Class.forName("fr.evolving.screens.GameScreen");
|
||||||
method.invoke(((Game) Gdx.app.getApplicationListener()).getScreen(), caller);
|
Class<?>[] params = { int.class };
|
||||||
} catch (Exception e) {
|
method = base.getDeclaredMethod("preparemenu", params);
|
||||||
// TODO Auto-generated catch block
|
method.invoke(((Game) Gdx.app.getApplicationListener()).getScreen(), caller);
|
||||||
e.printStackTrace();
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
buttonGroup.setMaxCheckCount(1);
|
buttonGroup.setMaxCheckCount(1);
|
||||||
buttonGroup.setMinCheckCount(0);
|
buttonGroup.setMinCheckCount(0);
|
||||||
buttonGroup.setUncheckLast(true);
|
buttonGroup.setUncheckLast(true);
|
||||||
this.setBounds(table.getX(),table.getY(),table.getWidth(),table.getHeight());
|
this.setBounds(table.getX(),table.getY(),table.getWidth(),table.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Actor hit(float x, float y, boolean touchable) {
|
public Actor hit(float x, float y, boolean touchable) {
|
||||||
return table.hit(x, y, touchable);
|
return table.hit(x, y, touchable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
table.draw(batch, parentAlpha);
|
table.draw(batch, parentAlpha);
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Insufler100 extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -105,7 +104,19 @@ public class Insufler100 extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Insufler33 extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ public class Insufler33 extends Transmuter {
|
||||||
this.Upgrade = null;
|
this.Upgrade = null;
|
||||||
this.Unlock = new Array<Transmuter>();
|
this.Unlock = new Array<Transmuter>();
|
||||||
this.Unlock.add(new Insufler50(null));
|
this.Unlock.add(new Insufler50(null));
|
||||||
this.showed = false;
|
this.showed = true;
|
||||||
this.CanUpgradeTemp = true;
|
this.CanUpgradeTemp = true;
|
||||||
this.CanUpgradeCycle = false;
|
this.CanUpgradeCycle = false;
|
||||||
this.CanUpgradeRayon = false;
|
this.CanUpgradeRayon = false;
|
||||||
|
@ -106,7 +105,19 @@ public class Insufler33 extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Insufler50 extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -106,7 +105,19 @@ public class Insufler50 extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Inverter_I extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ public class Inverter_I extends Transmuter {
|
||||||
this.Research = 0;
|
this.Research = 0;
|
||||||
this.Upgrade = new Inverter_II(level);
|
this.Upgrade = new Inverter_II(level);
|
||||||
this.Unlock = null;
|
this.Unlock = null;
|
||||||
this.showed = false;
|
this.showed = true;
|
||||||
this.CanUpgradeTemp = true;
|
this.CanUpgradeTemp = true;
|
||||||
this.CanUpgradeCycle = false;
|
this.CanUpgradeCycle = false;
|
||||||
this.CanUpgradeRayon = false;
|
this.CanUpgradeRayon = false;
|
||||||
|
@ -89,7 +88,19 @@ public class Inverter_I extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Inverter_II extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -89,7 +88,18 @@ public class Inverter_II extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Negativer extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -89,7 +88,19 @@ public class Negativer extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Negativer_I extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ public class Negativer_I extends Transmuter {
|
||||||
this.Research = 0;
|
this.Research = 0;
|
||||||
this.Upgrade = new Negativer_II(level);
|
this.Upgrade = new Negativer_II(level);
|
||||||
this.Unlock = null;
|
this.Unlock = null;
|
||||||
this.showed = false;
|
this.showed = true;
|
||||||
this.CanUpgradeTemp = true;
|
this.CanUpgradeTemp = true;
|
||||||
this.CanUpgradeCycle = true;
|
this.CanUpgradeCycle = true;
|
||||||
this.CanUpgradeRayon = false;
|
this.CanUpgradeRayon = false;
|
||||||
|
@ -91,7 +90,19 @@ public class Negativer_I extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Negativer_II extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -91,7 +90,19 @@ public class Negativer_II extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Negativer_III extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -89,7 +88,19 @@ public class Negativer_III extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Neutraliser_I extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -49,9 +48,9 @@ public class Neutraliser_I extends Transmuter {
|
||||||
this.Price = 20;
|
this.Price = 20;
|
||||||
this.Technology = 4;
|
this.Technology = 4;
|
||||||
this.Research = 0;
|
this.Research = 0;
|
||||||
this.Upgrade = null;
|
this.Upgrade = new Neutraliser_II(level);;
|
||||||
this.Unlock = null;
|
this.Unlock = null;
|
||||||
this.showed = false;
|
this.showed = true;
|
||||||
this.CanUpgradeTemp = true;
|
this.CanUpgradeTemp = true;
|
||||||
this.CanUpgradeCycle = false;
|
this.CanUpgradeCycle = false;
|
||||||
this.CanUpgradeRayon = false;
|
this.CanUpgradeRayon = false;
|
||||||
|
@ -89,7 +88,19 @@ public class Neutraliser_I extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Neutraliser_II extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -89,7 +88,19 @@ public class Neutraliser_II extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Oneway extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ public class Oneway extends Transmuter {
|
||||||
this.Upgrade = null;
|
this.Upgrade = null;
|
||||||
this.Unlock = new Array<Transmuter>();
|
this.Unlock = new Array<Transmuter>();
|
||||||
this.Unlock.add(new distributor(level));
|
this.Unlock.add(new distributor(level));
|
||||||
this.showed = false;
|
this.showed = true;
|
||||||
this.CanUpgradeTemp = true;
|
this.CanUpgradeTemp = true;
|
||||||
this.CanUpgradeCycle = false;
|
this.CanUpgradeCycle = false;
|
||||||
this.CanUpgradeRayon = false;
|
this.CanUpgradeRayon = false;
|
||||||
|
@ -90,7 +89,19 @@ public class Oneway extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Positiver extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -89,7 +88,19 @@ public class Positiver extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Positiver_I extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ public class Positiver_I extends Transmuter {
|
||||||
this.Research = 0;
|
this.Research = 0;
|
||||||
this.Upgrade = new Positiver_II(level);
|
this.Upgrade = new Positiver_II(level);
|
||||||
this.Unlock = null;
|
this.Unlock = null;
|
||||||
this.showed = false;
|
this.showed = true;
|
||||||
this.CanUpgradeTemp = true;
|
this.CanUpgradeTemp = true;
|
||||||
this.CanUpgradeCycle = true;
|
this.CanUpgradeCycle = true;
|
||||||
this.CanUpgradeRayon = false;
|
this.CanUpgradeRayon = false;
|
||||||
|
@ -91,7 +90,19 @@ public class Positiver_I extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class Positiver_II extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -91,7 +90,19 @@ public class Positiver_II extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -33,9 +33,8 @@ public class Positiver_III extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -88,7 +87,19 @@ public class Positiver_III extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
this.level.Rayon += TurnRayon * UpgradedRayon;
|
this.level.Rayon += TurnRayon * UpgradedRayon;
|
||||||
|
|
|
@ -41,8 +41,22 @@ public abstract class Transmuter implements Cloneable, Serializable {
|
||||||
};
|
};
|
||||||
|
|
||||||
protected transient Level level;
|
protected transient Level level;
|
||||||
protected transient Angular Rotation;
|
protected Angular Rotation;
|
||||||
|
|
||||||
|
protected boolean temp_showed;
|
||||||
|
protected float temp_UpgradedNrj;
|
||||||
|
protected float temp_UpgradedRayon;
|
||||||
|
protected float temp_UpgradedCycle;
|
||||||
|
protected float temp_UpgradedTemp;
|
||||||
|
|
||||||
|
public void SetTemp(boolean temp_showed,float temp_UpgradedCycle,float temp_UpgradedTemp,float temp_UpgradedRayon,float temp_UpgradedNrj) {
|
||||||
|
this.temp_showed=temp_showed;
|
||||||
|
this.temp_UpgradedCycle=temp_UpgradedCycle;
|
||||||
|
this.temp_UpgradedTemp=temp_UpgradedTemp;
|
||||||
|
this.temp_UpgradedRayon=temp_UpgradedRayon;
|
||||||
|
this.temp_UpgradedNrj=temp_UpgradedNrj;
|
||||||
|
}
|
||||||
|
|
||||||
public Transmuter(Level level) {
|
public Transmuter(Level level) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.Rotation = Angular.A00;
|
this.Rotation = Angular.A00;
|
||||||
|
@ -63,7 +77,13 @@ public abstract class Transmuter implements Cloneable, Serializable {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,19 +173,28 @@ public abstract class Transmuter implements Cloneable, Serializable {
|
||||||
|
|
||||||
public boolean isUpgradable(int value) {
|
public boolean isUpgradable(int value) {
|
||||||
Transmuter transmuter=this.getUpgrade();
|
Transmuter transmuter=this.getUpgrade();
|
||||||
return transmuter!= null && !transmuter.isShowed() && transmuter.getResearch()>=value;
|
return transmuter!= null && !transmuter.isShowed() && (transmuter.getResearch()<=value || value==-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnlockable(int value) {
|
public boolean isUnlockable(int value) {
|
||||||
Array<Transmuter> transmuters=this.getUnlock();
|
Array<Transmuter> transmuters=this.getUnlock();
|
||||||
if (transmuters != null) {
|
if (transmuters != null) {
|
||||||
for(Transmuter transmuter:transmuters) {
|
for(Transmuter transmuter:transmuters) {
|
||||||
if (!transmuter.isShowed() && transmuter.getResearch()>=value)
|
if (!transmuter.isShowed() && (transmuter.getResearch()<=value || value==-1))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUpgraded () {
|
||||||
|
Transmuter transmuter=this;
|
||||||
|
while(transmuter!=null) {
|
||||||
|
transmuter=transmuter.getUpgrade();
|
||||||
|
if (transmuter!=null && transmuter.isShowed()) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isShowed() {
|
public boolean isShowed() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -17,17 +17,21 @@ public class Worlds extends Actor {
|
||||||
private Level usedlevel;
|
private Level usedlevel;
|
||||||
private Array<Transmuter> Transmuters;
|
private Array<Transmuter> Transmuters;
|
||||||
private State state;
|
private State state;
|
||||||
|
private boolean Debug;
|
||||||
|
private int research;
|
||||||
|
|
||||||
public enum State {pause,simulating,notloaded,databasefailed};
|
public enum State {pause,simulating,notloaded,databasefailed};
|
||||||
|
|
||||||
public Worlds(String campaign) {
|
public Worlds(String campaign) {
|
||||||
name=campaign;
|
name=campaign;
|
||||||
init();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void initialize() {
|
||||||
|
Debug=false;
|
||||||
levels=null;
|
levels=null;
|
||||||
usedworld=-1;
|
usedworld=-1;
|
||||||
|
research=-2;
|
||||||
usedlevel=null;
|
usedlevel=null;
|
||||||
if (!AssetLoader.Datahandler.verifyall()) {
|
if (!AssetLoader.Datahandler.verifyall()) {
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Pilotes de bases de donnée défaillant.");
|
Gdx.app.debug(getClass().getSimpleName(),"Pilotes de bases de donnée défaillant.");
|
||||||
|
@ -36,16 +40,75 @@ public class Worlds extends Actor {
|
||||||
else
|
else
|
||||||
state=State.notloaded;
|
state=State.notloaded;
|
||||||
this.load(name);
|
this.load(name);
|
||||||
|
this.ReadTransmuters();
|
||||||
if (state==State.notloaded)
|
if (state==State.notloaded)
|
||||||
this.init(name);
|
create(name);
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ModResearch(int addsub) {
|
||||||
|
research+=addsub;
|
||||||
|
SaveResearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ReadResearch() {
|
||||||
|
if (research==-2)
|
||||||
|
research=AssetLoader.Datahandler.user().getResearchpoint(0);
|
||||||
|
return research;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveResearch() {
|
||||||
|
this.research=research;
|
||||||
|
AssetLoader.Datahandler.user().setResearchpoint(0,research);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ActivateDebug() {
|
||||||
|
this.Debug=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DesactivateDebug() {
|
||||||
|
this.Debug=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDebug() {
|
||||||
|
return this.Debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveTransmuters() {
|
||||||
|
AssetLoader.Datahandler.user().setTransmuters(0,Transmuters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReadTransmuters() {
|
||||||
|
Transmuters=AssetLoader.Datahandler.user().getTransmuters(0);
|
||||||
|
//String test=Transmuters.get(1).getInformations();
|
||||||
|
if (Transmuters==null)
|
||||||
|
state=State.notloaded;
|
||||||
|
else
|
||||||
|
state=State.pause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Array<String> ViewGrids() {
|
||||||
|
if (usedlevel!=null)
|
||||||
|
return AssetLoader.Datahandler.user().getGrids(0,usedlevel.id);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReadGrid(int number) {
|
||||||
|
if (usedlevel!=null)
|
||||||
|
usedlevel.Grid = AssetLoader.Datahandler.user().getGrid(0, usedlevel.id, number);
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveGrid() {
|
public void SaveGrid() {
|
||||||
if (usedlevel!=null)
|
if (usedlevel!=null)
|
||||||
AssetLoader.Datahandler.user().setGrid(0, usedlevel.id, usedlevel.Grid);
|
AssetLoader.Datahandler.user().setGrid(0, usedlevel.id, usedlevel.Grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ReadLastGrid() {
|
||||||
|
if (usedlevel!=null)
|
||||||
|
usedlevel.Grid = AssetLoader.Datahandler.user().getGrid(0, usedlevel.id, "LAST");
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveLastGrid() {
|
public void SaveLastGrid() {
|
||||||
if (usedlevel!=null)
|
if (usedlevel!=null)
|
||||||
AssetLoader.Datahandler.user().setGrid(0, usedlevel.id, "LAST", usedlevel.Grid);
|
AssetLoader.Datahandler.user().setGrid(0, usedlevel.id, "LAST", usedlevel.Grid);
|
||||||
|
@ -116,7 +179,7 @@ public class Worlds extends Actor {
|
||||||
|
|
||||||
public void NextWorld() {
|
public void NextWorld() {
|
||||||
if (state!=State.notloaded)
|
if (state!=State.notloaded)
|
||||||
if (usedworld<getMaxWorlds()-1) {
|
if (usedworld<getMaxWorlds()) {
|
||||||
usedworld++;
|
usedworld++;
|
||||||
onchanged();
|
onchanged();
|
||||||
}
|
}
|
||||||
|
@ -149,15 +212,12 @@ public class Worlds extends Actor {
|
||||||
levels=AssetLoader.Datahandler.game().getCampaign(campaign);
|
levels=AssetLoader.Datahandler.game().getCampaign(campaign);
|
||||||
name=campaign;
|
name=campaign;
|
||||||
if (levels==null)
|
if (levels==null)
|
||||||
|
|
||||||
{
|
|
||||||
state=State.notloaded;
|
state=State.notloaded;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
state=State.pause;
|
state=State.pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(String campaign) {
|
public void create(String campaign) {
|
||||||
Gdx.app.log("*****", "initialisation de la compagne "+campaign);
|
Gdx.app.log("*****", "initialisation de la compagne "+campaign);
|
||||||
try {
|
try {
|
||||||
levels=InitWorlds.go();
|
levels=InitWorlds.go();
|
||||||
|
@ -166,6 +226,10 @@ public class Worlds extends Actor {
|
||||||
name=campaign;
|
name=campaign;
|
||||||
AssetLoader.Datahandler.game().setCampaign(levels,name);
|
AssetLoader.Datahandler.game().setCampaign(levels,name);
|
||||||
state=State.pause;
|
state=State.pause;
|
||||||
|
research=0;
|
||||||
|
Transmuters=AssetLoader.allTransmuter;
|
||||||
|
SaveTransmuters();
|
||||||
|
SaveResearch();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
state=State.notloaded;
|
state=State.notloaded;
|
||||||
|
|
|
@ -34,9 +34,8 @@ public class distributor extends Transmuter {
|
||||||
private static float TurnRayon;
|
private static float TurnRayon;
|
||||||
private static float TurnNrj;
|
private static float TurnNrj;
|
||||||
private static boolean Activable;
|
private static boolean Activable;
|
||||||
private int ActivationLevel;
|
private transient int ActivationLevel;
|
||||||
private int Rotation;
|
private static String id;
|
||||||
private String id;
|
|
||||||
private static OrderedMap<Vector2, CaseType> Tilestype;
|
private static OrderedMap<Vector2, CaseType> Tilestype;
|
||||||
private static OrderedMap<Vector2, Integer> Tilesid;
|
private static OrderedMap<Vector2, Integer> Tilesid;
|
||||||
|
|
||||||
|
@ -97,6 +96,18 @@ public class distributor extends Transmuter {
|
||||||
public Class getaClass() {
|
public Class getaClass() {
|
||||||
return this.theClass;
|
return this.theClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void savestatic() {
|
||||||
|
SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorestatic() {
|
||||||
|
this.UpgradedTemp = this.temp_UpgradedTemp;
|
||||||
|
this.UpgradedCycle = this.temp_UpgradedCycle;
|
||||||
|
this.UpgradedRayon = this.temp_UpgradedRayon;
|
||||||
|
this.UpgradedNrj = this.temp_UpgradedNrj;
|
||||||
|
this.showed=this.temp_showed;
|
||||||
|
}
|
||||||
|
|
||||||
public void ProcessCycle() {
|
public void ProcessCycle() {
|
||||||
this.level.Temp += TurnTemp * UpgradedTemp;
|
this.level.Temp += TurnTemp * UpgradedTemp;
|
||||||
|
|
|
@ -202,16 +202,21 @@ public class LocalBase extends Base {
|
||||||
} catch (SQLiteGdxException e) {
|
} catch (SQLiteGdxException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Transmuter[] mc = null;
|
Array<Transmuter> mc=new Array<Transmuter>();
|
||||||
if (cursor.next())
|
if (cursor.next())
|
||||||
try {
|
try {
|
||||||
byte[] bytes = Base64Coder.decodeLines(cursor
|
byte[] bytes = Base64Coder.decodeLines(cursor
|
||||||
.getString(0));
|
.getString(0));
|
||||||
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||||
ObjectInputStream ins = new ObjectInputStream(bais);
|
ObjectInputStream ins = new ObjectInputStream(bais);
|
||||||
mc = (Transmuter[]) ins.readObject();
|
//mc = (Transmuter[]) ins.readObject();
|
||||||
|
Object[] objects=(Object[])ins.readObject();
|
||||||
|
for(Object object:objects)
|
||||||
|
mc.add((Transmuter)object);
|
||||||
ins.close();
|
ins.close();
|
||||||
return new Array<Transmuter>(mc);
|
for(Transmuter transmuter:mc)
|
||||||
|
transmuter.restorestatic();
|
||||||
|
return mc;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -221,6 +226,8 @@ public class LocalBase extends Base {
|
||||||
public boolean setTransmuters(int user, Array<Transmuter> transmuters) {
|
public boolean setTransmuters(int user, Array<Transmuter> transmuters) {
|
||||||
String encoded = "";
|
String encoded = "";
|
||||||
try {
|
try {
|
||||||
|
for(Transmuter transmuter:transmuters)
|
||||||
|
transmuter.savestatic();
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
ObjectOutputStream oos = new ObjectOutputStream(bos);
|
ObjectOutputStream oos = new ObjectOutputStream(bos);
|
||||||
oos.writeObject(transmuters.toArray());
|
oos.writeObject(transmuters.toArray());
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class LevelRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found != -1) {
|
if (found != -1) {
|
||||||
if (!LevelScreen.logosmall.isChecked())
|
if (!LevelScreen.worlds.isDebug())
|
||||||
Laser.draw(
|
Laser.draw(
|
||||||
batcher,
|
batcher,
|
||||||
LevelScreen.buttonLevels[i].level.X,
|
LevelScreen.buttonLevels[i].level.X,
|
||||||
|
|
|
@ -205,7 +205,7 @@ public class GameScreen implements Screen {
|
||||||
this.worlds = aworlds;
|
this.worlds = aworlds;
|
||||||
this.level=worlds.getInformations();
|
this.level=worlds.getInformations();
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Récupération des derniers niveaux.");
|
Gdx.app.debug(getClass().getSimpleName(),"Récupération des derniers niveaux.");
|
||||||
this.level.Grid = AssetLoader.Datahandler.user().getGrid(0, this.level.id, "LAST");
|
worlds.ReadLastGrid();
|
||||||
if (this.level.Grid == null) {
|
if (this.level.Grid == null) {
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Copie monde original.");
|
Gdx.app.debug(getClass().getSimpleName(), "Copie monde original.");
|
||||||
this.level.Grid = this.level.Grid_orig;
|
this.level.Grid = this.level.Grid_orig;
|
||||||
|
@ -228,7 +228,7 @@ public class GameScreen implements Screen {
|
||||||
map.setSelected(getselected());
|
map.setSelected(getselected());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
vertibar=new VertiBarre();
|
vertibar=new VertiBarre(worlds);
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Création des elements primordiaux du screen (stage, renderer, table, level, world)");
|
Gdx.app.debug(getClass().getSimpleName(),"Création des elements primordiaux du screen (stage, renderer, table, level, world)");
|
||||||
fpsLabel = new Label("0 FPS", AssetLoader.Skin_level, "FPS");
|
fpsLabel = new Label("0 FPS", AssetLoader.Skin_level, "FPS");
|
||||||
fpsLabel.setPosition(AssetLoader.width - 75, AssetLoader.height - 220);
|
fpsLabel.setPosition(AssetLoader.width - 75, AssetLoader.height - 220);
|
||||||
|
@ -259,7 +259,7 @@ public class GameScreen implements Screen {
|
||||||
nrj.setPosition(610, AssetLoader.height - 74);
|
nrj.setPosition(610, AssetLoader.height - 74);
|
||||||
tech = new ImageTextButton(String.valueOf(level.Tech),AssetLoader.Skin_level, "tech2");
|
tech = new ImageTextButton(String.valueOf(level.Tech),AssetLoader.Skin_level, "tech2");
|
||||||
tech.setPosition(1345, AssetLoader.height - 74);
|
tech.setPosition(1345, AssetLoader.height - 74);
|
||||||
tech.setVisible(level.Tech==1);
|
tech.setVisible(level.Tech>=1);
|
||||||
cout = new ImageTextButton(String.valueOf(level.Cout),AssetLoader.Skin_level, "cout2");
|
cout = new ImageTextButton(String.valueOf(level.Cout),AssetLoader.Skin_level, "cout2");
|
||||||
cout.setVisible(level.Cout>0);
|
cout.setVisible(level.Cout>0);
|
||||||
cout.setPosition(1445, AssetLoader.height - 74);
|
cout.setPosition(1445, AssetLoader.height - 74);
|
||||||
|
@ -327,8 +327,12 @@ public class GameScreen implements Screen {
|
||||||
info_up.addListener(new ClickListener() {
|
info_up.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
if (menu.getTransmuter()!=null && menu.getTransmuter().isUpgradable(0))
|
if (menu.getTransmuter()!=null && menu.getTransmuter().isUpgradable(worlds.ReadResearch()))
|
||||||
|
worlds.ModResearch(-menu.getTransmuter().getUpgrade().getResearch());
|
||||||
menu.getTransmuter().Upgrade();
|
menu.getTransmuter().Upgrade();
|
||||||
|
menu.update();
|
||||||
|
info_up.setVisible(false);
|
||||||
|
hideInfo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog = new WarnDialog(AssetLoader.Skin_ui);
|
dialog = new WarnDialog(AssetLoader.Skin_ui);
|
||||||
|
@ -372,7 +376,7 @@ public class GameScreen implements Screen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu = new Menu(level);
|
menu = new Menu(worlds);
|
||||||
menu.setBounds(1531f, AssetLoader.height-780, 264, 480);
|
menu.setBounds(1531f, AssetLoader.height-780, 264, 480);
|
||||||
menu.addListener(new ChangeListener() {
|
menu.addListener(new ChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -623,6 +627,13 @@ public class GameScreen implements Screen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void exit()
|
||||||
|
{
|
||||||
|
worlds.SaveLastGrid();
|
||||||
|
worlds.SaveTransmuters();
|
||||||
|
worlds.SaveResearch();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
stage.act();
|
stage.act();
|
||||||
|
@ -720,17 +731,16 @@ public class GameScreen implements Screen {
|
||||||
if (winSave.isVisible())
|
if (winSave.isVisible())
|
||||||
readsaved();
|
readsaved();
|
||||||
} else if (caller == "save") {
|
} else if (caller == "save") {
|
||||||
Gdx.app.debug("Barre", "Sauvegarde de la grille.");
|
Gdx.app.debug("Barre", "Sauvegarde de la grille.");
|
||||||
Gdx.app.debug("Barre", AssetLoader.Datahandler.user().toString());
|
|
||||||
worlds.SaveGrid();
|
worlds.SaveGrid();
|
||||||
readsaved();
|
readsaved();
|
||||||
} else if (caller == "levels") {
|
} else if (caller == "levels") {
|
||||||
Gdx.app.debug("Barre", "Affichage des niveaux.");
|
Gdx.app.debug("Barre", "Affichage des niveaux.");
|
||||||
worlds.SaveLastGrid();
|
exit();
|
||||||
((Game) Gdx.app.getApplicationListener()).setScreen(new LevelScreen(worlds));
|
((Game) Gdx.app.getApplicationListener()).setScreen(new LevelScreen(worlds));
|
||||||
} else if (caller == "tree") {
|
} else if (caller == "tree") {
|
||||||
} else if (caller == "exits") {
|
} else if (caller == "exits") {
|
||||||
worlds.SaveLastGrid();
|
exit();
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
} else if (caller == "screen") {
|
} else if (caller == "screen") {
|
||||||
DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
|
DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
|
||||||
|
@ -835,7 +845,7 @@ public class GameScreen implements Screen {
|
||||||
AssetLoader.Atlas_level.findRegion("jauge"
|
AssetLoader.Atlas_level.findRegion("jauge"
|
||||||
+ transmuter.getUpgradeRayon()));
|
+ transmuter.getUpgradeRayon()));
|
||||||
info_up_rayonval.setColor(AssetLoader.Levelcolors[2]);
|
info_up_rayonval.setColor(AssetLoader.Levelcolors[2]);
|
||||||
info_up.setVisible(transmuter.isUnlockable(0)||transmuter.isUpgradable(0));
|
info_up.setVisible(transmuter.isUpgradable(worlds.ReadResearch()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,8 +887,7 @@ public class GameScreen implements Screen {
|
||||||
selSaved.addListener(new ClickListener() {
|
selSaved.addListener(new ClickListener() {
|
||||||
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)
|
||||||
level.Grid = AssetLoader.Datahandler.user().getGrid(0,
|
worlds.ReadGrid(selSaved.getSelectedIndex());
|
||||||
level.id, selSaved.getSelectedIndex());
|
|
||||||
level.Grid.tiling_copper();
|
level.Grid.tiling_copper();
|
||||||
level.Grid.tiling_transmuter();
|
level.Grid.tiling_transmuter();
|
||||||
map.redraw();
|
map.redraw();
|
||||||
|
@ -892,8 +901,7 @@ public class GameScreen implements Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readsaved() {
|
public void readsaved() {
|
||||||
Array<String> items = AssetLoader.Datahandler.user().getGrids(0,
|
Array<String> items = worlds.ViewGrids();
|
||||||
level.id);
|
|
||||||
if (items != null)
|
if (items != null)
|
||||||
selSaved.setItems(items);
|
selSaved.setItems(items);
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,7 @@ public class LevelScreen implements Screen {
|
||||||
float y, int pointer) {
|
float y, int pointer) {
|
||||||
ButtonLevel abutton = (ButtonLevel) event
|
ButtonLevel abutton = (ButtonLevel) event
|
||||||
.getListenerActor();
|
.getListenerActor();
|
||||||
if (logosmall.isChecked()) {
|
if (worlds.isDebug()) {
|
||||||
abutton.setPosition(event.getStageX() - 56,
|
abutton.setPosition(event.getStageX() - 56,
|
||||||
event.getStageY() - 20);
|
event.getStageY() - 20);
|
||||||
}
|
}
|
||||||
|
@ -355,8 +355,16 @@ public class LevelScreen implements Screen {
|
||||||
});
|
});
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Création des boutons.");
|
Gdx.app.debug(getClass().getSimpleName(), "Création des boutons.");
|
||||||
logosmall = new ImageButton(AssetLoader.Skin_level, "logosmall");
|
logosmall = new ImageButton(AssetLoader.Skin_level, "logosmall");
|
||||||
logosmall.setPosition(20,
|
logosmall.setPosition(20,AssetLoader.height - 175 + logosmall.getHeight() / 2);
|
||||||
AssetLoader.height - 175 + logosmall.getHeight() / 2);
|
logosmall.setChecked(worlds.isDebug());
|
||||||
|
logosmall.addListener(new ClickListener() {
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
if (logosmall.isChecked())
|
||||||
|
worlds.ActivateDebug();
|
||||||
|
else
|
||||||
|
worlds.DesactivateDebug();
|
||||||
|
}
|
||||||
|
});
|
||||||
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,
|
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,
|
||||||
"Descriptif");
|
"Descriptif");
|
||||||
TextDescriptive.setBounds(15, 15, 1185, 110);
|
TextDescriptive.setBounds(15, 15, 1185, 110);
|
||||||
|
@ -389,7 +397,7 @@ public class LevelScreen implements Screen {
|
||||||
else
|
else
|
||||||
Userdata.setColor(1f, 1f, 1f, 1f);
|
Userdata.setColor(1f, 1f, 1f, 1f);
|
||||||
Worlddata.Refresh();
|
Worlddata.Refresh();
|
||||||
worlds.init();
|
worlds.initialize();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
buttonSave = new TextButton(AssetLoader.language.get("[buttonSave-levelscreen]"), AssetLoader.Skin_ui);
|
buttonSave = new TextButton(AssetLoader.language.get("[buttonSave-levelscreen]"), AssetLoader.Skin_ui);
|
||||||
|
|
Loading…
Reference in New Issue