fix: ajout du composant worldlist, affinage du système de gestion de base de donnée, correction de nombreux bogues, ajout du menu principal
This commit is contained in:
parent
7fe9f6804c
commit
2d8a6a7124
|
@ -1,6 +1,6 @@
|
|||
apply plugin: "java"
|
||||
|
||||
sourceCompatibility = 1.6
|
||||
sourceCompatibility = 1.7
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.badlogic.gdx.utils.Base64Coder;
|
|||
import com.badlogic.gdx.utils.XmlReader;
|
||||
import com.badlogic.gdx.utils.XmlReader.Element;
|
||||
|
||||
import fr.evolving.assets.AssetLoader;
|
||||
import fr.evolving.database.Base;
|
||||
import fr.evolving.database.Base.datatype;
|
||||
import fr.evolving.database.LocalBase;
|
||||
|
@ -25,6 +26,7 @@ public class ServerList extends List {
|
|||
HashMap parameters;
|
||||
String url;
|
||||
Base.datatype model;
|
||||
Worldlist list;
|
||||
|
||||
public ServerList(String url,Base.datatype model,Skin skin) {
|
||||
super(skin);
|
||||
|
@ -32,15 +34,18 @@ public class ServerList extends List {
|
|||
this.model=model;
|
||||
parameters = new HashMap();
|
||||
parameters.put("version", "last");
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public boolean getBackend(String base,datatype model) {
|
||||
String[] realbase=base.split(":");
|
||||
if (realbase[0].contains("mysql"))
|
||||
return SqlBase.isHandling(model);
|
||||
else
|
||||
return LocalBase.isHandling(model);
|
||||
public String getUrl() {
|
||||
return (String)this.getSelected();
|
||||
}
|
||||
|
||||
public Base.datatype getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setWorldlist(Worldlist list) {
|
||||
this.list=list;
|
||||
}
|
||||
|
||||
public void Refresh() {
|
||||
|
@ -65,13 +70,25 @@ public class ServerList extends List {
|
|||
XmlReader.Element xml_element = xml.parse(Response);
|
||||
resultxml= xml_element.getChildrenByName("server");
|
||||
for(Element child : resultxml)
|
||||
if (getBackend(child.getText(),ServerList.this.model))
|
||||
if (AssetLoader.Datahandler.isBackend(ServerList.this.model,child.getText()))
|
||||
resultstring.add(child.getText());
|
||||
String old=AssetLoader.Datahandler.getOld(ServerList.this.model);
|
||||
if (!resultstring.contains(old,false))
|
||||
resultstring.add(old);
|
||||
ServerList.this.setItems(resultstring);
|
||||
|
||||
ServerList.this.setSelectedIndex(resultstring.indexOf(old, false));
|
||||
if (list!=null && ServerList.this.model==Base.datatype.gamedata)
|
||||
list.Refresh();
|
||||
}
|
||||
@Override
|
||||
public void failed(Throwable t) {
|
||||
Array<String> resultstring=new Array<String>();
|
||||
String old=AssetLoader.Datahandler.getOld(ServerList.this.model);
|
||||
resultstring.add(old);
|
||||
ServerList.this.setItems(resultstring);
|
||||
ServerList.this.setSelectedIndex(resultstring.indexOf(old, false));
|
||||
if (list!=null && ServerList.this.model==Base.datatype.gamedata)
|
||||
list.Refresh();
|
||||
}
|
||||
|
||||
public void cancelled() {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package fr.evolving.UI;
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.List;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import fr.evolving.assets.AssetLoader;
|
||||
import fr.evolving.assets.Preference;
|
||||
|
||||
public class Worldlist extends List {
|
||||
|
||||
public Worldlist(Skin skin) {
|
||||
super(skin);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void Refresh() {
|
||||
Array<String> worlds=AssetLoader.Datahandler.game().getworlds();
|
||||
String world=Preference.prefs.getString("world");
|
||||
if (!worlds.contains(world, false))
|
||||
worlds.add(world);
|
||||
this.setItems(worlds);
|
||||
}
|
||||
}
|
|
@ -203,10 +203,14 @@ public class AssetLoader {
|
|||
Datahandler= new DatabaseManager();
|
||||
Datahandler.RegisterBackend(LocalBase.class);
|
||||
Datahandler.RegisterBackend(SqlBase.class);
|
||||
Datahandler.Attach(datatype.userdata, "local:test.db");
|
||||
Datahandler.Attach(datatype.statdata, "local:test.db");
|
||||
Datahandler.Attach(datatype.gamedata, "local:test.db");
|
||||
Databasemanagerfrompref();
|
||||
}
|
||||
|
||||
public static void Databasemanagerfrompref() {
|
||||
Datahandler.CloseAll();
|
||||
Datahandler.Attach(datatype.userdata, Preference.prefs.getString("userdata"));
|
||||
Datahandler.Attach(datatype.statdata, Preference.prefs.getString("statdata"));
|
||||
Datahandler.Attach(datatype.gamedata, Preference.prefs.getString("gamedata"));
|
||||
}
|
||||
|
||||
public static Transmuter getTransmuter(String Name) {
|
||||
|
|
|
@ -39,6 +39,9 @@ public class Preference {
|
|||
public static void defaults() {
|
||||
Vector2 maxres=getmaxresolution();
|
||||
Gdx.app.log("Preferences","Preference par defaut avec resolution native :"+maxres.x+"x"+maxres.y);
|
||||
Preference.prefs.putString("userdata", "local:test.db");
|
||||
Preference.prefs.putString("gamedata", "local:test.db");
|
||||
Preference.prefs.putString("statdata", "local:test.db");
|
||||
Preference.prefs.putInteger("ResolutionX", (int)maxres.x);
|
||||
Preference.prefs.putInteger("ResolutionY", (int)maxres.y);
|
||||
Preference.prefs.putInteger("Resolution", 9);
|
||||
|
@ -49,9 +52,10 @@ public class Preference {
|
|||
Preference.prefs.putBoolean("Refresh", false);
|
||||
Preference.prefs.putBoolean("Animation", true);
|
||||
Preference.prefs.putBoolean("Language", false);
|
||||
Preference.prefs.putString("world", "test pour voir");
|
||||
Preference.prefs.putFloat("Effect", 1.0f);
|
||||
Preference.prefs.putFloat("Music",0.75f);
|
||||
Preference.prefs.putInteger("Adaptation", 1);
|
||||
Preference.prefs.putInteger("Adaptation", 2);
|
||||
Preference.prefs.putInteger("Quality", 2);
|
||||
Preference.prefs.putInteger("log", Gdx.app.LOG_INFO);
|
||||
Preference.prefs.flush();
|
||||
|
|
|
@ -15,6 +15,10 @@ public abstract class Base {
|
|||
public Base() {
|
||||
}
|
||||
|
||||
public String getParam() {
|
||||
return null;
|
||||
}
|
||||
|
||||
//Gestion type Gamebase
|
||||
|
||||
public Array<String> getworlds() {
|
||||
|
|
|
@ -6,8 +6,13 @@ import com.badlogic.gdx.utils.Array;
|
|||
|
||||
public class DatabaseManager {
|
||||
private static Base[] bases;
|
||||
private static String[] old;
|
||||
private static Array<Class<?>> backends;
|
||||
|
||||
public Base getType(Base.datatype model) {
|
||||
return bases[model.ordinal()];
|
||||
}
|
||||
|
||||
public Base user(){
|
||||
return bases[Base.datatype.userdata.ordinal()];
|
||||
}
|
||||
|
@ -22,20 +27,29 @@ public class DatabaseManager {
|
|||
|
||||
public DatabaseManager(){
|
||||
bases=new Base[3];
|
||||
old=new String[3];
|
||||
backends=new Array<Class<?>>();
|
||||
}
|
||||
|
||||
public void CloseAll() {
|
||||
for(Base base:bases)
|
||||
base.Close();
|
||||
for(int i=0;i<3;i++)
|
||||
if (bases[i]!=null) {
|
||||
bases[i].Close();
|
||||
bases[i]=null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getOld(Base.datatype model) {
|
||||
return old[model.ordinal()];
|
||||
}
|
||||
|
||||
public boolean Attach(Base.datatype model, String Url) {
|
||||
if (bases[model.ordinal()]!=null)
|
||||
if (bases[model.ordinal()]!=null || model==null || Url==null)
|
||||
return false;
|
||||
Base backend=getBackend(model,Url);
|
||||
if (backend!=null) {
|
||||
bases[model.ordinal()]=backend;
|
||||
old[model.ordinal()]=Url;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -61,7 +75,23 @@ public class DatabaseManager {
|
|||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isBackend(Base.datatype model, String Url) {
|
||||
String Type=Url.split(":")[0];
|
||||
for(Class<?> classe:backends) {
|
||||
Base back;
|
||||
try {
|
||||
back = (Base) classe.newInstance();
|
||||
if (back.getprefix().equals(Type))
|
||||
return true;
|
||||
} catch (InstantiationException | IllegalAccessException
|
||||
| IllegalArgumentException | SecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RegisterBackend(Class<?> classe) {
|
||||
|
|
|
@ -2,19 +2,26 @@ package fr.evolving.database;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import com.badlogic.gdx.Files.FileType;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.sql.Database;
|
||||
import com.badlogic.gdx.sql.DatabaseCursor;
|
||||
import com.badlogic.gdx.sql.DatabaseFactory;
|
||||
import com.badlogic.gdx.sql.SQLiteGdxException;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import fr.evolving.assets.AssetLoader;
|
||||
import fr.evolving.automata.Grid;
|
||||
import fr.evolving.automata.Level;
|
||||
import fr.evolving.automata.Transmuter;
|
||||
|
@ -24,16 +31,40 @@ public class LocalBase extends Base {
|
|||
private static Database dbHandler;
|
||||
private String databasename = "base.db";
|
||||
private String creation;
|
||||
private String param;
|
||||
|
||||
//Contructeur de la base de donnée
|
||||
|
||||
public String getParam() {
|
||||
return this.param;
|
||||
}
|
||||
|
||||
public LocalBase() {
|
||||
}
|
||||
|
||||
public LocalBase(datatype model,String param) {
|
||||
super(model,param);
|
||||
String[] params=param.split(":");
|
||||
this.param=param;
|
||||
if (params.length>1)
|
||||
databasename=params[1];
|
||||
switch(Gdx.app.getType()) {
|
||||
case Android:
|
||||
try {
|
||||
FileChannel source = ((FileInputStream) Gdx.files.internal("bases/"+databasename).read()).getChannel();
|
||||
FileChannel destination = new FileOutputStream("/data/data/fr.evolving.game.android/databases/"+databasename).getChannel();
|
||||
destination.transferFrom(source, 0, source.size());
|
||||
source.close();
|
||||
destination.close();
|
||||
} catch (IOException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
case Desktop:
|
||||
FileHandle newbase=Gdx.files.local(databasename);
|
||||
if (!newbase.exists())
|
||||
Gdx.files.internal("bases/"+databasename).copyTo(newbase);
|
||||
}
|
||||
if (dbHandler!=null)
|
||||
Gdx.app.log("Local", "Reprise de la base '"+databasename+"', table:"+model.toString());
|
||||
else
|
||||
|
@ -292,7 +323,10 @@ public class LocalBase extends Base {
|
|||
|
||||
public void Close() {
|
||||
try {
|
||||
if (dbHandler!=null) {
|
||||
dbHandler.closeDatabase();
|
||||
dbHandler=null;
|
||||
}
|
||||
} catch (SQLiteGdxException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -12,6 +12,13 @@ public class SqlBase extends Base{
|
|||
super(model,param);
|
||||
}
|
||||
|
||||
public SqlBase() {
|
||||
}
|
||||
|
||||
public String getprefix() {
|
||||
return "mysql";
|
||||
}
|
||||
|
||||
public static boolean isHandling(datatype base){
|
||||
if (base==datatype.statdata)
|
||||
return false;
|
||||
|
|
|
@ -68,6 +68,7 @@ public class LevelRenderer {
|
|||
public void render(float delta, float runTime) {
|
||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
|
||||
if (LevelScreen.world>=0)
|
||||
font.setColor(AssetLoader.Levelcolors[LevelScreen.world]);
|
||||
batcher.begin();
|
||||
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||
|
@ -113,6 +114,7 @@ public class LevelRenderer {
|
|||
if (LevelScreen.selected.level.Tech>0)
|
||||
shapeRenderer.rect(1210, 620,250, AssetLoader.height-630);
|
||||
}
|
||||
if (!LevelScreen.MenuSolo.isVisible())
|
||||
shapeRenderer.rect(1470, 10, 440, AssetLoader.height-20);
|
||||
shapeRenderer.end();
|
||||
if (LevelScreen.buttonLevels!=null)
|
||||
|
|
|
@ -30,12 +30,14 @@ import fr.evolving.renderers.LevelRenderer;
|
|||
import fr.evolving.UI.ButtonLevel;
|
||||
import fr.evolving.UI.Objectives;
|
||||
import fr.evolving.UI.ServerList;
|
||||
import fr.evolving.UI.Worldlist;
|
||||
import fr.evolving.game.main;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import fr.evolving.assets.AssetLoader;
|
||||
import fr.evolving.assets.InitWorlds;
|
||||
import fr.evolving.assets.Preference;
|
||||
import fr.evolving.automata.Level;
|
||||
import fr.evolving.automata.Transmuter;
|
||||
import fr.evolving.database.Base;
|
||||
|
@ -54,11 +56,12 @@ public class LevelScreen implements Screen {
|
|||
private Stage stage;
|
||||
private Table table;
|
||||
private ImageButton Previous,Next,Exit;
|
||||
public ImageButton logosmall;
|
||||
public ImageButton logosmall,MenuSolo,MenuMulti,MenuScenario;
|
||||
private ImageTextButton cout,tech,cycle,temp,rayon,nrj;
|
||||
private TextButton buttonConnect,buttonPlay,buttonStat;
|
||||
private TextButton buttonConnect,buttonPlay,buttonStat,buttonSave, buttonApply, buttonPlaythis;
|
||||
private ServerList Statdata,Userdata,Gamedata;
|
||||
private Label Statdatalabel, Userdatalabel, Gamedatalabel;
|
||||
private Worldlist Worlddata;
|
||||
private Label Statdatalabel, Userdatalabel, Gamedatalabel,Worlddatalabel;
|
||||
private Array<Level> thelevels;
|
||||
private TextArea TextDescriptive;
|
||||
public int world;
|
||||
|
@ -74,7 +77,29 @@ public class LevelScreen implements Screen {
|
|||
return max;
|
||||
}
|
||||
|
||||
public void play() {
|
||||
//thelevels= InitWorlds.go();
|
||||
Gdx.app.debug(getClass().getSimpleName(),"Chargement des mondes depuis la base.");
|
||||
try {
|
||||
if (world<0)
|
||||
world=0;
|
||||
thelevels=AssetLoader.Datahandler.game().getworld(Preference.prefs.getString("world"));
|
||||
loadWorld(world);
|
||||
Previous.setVisible(true);
|
||||
Next.setVisible(true);
|
||||
buttonPlay.setVisible(true);
|
||||
TextDescriptive.setVisible(true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Previous.setVisible(false);
|
||||
Next.setVisible(false);
|
||||
buttonPlay.setVisible(false);
|
||||
TextDescriptive.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void menu() {
|
||||
selected=null;
|
||||
cout.setVisible(false);
|
||||
tech.setVisible(false);
|
||||
cycle.setVisible(false);
|
||||
|
@ -83,10 +108,44 @@ public class LevelScreen implements Screen {
|
|||
nrj.setVisible(false);
|
||||
Previous.setVisible(false);
|
||||
Next.setVisible(false);
|
||||
Exit.setVisible(false);
|
||||
Victory.setVisible(false);
|
||||
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);
|
||||
if (buttonLevels!=null)
|
||||
for (int j=0;j<10;j++)
|
||||
if (buttonLevels[j]!=null) {
|
||||
buttonLevels[j].remove();
|
||||
buttonLevels[j]=null;
|
||||
}
|
||||
}
|
||||
|
||||
public void level() {
|
||||
Exit.setPosition(1110, AssetLoader.height-Exit.getHeight()-5);
|
||||
MenuSolo.setVisible(false);
|
||||
MenuMulti.setVisible(false);
|
||||
MenuScenario.setVisible(false);
|
||||
buttonConnect.setVisible(true);
|
||||
buttonStat.setVisible(true);
|
||||
SetButtonStat();
|
||||
if (Preference.prefs.contains("world"))
|
||||
play();
|
||||
}
|
||||
|
||||
public void SetButtonConnect() {
|
||||
|
@ -98,6 +157,11 @@ public class LevelScreen implements Screen {
|
|||
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() {
|
||||
|
@ -109,6 +173,11 @@ public class LevelScreen implements Screen {
|
|||
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(int aworld) {
|
||||
|
@ -117,6 +186,7 @@ public class LevelScreen implements Screen {
|
|||
for (int j=0;j<10;j++) {
|
||||
if (buttonLevels[j]!=null) {
|
||||
buttonLevels[j].remove();
|
||||
buttonLevels[j]=null;
|
||||
}
|
||||
}
|
||||
buttonLevels = null;
|
||||
|
@ -176,11 +246,44 @@ public class LevelScreen implements Screen {
|
|||
}
|
||||
};
|
||||
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
|
||||
Gdx.app.debug(getClass().getSimpleName(),"Création du menu.");
|
||||
MenuSolo=new ImageButton(AssetLoader.Skin_level,"MenuSolo");
|
||||
MenuSolo.setPosition((AssetLoader.width-MenuSolo.getWidth())/2, AssetLoader.height-550);
|
||||
MenuSolo.addListener(new ClickListener() {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
level();
|
||||
}
|
||||
});
|
||||
MenuMulti=new ImageButton(AssetLoader.Skin_level,"MenuMulti");
|
||||
MenuMulti.setPosition((AssetLoader.width-MenuMulti.getWidth())/2, AssetLoader.height-900);
|
||||
MenuScenario=new ImageButton(AssetLoader.Skin_level,"MenuScenario");
|
||||
MenuScenario.setPosition((AssetLoader.width-MenuScenario.getWidth())/2, AssetLoader.height-1250);
|
||||
Gdx.app.debug(getClass().getSimpleName(),"Création des boutons.");
|
||||
logosmall=new ImageButton(AssetLoader.Skin_level,"logosmall");
|
||||
logosmall.setPosition(20, AssetLoader.height-175+logosmall.getHeight()/2);
|
||||
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,"Descriptif");
|
||||
TextDescriptive.setBounds(15, 15, 1185, 100);
|
||||
buttonApply = new TextButton("Appliquer", AssetLoader.Skin_ui);
|
||||
buttonApply.setBounds(1680, 350, 190, 40);
|
||||
buttonApply.addListener(new ClickListener() {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
menu();
|
||||
AssetLoader.Datahandler.CloseAll();
|
||||
AssetLoader.Datahandler.Attach(Userdata.getModel(),Userdata.getUrl());
|
||||
AssetLoader.Datahandler.Attach(Gamedata.getModel(),Gamedata.getUrl());
|
||||
AssetLoader.Datahandler.Attach(Statdata.getModel(),Statdata.getUrl());
|
||||
}
|
||||
});
|
||||
buttonSave = new TextButton("Sauvegarder", 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());
|
||||
}
|
||||
});
|
||||
buttonConnect = new TextButton("Connexions", AssetLoader.Skin_ui);
|
||||
buttonConnect.setBounds(1480, AssetLoader.height-60, 190, 40);
|
||||
buttonConnect.addListener(new ClickListener() {
|
||||
|
@ -205,6 +308,15 @@ public class LevelScreen implements Screen {
|
|||
SetButtonStat();
|
||||
}
|
||||
});
|
||||
buttonPlaythis = new TextButton("Jouer ce monde", AssetLoader.Skin_ui);
|
||||
buttonPlaythis.setBounds(1480, 50, 190, 40);
|
||||
buttonPlaythis.addListener(new ClickListener() {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
Preference.prefs.putString("world", (String)Worlddata.getSelected());
|
||||
Preference.prefs.flush();
|
||||
play();
|
||||
}
|
||||
});
|
||||
Exit=new ImageButton(AssetLoader.Skin_level,"Exit");
|
||||
Exit.setPosition(1110, AssetLoader.height-Exit.getHeight()-5);
|
||||
Exit.addListener(new ClickListener(){
|
||||
|
@ -256,24 +368,29 @@ public class LevelScreen implements Screen {
|
|||
String url="http://evolving.fr/servers/list.xml";
|
||||
Statdata=new ServerList(url,Base.datatype.statdata,AssetLoader.Skin_ui);
|
||||
Statdatalabel=new Label("Stockage des statistiques:", AssetLoader.Skin_ui, "grey");
|
||||
Statdata.setBounds(1480, AssetLoader.height-300, 420, 200);
|
||||
Statdata.setBounds(1480, AssetLoader.height-250, 420, 150);
|
||||
Statdatalabel.setPosition(1480, AssetLoader.height-100);
|
||||
Userdata=new ServerList(url,Base.datatype.userdata,AssetLoader.Skin_ui);
|
||||
Userdatalabel=new Label("Stockage des données du joueur:", AssetLoader.Skin_ui, "grey");
|
||||
Userdata.setBounds(1480, AssetLoader.height-600, 420, 200);
|
||||
Userdatalabel.setPosition(1480, AssetLoader.height-400);
|
||||
Userdata.setBounds(1480, AssetLoader.height-450, 420, 150);
|
||||
Userdatalabel.setPosition(1480, AssetLoader.height-300);
|
||||
Gamedata=new ServerList(url,Base.datatype.gamedata,AssetLoader.Skin_ui);
|
||||
Gamedatalabel=new Label("Stockage des données du jeu:", AssetLoader.Skin_ui, "grey");
|
||||
Gamedata.setBounds(1480, AssetLoader.height-900, 420, 200);
|
||||
Gamedatalabel.setPosition(1480, AssetLoader.height-700);
|
||||
Gamedata.setBounds(1480, AssetLoader.height-650, 420, 150);
|
||||
Gamedatalabel.setPosition(1480, AssetLoader.height-500);
|
||||
Worlddata=new Worldlist(AssetLoader.Skin_ui);
|
||||
Worlddatalabel=new Label("Mondes disponibles:", AssetLoader.Skin_ui, "grey");
|
||||
Worlddata.setBounds(1480, 100, 420, 200);
|
||||
Worlddatalabel.setPosition(1480, 300);
|
||||
Gamedata.setWorldlist(Worlddata);
|
||||
Statdata.Refresh();
|
||||
Userdata.Refresh();
|
||||
Gamedata.Refresh();
|
||||
Gdx.app.debug(getClass().getSimpleName(),"Affichage du menu.");
|
||||
//menu();
|
||||
|
||||
//thelevels= InitWorlds.go();
|
||||
|
||||
Gdx.app.debug(getClass().getSimpleName(),"Chargement des mondes depuis la base.");
|
||||
thelevels=AssetLoader.Datahandler.game().getworld("test pour voir");
|
||||
loadWorld(world);
|
||||
if (aworld!=-1)
|
||||
level();
|
||||
else
|
||||
menu();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -293,9 +410,15 @@ public class LevelScreen implements Screen {
|
|||
public void show() {
|
||||
Gdx.app.log("*****","Affichage du choix des mondes & niveaux.");
|
||||
table.setFillParent(true);
|
||||
stage.addActor(MenuSolo);
|
||||
stage.addActor(MenuMulti);
|
||||
stage.addActor(MenuScenario);
|
||||
stage.addActor(TextDescriptive);
|
||||
stage.addActor(buttonPlaythis);
|
||||
stage.addActor(Exit);
|
||||
stage.addActor(Next);
|
||||
stage.addActor(buttonApply);
|
||||
stage.addActor(buttonSave);
|
||||
stage.addActor(buttonPlay);
|
||||
stage.addActor(buttonConnect);
|
||||
stage.addActor(buttonStat);
|
||||
|
@ -314,6 +437,8 @@ public class LevelScreen implements Screen {
|
|||
stage.addActor(Userdatalabel);
|
||||
stage.addActor(Gamedata);
|
||||
stage.addActor(Gamedatalabel);
|
||||
stage.addActor(Worlddata);
|
||||
stage.addActor(Worlddatalabel);
|
||||
Gdx.input.setInputProcessor(stage);
|
||||
Gdx.app.debug("AssetLoader","Début dans la bande son \'intro\'");
|
||||
AssetLoader.intro.setLooping(true);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SplashScreen implements Screen {
|
|||
}),Actions.run(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((Game)Gdx.app.getApplicationListener()).setScreen(new LevelScreen(0));
|
||||
((Game)Gdx.app.getApplicationListener()).setScreen(new LevelScreen(-1));
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue