fix: correction de nombreux bogues

This commit is contained in:
Nicolas Hordé 2016-06-17 22:28:46 +02:00
parent 431496aeac
commit 61bdef8cec
8 changed files with 369 additions and 314 deletions

View File

@ -44,7 +44,7 @@ public class IconValue extends ImageTextButton{
break; break;
case research: case research:
this.setText(String.valueOf(worlds.ReadResearch())); this.setText(String.valueOf(worlds.ReadResearch()));
this.setVisible(worlds.ReadResearch()>0 || worlds.isDebug()); this.setVisible((worlds.getInformations().Tech>=1 && worlds.ReadResearch()>0) || worlds.isDebug());
break; break;
case cycle: case cycle:
this.setVisible(worlds.getWorld()>=1 || worlds.isDebug()); this.setVisible(worlds.getWorld()>=1 || worlds.isDebug());

View File

@ -231,7 +231,7 @@ public class Menu extends Actor {
this.setMenuTile(0, 4, 87, "gold_pen",0); this.setMenuTile(0, 4, 87, "gold_pen",0);
this.setMenuTile(1, 4, 88, "lock_pen",0); this.setMenuTile(1, 4, 88, "lock_pen",0);
} }
if (worlds.getInformations().Cout>=0 || worlds.isDebug()) if (worlds.getInformations().Cout_orig>=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);

View File

@ -76,6 +76,8 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
layers.add(layer); layers.add(layer);
} }
layers.get(3).setOpacity(0.9f); layers.get(3).setOpacity(0.9f);
level.Cout_copperfiber=level.Grid.tiling_copper();
level.Cout_transmuter=level.Grid.tiling_transmuter();
this.redraw(); this.redraw();
this.initzoom(); this.initzoom();
} }

View File

