feat: ajout d'options pour la grille et d'une icone modification comportement de la grille ajout de multiples traductions

This commit is contained in:
Nicolas Hordé 2016-01-25 21:42:31 +01:00
parent e64c410598
commit 6fc66860ed
9 changed files with 132 additions and 91 deletions

View File

@ -4,6 +4,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game; import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Batch;
@ -19,6 +20,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.utils.reflect.Method; import com.badlogic.gdx.utils.reflect.Method;
import fr.evolving.assets.AssetLoader; import fr.evolving.assets.AssetLoader;
import fr.evolving.assets.Preference;
import fr.evolving.screens.GameScreen; import fr.evolving.screens.GameScreen;
import fr.evolving.screens.GameScreen.calling; import fr.evolving.screens.GameScreen.calling;
@ -105,9 +107,10 @@ public class HorizBarre extends Actor {
} }
}); });
} }
Barre[15].setChecked(Gdx.graphics.isFullscreen()); Barre[15].setChecked(Preference.prefs.getBoolean("Fullscreen"));
Barre[16].setChecked(AssetLoader.intro.getVolume() > 0); Barre[16].setChecked(Preference.prefs.getBoolean("Sound"));
Barre[17].setChecked(AssetLoader.Tooltipmanager.enabled == true); Barre[17].setChecked(Preference.prefs.getBoolean("Tutorial"));
Barre[18].setChecked(Preference.prefs.getBoolean("Grid"));
table = new HorizontalGroup(); table = new HorizontalGroup();
table.bottom().padLeft(5f).padBottom(8f).space(10f); table.bottom().padLeft(5f).padBottom(8f).space(10f);
this.setTouchable(Touchable.enabled); this.setTouchable(Touchable.enabled);

View File

