feat: edition sans gestion des liens ni textarea

This commit is contained in:
Nicolas Hordé 2016-06-19 22:06:54 +02:00
parent 36191aa469
commit f513cd3473
5 changed files with 84 additions and 85 deletions

View File

@ -12,7 +12,6 @@ public class InitWorlds {
thelevels[0] = new Level( thelevels[0] = new Level(
0, 0,
0, 0,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"e0", new int[] { 0, 0, 0, 0, 0, 0 }, "e0", new int[] { 0, 0, 0, 0, 0, 0 },
@ -23,7 +22,6 @@ public class InitWorlds {
thelevels[1] = new Level( thelevels[1] = new Level(
0, 0,
1, 1,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"e0", new int[] { 0, 0, 0, 0, 0, 0 }, "e0", new int[] { 0, 0, 0, 0, 0, 0 },
@ -34,7 +32,6 @@ public class InitWorlds {
thelevels[2] = new Level( thelevels[2] = new Level(
0, 0,
2, 2,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"e0", new int[] { 0, 0, 0, 0, 0, 0 }, "e0", new int[] { 0, 0, 0, 0, 0, 0 },
@ -45,7 +42,6 @@ public class InitWorlds {
thelevels[3] = new Level( thelevels[3] = new Level(
0, 0,
3, 3,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"e+", new int[] { 0, 0, 0, 0, 0, 0 }, "e+", new int[] { 0, 0, 0, 0, 0, 0 },
@ -56,7 +52,6 @@ public class InitWorlds {
thelevels[4] = new Level( thelevels[4] = new Level(
0, 0,
4, 4,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"E-", new int[] { 0, 0, 0, 0, 0, 0 }, "E-", new int[] { 0, 0, 0, 0, 0, 0 },
@ -67,7 +62,6 @@ public class InitWorlds {
thelevels[5] = new Level( thelevels[5] = new Level(
0, 0,
5, 5,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"e0", new int[] { 0, 0, 0, 0, 0, 0 }, "e0", new int[] { 0, 0, 0, 0, 0, 0 },
@ -78,7 +72,6 @@ public class InitWorlds {
thelevels[6] = new Level( thelevels[6] = new Level(
0, 0,
6, 6,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"eX", new int[] { 0, 0, 0, 0, 0, 0 }, "eX", new int[] { 0, 0, 0, 0, 0, 0 },
@ -89,7 +82,6 @@ public class InitWorlds {
thelevels[7] = new Level( thelevels[7] = new Level(
0, 0,
7, 7,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"p", new int[] { 0, 0, 0, 0, 0, 0 }, "p", new int[] { 0, 0, 0, 0, 0, 0 },
@ -100,7 +92,6 @@ public class InitWorlds {
thelevels[8] = new Level( thelevels[8] = new Level(
0, 0,
8, 8,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"H", new int[] { 0, 0, 0, 0, 0, 0 }, "H", new int[] { 0, 0, 0, 0, 0, 0 },
@ -111,7 +102,6 @@ public class InitWorlds {
thelevels[9] = new Level( thelevels[9] = new Level(
1, 1,
0, 0,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"D", new int[] { 0, 0, 0, 0, 0, 0 }, "D", new int[] { 0, 0, 0, 0, 0, 0 },
@ -122,7 +112,6 @@ public class InitWorlds {
thelevels[10] = new Level( thelevels[10] = new Level(
1, 1,
1, 1,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"T", new int[] { 0, 0, 0, 0, 0, 0 }, "T", new int[] { 0, 0, 0, 0, 0, 0 },
@ -133,7 +122,6 @@ public class InitWorlds {
thelevels[11] = new Level( thelevels[11] = new Level(
1, 1,
2, 2,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"He", new int[] { 0, 0, 0, 0, 0, 0 }, "He", new int[] { 0, 0, 0, 0, 0, 0 },
@ -144,7 +132,6 @@ public class InitWorlds {
thelevels[12] = new Level( thelevels[12] = new Level(
1, 1,
3, 3,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"He", new int[] { 0, 0, 0, 0, 0, 0 }, "He", new int[] { 0, 0, 0, 0, 0, 0 },
@ -155,7 +142,6 @@ public class InitWorlds {
thelevels[13] = new Level( thelevels[13] = new Level(
1, 1,
4, 4,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"He", new int[] { 0, 0, 0, 0, 0, 0 }, "He", new int[] { 0, 0, 0, 0, 0, 0 },
@ -166,7 +152,6 @@ public class InitWorlds {
thelevels[14] = new Level( thelevels[14] = new Level(
1, 1,
5, 5,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Li", new int[] { 0, 0, 0, 0, 0, 0 }, "Li", new int[] { 0, 0, 0, 0, 0, 0 },
@ -177,7 +162,6 @@ public class InitWorlds {
thelevels[15] = new Level( thelevels[15] = new Level(
1, 1,
6, 6,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Be", new int[] { 0, 0, 0, 0, 0, 0 }, "Be", new int[] { 0, 0, 0, 0, 0, 0 },
@ -188,7 +172,6 @@ public class InitWorlds {
thelevels[16] = new Level( thelevels[16] = new Level(
1, 1,
7, 7,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"B", new int[] { 0, 0, 0, 0, 0, 0 }, "B", new int[] { 0, 0, 0, 0, 0, 0 },
@ -199,7 +182,6 @@ public class InitWorlds {
thelevels[17] = new Level( thelevels[17] = new Level(
1, 1,
8, 8,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"C", new int[] { 0, 0, 0, 0, 0, 0 }, "C", new int[] { 0, 0, 0, 0, 0, 0 },
@ -212,7 +194,6 @@ public class InitWorlds {
thelevels[18] = new Level( thelevels[18] = new Level(
2, 2,
0, 0,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"N", new int[] { 0, 0, 0, 0, 0, 0 }, "N", new int[] { 0, 0, 0, 0, 0, 0 },
@ -223,7 +204,6 @@ public class InitWorlds {
thelevels[19] = new Level( thelevels[19] = new Level(
2, 2,
1, 1,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"N", new int[] { 0, 0, 0, 0, 0, 0 }, "N", new int[] { 0, 0, 0, 0, 0, 0 },
@ -234,7 +214,6 @@ public class InitWorlds {
thelevels[20] = new Level( thelevels[20] = new Level(
2, 2,
2, 2,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"O", new int[] { 0, 0, 0, 0, 0, 0 }, "O", new int[] { 0, 0, 0, 0, 0, 0 },
@ -245,7 +224,6 @@ public class InitWorlds {
thelevels[21] = new Level( thelevels[21] = new Level(
2, 2,
3, 3,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"O", new int[] { 0, 0, 0, 0, 0, 0 }, "O", new int[] { 0, 0, 0, 0, 0, 0 },
@ -256,7 +234,6 @@ public class InitWorlds {
thelevels[22] = new Level( thelevels[22] = new Level(
2, 2,
4, 4,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"F", new int[] { 0, 0, 0, 0, 0, 0 }, "F", new int[] { 0, 0, 0, 0, 0, 0 },
@ -267,7 +244,6 @@ public class InitWorlds {
thelevels[23] = new Level( thelevels[23] = new Level(
2, 2,
5, 5,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Ne", new int[] { 0, 0, 0, 0, 0, 0 }, "Ne", new int[] { 0, 0, 0, 0, 0, 0 },
@ -278,7 +254,6 @@ public class InitWorlds {
thelevels[24] = new Level( thelevels[24] = new Level(
2, 2,
6, 6,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Ne", new int[] { 0, 0, 0, 0, 0, 0 }, "Ne", new int[] { 0, 0, 0, 0, 0, 0 },
@ -289,7 +264,6 @@ public class InitWorlds {
thelevels[25] = new Level( thelevels[25] = new Level(
2, 2,
7, 7,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Ne", new int[] { 0, 0, 0, 0, 0, 0 }, "Ne", new int[] { 0, 0, 0, 0, 0, 0 },
@ -300,7 +274,6 @@ public class InitWorlds {
thelevels[26] = new Level( thelevels[26] = new Level(
2, 2,
8, 8,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Na", new int[] { 0, 0, 0, 0, 0, 0 }, "Na", new int[] { 0, 0, 0, 0, 0, 0 },
@ -313,7 +286,6 @@ public class InitWorlds {
thelevels[27] = new Level( thelevels[27] = new Level(
3, 3,
0, 0,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Mg", new int[] { 0, 0, 0, 0, 0, 0 }, "Mg", new int[] { 0, 0, 0, 0, 0, 0 },
@ -323,7 +295,6 @@ public class InitWorlds {
thelevels[28] = new Level( thelevels[28] = new Level(
3, 3,
1, 1,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Mg", new int[] { 0, 0, 0, 0, 0, 0 }, "Mg", new int[] { 0, 0, 0, 0, 0, 0 },
@ -333,7 +304,6 @@ public class InitWorlds {
thelevels[29] = new Level( thelevels[29] = new Level(
3, 3,
2, 2,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Mg", new int[] { 0, 0, 0, 0, 0, 0 }, "Mg", new int[] { 0, 0, 0, 0, 0, 0 },
@ -343,7 +313,6 @@ public class InitWorlds {
thelevels[30] = new Level( thelevels[30] = new Level(
3, 3,
3, 3,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Al", new int[] { 0, 0, 0, 0, 0, 0 }, "Al", new int[] { 0, 0, 0, 0, 0, 0 },
@ -353,7 +322,6 @@ public class InitWorlds {
thelevels[31] = new Level( thelevels[31] = new Level(
3, 3,
4, 4,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Si", new int[] { 0, 0, 0, 0, 0, 0 }, "Si", new int[] { 0, 0, 0, 0, 0, 0 },
@ -363,7 +331,6 @@ public class InitWorlds {
thelevels[32] = new Level( thelevels[32] = new Level(
3, 3,
5, 5,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Si", new int[] { 0, 0, 0, 0, 0, 0 }, "Si", new int[] { 0, 0, 0, 0, 0, 0 },
@ -373,7 +340,6 @@ public class InitWorlds {
thelevels[33] = new Level( thelevels[33] = new Level(
3, 3,
6, 6,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Si", new int[] { 0, 0, 0, 0, 0, 0 }, "Si", new int[] { 0, 0, 0, 0, 0, 0 },
@ -383,7 +349,6 @@ public class InitWorlds {
thelevels[34] = new Level( thelevels[34] = new Level(
3, 3,
7, 7,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Si", new int[] { 0, 0, 0, 0, 0, 0 }, "Si", new int[] { 0, 0, 0, 0, 0, 0 },
@ -393,7 +358,6 @@ public class InitWorlds {
thelevels[35] = new Level( thelevels[35] = new Level(
3, 3,
8, 8,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"O", new int[] { 0, 0, 0, 0, 0, 0 }, "O", new int[] { 0, 0, 0, 0, 0, 0 },
@ -405,7 +369,6 @@ public class InitWorlds {
thelevels[36] = new Level( thelevels[36] = new Level(
4, 4,
0, 0,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"P", new int[] { 0, 0, 0, 0, 0, 0 }, "P", new int[] { 0, 0, 0, 0, 0, 0 },
@ -415,7 +378,6 @@ public class InitWorlds {
thelevels[37] = new Level( thelevels[37] = new Level(
4, 4,
1, 1,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"S", new int[] { 0, 0, 0, 0, 0, 0 }, "S", new int[] { 0, 0, 0, 0, 0, 0 },
@ -425,7 +387,6 @@ public class InitWorlds {
thelevels[38] = new Level( thelevels[38] = new Level(
4, 4,
2, 2,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"S", new int[] { 0, 0, 0, 0, 0, 0 }, "S", new int[] { 0, 0, 0, 0, 0, 0 },
@ -435,7 +396,6 @@ public class InitWorlds {
thelevels[39] = new Level( thelevels[39] = new Level(
4, 4,
3, 3,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"S", new int[] { 0, 0, 0, 0, 0, 0 }, "S", new int[] { 0, 0, 0, 0, 0, 0 },
@ -445,7 +405,6 @@ public class InitWorlds {
thelevels[40] = new Level( thelevels[40] = new Level(
4, 4,
4, 4,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"S", new int[] { 0, 0, 0, 0, 0, 0 }, "S", new int[] { 0, 0, 0, 0, 0, 0 },
@ -455,7 +414,6 @@ public class InitWorlds {
thelevels[41] = new Level( thelevels[41] = new Level(
4, 4,
5, 5,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Cl", new int[] { 0, 0, 0, 0, 0, 0 }, "Cl", new int[] { 0, 0, 0, 0, 0, 0 },
@ -465,7 +423,6 @@ public class InitWorlds {
thelevels[42] = new Level( thelevels[42] = new Level(
4, 4,
6, 6,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Cl", new int[] { 0, 0, 0, 0, 0, 0 }, "Cl", new int[] { 0, 0, 0, 0, 0, 0 },
@ -475,7 +432,6 @@ public class InitWorlds {
thelevels[43] = new Level( thelevels[43] = new Level(
4, 4,
7, 7,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Ar", new int[] { 0, 0, 0, 0, 0, 0 }, "Ar", new int[] { 0, 0, 0, 0, 0, 0 },
@ -485,7 +441,6 @@ public class InitWorlds {
thelevels[44] = new Level( thelevels[44] = new Level(
4, 4,
8, 8,
(int) (Math.random() * Integer.MAX_VALUE),
"", "",
"", "",
"Ar", new int[] { 0, 0, 0, 0, 0, 0 }, "Ar", new int[] { 0, 0, 0, 0, 0, 0 },

View File

@ -2,7 +2,7 @@ package fr.evolving.automata;
import java.io.Serializable; import java.io.Serializable;
public class Level implements Serializable { public class Level implements Serializable,Cloneable {
public String Name; public String Name;
public String Description; public String Description;
public String Element; public String Element;
@ -42,14 +42,14 @@ public class Level implements Serializable {
public transient boolean Locked; public transient boolean Locked;
public Level(int aWorld, int aLevel, int id, String Name, public Level(int aWorld, int aLevel, String Name,
String Description, String Element, int[] Current, int[] Victory, String Description, String Element, int[] Current, int[] Victory,
float X, float Y, int Tech, int Cout, Grid World, int Cycle, float X, float Y, int Tech, int Cout, Grid World, int Cycle,
int Temp, int Rayon, int Nrj, int Maxcycle, int Maxtemp, int Temp, int Rayon, int Nrj, int Maxcycle, int Maxtemp,
int Maxrayon, int Maxnrj, String Tuto, boolean Special, int[][] Link) { int Maxrayon, int Maxnrj, String Tuto, boolean Special, int[][] Link) {
this.aWorld = aWorld; this.aWorld = aWorld;
this.aLevel = aLevel; this.aLevel = aLevel;
this.id = id; this.id = (int) (Math.random() * Integer.MAX_VALUE);
this.Name = Name; this.Name = Name;
this.Description = Description; this.Description = Description;
this.Element = Element; this.Element = Element;
@ -73,4 +73,10 @@ public class Level implements Serializable {
this.Tuto = Tuto; this.Tuto = Tuto;
this.Link = Link; this.Link = Link;
} }
public Object clone() {
Level result = new Level(this.aWorld, this.aLevel, this.Name+" BIS", this.Description, this.Element, this.rewards.clone(), this.Victory_orig.clone(), this.X+100f, this.Y+100f, this.Tech, this.Cout_orig, (Grid)this.Grid_orig.clone(), this.Cycle_orig, this.Temp_orig, this.Rayon_orig, this.Nrj_orig, this.Maxcycle, this.Maxtemp, this.Maxrayon, this.Maxnrj, this.Tuto, this.Special, this.Link);
return result;
}
} }

View File

@ -233,7 +233,18 @@ public class Worlds extends Actor {
if (this.usedlevel!=null && this.usedlevel.aLevel==levelid) if (this.usedlevel!=null && this.usedlevel.aLevel==levelid)
this.usedlevel=null; this.usedlevel=null;
onchanged(level); onchanged(level);
this.showlevels(); }
}
public void dupLevel() {
dupLevel(usedlevel.aLevel);
}
public void dupLevel(int levelid) {
Level level=(Level) findLevel(levelid).clone();
if (level!=null) {
level.aLevel=getFreeLevel();
addLevel(level);
} }
} }
@ -243,7 +254,6 @@ public class Worlds extends Actor {
public void addLevel(Level level) { public void addLevel(Level level) {
levels.add(level); levels.add(level);
this.showlevels();
onchanged(level); onchanged(level);
} }
@ -308,10 +318,13 @@ public class Worlds extends Actor {
public void unLockLevel() { public void unLockLevel() {
AssetLoader.Datahandler.user().setLevelunlock(0, usedlevel.id); AssetLoader.Datahandler.user().setLevelunlock(0, usedlevel.id);
usedlevel.Locked=false;
} }
public void unLockLevel(int levelid) { public void unLockLevel(int levelid) {
AssetLoader.Datahandler.user().setLevelunlock(0, levelid); Level level=findLevel(levelid);
AssetLoader.Datahandler.user().setLevelunlock(0, level.id);
findLevel(levelid).Locked=false;
} }
public void set(String campaign) { public void set(String campaign) {

View File

@ -21,9 +21,11 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import fr.evolving.UI.ButtonLevel; import fr.evolving.UI.ButtonLevel;
@ -31,6 +33,7 @@ import fr.evolving.UI.Objectives;
import fr.evolving.UI.ServerList; import fr.evolving.UI.ServerList;
import fr.evolving.UI.Transhower; import fr.evolving.UI.Transhower;
import fr.evolving.UI.Translist; import fr.evolving.UI.Translist;
import fr.evolving.UI.VertiBarre;
import fr.evolving.UI.Worldlist; import fr.evolving.UI.Worldlist;
import fr.evolving.assets.AssetLoader; import fr.evolving.assets.AssetLoader;
import fr.evolving.assets.InitWorlds; import fr.evolving.assets.InitWorlds;
@ -53,7 +56,7 @@ public class LevelScreen implements Screen {
private Stage stage; private Stage stage;
private Table table; private Table table;
private WarningDialog dialog; private WarningDialog dialog;
private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer, finisher, deletelinker, deletebutton, addbutton; private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer, finisher, deletelinker, deletebutton, addbutton, unlocked, duplicate;
public Image MenuSolo, MenuMulti, MenuScenario; public Image MenuSolo, MenuMulti, MenuScenario;
private ImageTextButton cout, tech, cycle, temp, rayon, nrj, up_cycle, up_temp, up_rayon, up_nrj, research, up; 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 TextButton buttonConnect, buttonPlay, buttonStat, buttonSave, buttonApply, buttonPlaythis;
@ -63,6 +66,7 @@ public class LevelScreen implements Screen {
private TextArea TextDescriptive; private TextArea TextDescriptive;
public Worlds worlds; public Worlds worlds;
private Objectives Victory; private Objectives Victory;
private VerticalGroup vertibar;
public ButtonLevel selected; public ButtonLevel selected;
public int addervalue; public int addervalue;
public ButtonGroup chooser; public ButtonGroup chooser;
@ -151,26 +155,21 @@ public class LevelScreen implements Screen {
public ClickListener buttonLevelslistener() { public ClickListener buttonLevelslistener() {
return new ClickListener() { return 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.getListenerActor();
ButtonLevel abutton = (ButtonLevel) event
.getListenerActor();
Gdx.app.debug("wirechem-LevelScreen","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);
} }
public void exit(InputEvent event, float x, float y, public void exit(InputEvent event, float x, float y,int pointer, Actor fromActor) {
int pointer, Actor fromActor) { ButtonLevel abutton = (ButtonLevel) event.getListenerActor();
ButtonLevel abutton = (ButtonLevel) event
.getListenerActor();
Gdx.app.debug("wirechem-LevelScreen","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);
} }
public void touchDragged(InputEvent event, float x, public void touchDragged(InputEvent event, float x, float y, int pointer) {
float y, int pointer) {
ButtonLevel abutton = (ButtonLevel) event.getListenerActor(); ButtonLevel abutton = (ButtonLevel) event.getListenerActor();
if (worlds.isDebug()) { if (worlds.isDebug()) {
abutton.setPosition(event.getStageX() - 56, event.getStageY() - 20); abutton.setPosition(event.getStageX() - 56, event.getStageY() - 20);
@ -222,6 +221,7 @@ public class LevelScreen implements Screen {
buttonLevels.add(button); buttonLevels.add(button);
stage.addActor(button); stage.addActor(button);
button.addListener(buttonLevelslistener()); button.addListener(buttonLevelslistener());
showlevel(button);
return; return;
} }
LevelScreen.this.loadWorld(); LevelScreen.this.loadWorld();
@ -791,7 +791,23 @@ public class LevelScreen implements Screen {
//Group Debug //Group Debug
//********************************************************** //**********************************************************
Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Debug."); Gdx.app.debug("wirechem-LevelScreen", "Création du groupe Debug.");
deletebutton = new ImageButton(AssetLoader.Skin_level, "boss"); unlocked = new ImageButton(AssetLoader.Skin_level, "unlocked");
unlocked.setPosition(1460, 140);
unlocked.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.unLockLevel(selected.level.aLevel);
}
});
duplicate = new ImageButton(AssetLoader.Skin_level, "duplicate");
duplicate.setPosition(1460, 140);
duplicate.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.dupLevel(selected.level.aLevel);
}
});
deletebutton = new ImageButton(AssetLoader.Skin_level, "eraser");
deletebutton.setPosition(1460, 140); deletebutton.setPosition(1460, 140);
deletebutton.addListener(new ClickListener() { deletebutton.addListener(new ClickListener() {
@Override @Override
@ -817,13 +833,12 @@ public class LevelScreen implements Screen {
button.level.Link=links.toArray(); button.level.Link=links.toArray();
} }
Gdx.app.debug("wirechem-LevelScreen", "Destruction du bouton :"+selected.level.aLevel); Gdx.app.debug("wirechem-LevelScreen", "Destruction du bouton :"+selected.level.aLevel);
//buttonLevels.removeValue(selected, true);
worlds.delLevel(selected.level.aLevel); worlds.delLevel(selected.level.aLevel);
//selected.remove(); selectone();
} }
} }
}); });
deletelinker = new ImageButton(AssetLoader.Skin_level, "boss"); deletelinker = new ImageButton(AssetLoader.Skin_level, "cut");
deletelinker.setPosition(1560, 140); deletelinker.setPosition(1560, 140);
deletelinker.addListener(new ClickListener() { deletelinker.addListener(new ClickListener() {
@Override @Override
@ -842,7 +857,7 @@ public class LevelScreen implements Screen {
} }
} }
}); });
addbutton = new ImageButton(AssetLoader.Skin_level, "boss"); addbutton = new ImageButton(AssetLoader.Skin_level, "level");
addbutton.setPosition(1760, 540); addbutton.setPosition(1760, 540);
addbutton.addListener(new ClickListener() { addbutton.addListener(new ClickListener() {
@Override @Override
@ -850,7 +865,6 @@ public class LevelScreen implements Screen {
Level level=new Level( Level level=new Level(
worlds.getWorld(), worlds.getWorld(),
worlds.getFreeLevel(), worlds.getFreeLevel(),
(int) (Math.random() * Integer.MAX_VALUE),
"Unknown", "Unknown",
"Unknown", "Unknown",
"Uk", new int[] { 0, 0, 0, 0, 0, 0 }, "Uk", new int[] { 0, 0, 0, 0, 0, 0 },
@ -858,13 +872,9 @@ public class LevelScreen implements Screen {
(float)Math.random() * 750f, 0, 0, new Grid(3, 3), 0, 0, 0, 0, 99999, 99999, (float)Math.random() * 750f, 0, 0, new Grid(3, 3), 0, 0, 0, 0, 99999, 99999,
99999, 99999, "", false, new int[][] {{}}); 99999, 99999, "", false, new int[][] {{}});
worlds.addLevel(level); worlds.addLevel(level);
//ButtonLevel button=new ButtonLevel(level, AssetLoader.ratio, true);
//buttonLevels.add(button);
//stage.addActor(button);
//button.addListener(buttonLevelslistener());
} }
}); });
finisher = new ImageButton(AssetLoader.Skin_level, "boss"); finisher = new ImageButton(AssetLoader.Skin_level, "finish");
finisher.setSize(64, 64); finisher.setSize(64, 64);
finisher.setPosition(1560, 40); finisher.setPosition(1560, 40);
finisher.addListener(new ClickListener() { finisher.addListener(new ClickListener() {
@ -880,7 +890,7 @@ public class LevelScreen implements Screen {
} }
}); });
signer = new ImageButton(AssetLoader.Skin_level, "add"); signer = new ImageButton(AssetLoader.Skin_level, "add");
signer.setPosition(1660, 40); signer.setPosition(1280, AssetLoader.height-650);
signer.addListener(new ClickListener() { signer.addListener(new ClickListener() {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@ -899,7 +909,7 @@ public class LevelScreen implements Screen {
} }
}); });
adder = new ImageButton(AssetLoader.Skin_level, "add1"); adder = new ImageButton(AssetLoader.Skin_level, "add1");
adder.setPosition(1720, 40); adder.setPosition(1340, AssetLoader.height-650);
adder.addListener(new ClickListener() { adder.addListener(new ClickListener() {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@ -926,15 +936,22 @@ public class LevelScreen implements Screen {
worlds.save(worlds.getName()); worlds.save(worlds.getName());
} }
}); });
vertibar=new VerticalGroup();
vertibar.setPosition(1600, AssetLoader.height-500);
vertibar.center();
vertibar.addActor(databaseSave);
vertibar.space(20f);
vertibar.addActor(deletebutton);
vertibar.addActor(addbutton);
vertibar.addActor(duplicate);
vertibar.addActor(deletelinker);
vertibar.addActor(unlocked);
vertibar.addActor(finisher);
vertibar.addActor(databaseSave);
group_debug=new Group(); group_debug=new Group();
group_debug.addActor(databaseSave);
group_debug.addActor(adder); group_debug.addActor(adder);
group_debug.addActor(signer); group_debug.addActor(signer);
group_debug.addActor(finisher); group_debug.addActor(vertibar);
group_debug.addActor(deletelinker);
group_debug.addActor(deletebutton);
group_debug.addActor(addbutton);
//********************************************************** //**********************************************************
Gdx.app.debug("wirechem-LevelScreen", "Affichage du menu."); Gdx.app.debug("wirechem-LevelScreen", "Affichage du menu.");
@ -992,6 +1009,16 @@ public class LevelScreen implements Screen {
stage.dispose(); stage.dispose();
} }
public void selectone() {
for(ButtonLevel button: buttonLevels)
if (button!=null) {
selected=button;
selected.setChecked(true);
return;
}
return;
}
public void showlevel(ButtonLevel button) { public void showlevel(ButtonLevel button) {
if (button==null) if (button==null)
return; return;

View File

@ -64,10 +64,8 @@ public class SplashScreen implements Screen {
if (AssetLoader.manager != null) { if (AssetLoader.manager != null) {
batcher.begin(); batcher.begin();
batcher.setProjectionMatrix(AssetLoader.Camera.combined); batcher.setProjectionMatrix(AssetLoader.Camera.combined);
AssetLoader.empty.draw(batcher, (AssetLoader.width / 2) - 400f, AssetLoader.empty.draw(batcher, (AssetLoader.width / 2) - 400f, 150f, 800f, 50f);
150f, 800f, 50f); AssetLoader.full.draw(batcher, (AssetLoader.width / 2) - 400f, 150f, AssetLoader.manager.getProgress() * 800f, 50f);
AssetLoader.full.draw(batcher, (AssetLoader.width / 2) - 400f,
150f, AssetLoader.manager.getProgress() * 800f, 50f);
AssetLoader.manager.update(); AssetLoader.manager.update();
batcher.end(); batcher.end();
} }