fix: modification des appels à gdx.app.log/debogue/error afin de faire des filtres dans logcat.

This commit is contained in:
Nicolas Hordé 2016-02-10 21:40:19 +01:00
parent 16cfe33549
commit d5e88debd1
15 changed files with 211 additions and 190 deletions

View File

@ -51,7 +51,7 @@ public class HorizBarre extends Actor {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer de rotation."); Gdx.app.debug("wirechem-HorizBarre", "Mise en place du timer de rotation.");
oneselection = AssetLoader.Atlas_level.findRegion("circle"); oneselection = AssetLoader.Atlas_level.findRegion("circle");
rotation=0; rotation=0;
RotateTimer = new Timer(); RotateTimer = new Timer();
@ -66,8 +66,7 @@ public class HorizBarre extends Actor {
this.setBounds(0, 0, 1920, 80); this.setBounds(0, 0, 1920, 80);
Barre = new ImageButton[tocreate.length]; Barre = new ImageButton[tocreate.length];
int i = 0; int i = 0;
Gdx.app.debug(getClass().getSimpleName(), "Barre bas:" + Barre.length Gdx.app.debug("wirechem-HorizBarre", "Barre bas:" + Barre.length + " elements");
+ " elements");
for (String item : tocreate) { for (String item : tocreate) {
final String itemtocreate=item.replace("#", ""); final String itemtocreate=item.replace("#", "");
Barre[i] = new ImageButton(AssetLoader.Skin_level, itemtocreate); Barre[i] = new ImageButton(AssetLoader.Skin_level, itemtocreate);
@ -90,8 +89,7 @@ public class HorizBarre extends Actor {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
String caller = event.getListenerActor().getName(); String caller = event.getListenerActor().getName();
Gdx.app.debug("Barre", "Selection dans la Barre bas:" Gdx.app.debug("wirechem-HorizBarre", "Selection dans la Barre bas:" + caller);
+ caller);
try { try {
method.invoke(((Game) Gdx.app.getApplicationListener()).getScreen(), caller, this.getTapCount()); method.invoke(((Game) Gdx.app.getApplicationListener()).getScreen(), caller, this.getTapCount());
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {

View File

@ -29,7 +29,7 @@ public class IconValue extends ImageTextButton{
switch(this.icon) { switch(this.icon) {
case tech: case tech:
this.setText(String.valueOf(worlds.getInformations().Tech)); this.setText(String.valueOf(worlds.getInformations().Tech));
this.setVisible(worlds.getInformations().Tech>=1); this.setVisible(worlds.getInformations().Tech>=1 || worlds.isDebug());
break; break;
case cout: case cout:
worlds.getInformations().Cout=worlds.getInformations().Cout_orig-worlds.getInformations().Cout_copperfiber-worlds.getInformations().Cout_transmuter; worlds.getInformations().Cout=worlds.getInformations().Cout_orig-worlds.getInformations().Cout_copperfiber-worlds.getInformations().Cout_transmuter;
@ -40,35 +40,35 @@ public class IconValue extends ImageTextButton{
this.setColor(1f, 0.5f, 0.5f, 1f); this.setColor(1f, 0.5f, 0.5f, 1f);
else else
this.setColor(1f, 0, 0, 1f); this.setColor(1f, 0, 0, 1f);
this.setVisible(worlds.getInformations().Cout_orig>0); this.setVisible(worlds.getInformations().Cout_orig>0 || worlds.isDebug());
break; break;
case research: case research:
this.setText(String.valueOf(worlds.ReadResearch())); this.setText(String.valueOf(worlds.ReadResearch()));
this.setVisible(worlds.ReadResearch()>0); this.setVisible(worlds.ReadResearch()>0 || worlds.isDebug());
break; break;
case cycle: case cycle:
this.setVisible(worlds.getWorld()>=1); this.setVisible(worlds.getWorld()>=1 || worlds.isDebug());
if (showmaximum) if (showmaximum)
this.setText(String.valueOf(worlds.getInformations().Cycle)+"/"+String.valueOf(worlds.getInformations().Maxcycle)); this.setText(String.valueOf(worlds.getInformations().Cycle)+"/"+String.valueOf(worlds.getInformations().Maxcycle));
else else
this.setText(String.valueOf(worlds.getInformations().Cycle)); this.setText(String.valueOf(worlds.getInformations().Cycle));
break; break;
case temp: case temp:
this.setVisible(worlds.getWorld()>=2); this.setVisible(worlds.getWorld()>=2 || worlds.isDebug());
if (showmaximum) if (showmaximum)
this.setText(String.valueOf(worlds.getInformations().Temp)+"/"+String.valueOf(worlds.getInformations().Maxtemp)); this.setText(String.valueOf(worlds.getInformations().Temp)+"/"+String.valueOf(worlds.getInformations().Maxtemp));
else else
this.setText(String.valueOf(worlds.getInformations().Temp)); this.setText(String.valueOf(worlds.getInformations().Temp));
break; break;
case rayon: case rayon:
this.setVisible(worlds.getWorld()>=3); this.setVisible(worlds.getWorld()>=3 || worlds.isDebug());
if (showmaximum) if (showmaximum)
this.setText(String.valueOf(worlds.getInformations().Rayon)+"/"+String.valueOf(worlds.getInformations().Maxrayon)); this.setText(String.valueOf(worlds.getInformations().Rayon)+"/"+String.valueOf(worlds.getInformations().Maxrayon));
else else
this.setText(String.valueOf(worlds.getInformations().Rayon)); this.setText(String.valueOf(worlds.getInformations().Rayon));
break; break;
case nrj: case nrj:
this.setVisible(worlds.getWorld()>=4); this.setVisible(worlds.getWorld()>=4 || worlds.isDebug());
if (showmaximum) if (showmaximum)
this.setText(String.valueOf(worlds.getInformations().Nrj)+"/"+String.valueOf(worlds.getInformations().Maxnrj)); this.setText(String.valueOf(worlds.getInformations().Nrj)+"/"+String.valueOf(worlds.getInformations().Maxnrj));
else else

View File

@ -59,25 +59,25 @@ public class Menu extends Actor {
this.selpage=0; this.selpage=0;
this.seltype=0; this.seltype=0;
Gdx.app.debug(getClass().getSimpleName(), "Création du Tiledmap et Maprenderer"); Gdx.app.debug("wirechem-Menu", "Création du Tiledmap et Maprenderer");
map = new TiledMap[3][Transmuter.Class.values().length]; map = new TiledMap[3][Transmuter.Class.values().length];
initialize(); 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("wirechem-Menu", "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);
decx = -102f; decx = -102f;
decy = -20f; decy = -20f;
if (AssetLoader.ratio == 1.44f) decy -= 24; if (AssetLoader.ratio == 1.44f) decy -= 24;
Gdx.app.debug(getClass().getSimpleName(), "Décalage:" + decx + "x"+ decy); Gdx.app.debug("wirechem-Menu", "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("wirechem-Menu", "Ajout des éléments de menu");
update(); update();
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer de rotation."); Gdx.app.debug("wirechem-Menu", "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();
rotation=0; rotation=0;
@ -90,7 +90,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("wirechem-Menu", "Ajout de l'évènements clicked");
this.addListener(new ClickListener() { this.addListener(new ClickListener() {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@ -111,14 +111,14 @@ public class Menu extends Actor {
if (selected_transmuter != null) { if (selected_transmuter != null) {
selected.setName("transmuter"); selected.setName("transmuter");
setSurtile((int) coords.x,(int) coords.y, selected_transmuter); setSurtile((int) coords.x,(int) coords.y, selected_transmuter);
Gdx.app.debug("menu", "Choix transmuter:"+ selected_transmuter.getName()); Gdx.app.debug("wirechem-Menu", "Choix transmuter:"+ selected_transmuter.getName());
} }
} }
else else
selected.setName(tile.get("name").toString()); selected.setName(tile.get("name").toString());
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("wirechem-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"));
@ -230,18 +230,18 @@ public class Menu extends Actor {
public void update() { public void update() {
clearall(); clearall();
if (worlds.getInformations().Cout>=0) if (worlds.getInformations().Cout>=0 || worlds.isDebug())
{ {
this.setMenuTile(0, 7, 71, "copper_pen",0); this.setMenuTile(0, 7, 71, "copper_pen",0);
this.setMenuTile(1, 7, 72, "copper_brush",0); this.setMenuTile(1, 7, 72, "copper_brush",0);
this.setMenuTile(2, 7, 73, "copper_eraser",0); this.setMenuTile(2, 7, 73, "copper_eraser",0);
this.setMenuTile(3, 3, 79, "cleaner",0); this.setMenuTile(3, 3, 79, "cleaner",0);
} }
if (worlds.getInformations().Tech>=0) if (worlds.getInformations().Tech>=0 || worlds.isDebug())
{ {
this.setMenuTile(0, 5, 77, "transmuter_eraser",0); this.setMenuTile(0, 5, 77, "transmuter_eraser",0);
} }
if (worlds.getInformations().Tech>=2) if (worlds.getInformations().Tech>=2 || worlds.isDebug())
{ {
this.setMenuTile(1, 5, 70, "blank",0); this.setMenuTile(1, 5, 70, "blank",0);
this.setMenuTile(0, 6, 74, "fiber_pen",0); this.setMenuTile(0, 6, 74, "fiber_pen",0);
@ -314,8 +314,7 @@ public class Menu extends Actor {
cell.setTile(AssetLoader.tileSet.getTile(tile)); cell.setTile(AssetLoader.tileSet.getTile(tile));
cell.getTile().getProperties().put("name", title); cell.getTile().getProperties().put("name", title);
cell.setRotation(0); cell.setRotation(0);
Gdx.app.debug(getClass().getSimpleName(), "Tile find:" + tile Gdx.app.debug("wirechem-Menu", "Tile find:" + tile + " coords" + x + "," + y);
+ " coords" + x + "," + y);
layer.getProperties().put("noempty", false); layer.getProperties().put("noempty", false);
} }
} }
@ -353,11 +352,9 @@ public class Menu extends Actor {
TiledMapTileLayer layer; TiledMapTileLayer layer;
if (transmuter != null) { if (transmuter != null) {
int type=transmuter.getaClass().ordinal(); int type=transmuter.getaClass().ordinal();
Gdx.app.debug(getClass().getSimpleName(), "Transmuter find:" Gdx.app.debug("wirechem-Menu", "Transmuter find:"+ transmuter.getName() + " Angle:" + Angle + " coords" + x + "," + y+" page:"+page+" type:"+type);
+ transmuter.getName() + " Angle:" + Angle + " coords"
+ x + "," + y+" page:"+page+" type:"+type);
if (transmuter.getTechnology()<=worlds.getInformations().Tech || worlds.isDebug()) { if (transmuter.getTechnology()<=worlds.getInformations().Tech || worlds.isDebug()) {
Gdx.app.debug(getClass().getSimpleName(), "Autorisé par le niveau"); Gdx.app.debug("wirechem-Menu", "Autorisé par le niveau");
if (!transmuter.isShowed() && transmuter.isUpgraded() && !worlds.isDebug()) if (!transmuter.isShowed() && transmuter.isUpgraded() && !worlds.isDebug())
layer = ((TiledMapTileLayer) map[page][type].getLayers().get(2)); layer = ((TiledMapTileLayer) map[page][type].getLayers().get(2));
else if (transmuter.isShowed() || worlds.isDebug()) else if (transmuter.isShowed() || worlds.isDebug())

View File

@ -9,6 +9,7 @@ import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.input.GestureDetector.GestureListener; import com.badlogic.gdx.input.GestureDetector.GestureListener;
import com.badlogic.gdx.maps.MapLayer;
import com.badlogic.gdx.maps.MapLayers; import com.badlogic.gdx.maps.MapLayers;
import com.badlogic.gdx.maps.tiled.TiledMap; import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
@ -47,24 +48,33 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
this.mapexit=false; this.mapexit=false;
map = new TiledMap(); map = new TiledMap();
map.getTileSets().addTileSet(AssetLoader.tileSet); map.getTileSets().addTileSet(AssetLoader.tileSet);
MapRenderer = new OrthogonalTiledMapRenderer(map, 1 / 128.0f);
this.setBounds(80, 0, AssetLoader.width, AssetLoader.height);
camera = new OrthographicCamera();
this.resize();
}
public void resize() {
MapLayers layers = map.getLayers(); MapLayers layers = map.getLayers();
int max=layers.getCount();
for(int i=0;i<max;i++)
if (layers.get(0)!=null)
layers.remove(0);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
TiledMapTileLayer layer = new TiledMapTileLayer(level.Grid.sizeX, TiledMapTileLayer layer = new TiledMapTileLayer(level.Grid.sizeX, level.Grid.sizeY, sizex, sizey);
level.Grid.sizeY, sizex, sizey);
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();
if (i == 0) if (i == 0)
cell.setTile(AssetLoader.tileSet.getTile(53)); cell.setTile(AssetLoader.tileSet.getTile(this.clearsprite));
layer.setCell(x, y, cell); layer.setCell(x, y, cell);
} }
} }
layers.add(layer); layers.add(layer);
} }
layers.get(3).setOpacity(0.9f); layers.get(3).setOpacity(0.9f);
MapRenderer = new OrthogonalTiledMapRenderer(map, 1 / 128.0f); this.redraw();
camera = new OrthographicCamera(); this.initzoom();
initzoom();
} }
boolean event_coordination(float x, float y, int button, calling call, boolean event_coordination(float x, float y, int button, calling call,
@ -77,9 +87,7 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
if (level.Grid.GetXY(coords.x, coords.y) != null) { if (level.Grid.GetXY(coords.x, coords.y) != null) {
mapexit = false; mapexit = false;
if (call != calling.mouseover) if (call != calling.mouseover)
Gdx.app.debug("evenement", "mode:" + call + " outil:" Gdx.app.debug("wirechem-Touchmaptiles", "mode:" + call + " outil:" + selected + " X: " + coords.x + " Y: " + coords.y + " button:" + button);
+ selected + " X: " + coords.x
+ " Y: " + coords.y + " button:" + button);
Method method; Method method;
try { try {
Class<?> base = Class.forName("fr.evolving.screens.GameScreen"); Class<?> base = Class.forName("fr.evolving.screens.GameScreen");
@ -116,14 +124,14 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
public Vector2 screentoworld(float x, float y) { public Vector2 screentoworld(float x, float y) {
x = (int) ((x / AssetLoader.width * camera.viewportWidth) + decx); x = (int) ((x / this.getWidth() * camera.viewportWidth) + decx);
y = (int) ((y / AssetLoader.height * camera.viewportHeight) + decy); y = (int) ((y / this.getHeight() * camera.viewportHeight) + decy);
return new Vector2(x, y); return new Vector2(x, y);
} }
public Vector2 screentoworldsize(float x, float y) { public Vector2 screentoworldsize(float x, float y) {
x = ((x / AssetLoader.width * camera.viewportWidth)); x = ((x / this.getWidth() * camera.viewportWidth));
y = ((y / AssetLoader.height * camera.viewportHeight)); y = ((y / this.getHeight() * camera.viewportHeight));
return new Vector2(x, y); return new Vector2(x, y);
} }
@ -154,12 +162,9 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
public void redraw() { public void redraw() {
for (int x = 0; x < level.Grid.sizeX; x++) for (int x = 0; x < level.Grid.sizeX; x++)
for (int y = 0; y < level.Grid.sizeY; y++) { for (int y = 0; y < level.Grid.sizeY; y++) {
((TiledMapTileLayer) map.getLayers().get(2)).getCell((int) x, ((TiledMapTileLayer) map.getLayers().get(2)).getCell((int) x,(int) y).setTile(null);
(int) y).setTile(null); ((TiledMapTileLayer) map.getLayers().get(1)).getCell((int) x,(int) y).setTile(null);
((TiledMapTileLayer) map.getLayers().get(1)).getCell((int) x, ((TiledMapTileLayer) map.getLayers().get(0)).getCell((int) x,(int) y).setTile(AssetLoader.tileSet.getTile(this.clearsprite));
(int) y).setTile(null);
((TiledMapTileLayer) map.getLayers().get(0)).getCell((int) x,
(int) y).setTile(AssetLoader.tileSet.getTile(this.clearsprite));
} }
for (int x = 0; x < level.Grid.sizeX; x++) for (int x = 0; x < level.Grid.sizeX; x++)
for (int y = 0; y < level.Grid.sizeY; y++) { for (int y = 0; y < level.Grid.sizeY; y++) {
@ -204,21 +209,20 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
} }
public void initzoom() { public void initzoom() {
if ((level.Grid.sizeX / (float) level.Grid.sizeY) > (AssetLoader.width / AssetLoader.height)) { if ((level.Grid.sizeX / (float) level.Grid.sizeY) > (this.getWidth() / this.getHeight())) {
viewwidth = level.Grid.sizeX; viewwidth = level.Grid.sizeX;
viewheight = level.Grid.sizeX viewheight = level.Grid.sizeX
/ ((float) AssetLoader.width / AssetLoader.height); / ((float) this.getWidth() / this.getHeight());
} else { } else {
viewheight = level.Grid.sizeY; viewheight = level.Grid.sizeY;
viewwidth = level.Grid.sizeY viewwidth = level.Grid.sizeY
* ((float) AssetLoader.width / AssetLoader.height); * ((float) this.getWidth() / this.getHeight());
} }
Gdx.app.debug(getClass().getSimpleName(), "Caméra pour tilemap:" Gdx.app.debug("wirechem-Touchmaptiles", "Caméra pour tilemap:" + viewwidth + "x" + viewheight);
+ viewwidth + "x" + viewheight);
camera.setToOrtho(false, viewwidth, viewheight); camera.setToOrtho(false, viewwidth, viewheight);
decx = (level.Grid.sizeX - viewwidth) / 2.0f; decx = (level.Grid.sizeX - viewwidth) / 2.0f;
decy = (level.Grid.sizeY - viewheight) / 2.0f; decy = (level.Grid.sizeY - viewheight) / 2.0f;
Gdx.app.debug(getClass().getSimpleName(), "Décalage:" + decx + "x" + decy); Gdx.app.debug("wirechem-Touchmaptiles", "Décalage:" + decx + "x" + decy);
camera.translate(decx, decy); camera.translate(decx, decy);
} }
@ -237,9 +241,7 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
viewheight *= factor; viewheight *= factor;
camera.setToOrtho(false, viewwidth, viewheight); camera.setToOrtho(false, viewwidth, viewheight);
camera.translate(decx, decy); camera.translate(decx, decy);
Gdx.app.debug(getClass().getSimpleName(), "Caméra pour tilemap:" Gdx.app.debug("wirechem-Touchmaptiles", "Caméra pour tilemap:" + camera.viewportWidth + "x" + camera.viewportHeight + " zoom:" + factor);
+ camera.viewportWidth + "x" + camera.viewportHeight + " zoom:"
+ factor);
} }
public float getDecx() { public float getDecx() {
@ -256,8 +258,7 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
decy = decy - dec.y; decy = decy - dec.y;
camera.setToOrtho(false, viewwidth, viewheight); camera.setToOrtho(false, viewwidth, viewheight);
camera.translate(decx, decy); camera.translate(decx, decy);
Gdx.app.debug(getClass().getSimpleName(), "Decalage:" + dec.x + "x" Gdx.app.debug("wirechem-Touchmaptiles", "Decalage:" + dec.x + "x" + dec.y + " newxy:" + decx + "x" + decy);
+ dec.y + " newxy:" + decx + "x" + decy);
return; return;
} }

View File

@ -32,7 +32,7 @@ public class VertiBarre extends Actor {
table.space(10f); table.space(10f);
buttonGroup=new ButtonGroup<ImageTextButton>(); buttonGroup=new ButtonGroup<ImageTextButton>();
Barre = new ImageTextButton[Transmuter.Class.values().length]; Barre = new ImageTextButton[Transmuter.Class.values().length];
Gdx.app.debug(getClass().getSimpleName(), "Menu:" + Barre.length+ " elements"); Gdx.app.debug("wirechem-VertiBarre", "Menu:" + Barre.length+ " elements");
for (int i = 0; i < Barre.length; i++) for (int i = 0; i < Barre.length; i++)
{ {
if ((Transmuter.Class.values()[i]!=Transmuter.Class.Scenario && (worlds.getInformations().Tech>=0 || Transmuter.Class.values()[i]==Transmuter.Class.Structure)) || worlds.isDebug()) if ((Transmuter.Class.values()[i]!=Transmuter.Class.Scenario && (worlds.getInformations().Tech>=0 || Transmuter.Class.values()[i]==Transmuter.Class.Structure)) || worlds.isDebug())
@ -45,7 +45,7 @@ public class VertiBarre extends Actor {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
int caller = Integer.parseInt(event.getListenerActor().getName()); int caller = Integer.parseInt(event.getListenerActor().getName());
Gdx.app.debug("Barre2", "Selection dans la Barre droite:"+ caller); Gdx.app.debug("wirechem-VertiBarre", "Selection dans la Barre droite:"+ caller);
Method method; Method method;
try { try {
Class<?> base = Class.forName("fr.evolving.screens.GameScreen"); Class<?> base = Class.forName("fr.evolving.screens.GameScreen");

View File

@ -85,10 +85,9 @@ public class AssetLoader {
params.minFilter = quality; params.minFilter = quality;
params.magFilter = quality; params.magFilter = quality;
params.genMipMaps = (quality == TextureFilter.MipMap); params.genMipMaps = (quality == TextureFilter.MipMap);
Gdx.app.debug("AssetLoader", "Initialisation du asset manager"); Gdx.app.debug("wirechem-AssetLoader", "Initialisation du asset manager");
manager = new AssetManager(); manager = new AssetManager();
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader", "Initialisation du chargement des éléments multimédia");
"Initialisation du chargement des éléments multimédia");
manager.load("textures/level.pack", TextureAtlas.class); manager.load("textures/level.pack", TextureAtlas.class);
manager.load("textures/ui.pack", TextureAtlas.class); manager.load("textures/ui.pack", TextureAtlas.class);
manager.load("pictures/fond.png", Texture.class, params); manager.load("pictures/fond.png", Texture.class, params);
@ -101,9 +100,9 @@ public class AssetLoader {
} }
public static void finishall() { public static void finishall() {
Gdx.app.debug("AssetLoader", "Attente fin chargement..."); Gdx.app.debug("wirechem-AssetLoader", "Attente fin chargement...");
manager.finishLoading(); manager.finishLoading();
Gdx.app.debug("AssetLoader", "Affectation des éléments multimédia"); Gdx.app.debug("wirechem-AssetLoader", "Affectation des éléments multimédia");
Atlas_level = manager.get("textures/level.pack"); Atlas_level = manager.get("textures/level.pack");
intro = manager.get("musics/intro.mp3"); intro = manager.get("musics/intro.mp3");
Texture_fond = manager.get("pictures/fond.png"); Texture_fond = manager.get("pictures/fond.png");
@ -114,7 +113,7 @@ public class AssetLoader {
Texture_fond2.setFilter(quality, quality); Texture_fond2.setFilter(quality, quality);
Skin_level = manager.get("textures/level.json"); Skin_level = manager.get("textures/level.json");
Skin_ui = manager.get("textures/ui.json"); Skin_ui = manager.get("textures/ui.json");
Gdx.app.debug("AssetLoader", "Definition des constantes"); Gdx.app.debug("wirechem-AssetLoader", "Definition des constantes");
Levelcolors = new Color[5]; Levelcolors = new Color[5];
Levelcolors = new Color[] { AssetLoader.Skin_level.getColor("world0"), Levelcolors = new Color[] { AssetLoader.Skin_level.getColor("world0"),
AssetLoader.Skin_level.getColor("world1"), AssetLoader.Skin_level.getColor("world1"),
@ -133,10 +132,10 @@ public class AssetLoader {
Typenames = new String[13]; Typenames = new String[13];
Typenames = new String[] { "E-", "e-", "Ph", "e0", "E0", "e+", "E+", Typenames = new String[] { "E-", "e-", "Ph", "e0", "E0", "e+", "E+",
"K", "L", "M", "N", "n", "p" }; "K", "L", "M", "N", "n", "p" };
Gdx.app.debug("AssetLoader", "Création des tiles..."); Gdx.app.debug("wirechem-AssetLoader", "Création des tiles...");
tileSet = new TiledMapTileSet(); tileSet = new TiledMapTileSet();
Array<TextureAtlas.AtlasRegion> allregions = Atlas_level.getRegions(); Array<TextureAtlas.AtlasRegion> allregions = Atlas_level.getRegions();
Gdx.app.debug("AssetLoader", allregions.size + " régions disponibles"); Gdx.app.debug("wirechem-AssetLoader", allregions.size + " régions disponibles");
for (int i = 0; i < allregions.size; i++) { for (int i = 0; i < allregions.size; i++) {
allregions.get(i).getTexture().setFilter(quality, quality); allregions.get(i).getTexture().setFilter(quality, quality);
if (allregions.get(i).name.startsWith("sprite")) { if (allregions.get(i).name.startsWith("sprite")) {
@ -146,7 +145,7 @@ public class AssetLoader {
if (name[0].contains("sprite")) { if (name[0].contains("sprite")) {
int id = Integer.parseInt(name[1].split("#")[0]); int id = Integer.parseInt(name[1].split("#")[0]);
if (tileSet.getTile(1000 + id) == null) { if (tileSet.getTile(1000 + id) == null) {
Gdx.app.debug("AssetLoader", "Animated Tiles N°:" Gdx.app.debug("wirechem-AssetLoader", "Animated Tiles N°:"
+ String.valueOf(id + 1000)); + String.valueOf(id + 1000));
int maxid = 0; int maxid = 0;
for (int j = 1; Atlas_level.findRegion("sprite-" for (int j = 1; Atlas_level.findRegion("sprite-"
@ -163,8 +162,7 @@ public class AssetLoader {
+ id + "#" + j)))); + id + "#" + j))));
AnimatedTiledMapTile atile = new AnimatedTiledMapTile( AnimatedTiledMapTile atile = new AnimatedTiledMapTile(
0.15f, frameTiles); 0.15f, frameTiles);
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader","Taille:" + String.valueOf(frameTiles.size));
"Taille:" + String.valueOf(frameTiles.size));
atile.setId(1000 + id); atile.setId(1000 + id);
atile.getProperties().put("type", type[1]); atile.getProperties().put("type", type[1]);
tileSet.putTile(1000 + id, atile); tileSet.putTile(1000 + id, atile);
@ -178,15 +176,12 @@ public class AssetLoader {
atile.setId(allregions.get(i).index); atile.setId(allregions.get(i).index);
atile.getProperties().put("type", type[1]); atile.getProperties().put("type", type[1]);
tileSet.putTile(allregions.get(i).index, atile); tileSet.putTile(allregions.get(i).index, atile);
Gdx.app.debug( Gdx.app.debug("wirechem-AssetLoader","Type:" + type[1] + " Tiles N°:" + String.valueOf(allregions.get(i).index));
"AssetLoader",
"Type:" + type[1] + " Tiles N°:"
+ String.valueOf(allregions.get(i).index));
} }
} }
} }
Gdx.app.debug("AssetLoader", "Ajout des transmuters"); Gdx.app.debug("wirechem-AssetLoader", "Ajout des transmuters");
allTransmuter = new Array<Transmuter>(); allTransmuter = new Array<Transmuter>();
allTransmuter.add(new Positiver(null)); allTransmuter.add(new Positiver(null));
allTransmuter.add(new Positiver_I(null)); allTransmuter.add(new Positiver_I(null));
@ -209,18 +204,14 @@ public class AssetLoader {
Values<Integer> allTiles = transmuter.getTilesid().iterator(); Values<Integer> allTiles = transmuter.getTilesid().iterator();
while (allTiles.hasNext()) { while (allTiles.hasNext()) {
Integer atile = allTiles.next(); Integer atile = allTiles.next();
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader","Ajustement données Tiles N°:" + String.valueOf(atile) + " Nom:" + transmuter.getName());
"Ajustement données Tiles N°:" + String.valueOf(atile) AssetLoader.tileSet.getTile(atile).getProperties().put("transmuter", transmuter);
+ " Nom:" + transmuter.getName()); AssetLoader.tileSet.getTile(atile).getProperties().put("name", transmuter.getName());
AssetLoader.tileSet.getTile(atile).getProperties()
.put("transmuter", transmuter);
AssetLoader.tileSet.getTile(atile).getProperties()
.put("name", transmuter.getName());
} }
} }
Gdx.app.debug("AssetLoader", "Ajout de la gestion des tooltips"); Gdx.app.debug("wirechem-AssetLoader", "Ajout de la gestion des tooltips");
Tooltipmanager = new TooltipManager(); Tooltipmanager = new TooltipManager();
Gdx.app.debug("AssetLoader", "Mise en place de la base de donnée"); Gdx.app.debug("wirechem-AssetLoader", "Mise en place de la base de donnée");
Datahandler = new DatabaseManager(); Datahandler = new DatabaseManager();
Datahandler.RegisterBackend(LocalBase.class); Datahandler.RegisterBackend(LocalBase.class);
Datahandler.RegisterBackend(SqlBase.class); Datahandler.RegisterBackend(SqlBase.class);
@ -231,19 +222,19 @@ public class AssetLoader {
Datahandler.CloseAll(); Datahandler.CloseAll();
if (Datahandler.Attach(datatype.userdata, if (Datahandler.Attach(datatype.userdata,
Preference.prefs.getString("userdata"))) Preference.prefs.getString("userdata")))
Gdx.app.debug("AssetLoader", "Base user ok"); Gdx.app.debug("wirechem-AssetLoader", "Base user ok");
else else
Gdx.app.debug("AssetLoader", "Base user erreur"); Gdx.app.debug("wirechem-AssetLoader", "Base user erreur");
if (Datahandler.Attach(datatype.statdata, if (Datahandler.Attach(datatype.statdata,
Preference.prefs.getString("statdata"))) Preference.prefs.getString("statdata")))
Gdx.app.debug("AssetLoader", "Base stat ok"); Gdx.app.debug("wirechem-AssetLoader", "Base stat ok");
else else
Gdx.app.debug("AssetLoader", "Base stat erreur"); Gdx.app.debug("wirechem-AssetLoader", "Base stat erreur");
if (Datahandler.Attach(datatype.gamedata, if (Datahandler.Attach(datatype.gamedata,
Preference.prefs.getString("gamedata"))) Preference.prefs.getString("gamedata")))
Gdx.app.debug("AssetLoader", "Base jeu ok"); Gdx.app.debug("wirechem-AssetLoader", "Base jeu ok");
else else
Gdx.app.debug("AssetLoader", "Base jeu erreur"); Gdx.app.debug("wirechem-AssetLoader", "Base jeu erreur");
} }
public static Transmuter getTransmuter(String Name) { public static Transmuter getTransmuter(String Name) {
@ -255,12 +246,12 @@ public class AssetLoader {
} }
public static void init() { public static void init() {
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader",
"Initialisation de la résolution virtuelle..."); "Initialisation de la résolution virtuelle...");
int realWidth = Gdx.graphics.getWidth(); int realWidth = Gdx.graphics.getWidth();
int realHeight = Gdx.graphics.getHeight(); int realHeight = Gdx.graphics.getHeight();
float realRatio = realWidth / (float) realHeight; float realRatio = realWidth / (float) realHeight;
Gdx.app.debug("AssetLoader", "Résolution de " + realWidth + "x" Gdx.app.debug("wirechem-AssetLoader", "Résolution de " + realWidth + "x"
+ realHeight + " ratio de " + String.format("%.2f", realRatio) + realHeight + " ratio de " + String.format("%.2f", realRatio)
+ "."); + ".");
ratio = 1; ratio = 1;
@ -268,29 +259,29 @@ public class AssetLoader {
height = 1080; height = 1080;
if (Math.abs(16f / 9f - realRatio) > Math.abs(4f / 3f - realRatio)) { if (Math.abs(16f / 9f - realRatio) > Math.abs(4f / 3f - realRatio)) {
ratio = 1.44f; ratio = 1.44f;
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader",
"Ratio 4/3, résolution virtuelle : 1920x1440."); "Ratio 4/3, résolution virtuelle : 1920x1440.");
height = 1440; height = 1440;
} else } else
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader",
"Ratio 16/9, résolution virtuelle : 1920x1080."); "Ratio 16/9, résolution virtuelle : 1920x1080.");
Camera = new OrthographicCamera(width, height); Camera = new OrthographicCamera(width, height);
Camera.position.set(width / 2, height / 2, 0); Camera.position.set(width / 2, height / 2, 0);
Camera.update(); Camera.update();
if (Preference.prefs.getInteger("Adaptation") == 1) { if (Preference.prefs.getInteger("Adaptation") == 1) {
viewport = new StretchViewport(width, height); viewport = new StretchViewport(width, height);
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader",
"Adaptation d'écran maximale, 'Aspect-Ratio' non conservé."); "Adaptation d'écran maximale, 'Aspect-Ratio' non conservé.");
} else { } else {
viewport = new FitViewport(width, height); viewport = new FitViewport(width, height);
Gdx.app.debug("AssetLoader", Gdx.app.debug("wirechem-AssetLoader",
"Adaptation d'écran totale, 'Aspect-Ratio' conservé."); "Adaptation d'écran totale, 'Aspect-Ratio' conservé.");
} }
viewport.apply(); viewport.apply();
} }
public static void load() { public static void load() {
Gdx.app.debug("AssetLoader", "Ajout de la gestion des locales"); Gdx.app.debug("wirechem-AssetLoader", "Ajout de la gestion des locales");
FileHandle baseFileHandle = Gdx.files.internal("i18n/messages/messages"); FileHandle baseFileHandle = Gdx.files.internal("i18n/messages/messages");
usa = I18NBundle.createBundle(baseFileHandle, new Locale("en")); usa = I18NBundle.createBundle(baseFileHandle, new Locale("en"));
french = I18NBundle.createBundle(baseFileHandle, new Locale("fr")); french = I18NBundle.createBundle(baseFileHandle, new Locale("fr"));
@ -300,9 +291,9 @@ public class AssetLoader {
language = usa; language = usa;
I18NBundle.setExceptionOnMissingKey(true); I18NBundle.setExceptionOnMissingKey(true);
Gdx.app.debug("AssetLoader", "Réglage de la qualité des textures"); Gdx.app.debug("wirechem-AssetLoader", "Réglage de la qualité des textures");
quality = GameScreen.quality.values()[Preference.prefs.getInteger("Quality")].getQuality(); quality = GameScreen.quality.values()[Preference.prefs.getInteger("Quality")].getQuality();
Gdx.app.debug("AssetLoader", "Chargements des éléments minimalistes"); Gdx.app.debug("wirechem-AssetLoader", "Chargements des éléments minimalistes");
Texture_logo = new Texture(Gdx.files.internal("pictures/logo.png"), Texture_logo = new Texture(Gdx.files.internal("pictures/logo.png"),
quality == TextureFilter.MipMap); quality == TextureFilter.MipMap);
Texture_logo.setFilter(quality, quality); Texture_logo.setFilter(quality, quality);

View File

@ -34,9 +34,7 @@ public class Preference {
public static void defaults() { public static void defaults() {
Vector2 maxres = getmaxresolution(); Vector2 maxres = getmaxresolution();
Gdx.app.log("Preferences", Gdx.app.log("Preferences","Preference par defaut avec resolution native :" + maxres.x + "x" + maxres.y);
"Preference par defaut avec resolution native :" + maxres.x
+ "x" + maxres.y);
Preference.prefs.putString("userdata", "local:test.db"); Preference.prefs.putString("userdata", "local:test.db");
Preference.prefs.putString("gamedata", "local:test.db"); Preference.prefs.putString("gamedata", "local:test.db");
Preference.prefs.putString("statdata", "local:test.db"); Preference.prefs.putString("statdata", "local:test.db");

View File

@ -50,8 +50,7 @@ public class Grid implements Serializable,Cloneable {
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 (GetXY(x, y).Transmuter_calc > 0) if (GetXY(x, y).Transmuter_calc > 0)
Gdx.app.debug("info", x + "," + y + ">" Gdx.app.debug("wirechem-Grid", x + "," + y + ">"+ GetXY(x, y).Transmuter_calc);
+ GetXY(x, y).Transmuter_calc);
} }
return result; return result;
} }
@ -277,5 +276,16 @@ public class Grid implements Serializable,Cloneable {
result.Cells[x][y] = (Cell)this.Cells[x][y].clone(); result.Cells[x][y] = (Cell)this.Cells[x][y].clone();
return result; return result;
} }
public Object clone(int newsizex,int newsizey) {
if (newsizex<3) newsizex=3;
if (newsizey<3) newsizey=3;
Grid result = new Grid(newsizex,newsizey);
for (int x = 0; x < newsizex; x++)
for (int y = 0; y < newsizey; y++)
if (x<this.sizeX && y<this.sizeY)
result.Cells[x][y] = (Cell)this.Cells[x][y].clone();
return result;
}
} }

View File

@ -34,7 +34,7 @@ public class Worlds extends Actor {
research=-2; 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("wirechem-Worlds","Pilotes de bases de donnée défaillant.");
state=State.databasefailed; state=State.databasefailed;
} }
else else
@ -155,27 +155,31 @@ public class Worlds extends Actor {
} }
public void prepareLevel(boolean force) { public void prepareLevel(boolean force) {
Gdx.app.debug(getClass().getSimpleName(),"Récupération des conditions initiales."); Gdx.app.debug("wirechem-Worlds","Récupération des conditions initiales.");
usedlevel.Cout=usedlevel.Cout_orig; usedlevel.Cout=usedlevel.Cout_orig;
usedlevel.Cycle=usedlevel.Cycle_orig; usedlevel.Cycle=usedlevel.Cycle_orig;
usedlevel.Temp=usedlevel.Temp_orig; usedlevel.Temp=usedlevel.Temp_orig;
usedlevel.Rayon=usedlevel.Rayon_orig; usedlevel.Rayon=usedlevel.Rayon_orig;
usedlevel.Nrj=usedlevel.Nrj_orig; usedlevel.Nrj=usedlevel.Nrj_orig;
usedlevel.Victory=usedlevel.Victory_orig.clone(); usedlevel.Victory=usedlevel.Victory_orig.clone();
Gdx.app.debug(getClass().getSimpleName(),"Récupération des derniers niveaux."); Gdx.app.debug("wirechem-Worlds","Récupération des derniers niveaux.");
ReadLastGrid(); ReadLastGrid();
if (usedlevel.Grid == null || force) { if (usedlevel.Grid == null || force) {
Gdx.app.debug(getClass().getSimpleName(), "Copie monde original."); Gdx.app.debug("wirechem-Worlds", "Copie monde original.");
usedlevel.Grid = (Grid)usedlevel.Grid_orig.clone(); usedlevel.Grid = (Grid)usedlevel.Grid_orig.clone();
} else { } else {
Gdx.app.debug(getClass().getSimpleName(),"Récupération de la dernière grille."); Gdx.app.debug("wirechem-Worlds","Récupération de la dernière grille.");
ReadLastGrid(); ReadLastGrid();
} }
usedlevel.Grid.tiling_copper(); usedlevel.Grid.tiling_copper();
usedlevel.Grid.tiling_transmuter(); usedlevel.Grid.tiling_transmuter();
} }
public void origLevel() {
usedlevel.Grid_orig = (Grid)usedlevel.Grid.clone();
}
public void setLevel(int alevel) { public void setLevel(int alevel) {
if (state!=State.notloaded) if (state!=State.notloaded)
if (usedworld>=0) { if (usedworld>=0) {
@ -262,14 +266,14 @@ public class Worlds extends Actor {
} }
public void set(String campaign) { public void set(String campaign) {
Gdx.app.log("*****", "Définition de la compagne "+campaign); Gdx.app.log("wirechem-Worlds", "***** Définition de la compagne "+campaign);
Preference.prefs.putString("world", campaign); Preference.prefs.putString("world", campaign);
Preference.prefs.flush(); Preference.prefs.flush();
load(campaign); load(campaign);
} }
public void load(String campaign) { public void load(String campaign) {
Gdx.app.log("*****", "Chargement de la compagne "+campaign); Gdx.app.log("wirechem-Worlds", "***** Chargement de la compagne "+campaign);
levels=AssetLoader.Datahandler.game().getCampaign(campaign); levels=AssetLoader.Datahandler.game().getCampaign(campaign);
updateUnlockLevels(); updateUnlockLevels();
name=campaign; name=campaign;
@ -280,7 +284,7 @@ public class Worlds extends Actor {
} }
public void create(String campaign) { public void create(String campaign) {
Gdx.app.log("*****", "initialisation de la compagne "+campaign); Gdx.app.log("wirechem-Worlds", "***** initialisation de la compagne "+campaign);
try { try {
levels=InitWorlds.go(); levels=InitWorlds.go();
Preference.prefs.putString("world",campaign); Preference.prefs.putString("world",campaign);
@ -299,7 +303,7 @@ public class Worlds extends Actor {
} }
public void save(String campaign) { public void save(String campaign) {
Gdx.app.log("*****", "enregistrement de la compagne "+campaign); Gdx.app.log("wirechem-Worlds", "***** enregistrement de la compagne "+campaign);
AssetLoader.Datahandler.game().setCampaign(levels,campaign); AssetLoader.Datahandler.game().setCampaign(levels,campaign);
} }

View File

@ -44,29 +44,29 @@ public class LocalBase extends Base {
try { try {
FileHandle newbase = Gdx.files.absolute("/data/data/fr.evolving.game.android/databases/"+ databasename); FileHandle newbase = Gdx.files.absolute("/data/data/fr.evolving.game.android/databases/"+ databasename);
if (!newbase.exists()) { if (!newbase.exists()) {
Gdx.app.log("Base", "Copie de la base de donnee android"); Gdx.app.log("wirechem-LocalBase", "***** Copie de la base de donnee android");
Gdx.files.internal("bases/" + databasename).copyTo(newbase); Gdx.files.internal("bases/" + databasename).copyTo(newbase);
} }
} catch (Exception e1) { } catch (Exception e1) {
Gdx.app.error("Base", "Erreur de copie"); Gdx.app.error("wirechem-LocalBase", "Erreur de copie");
} }
break; break;
case Desktop: case Desktop:
Gdx.app.log("Base", "Copie de la base de donnee desktop"); Gdx.app.log("wirechem-LocalBase", "***** Copie de la base de donnee desktop");
FileHandle newbase = Gdx.files.local(databasename); FileHandle newbase = Gdx.files.local(databasename);
try { try {
if (!newbase.exists()) if (!newbase.exists())
Gdx.files.internal("bases/" + databasename).copyTo(newbase); Gdx.files.internal("bases/" + databasename).copyTo(newbase);
} catch (Exception e1) { } catch (Exception e1) {
Gdx.app.error("Base", "Erreur de copie"); Gdx.app.error("wirechem-LocalBase", "Erreur de copie");
} }
break; break;
} }
if (dbHandler != null) if (dbHandler != null)
Gdx.app.log("Local", "Reprise de la base '" + databasename Gdx.app.log("wirechem-LocalBase", "Reprise de la base '" + databasename
+ "', table:" + model.toString()); + "', table:" + model.toString());
else { else {
Gdx.app.log("Local", "Utilisation de la base '" + databasename Gdx.app.log("wirechem-LocalBase", "Utilisation de la base '" + databasename
+ "', table:" + model.toString()); + "', table:" + model.toString());
dbHandler = DatabaseFactory.getNewDatabase(databasename, 1, null, dbHandler = DatabaseFactory.getNewDatabase(databasename, 1, null,
null); null);
@ -76,7 +76,7 @@ public class LocalBase extends Base {
dbHandler.openOrCreateDatabase(); dbHandler.openOrCreateDatabase();
} catch (SQLiteGdxException e) { } catch (SQLiteGdxException e) {
e.printStackTrace(); e.printStackTrace();
Gdx.app.log("Local", "Erreur à l'ouverture de la base"); Gdx.app.log("wirechem-LocalBase", "Erreur à l'ouverture de la base");
} }
} }
try { try {

View File

@ -12,8 +12,7 @@ public class main extends Game {
@Override @Override
public void create() { public void create() {
Preference.init(); Preference.init();
Gdx.app.debug(getClass().getSimpleName(), Gdx.app.debug("wirechem-main","Récupération de la résolution des préférences.");
"Récupération de la résolution des préférences.");
if (Preference.prefs.getInteger("ResolutionX") > 0 if (Preference.prefs.getInteger("ResolutionX") > 0
&& Preference.prefs.getInteger("ResolutionY") > 0) { && Preference.prefs.getInteger("ResolutionY") > 0) {
try { try {
@ -25,18 +24,15 @@ public class main extends Game {
Fullscreen); Fullscreen);
Gdx.graphics.setVSync(VSync); Gdx.graphics.setVSync(VSync);
} catch (ClassCastException e) { } catch (ClassCastException e) {
Gdx.app.error("****", Gdx.app.error("wirechem-main","***** Impossible d'appliquer les préférences graphiques");
"Impossible d'appliquer les préférences graphiques"); Gdx.app.debug("wirechem-main", e.getMessage());
Gdx.app.debug(getClass().getSimpleName(), e.getMessage());
} finally { } finally {
Gdx.app.log("****", Gdx.app.log("wirechem-main","***** Changement de résolution selon préférences graphiques");
"Changement de résolution selon préférences graphiques");
} }
} else } else
Gdx.app.debug(getClass().getSimpleName(), "...Aucune préférence !"); Gdx.app.debug("wirechem-main", "...Aucune préférence !");
AssetLoader.init(); AssetLoader.init();
Gdx.app.debug(getClass().getSimpleName(), Gdx.app.debug("wirechem-main", "Creation de l'objet SplashScreen.");
"Creation de l'objet SplashScreen.");
setScreen(new SplashScreen(this)); setScreen(new SplashScreen(this));
} }

View File

@ -33,7 +33,7 @@ public class GameRenderer {
} else if (layer == 1) { } else if (layer == 1) {
batcher.begin(); batcher.begin();
batcher.setColor(0.25f, 0.25f, 0.25f, 1f); batcher.setColor(0.25f, 0.25f, 0.25f, 1f);
if (GameScreen.worlds.getInformations().Cout>0 || GameScreen.worlds.getInformations().Tech>=1 ) { if (GameScreen.worlds.getInformations().Cout>0 || GameScreen.worlds.getInformations().Tech>=1 || GameScreen.worlds.isDebug()) {
batcher.draw(AssetLoader.Atlas_level.findRegion("barrehaut"), 0.0f, AssetLoader.height - 198.0f, 1920.0f, 200.0f); batcher.draw(AssetLoader.Atlas_level.findRegion("barrehaut"), 0.0f, AssetLoader.height - 198.0f, 1920.0f, 200.0f);
batcher.draw(AssetLoader.Atlas_level.findRegion("barrecentre"), 1480f, AssetLoader.height - 785.0f, 590f, 530.0f); batcher.draw(AssetLoader.Atlas_level.findRegion("barrecentre"), 1480f, AssetLoader.height - 785.0f, 590f, 530.0f);
} }

View File

@ -65,6 +65,7 @@ import fr.evolving.UI.WarnDialog;
import fr.evolving.UI.IconValue.Icon; import fr.evolving.UI.IconValue.Icon;
import fr.evolving.assets.AssetLoader; import fr.evolving.assets.AssetLoader;
import fr.evolving.assets.Preference; import fr.evolving.assets.Preference;
import fr.evolving.automata.Grid;
import fr.evolving.automata.Level; import fr.evolving.automata.Level;
import fr.evolving.automata.Neutraliser_II; import fr.evolving.automata.Neutraliser_II;
import fr.evolving.automata.Transmuter; import fr.evolving.automata.Transmuter;
@ -201,24 +202,24 @@ public class GameScreen implements Screen {
// This is the constructor, not the class declaration // This is the constructor, not the class declaration
public GameScreen(Worlds aworlds) { public GameScreen(Worlds aworlds) {
Gdx.app.debug(getClass().getSimpleName(),"Préparation du screen"); Gdx.app.debug("wirechem-GameScreen","Préparation du screen");
this.worlds = aworlds; this.worlds = aworlds;
this.worlds.prepareLevel(false); this.worlds.prepareLevel(false);
this.level=worlds.getInformations(); this.level=worlds.getInformations();
if (worlds.isDebug()) if (worlds.isDebug())
tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "infos#", "separator", "raz", "save", "levels", "tree", "exits", "separator", "screen", "sound", "tuto", "grid", "settings", "separator", "stat","separator","unlocked" }; tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "infos#", "separator", "raz", "save", "levels", "tree", "exits", "separator", "screen", "sound", "tuto", "grid", "settings", "separator", "stat","separator","unlocked","delrow","delcol","addrow","addcol","database" };
else if (level.Tech<1) else if (level.Tech<1)
tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "separator", "levels", "exits", "separator", "screen", "sound", "settings" }; tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "separator", "levels", "exits", "separator", "screen", "sound", "settings" };
else if (level.aWorld<1) else if (level.aWorld<1)
tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "infos#", "separator", "raz", "save", "levels", "exits", "separator", "screen", "sound", "grid", "settings" }; tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "infos#", "separator", "raz", "save", "levels", "exits", "separator", "screen", "sound", "grid", "settings" };
else else
tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "infos#", "separator", "raz", "save", "levels", "tree", "exits", "separator", "screen", "sound", "tuto", "grid", "settings", "separator", "stat" }; tocreate = new String[] { "run", "stop", "speed", "separator", "move#", "zoomp#","zoomm#", "infos#", "separator", "raz", "save", "levels", "tree", "exits", "separator", "screen", "sound", "tuto", "grid", "settings", "separator", "stat" };
Gdx.app.debug(getClass().getSimpleName(),"Création des Barres verticales & horizontales."); Gdx.app.debug("wirechem-GameScreen","Création des Barres verticales & horizontales.");
horizbar=new HorizBarre(tocreate,"preparebarre"); horizbar=new HorizBarre(tocreate,"preparebarre");
horizbar.addListener(new ChangeListener() { horizbar.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
Gdx.app.debug("Barre", "Element changé"); Gdx.app.debug("wirechem-GameScreen", "Barre | Element changé");
hideInfo(); hideInfo();
map.tempclear(); map.tempclear();
menu.unSelect(); menu.unSelect();
@ -226,7 +227,7 @@ public class GameScreen implements Screen {
} }
}); });
vertibar=new VertiBarre(worlds); vertibar=new VertiBarre(worlds);
Gdx.app.debug(getClass().getSimpleName(),"Création des elements primordiaux du screen (stage, renderer, table, level, world)"); Gdx.app.debug("wirechem-GameScreen","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);
multiplexer = new InputMultiplexer(); multiplexer = new InputMultiplexer();
@ -238,10 +239,10 @@ public class GameScreen implements Screen {
oldy = 0; oldy = 0;
unroll = false; unroll = false;
Renderer = new GameRenderer(this); Renderer = new GameRenderer(this);
Gdx.app.debug(getClass().getSimpleName(), "Création des barres"); Gdx.app.debug("wirechem-GameScreen", "Création des barres");
tooltip = new TextArea("tooltip:x\r\n tooltip:y",AssetLoader.Skin_level, "info_tooltip"); tooltip = new TextArea("tooltip:x\r\n tooltip:y",AssetLoader.Skin_level, "info_tooltip");
tooltip.setBounds(541, 27, 100, 50); tooltip.setBounds(541, 27, 100, 50);
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du haut"); Gdx.app.debug("wirechem-GameScreen","Création de la barre de gestion du haut");
cycle = new IconValue(Icon.cycle,worlds, AssetLoader.Skin_level); cycle = new IconValue(Icon.cycle,worlds, AssetLoader.Skin_level);
cycle.setPosition(10, AssetLoader.height - 74); cycle.setPosition(10, AssetLoader.height - 74);
temp = new IconValue(Icon.temp,worlds, AssetLoader.Skin_level); temp = new IconValue(Icon.temp,worlds, AssetLoader.Skin_level);
@ -266,13 +267,12 @@ public class GameScreen implements Screen {
buttonlevel.addListener(new ClickListener() { buttonlevel.addListener(new ClickListener() {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
Gdx.app.debug(getClass().getSimpleName(),"Remise à zéro du monde"); Gdx.app.debug("wirechem-GameScreen","Remise à zéro du monde");
worlds.prepareLevel(true); worlds.prepareLevel(true);
prepare(); prepare();
} }
}); });
Gdx.app.debug(getClass().getSimpleName(), Gdx.app.debug("wirechem-GameScreen","Création de la barre d'information");
"Création de la barre d'information");
info_tech = new ImageTextButton("0", AssetLoader.Skin_level,"info_tech"); info_tech = new ImageTextButton("0", AssetLoader.Skin_level,"info_tech");
info_tech.setSize(48, 48); info_tech.setSize(48, 48);
info_tech.setPosition(1200, AssetLoader.height - 775); info_tech.setPosition(1200, AssetLoader.height - 775);
@ -324,16 +324,15 @@ public class GameScreen implements Screen {
} }
}); });
dialog = new WarnDialog(AssetLoader.Skin_ui); dialog = new WarnDialog(AssetLoader.Skin_ui);
Gdx.app.debug(getClass().getSimpleName(), "Création d'une tilemap"); Gdx.app.debug("wirechem-GameScreen", "Création d'une tilemap");
map = new TouchMaptiles(level, 128, 128); map = new TouchMaptiles(level, 128, 128);
if (Preference.prefs.getBoolean("Grid")) if (Preference.prefs.getBoolean("Grid"))
map.setClearsprite(60); map.setClearsprite(60);
else else
map.setClearsprite(53); map.setClearsprite(53);
map.setBounds(0, 0, AssetLoader.width, AssetLoader.height);
map.redraw(); map.redraw();
Gdx.app.debug(getClass().getSimpleName(), "Création du menu"); Gdx.app.debug("wirechem-GameScreen", "Création du menu");
nextpage=new ImageButton(AssetLoader.Skin_level,"extend"); nextpage=new ImageButton(AssetLoader.Skin_level,"extend");
nextpage.setPosition(1850, AssetLoader.height - 370); nextpage.setPosition(1850, AssetLoader.height - 370);
nextpage.addListener(new ClickListener() { nextpage.addListener(new ClickListener() {
@ -341,7 +340,7 @@ public class GameScreen implements Screen {
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
if (!nextpage.isDisabled()) { if (!nextpage.isDisabled()) {
menu.NextPage(); menu.NextPage();
Gdx.app.debug("menu", "Page suivante:"+menu.getPage()); Gdx.app.debug("wirechem-GameScreen", "Menu | Page suivante:"+menu.getPage());
map.tempclear(); map.tempclear();
hideInfo(); hideInfo();
nextpage.setDisabled(menu.isNextEmpty()); nextpage.setDisabled(menu.isNextEmpty());
@ -356,7 +355,7 @@ public class GameScreen implements Screen {
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
if (!previouspage.isDisabled()) { if (!previouspage.isDisabled()) {
menu.PreviousPage(); menu.PreviousPage();
Gdx.app.debug("menu", "Page précédente:"+menu.getPage()); Gdx.app.debug("wirechem-GameScreen", "Menu | Page précédente:"+menu.getPage());
map.tempclear(); map.tempclear();
hideInfo(); hideInfo();
nextpage.setDisabled(menu.isNextEmpty()); nextpage.setDisabled(menu.isNextEmpty());
@ -369,7 +368,7 @@ public class GameScreen implements Screen {
menu.addListener(new ChangeListener() { menu.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
Gdx.app.debug("Menu", "Element changé"); Gdx.app.debug("wirechem-GameScreen", "Menu | Element changé");
hideInfo(); hideInfo();
map.tempclear(); map.tempclear();
if (menu.getTransmuter() != null) if (menu.getTransmuter() != null)
@ -460,18 +459,18 @@ public class GameScreen implements Screen {
public void map_infos(float realx, float realy, int x, int y, boolean alone, public void map_infos(float realx, float realy, int x, int y, boolean alone,
int button, calling call) { int button, calling call) {
if (level.Grid.GetXY(x, y) != null) { if (level.Grid.GetXY(x, y) != null) {
Gdx.app.debug("map", "Etat extension:" + unroll); Gdx.app.debug("wirechem-GameScreen", "Etat extension:" + unroll);
if (level.Grid.GetXY(x, y).Copper) if (level.Grid.GetXY(x, y).Copper)
Gdx.app.debug("map", "*** Présence de cuivre"); Gdx.app.debug("wirechem-GameScreen", "*** Présence de cuivre");
if (level.Grid.GetXY(x, y).Fiber > 0) if (level.Grid.GetXY(x, y).Fiber > 0)
Gdx.app.debug("map", "*** Présence de fibre"); Gdx.app.debug("wirechem-GameScreen", "*** Présence de fibre");
if (level.Grid.GetXY(x, y).Transmuter_calc > 0) { if (level.Grid.GetXY(x, y).Transmuter_calc > 0) {
Gdx.app.debug("map", "transmuter deplacement vers origine:" Gdx.app.debug("wirechem-GameScreen", "transmuter deplacement vers origine:"
+ level.Grid.GetXY(x, y).Transmuter_movex + "," + level.Grid.GetXY(x, y).Transmuter_movex + ","
+ level.Grid.GetXY(x, y).Transmuter_movey + " coords:" + level.Grid.GetXY(x, y).Transmuter_movey + " coords:"
+ (x + level.Grid.GetXY(x, y).Transmuter_movex) + "x" + (x + level.Grid.GetXY(x, y).Transmuter_movex) + "x"
+ (y + level.Grid.GetXY(x, y).Transmuter_movey)); + (y + level.Grid.GetXY(x, y).Transmuter_movey));
Gdx.app.debug("map",level.Grid.getTransmuter( Gdx.app.debug("wirechem-GameScreen",level.Grid.getTransmuter(
x + level.Grid.GetXY(x, y).Transmuter_movex, x + level.Grid.GetXY(x, y).Transmuter_movex,
y + level.Grid.GetXY(x, y).Transmuter_movey) y + level.Grid.GetXY(x, y).Transmuter_movey)
.getInformations()); .getInformations());
@ -503,7 +502,7 @@ public class GameScreen implements Screen {
int button, calling call) { int button, calling call) {
if (oldx != 0 && oldy != 0) { if (oldx != 0 && oldy != 0) {
map.setDec(realx - oldx, realy - oldy); map.setDec(realx - oldx, realy - oldy);
Gdx.app.debug("map", "Decalage absolue en pixel:" + (realx - oldx)+ "x" + (realy - oldy)); Gdx.app.debug("wirechem-GameScreen", "Decalage absolue en pixel:" + (realx - oldx)+ "x" + (realy - oldy));
} }
oldx = realx; oldx = realx;
oldy = realy; oldy = realy;
@ -542,7 +541,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 + level.Grid.GetXY(x, y).Transmuter_movex, y level.Grid.GetXY(x + level.Grid.GetXY(x, y).Transmuter_movex, y
+ level.Grid.GetXY(x, y).Transmuter_movey).Transmuter = null; + level.Grid.GetXY(x, y).Transmuter_movey).Transmuter = null;
Gdx.app.debug("map", "transmuter deplacement vers origine:" Gdx.app.debug("wirechem-GameScreen", "transmuter deplacement vers origine:"
+ level.Grid.GetXY(x, y).Transmuter_movex + "," + level.Grid.GetXY(x, y).Transmuter_movex + ","
+ level.Grid.GetXY(x, y).Transmuter_movey + " coords:" + level.Grid.GetXY(x, y).Transmuter_movey + " coords:"
+ (x + level.Grid.GetXY(x, y).Transmuter_movex) + "x" + (x + level.Grid.GetXY(x, y).Transmuter_movex) + "x"
@ -661,13 +660,12 @@ public class GameScreen implements Screen {
@Override @Override
public void show() { public void show() {
Gdx.app.debug(getClass().getSimpleName(), Gdx.app.debug("wirechem-GameScreen","Création de la fenêtre d'option");
"Création de la fenêtre d'option");
Table Optiontable = Createoption(); Table Optiontable = Createoption();
stage.addActor(winOptions); stage.addActor(winOptions);
Table Savetable = Createsaving(); Table Savetable = Createsaving();
stage.addActor(winSave); stage.addActor(winSave);
Gdx.app.log("*****", "Affichage du niveau."); Gdx.app.log("wirechem-GameScreen", "***** Affichage du niveau.");
stage_info.addActor(info_tech); stage_info.addActor(info_tech);
stage_info.addActor(info_research); stage_info.addActor(info_research);
stage_info.addActor(info_activation); stage_info.addActor(info_activation);
@ -685,13 +683,13 @@ public class GameScreen implements Screen {
stage_info.addActor(info_desc); stage_info.addActor(info_desc);
stage_tooltip.addActor(tooltip); stage_tooltip.addActor(tooltip);
stage.addActor(horizbar); stage.addActor(horizbar);
if (worlds.getInformations().Cout>0 || worlds.getInformations().Tech>=1 ) { if (worlds.getInformations().Cout>0 || worlds.getInformations().Tech>=1 || worlds.isDebug()) {
stage.addActor(vertibar); stage.addActor(vertibar);
stage.addActor(buttonlevel); stage.addActor(buttonlevel);
stage.addActor(menu); stage.addActor(menu);
stage.addActor(nextpage);
stage.addActor(previouspage);
} }
stage.addActor(nextpage);
stage.addActor(previouspage);
stage.addActor(objectives); stage.addActor(objectives);
stage.addActor(rayon); stage.addActor(rayon);
stage.addActor(nrj); stage.addActor(nrj);
@ -738,11 +736,11 @@ 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("wirechem-GameScreen", "Barre | Sauvegarde de la grille.");
worlds.SaveGrid(); worlds.SaveGrid();
readsaved(); readsaved();
} else if (caller == "levels") { } else if (caller == "levels") {
Gdx.app.debug("Barre", "Affichage des niveaux."); Gdx.app.debug("wirechem-GameScreen", "Barre | Affichage des niveaux.");
exit(); 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") {
@ -752,28 +750,28 @@ public class GameScreen implements Screen {
} else if (caller == "screen") { } else if (caller == "screen") {
DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode(); DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
if (Gdx.graphics.isFullscreen()) { if (Gdx.graphics.isFullscreen()) {
Gdx.app.debug("Barre", "vers fenetre."); Gdx.app.debug("wirechem-GameScreen", "Barre | vers fenetre.");
Gdx.graphics.setDisplayMode(currentMode.width, Gdx.graphics.setDisplayMode(currentMode.width,
currentMode.height, false); currentMode.height, false);
} else { } else {
Gdx.app.debug("Barre", "vers plein ecran."); Gdx.app.debug("wirechem-GameScreen", "Barre | vers plein ecran.");
Gdx.graphics.setDisplayMode(currentMode.width, Gdx.graphics.setDisplayMode(currentMode.width,
currentMode.height, true); currentMode.height, true);
} }
} else if (caller == "sound") { } else if (caller == "sound") {
if (AssetLoader.intro.getVolume() > 0) { if (AssetLoader.intro.getVolume() > 0) {
Gdx.app.debug("Barre", "arret son."); Gdx.app.debug("wirechem-GameScreen", "Barre | arret son.");
AssetLoader.intro.setVolume(0f); AssetLoader.intro.setVolume(0f);
} else { } else {
Gdx.app.debug("Barre", "marche son."); Gdx.app.debug("wirechem-GameScreen", "Barre | marche son.");
AssetLoader.intro.setVolume(1f); AssetLoader.intro.setVolume(1f);
} }
} else if (caller == "tuto") { } else if (caller == "tuto") {
if (AssetLoader.Tooltipmanager.enabled) { if (AssetLoader.Tooltipmanager.enabled) {
Gdx.app.debug("Barre", "arret tuto."); Gdx.app.debug("wirechem-GameScreen", "Barre | arret tuto.");
AssetLoader.Tooltipmanager.enabled = false; AssetLoader.Tooltipmanager.enabled = false;
} else { } else {
Gdx.app.debug("Barre", "marche tuto."); Gdx.app.debug("wirechem-GameScreen", "Barre | marche tuto.");
AssetLoader.Tooltipmanager.enabled = true; AssetLoader.Tooltipmanager.enabled = true;
} }
} else if (caller=="grid") { } else if (caller=="grid") {
@ -795,10 +793,10 @@ public class GameScreen implements Screen {
} else if (caller == "flag") { } else if (caller == "flag") {
if (AssetLoader.language.getLocale().getDisplayName() if (AssetLoader.language.getLocale().getDisplayName()
.contains("français")) { .contains("français")) {
Gdx.app.debug("Barre", "Langue USA"); Gdx.app.debug("wirechem-GameScreen", "Barre | Langue USA");
AssetLoader.language = AssetLoader.usa; AssetLoader.language = AssetLoader.usa;
} else { } else {
Gdx.app.debug("Barre", "Langue FR"); Gdx.app.debug("wirechem-GameScreen", "Barre | Langue FR");
AssetLoader.language = AssetLoader.french; AssetLoader.language = AssetLoader.french;
} }
} else if (caller == "stat") { } else if (caller == "stat") {
@ -806,6 +804,20 @@ public class GameScreen implements Screen {
level.Locked=false; level.Locked=false;
buttonlevel.setDisabled(false); buttonlevel.setDisabled(false);
worlds.unLockLevel(); worlds.unLockLevel();
} else if (caller == "database") {
worlds.origLevel();
} else if (caller == "delrow") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX-1, level.Grid.sizeY);
map.resize();
} else if (caller == "delcol") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX, level.Grid.sizeY-1);
map.resize();
} else if (caller == "addrow") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX+1, level.Grid.sizeY);
map.resize();
} else if (caller == "addcol") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX, level.Grid.sizeY+1);
map.resize();
} }
} }

View File

@ -46,8 +46,7 @@ public class LevelScreen implements Screen {
private Stage stage; private Stage stage;
private Table table; private Table table;
private WarnDialog dialog; private WarnDialog dialog;
private ImageButton Previous, Next, Exit; private ImageButton Previous, Next, Exit, logosmall, databaseSave;
public ImageButton logosmall;
public Image MenuSolo, MenuMulti, MenuScenario; public Image MenuSolo, MenuMulti, MenuScenario;
private ImageTextButton cout, tech, cycle, temp, rayon, nrj; private ImageTextButton cout, tech, cycle, temp, rayon, nrj;
private TextButton buttonConnect, buttonPlay, buttonStat, buttonSave, private TextButton buttonConnect, buttonPlay, buttonStat, buttonSave,
@ -65,7 +64,7 @@ public class LevelScreen implements Screen {
if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) { if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) {
if (worlds.getWorld() < 0) if (worlds.getWorld() < 0)
worlds.setMaxWorldLevel(); worlds.setMaxWorldLevel();
Gdx.app.debug(getClass().getSimpleName(),"Afficher derniere réalisation, monde :"+worlds.getWorld()+" niveau:"+worlds.getLevel()); Gdx.app.debug("wirechem-LevelScreen","Afficher derniere réalisation, monde :"+worlds.getWorld()+" niveau:"+worlds.getLevel());
worlds.Forcereload(); worlds.Forcereload();
} }
} }
@ -73,6 +72,7 @@ public class LevelScreen implements Screen {
public void menu() { public void menu() {
selected = null; selected = null;
cout.setVisible(false); cout.setVisible(false);
databaseSave.setVisible(false);
tech.setVisible(false); tech.setVisible(false);
cycle.setVisible(false); cycle.setVisible(false);
temp.setVisible(false); temp.setVisible(false);
@ -147,6 +147,8 @@ public class LevelScreen implements Screen {
} }
public void level() { public void level() {
if (worlds.isDebug())
databaseSave.setVisible(true);
Exit.setPosition(1110, AssetLoader.height - Exit.getHeight() - 5); Exit.setPosition(1110, AssetLoader.height - Exit.getHeight() - 5);
MenuSolo.setVisible(false); MenuSolo.setVisible(false);
MenuMulti.setVisible(false); MenuMulti.setVisible(false);
@ -211,14 +213,14 @@ public class LevelScreen implements Screen {
level.Description=AssetLoader.language.get("[level"+(level.aWorld+1)+"/"+(level.aLevel+1)+"-desc]"); level.Description=AssetLoader.language.get("[level"+(level.aWorld+1)+"/"+(level.aLevel+1)+"-desc]");
buttonLevels[i] = new ButtonLevel(level, AssetLoader.ratio, true); buttonLevels[i] = new ButtonLevel(level, AssetLoader.ratio, true);
if (worlds.isDebug()) buttonLevels[i].setDisabled(false); if (worlds.isDebug()) buttonLevels[i].setDisabled(false);
Gdx.app.debug(getClass().getSimpleName(), "Ajout du niveau :"+ level.Name + "" + String.valueOf(level.aLevel)); Gdx.app.debug("wirechem-LevelScreen", "Ajout du niveau :"+ level.Name + "" + String.valueOf(level.aLevel));
buttonLevels[i++].addListener(new ClickListener() { buttonLevels[i++].addListener(new ClickListener() {
@Override @Override
public void enter(InputEvent event, float x, float y, public void enter(InputEvent event, float x, float y,
int pointer, Actor fromActor) { int pointer, Actor fromActor) {
ButtonLevel abutton = (ButtonLevel) event ButtonLevel abutton = (ButtonLevel) event
.getListenerActor(); .getListenerActor();
Gdx.app.debug(event.getListenerActor().toString(),"Enter button "); Gdx.app.debug("wirechem-LevelScreen","Enter button ");
if (!abutton.isChecked() && (!abutton.level.Locked || worlds.isDebug())) if (!abutton.isChecked() && (!abutton.level.Locked || worlds.isDebug()))
showlevel(abutton); showlevel(abutton);
} }
@ -227,7 +229,7 @@ public class LevelScreen implements Screen {
int pointer, Actor fromActor) { int pointer, Actor fromActor) {
ButtonLevel abutton = (ButtonLevel) event ButtonLevel abutton = (ButtonLevel) event
.getListenerActor(); .getListenerActor();
Gdx.app.debug(event.getListenerActor().toString(),"Enter button "); Gdx.app.debug("wirechem-LevelScreen","Enter button ");
if (!abutton.isChecked() && (!abutton.level.Locked || worlds.isDebug())) if (!abutton.isChecked() && (!abutton.level.Locked || worlds.isDebug()))
showlevel(abutton); showlevel(abutton);
} }
@ -290,12 +292,12 @@ public class LevelScreen implements Screen {
} }
} }
}); });
Gdx.app.debug(getClass().getSimpleName(),"Création des elements primordiaux du screen (stage, renderer, table)"); Gdx.app.debug("wirechem-LevelScreen","Création des elements primordiaux du screen (stage, renderer, table)");
stage = new Stage(AssetLoader.viewport); stage = new Stage(AssetLoader.viewport);
table = new Table(); table = new Table();
Renderer = new LevelRenderer(this); Renderer = new LevelRenderer(this);
dialog = new WarnDialog(AssetLoader.Skin_ui); dialog = new WarnDialog(AssetLoader.Skin_ui);
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer."); Gdx.app.debug("wirechem-LevelScreen", "Mise en place du timer.");
ScrollTimer = new Timer(); ScrollTimer = new Timer();
ScrollTask = new TimerTask() { ScrollTask = new TimerTask() {
@Override @Override
@ -304,7 +306,7 @@ public class LevelScreen implements Screen {
} }
}; };
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30); ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
Gdx.app.debug(getClass().getSimpleName(), "Création du menu."); Gdx.app.debug("wirechem-LevelScreen", "Création du menu.");
MenuSolo = new Image(AssetLoader.Skin_level, "menu1"); MenuSolo = new Image(AssetLoader.Skin_level, "menu1");
MenuSolo.setOrigin(MenuSolo.getWidth() / 2, MenuSolo.getHeight() / 2); MenuSolo.setOrigin(MenuSolo.getWidth() / 2, MenuSolo.getHeight() / 2);
MenuSolo.addListener(new ClickListener() { MenuSolo.addListener(new ClickListener() {
@ -355,7 +357,7 @@ public class LevelScreen implements Screen {
}))); })));
} }
}); });
Gdx.app.debug(getClass().getSimpleName(), "Création des boutons."); Gdx.app.debug("wirechem-LevelScreen", "Création des boutons.");
logosmall = new ImageButton(AssetLoader.Skin_level, "logosmall"); logosmall = new ImageButton(AssetLoader.Skin_level, "logosmall");
logosmall.setPosition(20,AssetLoader.height - 175 + logosmall.getHeight() / 2); logosmall.setPosition(20,AssetLoader.height - 175 + logosmall.getHeight() / 2);
logosmall.setChecked(worlds.isDebug()); logosmall.setChecked(worlds.isDebug());
@ -369,6 +371,7 @@ public class LevelScreen implements Screen {
} }
worlds.ActivateDebug(); worlds.ActivateDebug();
Next.setVisible(!worlds.isRealLastWorld()); Next.setVisible(!worlds.isRealLastWorld());
databaseSave.setVisible(true);
} }
else { else {
if (buttonLevels != null) if (buttonLevels != null)
@ -379,6 +382,7 @@ public class LevelScreen implements Screen {
worlds.DesactivateDebug(); worlds.DesactivateDebug();
worlds.updateUnlockLevels(); worlds.updateUnlockLevels();
worlds.setMaxWorldLevel(); worlds.setMaxWorldLevel();
databaseSave.setVisible(false);
} }
} }
}); });
@ -489,7 +493,7 @@ public class LevelScreen implements Screen {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
worlds.NextWorld(); worlds.NextWorld();
Gdx.app.debug(event.getListenerActor().toString(), Gdx.app.debug("wirechem-LevelScreen",
"World:" + String.valueOf(worlds.getWorld()) + " Maxworld:" "World:" + String.valueOf(worlds.getWorld()) + " Maxworld:"
+ String.valueOf(worlds.getMaxWorlds())); + String.valueOf(worlds.getMaxWorlds()));
} }
@ -500,11 +504,20 @@ public class LevelScreen implements Screen {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
worlds.PreviousWorld(); worlds.PreviousWorld();
Gdx.app.debug(event.getListenerActor().toString(), Gdx.app.debug("wirechem-LevelScreen",
"World:" + String.valueOf(worlds.getWorld()) + " Maxworld:" "World:" + String.valueOf(worlds.getWorld()) + " Maxworld:"
+ String.valueOf(worlds.getMaxWorlds())); + String.valueOf(worlds.getMaxWorlds()));
} }
}); });
databaseSave = new ImageButton(AssetLoader.Skin_level, "database-save");
databaseSave.setPosition(1820, 40);
databaseSave.setVisible(false);
databaseSave.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.save(worlds.getName());
}
});
cout = new ImageTextButton("5", AssetLoader.Skin_level, "cout"); cout = new ImageTextButton("5", AssetLoader.Skin_level, "cout");
cout.setPosition(1250, 48); cout.setPosition(1250, 48);
tech = new ImageTextButton("10", AssetLoader.Skin_level, "tech"); tech = new ImageTextButton("10", AssetLoader.Skin_level, "tech");
@ -517,7 +530,7 @@ public class LevelScreen implements Screen {
nrj.setPosition(1365, 490); nrj.setPosition(1365, 490);
rayon = new ImageTextButton("10", AssetLoader.Skin_level, "rayon"); rayon = new ImageTextButton("10", AssetLoader.Skin_level, "rayon");
rayon.setPosition(1250, 490); rayon.setPosition(1250, 490);
Gdx.app.debug(getClass().getSimpleName(), "Conditions de victoire."); Gdx.app.debug("wirechem-LevelScreen", "Conditions de victoire.");
Victory = new Objectives(); Victory = new Objectives();
Victory.setVictory(new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); Victory.setVictory(new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
Victory.setPosition(1216, 185); Victory.setPosition(1216, 185);
@ -549,7 +562,7 @@ public class LevelScreen implements Screen {
Statdata.Refresh(); Statdata.Refresh();
Userdata.Refresh(); Userdata.Refresh();
Gamedata.Refresh(); Gamedata.Refresh();
Gdx.app.debug(getClass().getSimpleName(), "Affichage du menu."); Gdx.app.debug("wirechem-LevelScreen", "Affichage du menu.");
if (worlds.getWorld() != -1) if (worlds.getWorld() != -1)
level(); level();
else else
@ -571,7 +584,7 @@ public class LevelScreen implements Screen {
@Override @Override
public void show() { public void show() {
Gdx.app.log("*****", "Affichage du choix des mondes & niveaux."); Gdx.app.log("wirechem-LevelScreen", "***** Affichage du choix des mondes & niveaux.");
table.setFillParent(true); table.setFillParent(true);
stage.addActor(worlds); stage.addActor(worlds);
stage.addActor(MenuSolo); stage.addActor(MenuSolo);
@ -603,8 +616,9 @@ public class LevelScreen implements Screen {
stage.addActor(Gamedatalabel); stage.addActor(Gamedatalabel);
stage.addActor(Worlddata); stage.addActor(Worlddata);
stage.addActor(Worlddatalabel); stage.addActor(Worlddatalabel);
stage.addActor(databaseSave);
Gdx.input.setInputProcessor(stage); Gdx.input.setInputProcessor(stage);
Gdx.app.debug("AssetLoader", "Début dans la bande son \'intro\'"); Gdx.app.debug("wirechem-LevelScreen", "Début dans la bande son \'intro\'");
AssetLoader.intro.setLooping(true); AssetLoader.intro.setLooping(true);
AssetLoader.intro.play(); AssetLoader.intro.play();
} }
@ -629,7 +643,7 @@ public class LevelScreen implements Screen {
public void showlevel(ButtonLevel button) { public void showlevel(ButtonLevel button) {
if (button==null) if (button==null)
return; return;
Gdx.app.debug(getClass().getSimpleName(), "Reading button " + button.level.Name); Gdx.app.debug("wirechem-LevelScreen", "Reading button " + button.level.Name);
TextDescriptive.setText(button.level.Description); TextDescriptive.setText(button.level.Description);
if (button.level.Maxcycle < 99999 && button.level.Maxcycle > 0) { if (button.level.Maxcycle < 99999 && button.level.Maxcycle > 0) {
cycle.setText(String.valueOf(button.level.Maxcycle)); cycle.setText(String.valueOf(button.level.Maxcycle));

View File

@ -33,7 +33,7 @@ public class SplashScreen implements Screen {
@Override @Override
public void show() { public void show() {
Gdx.app.log("****", "Affichage du SplashScreen"); Gdx.app.log("wirechem-LevelScreen", "***** Affichage du SplashScreen");
scale = 2; scale = 2;
splashImage.setScale(scale); splashImage.setScale(scale);
splashImage.setPosition( splashImage.setPosition(