@ -35,15 +35,31 @@ public class Grid implements Serializable,Cloneable {
for (int y = 0; y < this.sizeY; y++) { for (int y = 0; y < this.sizeY; y++) {
Transmuter transmuter = getTransmuter(x, y); Transmuter transmuter = getTransmuter(x, y);
if (transmuter != null) { if (transmuter != null) {
Iterator<Entry<Vector2, Integer>> tiles = transmuter Iterator<Entry<Vector2, Integer>> tiles = transmuter.getTilesidrotated().iterator();
.getTilesidrotated().iterator();
while (tiles.hasNext()) { while (tiles.hasNext()) {
Entry<Vector2, Integer> all = tiles.next(); Entry<Vector2, Integer> all = tiles.next();
GetXY(x + all.key.x, y + all.key.y).Transmuter_calc = (1 << 16) Cell cell=GetXY(x + all.key.x, y + all.key.y);
* transmuter.getRotation().ordinal() if (cell!=null) {
+ all.value; cell.Transmuter_calc = (1 << 16) * transmuter.getRotation().ordinal()+ all.value;
GetXY(x + all.key.x, y + all.key.y).Transmuter_movex = (int) -all.key.x; cell.Transmuter_movex = (int) -all.key.x;
GetXY(x + all.key.x, y + all.key.y).Transmuter_movey = (int) -all.key.y; cell.Transmuter_movey = (int) -all.key.y;
}
else
{
result-=GetXY(x, y).Transmuter.getPrice();
Iterator<Entry<Vector2, Integer>> tileseraser = transmuter.getTilesidrotated().iterator();
while (tileseraser.hasNext()) {
Entry<Vector2, Integer> allereaser = tileseraser.next();
Cell celleraser=GetXY(x + allereaser.key.x, y + allereaser.key.y);
if (celleraser!=null) {
celleraser.Transmuter=null;
celleraser.Transmuter_calc=0;
celleraser.Transmuter_movex=0;
celleraser.Transmuter_movey=0;
}
}
break;
}
} }
} }
} }

View File

@ -54,7 +54,7 @@ public class Worlds extends Actor {
public int ReadResearch() { public int ReadResearch() {
if (research==-2) if (research==-2)
research=AssetLoader.Datahandler.user().getResearchpoint(0); research=AssetLoader.Datahandler.user().getResearchpoint(0);
return research+5800; return research;
} }
public void SaveResearch() { public void SaveResearch() {

View File

@ -117,7 +117,7 @@ public class LevelRenderer {
if (LevelScreen.selected.level.Tech > 0 || LevelScreen.worlds.isDebug()) if (LevelScreen.selected.level.Tech > 0 || LevelScreen.worlds.isDebug())
shapeRenderer.rect(1210, 620, 250, AssetLoader.height - 630); shapeRenderer.rect(1210, 620, 250, AssetLoader.height - 630);
} }
if (!LevelScreen.MenuSolo.isVisible()) if (!LevelScreen.group_init.isVisible())
shapeRenderer.rect(1470, 10, 440, AssetLoader.height - 20); shapeRenderer.rect(1470, 10, 440, AssetLoader.height - 20);
shapeRenderer.end(); shapeRenderer.end();
if (LevelScreen.buttonLevels != null) if (LevelScreen.buttonLevels != null)

View File

@ -244,19 +244,67 @@ public class GameScreen implements Screen {
Gdx.app.debug("wirechem-GameScreen","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);
cycle.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (worlds.isDebug())
worlds.getInformations().Cycle=5000;
}
});
temp = new IconValue(Icon.temp,worlds, AssetLoader.Skin_level); temp = new IconValue(Icon.temp,worlds, AssetLoader.Skin_level);
temp.setPosition(210, AssetLoader.height - 74); temp.setPosition(210, AssetLoader.height - 74);
temp.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (worlds.isDebug())
worlds.getInformations().Temp=5000;
}
});
rayon = new IconValue(Icon.rayon,worlds, AssetLoader.Skin_level); rayon = new IconValue(Icon.rayon,worlds, AssetLoader.Skin_level);
rayon.setPosition(410, AssetLoader.height - 74); rayon.setPosition(410, AssetLoader.height - 74);
rayon.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (worlds.isDebug())
worlds.getInformations().Rayon=5000;
}
});
nrj = new IconValue(Icon.nrj,worlds, AssetLoader.Skin_level); nrj = new IconValue(Icon.nrj,worlds, AssetLoader.Skin_level);
nrj.setPosition(610, AssetLoader.height - 74); nrj.setPosition(610, AssetLoader.height - 74);
nrj.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (worlds.isDebug())
worlds.getInformations().Nrj=5000;
}
});
tech = new IconValue(Icon.tech,worlds, AssetLoader.Skin_level); tech = new IconValue(Icon.tech,worlds, AssetLoader.Skin_level);
tech.setPosition(1345, AssetLoader.height - 74); tech.setPosition(1345, AssetLoader.height - 74);
tech.addListener(new Tooltip(tooltip,AssetLoader.Tooltipmanager)); tech.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (worlds.isDebug())
worlds.getInformations().Tech=12;
}
});
cout = new IconValue(Icon.cout,worlds, AssetLoader.Skin_level); cout = new IconValue(Icon.cout,worlds, AssetLoader.Skin_level);
cout.setPosition(1445, AssetLoader.height - 74); cout.setPosition(1445, AssetLoader.height - 74);
cout.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (worlds.isDebug())
worlds.getInformations().Cout_orig=5000;
}
});
research = new IconValue(Icon.research,worlds, AssetLoader.Skin_level); research = new IconValue(Icon.research,worlds, AssetLoader.Skin_level);
research.setPosition(1545, AssetLoader.height - 74); research.setPosition(1545, AssetLoader.height - 74);
research.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (worlds.isDebug())
worlds.ModResearch(5000);
}
});
objectives = new Objectives(worlds); objectives = new Objectives(worlds);
objectives.setPosition(890, AssetLoader.height - 95); objectives.setPosition(890, AssetLoader.height - 95);
objectives.setVisible(level.Cout>0); objectives.setVisible(level.Cout>0);
@ -888,16 +936,16 @@ public class GameScreen implements Screen {
worlds.unLockLevel(); worlds.unLockLevel();
} else if (caller == "database") { } else if (caller == "database") {
worlds.origLevel(); worlds.origLevel();
} else if (caller == "delrow") { } else if (caller == "delcol") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX-1, level.Grid.sizeY); level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX-1, level.Grid.sizeY);
map.resize(); map.resize();
} else if (caller == "delcol") { } else if (caller == "delrow") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX, level.Grid.sizeY-1); level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX, level.Grid.sizeY-1);
map.resize(); map.resize();
} else if (caller == "addrow") { } else if (caller == "addcol") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX+1, level.Grid.sizeY); level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX+1, level.Grid.sizeY);
map.resize(); map.resize();
} else if (caller == "addcol") { } else if (caller == "addrow") {
level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX, level.Grid.sizeY+1); level.Grid=(Grid) level.Grid.clone(level.Grid.sizeX, level.Grid.sizeY+1);
map.resize(); map.resize();
} }

View File

@ -9,9 +9,11 @@ import com.badlogic.gdx.Screen;
import com.badlogic.gdx.Application; import com.badlogic.gdx.Application;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup;
import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
@ -62,6 +64,8 @@ public class LevelScreen implements Screen {
private Objectives Victory; private Objectives Victory;
public ButtonLevel selected; public ButtonLevel selected;
public int addervalue; public int addervalue;
public ButtonGroup chooser;
public Group group_init, group_stat, group_level, group_base, group_debug, group_choose, group_other;
public void play() { public void play() {
if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) { if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) {
@ -74,45 +78,15 @@ public class LevelScreen implements Screen {
public void menu() { public void menu() {
selected = null; selected = null;
group_init.setVisible(true);
group_stat.setVisible(false);
group_level.setVisible(false);
group_base.setVisible(false);
group_debug.setVisible(false);
group_choose.setVisible(false);
logosmall.setChecked(false); logosmall.setChecked(false);
worlds.DesactivateDebug(); worlds.DesactivateDebug();
cout.setVisible(false);
databaseSave.setVisible(false);
signer.setVisible(false);
up_rayon.setVisible(false);
up_nrj.setVisible(false);
up_temp.setVisible(false);
up_cycle.setVisible(false);
up.setVisible(false);
research.setVisible(false);
adder.setVisible(false);
tech.setVisible(false);
cycle.setVisible(false);
temp.setVisible(false);
rayon.setVisible(false);
nrj.setVisible(false);
Previous.setVisible(false);
Next.setVisible(false);
Victory.setVisible(false);
Exit.setPosition(1820, AssetLoader.height - 100); Exit.setPosition(1820, AssetLoader.height - 100);
buttonPlay.setVisible(false);
TextDescriptive.setVisible(false);
MenuSolo.setVisible(true);
MenuMulti.setVisible(true);
MenuScenario.setVisible(true);
buttonConnect.setVisible(false);
buttonStat.setVisible(false);
Statdata.setVisible(false);
Userdata.setVisible(false);
Gamedata.setVisible(false);
Statdatalabel.setVisible(false);
Userdatalabel.setVisible(false);
Gamedatalabel.setVisible(false);
Worlddatalabel.setVisible(false);
buttonPlaythis.setVisible(false);
Worlddata.setVisible(false);
buttonSave.setVisible(false);
buttonApply.setVisible(false);
initlevel(); initlevel();
MenuSolo.setRotation(0); MenuSolo.setRotation(0);
MenuSolo.setScale(1f); MenuSolo.setScale(1f);
@ -140,17 +114,6 @@ public class LevelScreen implements Screen {
public void initlevel() { public void initlevel() {
selected = null; selected = null;
buttonPlay.setVisible(false);
TextDescriptive.setVisible(false);
cout.setVisible(false);
tech.setVisible(false);
cycle.setVisible(false);
temp.setVisible(false);
rayon.setVisible(false);
nrj.setVisible(false);
Previous.setVisible(false);
Next.setVisible(false);
Victory.setVisible(false);
if (buttonLevels != null) if (buttonLevels != null)
for (int j = 0; j < 10; j++) for (int j = 0; j < 10; j++)
if (buttonLevels[j] != null) { if (buttonLevels[j] != null) {
@ -160,52 +123,29 @@ public class LevelScreen implements Screen {
} }
public void level() { public void level() {
if (worlds.isDebug()) {
databaseSave.setVisible(true);
adder.setVisible(true);
signer.setVisible(true);
}
Exit.setPosition(1110, AssetLoader.height - Exit.getHeight() - 5); Exit.setPosition(1110, AssetLoader.height - Exit.getHeight() - 5);
MenuSolo.setVisible(false); group_init.setVisible(false);
MenuMulti.setVisible(false); group_choose.setVisible(true);
MenuScenario.setVisible(false); group_level.setVisible(true);
buttonConnect.setVisible(true);
buttonStat.setVisible(true);
SetButtonStat(); SetButtonStat();
if (worlds.isDebug()) {
group_debug.setVisible(true);
group_choose.setVisible(false);
group_base.setVisible(false);
group_stat.setVisible(false);
}
play(); play();
} }
public void SetButtonConnect() { public void SetButtonConnect() {
buttonStat.setColor(1f, 1f, 1f, 1f); group_stat.setVisible(false);
buttonConnect.setColor(1f, 0, 0, 1f); group_base.setVisible(true);
Statdata.setVisible(true);
Userdata.setVisible(true);
Gamedata.setVisible(true);
Statdatalabel.setVisible(true);
Userdatalabel.setVisible(true);
Gamedatalabel.setVisible(true);
buttonSave.setVisible(true);
buttonApply.setVisible(true);
Worlddatalabel.setVisible(true);
Worlddata.setVisible(true);
buttonPlaythis.setVisible(true);
} }
public void SetButtonStat() { public void SetButtonStat() {
buttonConnect.setColor(1f, 1f, 1f, 1f); group_stat.setVisible(true);
buttonStat.setColor(1f, 0, 0, 1f); group_base.setVisible(false);
buttonStat.setColor(1f, 0, 0, 1f);
Statdata.setVisible(false);
Userdata.setVisible(false);
Gamedata.setVisible(false);
Statdatalabel.setVisible(false);
Userdatalabel.setVisible(false);
Gamedatalabel.setVisible(false);
buttonSave.setVisible(false);
buttonApply.setVisible(false);
Worlddatalabel.setVisible(false);
Worlddata.setVisible(false);
buttonPlaythis.setVisible(false);
} }
public void loadWorld() { public void loadWorld() {
@ -323,7 +263,11 @@ public class LevelScreen implements Screen {
} }
}; };
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30); ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
Gdx.app.debug("wirechem-LevelScreen", "Création du menu.");
//**********************************************************
//Group Init
//**********************************************************
Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Init.");
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() {
@ -374,144 +318,45 @@ public class LevelScreen implements Screen {
}))); })));
} }
}); });
Gdx.app.debug("wirechem-LevelScreen", "Création des boutons.");
logosmall = new ImageButton(AssetLoader.Skin_level, "logosmall"); group_init=new Group();
logosmall.setPosition(20,AssetLoader.height - 175 + logosmall.getHeight() / 2); group_init.addActor(MenuScenario);
logosmall.setChecked(worlds.isDebug()); group_init.addActor(MenuMulti);
logosmall.addListener(new ClickListener() { group_init.addActor(MenuSolo);
public void clicked(InputEvent event, float x, float y) {
if (!MenuSolo.isVisible()) //**********************************************************
if (logosmall.isChecked()) { //Group Choose
if (buttonLevels != null) //**********************************************************
for (int j = 0; j < 10; j++) { Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Choose.");
if (buttonLevels[j] != null)
buttonLevels[j].setDisabled(false);
}
worlds.ActivateDebug();
Next.setVisible(!worlds.isRealLastWorld());
databaseSave.setVisible(true);
adder.setVisible(true);
signer.setVisible(true);
showlevel(selected);
}
else {
if (buttonLevels != null)
for (int j = 0; j < 10; j++) {
if (buttonLevels[j] != null)
buttonLevels[j].setDisabled(buttonLevels[j].level.Locked);
}
worlds.DesactivateDebug();
worlds.updateUnlockLevels();
worlds.setMaxWorldLevel();
databaseSave.setVisible(false);
adder.setVisible(false);
signer.setVisible(false);
}
else
logosmall.setChecked(false);
}
});
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,
"Descriptif");
TextDescriptive.setBounds(15, 15, 1185, 110);
buttonApply = new TextButton(AssetLoader.language.get("[buttonApply-levelscreen]"), AssetLoader.Skin_ui);
buttonApply.setBounds(1680, 350, 190, 40);
buttonApply.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
AssetLoader.Datahandler.CloseAll();
AssetLoader.Datahandler.Attach(Userdata.getModel(),
Userdata.getUrl());
AssetLoader.Datahandler.Attach(Statdata.getModel(),
Statdata.getUrl());
AssetLoader.Datahandler.Attach(Gamedata.getModel(),
Gamedata.getUrl());
if (!AssetLoader.Datahandler.verifyall()) {
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errorloading]"),stage);
initlevel();
} else
menu();
if (AssetLoader.Datahandler.stat() == null)
Statdata.setColor(1f, 0, 0, 1f);
else
Statdata.setColor(1f, 1f, 1f, 1f);
if (AssetLoader.Datahandler.game() == null)
Gamedata.setColor(1f, 0, 0, 1f);
else
Gamedata.setColor(1f, 1f, 1f, 1f);
if (AssetLoader.Datahandler.user() == null)
Userdata.setColor(1f, 0, 0, 1f);
else
Userdata.setColor(1f, 1f, 1f, 1f);
Worlddata.Refresh();
worlds.initialize();
}
});
buttonSave = new TextButton(AssetLoader.language.get("[buttonSave-levelscreen]"), AssetLoader.Skin_ui);
buttonSave.setBounds(1480, 350, 190, 40);
buttonSave.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
menu();
Preference.prefs.putString("userdata", Userdata.getUrl());
Preference.prefs.putString("gamedata", Gamedata.getUrl());
Preference.prefs.putString("statdata", Statdata.getUrl());
Preference.prefs.flush();
dialog.show(
AssetLoader.language.get("[dialog-levelscreen-savedatabase]"),stage);
}
});
buttonConnect = new TextButton(AssetLoader.language.get("[buttonConnect-levelscreen]"), AssetLoader.Skin_ui); buttonConnect = new TextButton(AssetLoader.language.get("[buttonConnect-levelscreen]"), AssetLoader.Skin_ui);
buttonConnect.setBounds(1480, AssetLoader.height - 60, 190, 40); buttonConnect.setBounds(1480, AssetLoader.height - 60, 190, 40);
buttonConnect.addListener(new ClickListener() { buttonConnect.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
if (!Statdata.isVisible())
SetButtonConnect(); SetButtonConnect();
} }
}); });
buttonPlay = new TextButton(AssetLoader.language.get("[buttonPlay-levelscreen]"), AssetLoader.Skin_ui);
buttonPlay.setBounds(1040, 20, 150, 40);
buttonPlay.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.setLevel(selected.level.aLevel);
((Game) Gdx.app.getApplicationListener()).setScreen(new GameScreen(worlds));
}
});
buttonStat = new TextButton(AssetLoader.language.get("[buttonStat-levelscreen]"), AssetLoader.Skin_ui); buttonStat = new TextButton(AssetLoader.language.get("[buttonStat-levelscreen]"), AssetLoader.Skin_ui);
buttonStat.setBounds(1710, AssetLoader.height - 60, 190, 40); buttonStat.setBounds(1710, AssetLoader.height - 60, 190, 40);
buttonStat.addListener(new ClickListener() { buttonStat.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
if (Statdata.isVisible())
SetButtonStat(); SetButtonStat();
} }
}); });
buttonPlaythis = new TextButton(AssetLoader.language.get("[buttonPlaythis-levelscreen]"), AssetLoader.Skin_ui); chooser=new ButtonGroup();
buttonPlaythis.setBounds(1480, 50, 230, 40); chooser.add(buttonStat);
buttonPlaythis.addListener(new ClickListener() { chooser.add(buttonConnect);
public void clicked(InputEvent event, float x, float y) { chooser.setMaxCheckCount(1);
if (!AssetLoader.Datahandler.verifyall()) chooser.setMinCheckCount(1);
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errorlevels]"),stage); group_choose=new Group();
else { group_choose.addActor(buttonStat);
if (Worlddata.getSelected() == null) group_choose.addActor(buttonConnect);
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errornoworld]"), stage);
else { //**********************************************************
worlds.set((String) Worlddata.getSelected()); //Group Level
Preference.prefs.flush(); //**********************************************************
play(); Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Level.");
} TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,"Descriptif");
} TextDescriptive.setBounds(15, 15, 1185, 110);
}
});
Exit = new ImageButton(AssetLoader.Skin_level, "Exit");
Exit.setPosition(1110, AssetLoader.height - Exit.getHeight() - 5);
Exit.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (Exit.getX() < 1210)
menu();
else
Gdx.app.exit();
}
});
Next = new ImageButton(AssetLoader.Skin_level, "Next"); Next = new ImageButton(AssetLoader.Skin_level, "Next");
Next.setPosition(1030, 185); Next.setPosition(1030, 185);
Next.addListener(new ClickListener() { Next.addListener(new ClickListener() {
@ -534,56 +379,6 @@ public class LevelScreen implements Screen {
+ String.valueOf(worlds.getMaxWorlds())); + String.valueOf(worlds.getMaxWorlds()));
} }
}); });
signer = new ImageButton(AssetLoader.Skin_level, "add");
signer.setPosition(1660, 40);
signer.setVisible(false);
signer.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
String whereis=signer.getStyle().up.toString();
ImageButton.ImageButtonStyle imagebuttonstyle;
if (whereis.equals("add")) {
imagebuttonstyle=AssetLoader.Skin_level.get("sub", ImageButton.ImageButtonStyle.class);
addervalue=-Math.abs(addervalue);
}
else
{
imagebuttonstyle=AssetLoader.Skin_level.get("add", ImageButton.ImageButtonStyle.class);
addervalue=Math.abs(addervalue);
}
signer.setStyle(imagebuttonstyle);
}
});
adder = new ImageButton(AssetLoader.Skin_level, "add1");
adder.setPosition(1720, 40);
adder.setVisible(false);
adder.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
String whereis=adder.getStyle().up.toString();
if (whereis.equals("add1"))
addervalue=(int)(10*Math.signum(addervalue));
else if (whereis.equals("add10"))
addervalue=(int)(100*Math.signum(addervalue));
else if (whereis.equals("add100"))
addervalue=(int)(1000*Math.signum(addervalue));
else if (whereis.equals("add1000"))
addervalue=(int)(10000*Math.signum(addervalue));
else
addervalue=1;
ImageButton.ImageButtonStyle imagebuttonstyle=AssetLoader.Skin_level.get("add"+String.valueOf(Math.abs(addervalue)), ImageButton.ImageButtonStyle.class);
adder.setStyle(imagebuttonstyle);
}
});
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);
cout.addListener(new ClickListener() { cout.addListener(new ClickListener() {
@ -792,6 +587,101 @@ public class LevelScreen implements Screen {
} }
} }
}); });
buttonPlay = new TextButton(AssetLoader.language.get("[buttonPlay-levelscreen]"), AssetLoader.Skin_ui);
buttonPlay.setBounds(1040, 20, 150, 40);
buttonPlay.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.setLevel(selected.level.aLevel);
((Game) Gdx.app.getApplicationListener()).setScreen(new GameScreen(worlds));
}
});
group_level=new Group();
group_level.addActor(TextDescriptive);
group_level.addActor(buttonPlay);
group_level.addActor(Next);
group_level.addActor(Previous);
group_level.addActor(cout);
group_level.addActor(tech);
group_level.addActor(temp);
group_level.addActor(cycle);
group_level.addActor(nrj);
group_level.addActor(rayon);
group_level.addActor(up_cycle);
group_level.addActor(up_nrj);
group_level.addActor(up_rayon);
group_level.addActor(up_temp);
group_level.addActor(up);
group_level.addActor(research);
group_level.addActor(Victory);
//**********************************************************
//Group Base
//**********************************************************
Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Base.");
buttonApply = new TextButton(AssetLoader.language.get("[buttonApply-levelscreen]"), AssetLoader.Skin_ui);
buttonApply.setBounds(1680, 350, 190, 40);
buttonApply.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
AssetLoader.Datahandler.CloseAll();
AssetLoader.Datahandler.Attach(Userdata.getModel(),
Userdata.getUrl());
AssetLoader.Datahandler.Attach(Statdata.getModel(),
Statdata.getUrl());
AssetLoader.Datahandler.Attach(Gamedata.getModel(),
Gamedata.getUrl());
if (!AssetLoader.Datahandler.verifyall()) {
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errorloading]"),stage);
initlevel();
} else
menu();
if (AssetLoader.Datahandler.stat() == null)
Statdata.setColor(1f, 0, 0, 1f);
else
Statdata.setColor(1f, 1f, 1f, 1f);
if (AssetLoader.Datahandler.game() == null)
Gamedata.setColor(1f, 0, 0, 1f);
else
Gamedata.setColor(1f, 1f, 1f, 1f);
if (AssetLoader.Datahandler.user() == null)
Userdata.setColor(1f, 0, 0, 1f);
else
Userdata.setColor(1f, 1f, 1f, 1f);
Worlddata.Refresh();
worlds.initialize();
}
});
buttonSave = new TextButton(AssetLoader.language.get("[buttonSave-levelscreen]"), AssetLoader.Skin_ui);
buttonSave.setBounds(1480, 350, 190, 40);
buttonSave.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
menu();
Preference.prefs.putString("userdata", Userdata.getUrl());
Preference.prefs.putString("gamedata", Gamedata.getUrl());
Preference.prefs.putString("statdata", Statdata.getUrl());
Preference.prefs.flush();
dialog.show(
AssetLoader.language.get("[dialog-levelscreen-savedatabase]"),stage);
}
});
buttonPlaythis = new TextButton(AssetLoader.language.get("[buttonPlaythis-levelscreen]"), AssetLoader.Skin_ui);
buttonPlaythis.setBounds(1480, 50, 230, 40);
buttonPlaythis.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
if (!AssetLoader.Datahandler.verifyall())
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errorlevels]"),stage);
else {
if (Worlddata.getSelected() == null)
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errornoworld]"), stage);
else {
worlds.set((String) Worlddata.getSelected());
Preference.prefs.flush();
play();
}
}
}
});
String url = "http://evolving.fr/servers/list.xml"; String url = "http://evolving.fr/servers/list.xml";
Statdata = new ServerList(url, Base.datatype.statdata, Statdata = new ServerList(url, Base.datatype.statdata,
AssetLoader.Skin_ui); AssetLoader.Skin_ui);
@ -820,6 +710,136 @@ public class LevelScreen implements Screen {
Statdata.Refresh(); Statdata.Refresh();
Userdata.Refresh(); Userdata.Refresh();
Gamedata.Refresh(); Gamedata.Refresh();
group_base=new Group();
group_base.addActor(buttonPlaythis);
group_base.addActor(buttonSave);
group_base.addActor(buttonApply);
group_base.addActor(Statdata);
group_base.addActor(Userdata);
group_base.addActor(Gamedata);
group_base.addActor(Worlddata);
group_base.addActor(Statdatalabel);
group_base.addActor(Userdatalabel);
group_base.addActor(Gamedatalabel);
group_base.addActor(Worlddatalabel);
//**********************************************************
//Group Other
//**********************************************************
group_stat=new Group();
//**********************************************************
//Group Other
//**********************************************************
Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Other.");
Exit = new ImageButton(AssetLoader.Skin_level, "Exit");
Exit.setPosition(1110, AssetLoader.height - Exit.getHeight() - 5);
Exit.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (Exit.getX() < 1210)
menu();
else
Gdx.app.exit();
}
});
logosmall = new ImageButton(AssetLoader.Skin_level, "logosmall");
logosmall.setPosition(20,AssetLoader.height - 175 + logosmall.getHeight() / 2);
logosmall.setChecked(worlds.isDebug());
logosmall.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
if (!group_init.isVisible())
if (logosmall.isChecked()) {
if (buttonLevels != null)
for (int j = 0; j < 10; j++)
if (buttonLevels[j] != null)
buttonLevels[j].setDisabled(false);
worlds.ActivateDebug();
Next.setVisible(!worlds.isRealLastWorld());
group_debug.setVisible(true);
group_choose.setVisible(false);
group_stat.setVisible(false);
group_base.setVisible(false);
showlevel(selected);
}
else {
if (buttonLevels != null)
for (int j = 0; j < 10; j++)
if (buttonLevels[j] != null)
buttonLevels[j].setDisabled(buttonLevels[j].level.Locked);
worlds.DesactivateDebug();
worlds.updateUnlockLevels();
worlds.setMaxWorldLevel();
group_debug.setVisible(false);
group_choose.setVisible(true);
SetButtonStat();
}
else
logosmall.setChecked(false);
}
});
group_other=new Group();
group_other.addActor(Exit);
group_other.addActor(logosmall);
//**********************************************************
//Group Debug
//**********************************************************
Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Debug.");
signer = new ImageButton(AssetLoader.Skin_level, "add");
signer.setPosition(1660, 40);
signer.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
String whereis=signer.getStyle().up.toString();
ImageButton.ImageButtonStyle imagebuttonstyle;
if (whereis.equals("add")) {
imagebuttonstyle=AssetLoader.Skin_level.get("sub", ImageButton.ImageButtonStyle.class);
addervalue=-Math.abs(addervalue);
}
else
{
imagebuttonstyle=AssetLoader.Skin_level.get("add", ImageButton.ImageButtonStyle.class);
addervalue=Math.abs(addervalue);
}
signer.setStyle(imagebuttonstyle);
}
});
adder = new ImageButton(AssetLoader.Skin_level, "add1");
adder.setPosition(1720, 40);
adder.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
String whereis=adder.getStyle().up.toString();
if (whereis.equals("add1"))
addervalue=(int)(10*Math.signum(addervalue));
else if (whereis.equals("add10"))
addervalue=(int)(100*Math.signum(addervalue));
else if (whereis.equals("add100"))
addervalue=(int)(1000*Math.signum(addervalue));
else if (whereis.equals("add1000"))
addervalue=(int)(10000*Math.signum(addervalue));
else
addervalue=1;
ImageButton.ImageButtonStyle imagebuttonstyle=AssetLoader.Skin_level.get("add"+String.valueOf(Math.abs(addervalue)), ImageButton.ImageButtonStyle.class);
adder.setStyle(imagebuttonstyle);
}
});
databaseSave = new ImageButton(AssetLoader.Skin_level, "database-save");
databaseSave.setPosition(1820, 40);
databaseSave.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.save(worlds.getName());
}
});
group_debug=new Group();
group_debug.addActor(databaseSave);
group_debug.addActor(adder);
group_debug.addActor(signer);
Gdx.app.debug("wirechem-LevelScreen", "Affichage du menu."); Gdx.app.debug("wirechem-LevelScreen", "Affichage du menu.");
if (worlds.getWorld() != -1) if (worlds.getWorld() != -1)
level(); level();
@ -845,44 +865,13 @@ public class LevelScreen implements Screen {
Gdx.app.log("wirechem-LevelScreen", "***** 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(group_init);
stage.addActor(MenuMulti); stage.addActor(group_stat);
stage.addActor(MenuScenario); stage.addActor(group_level);
stage.addActor(TextDescriptive); stage.addActor(group_base);
stage.addActor(buttonPlaythis); stage.addActor(group_debug);
stage.addActor(Exit); stage.addActor(group_choose);
stage.addActor(Next); stage.addActor(group_other);
stage.addActor(buttonApply);
stage.addActor(buttonSave);
stage.addActor(buttonPlay);
stage.addActor(buttonConnect);
stage.addActor(buttonStat);
stage.addActor(Previous);
stage.addActor(cout);
stage.addActor(tech);
stage.addActor(cycle);
stage.addActor(nrj);
stage.addActor(temp);
stage.addActor(rayon);
stage.addActor(Victory);
stage.addActor(logosmall);
stage.addActor(Statdata);
stage.addActor(Statdatalabel);
stage.addActor(Userdata);
stage.addActor(Userdatalabel);
stage.addActor(Gamedata);
stage.addActor(Gamedatalabel);
stage.addActor(Worlddata);
stage.addActor(Worlddatalabel);
stage.addActor(databaseSave);
stage.addActor(adder);
stage.addActor(signer);
stage.addActor(up);
stage.addActor(up_nrj);
stage.addActor(up_cycle);
stage.addActor(up_temp);
stage.addActor(up_rayon);
stage.addActor(research);
Gdx.input.setInputProcessor(stage); Gdx.input.setInputProcessor(stage);
Gdx.app.debug("wirechem-LevelScreen", "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);