@ -94,8 +94,7 @@ public class Menu extends Actor {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
Vector2 coords = screentoworld(x, y); Vector2 coords = screentoworld(x, y);
MapProperties tile = getMenubyTile((int) coords.x, MapProperties tile = getMenubyTile((int) coords.x,(int) coords.y);
(int) coords.y);
if (tile != null && tile.containsKey("name")) { if (tile != null && tile.containsKey("name")) {
selected_transmuter=null; selected_transmuter=null;
EraseSurtile(); EraseSurtile();
@ -266,8 +265,8 @@ public class Menu extends Actor {
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(54)); cell.setTile(AssetLoader.tileSet.getTile(54));*/
layer.setCell(x, y, cell); layer.setCell(x, y, cell);
} }
} }
@ -356,7 +355,7 @@ public class Menu extends Actor {
public MapProperties getMenubyTile(int x, int y) { public MapProperties getMenubyTile(int x, int y) {
Cell cell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(0)).getCell(x, y); Cell cell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(0)).getCell(x, y);
if (cell != null) if (cell != null && cell.getTile()!=null)
return cell.getTile().getProperties(); return cell.getTile().getProperties();
else else
return null; return null;

View File

@ -38,6 +38,7 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
private float viewwidth, viewheight, decx, decy; private float viewwidth, viewheight, decx, decy;
private String selected; private String selected;
private boolean mapexit; private boolean mapexit;
private int clearsprite;
public TouchMaptiles(Level level, int sizex, int sizey) { public TouchMaptiles(Level level, int sizex, int sizey) {
this.level = level; this.level = level;
@ -104,6 +105,15 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
public void setSelected(String selected) { public void setSelected(String selected) {
this.selected=selected; this.selected=selected;
} }
public void setClearsprite(int sprite) {
this.clearsprite=sprite;
}
public int getClearsprite() {
return this.clearsprite;
}
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 / AssetLoader.width * camera.viewportWidth) + decx);
@ -141,7 +151,7 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
} }
} }
public void redraw(int tile) { 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,
@ -149,7 +159,7 @@ public class TouchMaptiles extends Actor implements GestureListener,InputProcess
((TiledMapTileLayer) map.getLayers().get(1)).getCell((int) x, ((TiledMapTileLayer) map.getLayers().get(1)).getCell((int) x,
(int) y).setTile(null); (int) y).setTile(null);
((TiledMapTileLayer) map.getLayers().get(0)).getCell((int) x, ((TiledMapTileLayer) map.getLayers().get(0)).getCell((int) x,
(int) y).setTile(AssetLoader.tileSet.getTile(tile)); (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++) {

View File

@ -13,12 +13,12 @@ public class WarnDialog extends Dialog {
Label thelabel; Label thelabel;
public WarnDialog(Skin skin) { public WarnDialog(Skin skin) {
super("Informations", skin); super(AssetLoader.language.get("[dialog-window]"), skin);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
this.getContentTable() this.getContentTable()
.add(new ImageButton(AssetLoader.Skin_level, "Warnerbros")) .add(new ImageButton(AssetLoader.Skin_level, "Warnerbros"))
.left(); .left();
thelabel = new Label("MenuScenario", AssetLoader.Skin_level); thelabel = new Label("", AssetLoader.Skin_level);
this.getContentTable().add(thelabel).right(); this.getContentTable().add(thelabel).right();
this.setModal(true); this.setModal(true);
this.button("Ok"); this.button("Ok");

View File

@ -185,15 +185,7 @@ public class AssetLoader {
} }
} }
} }
Gdx.app.debug("AssetLoader", "Ajout de la gestion des locales");
FileHandle baseFileHandle = Gdx.files.internal("i18n/messages/messages");
usa = I18NBundle.createBundle(baseFileHandle, new Locale("en"));
french = I18NBundle.createBundle(baseFileHandle, new Locale("fr"));
if (Preference.prefs.getBoolean("Language"))
language = french;
else
language = usa;
I18NBundle.setExceptionOnMissingKey(true);
Gdx.app.debug("AssetLoader", "Ajout des transmuters"); Gdx.app.debug("AssetLoader", "Ajout des transmuters");
allTransmuter = new Array<Transmuter>(); allTransmuter = new Array<Transmuter>();
allTransmuter.add(new Positiver(null)); allTransmuter.add(new Positiver(null));
@ -299,9 +291,18 @@ public class AssetLoader {
} }
public static void load() { public static void load() {
Gdx.app.debug("AssetLoader", "Ajout de la gestion des locales");
FileHandle baseFileHandle = Gdx.files.internal("i18n/messages/messages");
usa = I18NBundle.createBundle(baseFileHandle, new Locale("en"));
french = I18NBundle.createBundle(baseFileHandle, new Locale("fr"));
if (Preference.prefs.getBoolean("Language"))
language = french;
else
language = usa;
I18NBundle.setExceptionOnMissingKey(true);
Gdx.app.debug("AssetLoader", "Réglage de la qualité des textures"); Gdx.app.debug("AssetLoader", "Réglage de la qualité des textures");
quality = GameScreen.quality.values()[Preference.prefs quality = GameScreen.quality.values()[Preference.prefs.getInteger("Quality")].getQuality();
.getInteger("Quality")].getQuality();
Gdx.app.debug("AssetLoader", "Chargements des éléments minimalistes"); Gdx.app.debug("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);

View File

@ -50,6 +50,7 @@ public class Preference {
Preference.prefs.putBoolean("Refresh", false); Preference.prefs.putBoolean("Refresh", false);
Preference.prefs.putBoolean("Animation", true); Preference.prefs.putBoolean("Animation", true);
Preference.prefs.putBoolean("Language", false); Preference.prefs.putBoolean("Language", false);
Preference.prefs.putBoolean("Grid", false);
Preference.prefs.putString("world", "test pour voir"); Preference.prefs.putString("world", "test pour voir");
Preference.prefs.putFloat("Effect", 1.0f); Preference.prefs.putFloat("Effect", 1.0f);
Preference.prefs.putFloat("Music", 0.75f); Preference.prefs.putFloat("Music", 0.75f);

View File

@ -25,8 +25,17 @@ public class LevelRenderer {
Laser Laser; Laser Laser;
public TextureRegion Texture_logobig; public TextureRegion Texture_logobig;
BitmapFont font; BitmapFont font;
String reward,goal,ressource,handicap;
public LevelRenderer(LevelScreen LevelScreen) { public LevelRenderer(LevelScreen LevelScreen) {
this.reward=AssetLoader.language.get("[reward-levelscreen]");
this.goal=AssetLoader.language.get("[goal-levelscreen]");
this.ressource=AssetLoader.language.get("[ressource-levelscreen]");
this.handicap=AssetLoader.language.get("[handicap-levelscreen]");
this.LevelScreen = LevelScreen; this.LevelScreen = LevelScreen;
this.scrollx = 0; this.scrollx = 0;
this.scrolly = 0; this.scrolly = 0;
@ -84,15 +93,15 @@ public class LevelRenderer {
if (LevelScreen.selected != null) { if (LevelScreen.selected != null) {
font.draw(batcher2, LevelScreen.selected.level.Name, 15, 145); font.draw(batcher2, LevelScreen.selected.level.Name, 15, 145);
if (LevelScreen.selected.level.Tech > 0) if (LevelScreen.selected.level.Tech > 0)
font.draw(batcher2, "Recompenses", 1215, font.draw(batcher2, this.reward, 1215,
AssetLoader.height - 15); AssetLoader.height - 15);
if (LevelScreen.selected.level.Cout > 0) { if (LevelScreen.selected.level.Cout > 0) {
font.draw(batcher2, "Ressources", 1215, 145); font.draw(batcher2, this.ressource, 1215, 145);
font.draw(batcher2, "Objectifs", 1215, 295); font.draw(batcher2, this.goal, 1215, 295);
} }
if (LevelScreen.selected.level.aWorld > 0) if (LevelScreen.selected.level.aWorld > 0)
font.draw(batcher2, "Handicaps", 1215, 605); font.draw(batcher2, this.handicap, 1215, 605);
font.draw(batcher2, "", 1215, 145); font.draw(batcher2, "", 1215, 145);
} }
batcher2.end(); batcher2.end();

View File

@ -79,7 +79,7 @@ public class GameScreen implements Screen {
public Level level; public Level level;
private Window winOptions, winSave; private Window winOptions, winSave;
private CheckBox SetSound, SetVsynch, SetFullscreen, SetAnimation, Settuto, private CheckBox SetSound, SetVsynch, SetFullscreen, SetAnimation, Settuto,
Setdebog, Setrefresh; Setdebog, Setgrid, Setrefresh;
private Slider SetEffectvolume, SetMusicvolume; private Slider SetEffectvolume, SetMusicvolume;
private TextButton Setcancel, Setsave; private TextButton Setcancel, Setsave;
private SelectBox<resolutions> selResolution; private SelectBox<resolutions> selResolution;
@ -93,7 +93,7 @@ public class GameScreen implements Screen {
info_cout, info_tech, info_research, info_activation; info_cout, info_tech, info_research, info_activation;
String[] tocreate = { "run", "stop", "speed", "separator", "move#", "zoomp#", String[] tocreate = { "run", "stop", "speed", "separator", "move#", "zoomp#",
"zoomm#", "infos#", "separator", "raz", "save", "levels", "tree", "zoomm#", "infos#", "separator", "raz", "save", "levels", "tree",
"exits", "separator", "screen", "sound", "tuto", "settings", "exits", "separator", "screen", "sound", "tuto", "grid", "settings",
"separator", "stat" }; "separator", "stat" };
private ButtonLevel buttonlevel; private ButtonLevel buttonlevel;
private Objectives objectives; private Objectives objectives;
@ -111,8 +111,8 @@ public class GameScreen implements Screen {
}; };
public enum quality { public enum quality {
Bas("Bas", TextureFilter.Nearest), Moyen("Moyen", TextureFilter.MipMap), Eleve( Bas(AssetLoader.language.get("[quality-gamescreen-low]"), TextureFilter.Nearest), Moyen(AssetLoader.language.get("[quality-gamescreen-medium]"), TextureFilter.MipMap), Eleve(
"Eleve", TextureFilter.Linear); AssetLoader.language.get("[quality-gamescreen-high]"), TextureFilter.Linear);
private final String text; private final String text;
private final TextureFilter aquality; private final TextureFilter aquality;
@ -132,7 +132,7 @@ public class GameScreen implements Screen {
}; };
public enum adaptation { public enum adaptation {
fit("Aspect conserve"), fill("Remplissage"); fit(AssetLoader.language.get("[adaptation-gamescreen-fit]")), fill(AssetLoader.language.get("[adaptation-gamescreen-fill]"));
private final String text; private final String text;
private adaptation(final String text) { private adaptation(final String text) {
@ -169,7 +169,7 @@ public class GameScreen implements Screen {
@Override @Override
public String toString() { public String toString() {
if (full) if (full)
return text + " Fullscreen"; return text + " "+AssetLoader.language.get("[resolutions-gamescreen-fullscreen]");
else else
return text; return text;
} }
@ -223,7 +223,7 @@ public class GameScreen implements Screen {
Gdx.app.debug("Barre", "Element changé"); Gdx.app.debug("Barre", "Element changé");
hideInfo(); hideInfo();
map.tempclear(); map.tempclear();
map.fillempty(60); //map.fillempty(60);
menu.unSelect(); menu.unSelect();
map.setSelected(getselected()); map.setSelected(getselected());
} }
@ -280,7 +280,7 @@ public class GameScreen implements Screen {
GameScreen.this.level.Grid = GameScreen.this.level.Grid_orig; GameScreen.this.level.Grid = GameScreen.this.level.Grid_orig;
level.Grid.tiling_copper(); level.Grid.tiling_copper();
level.Grid.tiling_transmuter(); level.Grid.tiling_transmuter();
map.redraw(53); map.redraw();
buttonlevel.setChecked(false); buttonlevel.setChecked(false);
} }
}); });
@ -335,8 +335,12 @@ 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(getClass().getSimpleName(), "Création d'une tilemap");
map = new TouchMaptiles(level, 128, 128); map = new TouchMaptiles(level, 128, 128);
if (Preference.prefs.getBoolean("Grid"))
map.setClearsprite(60);
else
map.setClearsprite(53);
map.setBounds(0, 0, AssetLoader.width, AssetLoader.height); map.setBounds(0, 0, AssetLoader.width, AssetLoader.height);
map.redraw(53); map.redraw();
Gdx.app.debug(getClass().getSimpleName(), "Création du menu"); Gdx.app.debug(getClass().getSimpleName(), "Création du menu");
nextpage=new ImageButton(AssetLoader.Skin_level,"extend"); nextpage=new ImageButton(AssetLoader.Skin_level,"extend");
@ -348,7 +352,7 @@ public class GameScreen implements Screen {
menu.NextPage(); menu.NextPage();
Gdx.app.debug("menu", "Page suivante:"+menu.getPage()); Gdx.app.debug("menu", "Page suivante:"+menu.getPage());
map.tempclear(); map.tempclear();
map.fillempty(53); //map.fillempty(53);
hideInfo(); hideInfo();
nextpage.setDisabled(menu.isNextEmpty()); nextpage.setDisabled(menu.isNextEmpty());
previouspage.setDisabled(menu.isPreviousEmpty()); previouspage.setDisabled(menu.isPreviousEmpty());
@ -364,7 +368,7 @@ public class GameScreen implements Screen {
menu.PreviousPage(); menu.PreviousPage();
Gdx.app.debug("menu", "Page précédente:"+menu.getPage()); Gdx.app.debug("menu", "Page précédente:"+menu.getPage());
map.tempclear(); map.tempclear();
map.fillempty(53); //map.fillempty(53);
hideInfo(); hideInfo();
nextpage.setDisabled(menu.isNextEmpty()); nextpage.setDisabled(menu.isNextEmpty());
previouspage.setDisabled(menu.isPreviousEmpty()); previouspage.setDisabled(menu.isPreviousEmpty());
@ -379,7 +383,7 @@ public class GameScreen implements Screen {
Gdx.app.debug("Menu", "Element changé"); Gdx.app.debug("Menu", "Element changé");
hideInfo(); hideInfo();
map.tempclear(); map.tempclear();
map.fillempty(60); //map.fillempty(60);
if (menu.getTransmuter() != null) if (menu.getTransmuter() != null)
showInfo(menu.getTransmuter()); showInfo(menu.getTransmuter());
else else
@ -458,8 +462,8 @@ public class GameScreen implements Screen {
.clone(); .clone();
if (alone) if (alone)
level.Grid.tiling_transmuter(); level.Grid.tiling_transmuter();
map.redraw(60); map.redraw();
Gdx.input.vibrate(new long[] { 0, 400, 500, 400 }, -1); Gdx.input.vibrate(new long[] { 0, 200, 200, 200 }, -1);
} }
} }
@ -533,7 +537,7 @@ public class GameScreen implements Screen {
map_copper_eraser(0, 0, x, y, false, button, call); map_copper_eraser(0, 0, x, y, false, button, call);
} }
level.Grid.tiling_copper(); level.Grid.tiling_copper();
map.redraw(60); map.redraw();
} }
public void map_all_eraser(float realx, float realy, int x, int y, boolean alone, public void map_all_eraser(float realx, float realy, int x, int y, boolean alone,
@ -556,7 +560,7 @@ public class GameScreen implements Screen {
} }
if (alone) { if (alone) {
level.Grid.tiling_transmuter(); level.Grid.tiling_transmuter();
map.redraw(60); map.redraw();
} }
} }
@ -566,7 +570,7 @@ public class GameScreen implements Screen {
level.Grid.GetXY(x, y).Fiber = 0; level.Grid.GetXY(x, y).Fiber = 0;
if (alone) { if (alone) {
level.Grid.tiling_copper(); level.Grid.tiling_copper();
map.redraw(60); map.redraw();
} }
} }
} }
@ -578,7 +582,7 @@ public class GameScreen implements Screen {
+ 1; + 1;
if (alone) { if (alone) {
level.Grid.tiling_copper(); level.Grid.tiling_copper();
map.redraw(60); map.redraw();
} }
} }
@ -588,7 +592,7 @@ public class GameScreen implements Screen {
level.Grid.GetXY(x, y).Fiber = 1; level.Grid.GetXY(x, y).Fiber = 1;
if (alone) { if (alone) {
level.Grid.tiling_copper(); level.Grid.tiling_copper();
map.redraw(60); map.redraw();
} }
} }
@ -598,7 +602,7 @@ public class GameScreen implements Screen {
level.Grid.GetXY(x, y).Copper = false; level.Grid.GetXY(x, y).Copper = false;
if (alone) { if (alone) {
level.Grid.tiling_copper(); level.Grid.tiling_copper();
map.redraw(60); map.redraw();
} }
} }
} }
@ -609,7 +613,7 @@ public class GameScreen implements Screen {
level.Grid.GetXY(x, y).Copper = !level.Grid.GetXY(x, y).Copper; level.Grid.GetXY(x, y).Copper = !level.Grid.GetXY(x, y).Copper;
if (alone) { if (alone) {
level.Grid.tiling_copper(); level.Grid.tiling_copper();
map.redraw(60); map.redraw();
} }
} }
@ -619,7 +623,7 @@ public class GameScreen implements Screen {
level.Grid.GetXY(x, y).Copper = true; level.Grid.GetXY(x, y).Copper = true;
if (alone) { if (alone) {
level.Grid.tiling_copper(); level.Grid.tiling_copper();
map.redraw(60); map.redraw();
} }
} }
@ -696,7 +700,7 @@ public class GameScreen implements Screen {
} }
public void preparebarre(String caller, int count) { public void preparebarre(String caller, int count) {
map.fillempty(53); //map.fillempty(53);
map.tempclear(); map.tempclear();
menu.EraseSurtile(); menu.EraseSurtile();
hideInfo(); hideInfo();
@ -764,6 +768,17 @@ public class GameScreen implements Screen {
Gdx.app.debug("Barre", "marche tuto."); Gdx.app.debug("Barre", "marche tuto.");
AssetLoader.Tooltipmanager.enabled = true; AssetLoader.Tooltipmanager.enabled = true;
} }
} else if (caller=="grid") {
if (map.getClearsprite()==53)
{
map.fillempty(60);
map.setClearsprite(60);
}
else
{
map.fillempty(53);
map.setClearsprite(53);
}
} else if (caller == "settings") { } else if (caller == "settings") {
winOptions.setVisible(!winOptions.isVisible()); winOptions.setVisible(!winOptions.isVisible());
winSave.setVisible(false); winSave.setVisible(false);
@ -784,7 +799,7 @@ public class GameScreen implements Screen {
public void preparemenu(int menuitem) { public void preparemenu(int menuitem) {
map.tempclear(); map.tempclear();
map.fillempty(53); //map.fillempty(53);
horizbar.unSelect(); horizbar.unSelect();
menu.setPageType(0,menuitem); menu.setPageType(0,menuitem);
nextpage.setDisabled(menu.isNextEmpty()); nextpage.setDisabled(menu.isNextEmpty());
@ -855,7 +870,7 @@ public class GameScreen implements Screen {
} }
public Table Createsaving() { public Table Createsaving() {
winSave = new Window("Saved grids", AssetLoader.Skin_ui); winSave = new Window(AssetLoader.language.get("[winSave-gamescreen]"), AssetLoader.Skin_ui);
winSave.add(savingPanel()).row(); winSave.add(savingPanel()).row();
winSave.setColor(1, 1, 1, 0.8f); winSave.setColor(1, 1, 1, 0.8f);
winSave.setVisible(false); winSave.setVisible(false);
@ -875,7 +890,9 @@ public class GameScreen implements Screen {
level.id, selSaved.getSelectedIndex()); level.id, selSaved.getSelectedIndex());
level.Grid.tiling_copper(); level.Grid.tiling_copper();
level.Grid.tiling_transmuter(); level.Grid.tiling_transmuter();
map.redraw(53); map.redraw();
map.tempclear();
hideInfo();
} }
}); });
ScrollPane scroll = new ScrollPane(selSaved); ScrollPane scroll = new ScrollPane(selSaved);
@ -891,7 +908,7 @@ public class GameScreen implements Screen {
} }
public Table Createoption() { public Table Createoption() {
winOptions = new Window("Options", AssetLoader.Skin_ui); winOptions = new Window(AssetLoader.language.get("[winOptions-gamescreen]"), AssetLoader.Skin_ui);
winOptions.add(SettingsVideo()).row(); winOptions.add(SettingsVideo()).row();
winOptions.add(SettingsAudio()).row(); winOptions.add(SettingsAudio()).row();
winOptions.add(SettingsOther()).row(); winOptions.add(SettingsOther()).row();
@ -912,6 +929,7 @@ public class GameScreen implements Screen {
SetAnimation.setChecked(Preference.prefs.getBoolean("Animation")); SetAnimation.setChecked(Preference.prefs.getBoolean("Animation"));
Setflag.setChecked(Preference.prefs.getBoolean("Language")); Setflag.setChecked(Preference.prefs.getBoolean("Language"));
SetEffectvolume.setValue(Preference.prefs.getFloat("Effect")); SetEffectvolume.setValue(Preference.prefs.getFloat("Effect"));
Setgrid.setChecked(Preference.prefs.getBoolean("Grid"));
SetMusicvolume.setValue(Preference.prefs.getFloat("Music")); SetMusicvolume.setValue(Preference.prefs.getFloat("Music"));
selResolution.setSelectedIndex(Preference.prefs.getInteger("Resolution")); selResolution.setSelectedIndex(Preference.prefs.getInteger("Resolution"));
selAdaptscreen.setSelectedIndex(Preference.prefs.getInteger("Adaptation")); selAdaptscreen.setSelectedIndex(Preference.prefs.getInteger("Adaptation"));
@ -925,6 +943,7 @@ public class GameScreen implements Screen {
Preference.prefs.putInteger("Resolution", selResolution.getSelectedIndex()); Preference.prefs.putInteger("Resolution", selResolution.getSelectedIndex());
Preference.prefs.putBoolean("Fullscreen", SetFullscreen.isChecked()); Preference.prefs.putBoolean("Fullscreen", SetFullscreen.isChecked());
Preference.prefs.putBoolean("Sound", SetSound.isChecked()); Preference.prefs.putBoolean("Sound", SetSound.isChecked());
Preference.prefs.putBoolean("Grid", Setgrid.isChecked());
Preference.prefs.putBoolean("Tutorial", Settuto.isChecked()); Preference.prefs.putBoolean("Tutorial", Settuto.isChecked());
Preference.prefs.putBoolean("VSync", SetVsynch.isChecked()); Preference.prefs.putBoolean("VSync", SetVsynch.isChecked());
Preference.prefs.putBoolean("Refresh", Setrefresh.isChecked()); Preference.prefs.putBoolean("Refresh", Setrefresh.isChecked());
@ -944,20 +963,23 @@ public class GameScreen implements Screen {
private Table SettingsOther() { private Table SettingsOther() {
Table table = new Table(); Table table = new Table();
table.pad(10, 10, 0, 10); table.pad(10, 10, 0, 10);
table.add(new Label("Divers", AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3); table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Game]"), AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3);
table.row(); table.row();
table.columnDefaults(0).padRight(10); table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10); table.columnDefaults(1).padRight(10);
Settuto = new CheckBox("Activation du tutoriel", AssetLoader.Skin_ui); Settuto = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-tuto]"), AssetLoader.Skin_ui);
table.add(Settuto).left(); table.add(Settuto).left();
table.row(); table.row();
Setdebog = new CheckBox("Mode debugage", AssetLoader.Skin_ui); Setdebog = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-debug]"), AssetLoader.Skin_ui);
table.add(Setdebog).left(); table.add(Setdebog).left();
table.row(); table.row();
Setrefresh = new CheckBox("Afficher le rafraichissement",AssetLoader.Skin_ui); Setgrid = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-grid]"),AssetLoader.Skin_ui);
table.add(Setgrid).left();
table.row();
Setrefresh = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-refresh]"),AssetLoader.Skin_ui);
table.add(Setrefresh).left(); table.add(Setrefresh).left();
table.row(); table.row();
table.add(new Label("Choix de la langue", AssetLoader.Skin_ui,"default-font", Color.WHITE)).left(); table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-language]"), AssetLoader.Skin_ui,"default-font", Color.WHITE)).left();
Setflag = new ImageButton(AssetLoader.Skin_level, "Setflag"); Setflag = new ImageButton(AssetLoader.Skin_level, "Setflag");
table.add(Setflag); table.add(Setflag);
table.row(); table.row();
@ -967,25 +989,25 @@ public class GameScreen implements Screen {
private Table SettingsVideo() { private Table SettingsVideo() {
Table table = new Table(); Table table = new Table();
table.pad(10, 10, 0, 10); table.pad(10, 10, 0, 10);
table.add(new Label("Video",AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3); table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Video]"),AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3);
table.row(); table.row();
table.columnDefaults(0).padRight(10); table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10); table.columnDefaults(1).padRight(10);
SetVsynch = new CheckBox("Synchronisation verticale",AssetLoader.Skin_ui); SetVsynch = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-sync]"),AssetLoader.Skin_ui);
table.add(SetVsynch).left(); table.add(SetVsynch).left();
Table tablev1 = new Table(); Table tablev1 = new Table();
tablev1.add(new Label("Resolution:", AssetLoader.Skin_ui, "default-font",Color.WHITE)).left().row(); tablev1.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-resolution]"), AssetLoader.Skin_ui, "default-font",Color.WHITE)).left().row();
selResolution = new SelectBox<resolutions>(AssetLoader.Skin_ui); selResolution = new SelectBox<resolutions>(AssetLoader.Skin_ui);
selResolution.setItems(resolutions.values()); selResolution.setItems(resolutions.values());
tablev1.add(selResolution).left().row(); tablev1.add(selResolution).left().row();
table.add(tablev1).left(); table.add(tablev1).left();
table.row(); table.row();
SetFullscreen = new CheckBox("Plein ecran", AssetLoader.Skin_ui); SetFullscreen = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-full]"), AssetLoader.Skin_ui);
table.add(SetFullscreen).left(); table.add(SetFullscreen).left();
Table tablev2 = new Table(); Table tablev2 = new Table();
tablev2.add(new Label("Remplissage de l'ecran:", AssetLoader.Skin_ui,"default-font", Color.WHITE)).left().row(); tablev2.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-fill]"), AssetLoader.Skin_ui,"default-font", Color.WHITE)).left().row();
selAdaptscreen = new SelectBox<adaptation>(AssetLoader.Skin_ui); selAdaptscreen = new SelectBox<adaptation>(AssetLoader.Skin_ui);
selAdaptscreen.setItems(adaptation.values()); selAdaptscreen.setItems(adaptation.values());
tablev2.add(selAdaptscreen).left().row(); tablev2.add(selAdaptscreen).left().row();
@ -993,8 +1015,8 @@ public class GameScreen implements Screen {
table.row(); table.row();
Table tablev3 = new Table(); Table tablev3 = new Table();
tablev3.add(new Label("Qualite des textures:", AssetLoader.Skin_ui, "default-font", Color.WHITE)).left().row(); tablev3.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-quality]"), AssetLoader.Skin_ui, "default-font", Color.WHITE)).left().row();
SetAnimation = new CheckBox("Activer les animations",AssetLoader.Skin_ui); SetAnimation = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-animation]"),AssetLoader.Skin_ui);
table.add(SetAnimation).left(); table.add(SetAnimation).left();
selTexturequal = new SelectBox<quality>(AssetLoader.Skin_ui); selTexturequal = new SelectBox<quality>(AssetLoader.Skin_ui);
selTexturequal.setItems(quality.values()); selTexturequal.setItems(quality.values());
@ -1022,18 +1044,18 @@ public class GameScreen implements Screen {
private Table SettingsAudio() { private Table SettingsAudio() {
Table table = new Table(); Table table = new Table();
table.pad(10, 10, 0, 10); table.pad(10, 10, 0, 10);
table.add(new Label("Audio", AssetLoader.Skin_level, "Fluoxetine-25", Color.ORANGE)).colspan(3); table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Audio]"), AssetLoader.Skin_level, "Fluoxetine-25", Color.ORANGE)).colspan(3);
table.row(); table.row();
table.columnDefaults(0).padRight(10); table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10); table.columnDefaults(1).padRight(10);
SetSound = new CheckBox("Activation du son", AssetLoader.Skin_ui); SetSound = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-sound]"), AssetLoader.Skin_ui);
table.add(SetSound).left(); table.add(SetSound).left();
table.row(); table.row();
table.add(new Label("Volume des effets", AssetLoader.Skin_ui)); table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-effect]"), AssetLoader.Skin_ui));
SetEffectvolume = new Slider(0.0f, 1.0f, 0.1f, false,AssetLoader.Skin_ui); SetEffectvolume = new Slider(0.0f, 1.0f, 0.1f, false,AssetLoader.Skin_ui);
table.add(SetEffectvolume).left(); table.add(SetEffectvolume).left();
table.row(); table.row();
table.add(new Label("Volume de la musiques", AssetLoader.Skin_ui)); table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-music]"), AssetLoader.Skin_ui));
SetMusicvolume = new Slider(0.0f, 1.0f, 0.1f, false,AssetLoader.Skin_ui); SetMusicvolume = new Slider(0.0f, 1.0f, 0.1f, false,AssetLoader.Skin_ui);
table.add(SetMusicvolume).left(); table.add(SetMusicvolume).left();
table.row(); table.row();
@ -1044,7 +1066,7 @@ public class GameScreen implements Screen {
winOptions.setVisible(false); winOptions.setVisible(false);
writepref(); writepref();
dialog.Show( dialog.Show(
"Veuillez redémmarrer pour que les préférences soient appliquées.", AssetLoader.language.get("[dialog-gamescreen-preference]"),
stage); stage);
} }
@ -1055,7 +1077,7 @@ public class GameScreen implements Screen {
private Table SettingsButtons() { private Table SettingsButtons() {
Table table = new Table(); Table table = new Table();
table.pad(10, 10, 0, 10); table.pad(10, 10, 0, 10);
Setsave = new TextButton("Save", AssetLoader.Skin_ui); Setsave = new TextButton(AssetLoader.language.get("[WinOptions-gamescreen-save]"), AssetLoader.Skin_ui);
table.add(Setsave).padRight(30); table.add(Setsave).padRight(30);
Setsave.addListener(new ChangeListener() { Setsave.addListener(new ChangeListener() {
@Override @Override
@ -1063,7 +1085,7 @@ public class GameScreen implements Screen {
onSaveClicked(); onSaveClicked();
} }
}); });
Setcancel = new TextButton("Cancel", AssetLoader.Skin_ui); Setcancel = new TextButton(AssetLoader.language.get("[WinOptions-gamescreen-cancel]"), AssetLoader.Skin_ui);
table.add(Setcancel); table.add(Setcancel);
Setcancel.addListener(new ChangeListener() { Setcancel.addListener(new ChangeListener() {
@Override @Override

View File

@ -354,7 +354,7 @@ public class LevelScreen implements Screen {
TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level, TextDescriptive = new TextArea("Descriptif", AssetLoader.Skin_level,
"Descriptif"); "Descriptif");
TextDescriptive.setBounds(15, 15, 1185, 100); TextDescriptive.setBounds(15, 15, 1185, 100);
buttonApply = new TextButton("Appliquer", AssetLoader.Skin_ui); buttonApply = new TextButton(AssetLoader.language.get("[buttonApply-levelscreen]"), AssetLoader.Skin_ui);
buttonApply.setBounds(1680, 350, 190, 40); buttonApply.setBounds(1680, 350, 190, 40);
buttonApply.addListener(new ClickListener() { buttonApply.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@ -367,8 +367,7 @@ public class LevelScreen implements Screen {
Gamedata.getUrl()); Gamedata.getUrl());
if (!AssetLoader.Datahandler.verifyall()) { if (!AssetLoader.Datahandler.verifyall()) {
dialog.Show( dialog.Show(
"Un problème est survenu lors du changement de base de donnée.", AssetLoader.language.get("[dialog-levelscreen-errorloading]"),stage);
stage);
initlevel(); initlevel();
} else } else
menu(); menu();
@ -387,7 +386,7 @@ public class LevelScreen implements Screen {
Worlddata.Refresh(); Worlddata.Refresh();
} }
}); });
buttonSave = new TextButton("Sauvegarder", AssetLoader.Skin_ui); buttonSave = new TextButton(AssetLoader.language.get("[buttonSave-levelscreen]"), AssetLoader.Skin_ui);
buttonSave.setBounds(1480, 350, 190, 40); buttonSave.setBounds(1480, 350, 190, 40);
buttonSave.addListener(new ClickListener() { buttonSave.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@ -396,11 +395,10 @@ public class LevelScreen implements Screen {
Preference.prefs.putString("gamedata", Gamedata.getUrl()); Preference.prefs.putString("gamedata", Gamedata.getUrl());
Preference.prefs.putString("statdata", Statdata.getUrl()); Preference.prefs.putString("statdata", Statdata.getUrl());
dialog.Show( dialog.Show(
"Vous devez redemarrer pour bénéfier des changements.", AssetLoader.language.get("[dialog-levelscreen-savedatabase]"),stage);
stage);
} }
}); });
buttonConnect = new TextButton("Connexions", 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) {
@ -408,7 +406,7 @@ public class LevelScreen implements Screen {
SetButtonConnect(); SetButtonConnect();
} }
}); });
buttonPlay = new TextButton("Jouer", AssetLoader.Skin_ui); buttonPlay = new TextButton(AssetLoader.language.get("[buttonPlay-levelscreen]"), AssetLoader.Skin_ui);
buttonPlay.setBounds(1040, 20, 150, 40); buttonPlay.setBounds(1040, 20, 150, 40);
buttonPlay.addListener(new ClickListener() { buttonPlay.addListener(new ClickListener() {
@Override @Override
@ -417,7 +415,7 @@ public class LevelScreen implements Screen {
.setScreen(new GameScreen(selected.level)); .setScreen(new GameScreen(selected.level));
} }
}); });
buttonStat = new TextButton("Statistiques", 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) {
@ -425,17 +423,15 @@ public class LevelScreen implements Screen {
SetButtonStat(); SetButtonStat();
} }
}); });
buttonPlaythis = new TextButton("Jouer ce monde", AssetLoader.Skin_ui); buttonPlaythis = new TextButton(AssetLoader.language.get("[buttonPlaythis-levelscreen]"), AssetLoader.Skin_ui);
buttonPlaythis.setBounds(1480, 50, 190, 40); buttonPlaythis.setBounds(1480, 50, 190, 40);
buttonPlaythis.addListener(new ClickListener() { buttonPlaythis.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
if (!AssetLoader.Datahandler.verifyall()) if (!AssetLoader.Datahandler.verifyall())
dialog.Show( dialog.Show(AssetLoader.language.get("[dialog-levelscreen-errorlevels]"),stage);
"Impossible de jouer sans bases de données correctement configurée, cliquer sur RAZ si vous ne savez pas revenir à une situation jouable.",
stage);
else { else {
if (Worlddata.getSelected() == null) if (Worlddata.getSelected() == null)
dialog.Show("Aucun monde n'a été sélectionné", stage); dialog.Show(AssetLoader.language.get("[dialog-levelscreen-errornoworld]"), stage);
else { else {
Preference.prefs.putString("world", Preference.prefs.putString("world",
(String) Worlddata.getSelected()); (String) Worlddata.getSelected());
@ -503,24 +499,24 @@ public class LevelScreen implements Screen {
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);
Statdatalabel = new Label("Stockage des statistiques:", Statdatalabel = new Label(AssetLoader.language.get("[Statdatalabel-levelscreen]"),
AssetLoader.Skin_ui, "grey"); AssetLoader.Skin_ui, "grey");
Statdata.setBounds(1480, AssetLoader.height - 250, 420, 150); Statdata.setBounds(1480, AssetLoader.height - 250, 420, 150);
Statdatalabel.setPosition(1480, AssetLoader.height - 100); Statdatalabel.setPosition(1480, AssetLoader.height - 100);
Userdata = new ServerList(url, Base.datatype.userdata, Userdata = new ServerList(url, Base.datatype.userdata,
AssetLoader.Skin_ui); AssetLoader.Skin_ui);
Userdatalabel = new Label("Stockage des données du joueur:", Userdatalabel = new Label(AssetLoader.language.get("[Userdatalabel-levelscreen]"),
AssetLoader.Skin_ui, "grey"); AssetLoader.Skin_ui, "grey");
Userdata.setBounds(1480, AssetLoader.height - 450, 420, 150); Userdata.setBounds(1480, AssetLoader.height - 450, 420, 150);
Userdatalabel.setPosition(1480, AssetLoader.height - 300); Userdatalabel.setPosition(1480, AssetLoader.height - 300);
Gamedata = new ServerList(url, Base.datatype.gamedata, Gamedata = new ServerList(url, Base.datatype.gamedata,
AssetLoader.Skin_ui); AssetLoader.Skin_ui);
Gamedatalabel = new Label("Stockage des données du jeu:", Gamedatalabel = new Label(AssetLoader.language.get("[Gamedatalabel-levelscreen]"),
AssetLoader.Skin_ui, "grey"); AssetLoader.Skin_ui, "grey");
Gamedata.setBounds(1480, AssetLoader.height - 650, 420, 150); Gamedata.setBounds(1480, AssetLoader.height - 650, 420, 150);
Gamedatalabel.setPosition(1480, AssetLoader.height - 500); Gamedatalabel.setPosition(1480, AssetLoader.height - 500);
Worlddata = new Worldlist(AssetLoader.Skin_ui); Worlddata = new Worldlist(AssetLoader.Skin_ui);
Worlddatalabel = new Label("Mondes disponibles:", AssetLoader.Skin_ui, Worlddatalabel = new Label(AssetLoader.language.get("[Worlddatalabel-levelscreen]"), AssetLoader.Skin_ui,
"grey"); "grey");
Worlddata.setBounds(1480, 100, 420, 200); Worlddata.setBounds(1480, 100, 420, 200);
Worlddatalabel.setPosition(1480, 300); Worlddatalabel.setPosition(1480, 300);