fix: correction d'autres bogues du mode édition

This commit is contained in:
Nicolas Hordé 2016-07-04 01:10:25 +02:00
parent 68cd234b35
commit 6fd09144ea
3 changed files with 35 additions and 33 deletions

View File

@ -396,8 +396,8 @@ public class Worlds extends Actor {
public void NextWorld() {
if (state!=State.notloaded)
if (usedworld<getMaxWorlds()) {
usedlevel=null;
usedworld++;
usedlevel=getMaxUnlockLevel();
onchanged(null);
}
}
@ -405,8 +405,8 @@ public class Worlds extends Actor {
public void PreviousWorld() {
if (state!=State.notloaded)
if (usedworld>0) {
usedlevel=null;
usedworld--;
usedlevel=getMaxUnlockLevel();
onchanged(null);
}
}

View File

@ -61,6 +61,7 @@ public class LevelRenderer {
if (this.scrolly < 0)
this.diry = 1;
Laser.i += 0.3f;
if (Laser.i > 10.0f) {
Laser.i = 0;
}
@ -90,15 +91,15 @@ public class LevelRenderer {
if (LevelScreen.selected != null) {
font.draw(batcher2, LevelScreen.selected.level.Name, 15, 165);
if (LevelScreen.selected.level.Tech > 0 || LevelScreen.worlds.isDebug())
if (LevelScreen.selected.level.Tech > 0 && !LevelScreen.worlds.isDebug() || LevelScreen.modify.isChecked() && LevelScreen.worlds.isDebug())
font.draw(batcher2, this.reward, 1215,
AssetLoader.height - 15);
if (LevelScreen.selected.level.Cout_orig > 0 || LevelScreen.worlds.isDebug()) {
if (LevelScreen.selected.level.Cout_orig > 0 && !LevelScreen.worlds.isDebug() || LevelScreen.modify.isChecked() && LevelScreen.worlds.isDebug()) {
font.draw(batcher2, this.ressource, 1215, 145);
font.draw(batcher2, this.goal, 1215, 295);
}
if (LevelScreen.selected.level.aWorld > 0 || LevelScreen.worlds.isDebug())
if (LevelScreen.selected.level.aWorld > 0 && !LevelScreen.worlds.isDebug() || LevelScreen.modify.isChecked() && LevelScreen.worlds.isDebug())
font.draw(batcher2, this.handicap, 1215, 605);
//font.draw(batcher2, "", 1215, 145);
}
@ -110,13 +111,13 @@ public class LevelRenderer {
shapeRenderer.setColor(0.5f, 0.5f, 0.5f, 0.5f);
if (LevelScreen.selected != null) {
shapeRenderer.rect(10, 10, 1190, 165);
if (LevelScreen.selected.level.Cout_orig > 0 || LevelScreen.worlds.isDebug()) {
if (LevelScreen.selected.level.Cout_orig > 0 && !LevelScreen.worlds.isDebug() || LevelScreen.modify.isChecked() && LevelScreen.worlds.isDebug()) {
shapeRenderer.rect(1210, 10, 250, 140);
shapeRenderer.rect(1210, 160, 250, 140);
}
if (LevelScreen.selected.level.aWorld > 0 || LevelScreen.worlds.isDebug())
if (LevelScreen.selected.level.aWorld > 0 && !LevelScreen.worlds.isDebug() || LevelScreen.modify.isChecked() && LevelScreen.worlds.isDebug())
shapeRenderer.rect(1210, 310, 250, 300);
if (LevelScreen.selected.level.Tech > 0 || LevelScreen.worlds.isDebug())
if (LevelScreen.selected.level.Tech > 0 && !LevelScreen.worlds.isDebug() || LevelScreen.modify.isChecked() && LevelScreen.worlds.isDebug())
shapeRenderer.rect(1210, 620, 250, AssetLoader.height - 630);
}
if (!LevelScreen.group_init.isVisible())

View File

@ -61,8 +61,9 @@ public class LevelScreen implements Screen {
private Stage stage;
private Table table;
private WarningDialog dialog;
private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer, finisher, deletelinker, deletebutton, addbutton, unlocked, duplicate, moveit,modify, link;
public Image MenuSolo, MenuMulti, MenuScenario;
private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer, finisher, deletelinker, deletebutton, addbutton, unlocked, duplicate, moveit,link;
public ImageButton modify;
private Image MenuSolo, MenuMulti, MenuScenario;
private ImageTextButton cout, tech, cycle, temp, rayon, nrj, up_cycle, up_temp, up_rayon, up_nrj, research, up;
private TextButton buttonConnect, buttonPlay, buttonStat, buttonSave, buttonApply, buttonPlaythis;
private ServerList Statdata, Userdata, Gamedata;
@ -74,17 +75,17 @@ public class LevelScreen implements Screen {
private VerticalGroup vertibar,vertibarmod;
public ButtonLevel selected;
public int addervalue;
public ButtonGroup<Button> chooser, modifbar;
private ButtonGroup<Button> chooser, modifbar;
public Group group_init, group_stat, group_level, group_base, group_debug, group_choose, group_other;
public ClickListener buttonLevelslistener;
public DragAndDrop dragAndDrop;
private ClickListener buttonLevelslistener;
private DragAndDrop dragAndDrop;
public void play() {
if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) {
if (worlds.getWorld() < 0)
worlds.setMaxWorldLevel();
Gdx.app.debug("wirechem-LevelScreen","Afficher derniere réalisation, monde :"+worlds.getWorld()+" niveau:"+worlds.getLevel());
worlds.Forcereload();
if (worlds.getWorld() < 0)
worlds.setMaxWorldLevel();
}
}
@ -244,7 +245,10 @@ public class LevelScreen implements Screen {
}
public void clicked(InputEvent event, float x, float y) {
ButtonLevel abutton = (ButtonLevel) event.getListenerActor();
abutton.setChecked(false);
if (!worlds.isDebug() || modify.isChecked())
abutton.setChecked(true);
else
abutton.setChecked(false);
}
};
}
@ -309,6 +313,9 @@ public class LevelScreen implements Screen {
}
Gdx.app.debug("wirechem-LevelScreen", "Changement - rechargement des mondes");
loadWorld();
if (worlds.isDebug() && modify.isChecked())
selectone();
else if (!worlds.isDebug())
for (ButtonLevel button : buttonLevels)
{
button.setChecked(false);
@ -318,6 +325,8 @@ public class LevelScreen implements Screen {
break;
}
}
else
selectnoone();
if (worlds.getLevelData()==null)
selected=buttonLevels.first();
Previous.setVisible(!worlds.isFirstWorld());
@ -982,7 +991,7 @@ public class LevelScreen implements Screen {
}
});
signer = new ImageButton(AssetLoader.Skin_level, "add");
signer.setPosition(1680, 40);
signer.setPosition(1660, 40);
signer.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
@ -1054,6 +1063,7 @@ public class LevelScreen implements Screen {
modifbar.add(link);
modifbar.add(modify);
modifbar.add(addbutton);
moveit.setChecked(true);
group_debug=new Group();
@ -1120,21 +1130,8 @@ public class LevelScreen implements Screen {
}
public void selectone() {
for(ButtonLevel button: buttonLevels)
if (button!=null) {
showlevel(button);
return;
}
return;
}
public void selectoneunlock() {
for(ButtonLevel button: buttonLevels)
if (button!=null && button.level.Locked==false) {
showlevel(button);
return;
}
return;
if (buttonLevels.size>0)
showlevel(buttonLevels.first());
}
public void selectnoone() {
@ -1154,10 +1151,14 @@ public class LevelScreen implements Screen {
TextDescriptive.setText(button.level.Description);
Victory.setVictory(button.level.Victory_orig);
button.setChecked(true);
buttonPlay.setVisible(false);
buttonPlay.setVisible(true);
}
else
{
Gdx.app.debug("wirechem-LevelScreen", "Raz button information");
buttonPlay.setVisible(false);
TextDescriptive.setVisible(false);
}
if (button!=null && (worlds.isDebug() || button.level.Maxcycle < 99999 && button.level.Maxcycle > 0)) {
cycle.setText(String.valueOf(button.level.Maxcycle));
cycle.setVisible(true);