feat: création d'un package "dialogs" qui comprends windows et dialogs. ajout de 2 classes prefwindow et savingwindow et mouvement de warningdialog de ui vers ce nouveau package.

This commit is contained in:
Nicolas Hordé 2016-02-26 14:29:30 +01:00
parent ee6c8ca2a4
commit f2f11a4bfe
5 changed files with 327 additions and 263 deletions

View File

@ -0,0 +1,235 @@
package fr.evolving.dialogs;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Graphics.DisplayMode;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Slider;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.utils.Array;
import fr.evolving.assets.AssetLoader;
import fr.evolving.assets.Preference;
import fr.evolving.screens.GameScreen.adaptation;
import fr.evolving.screens.GameScreen.quality;
import fr.evolving.screens.GameScreen.resolutions;
public class PrefWindow extends Window {
private CheckBox SetSound, SetVsynch, SetFullscreen, SetAnimation, Settuto,
Setdebog, Setgrid, Setrefresh;
private Slider SetEffectvolume, SetMusicvolume;
private TextButton Setcancel, Setsave;
private SelectBox<resolutions> selResolution;
private SelectBox<quality> selTexturequal;
private SelectBox<adaptation> selAdaptscreen;
private ImageButton Setflag;
private WarningDialog dialog;
public PrefWindow() {
super(AssetLoader.language.get("[winOptions-gamescreen]"), AssetLoader.Skin_ui);
// TODO Auto-generated constructor stub
this.add(SettingsVideo()).row();
this.add(SettingsAudio()).row();
this.add(SettingsOther()).row();
this.add(SettingsButtons()).pad(10, 0, 10, 0);
this.setColor(1, 1, 1, 0.8f);
this.setVisible(false);
this.pack();
this.setPosition(100, 250);
dialog = new WarningDialog(AssetLoader.Skin_ui);
}
public void refresh() {
SetFullscreen.setChecked(Preference.prefs.getBoolean("Fullscreen"));
SetSound.setChecked(Preference.prefs.getBoolean("Sound"));
Settuto.setChecked(Preference.prefs.getBoolean("Tutorial"));
SetVsynch.setChecked(Preference.prefs.getBoolean("VSync"));
Setrefresh.setChecked(Preference.prefs.getBoolean("Refresh"));
SetAnimation.setChecked(Preference.prefs.getBoolean("Animation"));
Setflag.setChecked(Preference.prefs.getBoolean("Language"));
SetEffectvolume.setValue(Preference.prefs.getFloat("Effect"));
Setgrid.setChecked(Preference.prefs.getBoolean("Grid"));
SetMusicvolume.setValue(Preference.prefs.getFloat("Music"));
selResolution.setSelectedIndex(Preference.prefs.getInteger("Resolution"));
selAdaptscreen.setSelectedIndex(Preference.prefs.getInteger("Adaptation"));
selTexturequal.setSelectedIndex(Preference.prefs.getInteger("Quality"));
Setdebog.setChecked(Preference.prefs.getInteger("log") == Gdx.app.LOG_DEBUG);
}
public void writepref() {
Preference.prefs.putInteger("ResolutionX", selResolution.getSelected().getResolutionX());
Preference.prefs.putInteger("ResolutionY", selResolution.getSelected().getResolutionY());
Preference.prefs.putInteger("Resolution", selResolution.getSelectedIndex());
Preference.prefs.putBoolean("Fullscreen", SetFullscreen.isChecked());
Preference.prefs.putBoolean("Sound", SetSound.isChecked());
Preference.prefs.putBoolean("Grid", Setgrid.isChecked());
Preference.prefs.putBoolean("Tutorial", Settuto.isChecked());
Preference.prefs.putBoolean("VSync", SetVsynch.isChecked());
Preference.prefs.putBoolean("Refresh", Setrefresh.isChecked());
Preference.prefs.putBoolean("Animation", SetAnimation.isChecked());
Preference.prefs.putBoolean("Language", Setflag.isChecked());
Preference.prefs.putFloat("Effect", SetEffectvolume.getValue());
Preference.prefs.putFloat("Music", SetMusicvolume.getValue());
Preference.prefs.putInteger("Adaptation",selAdaptscreen.getSelectedIndex());
Preference.prefs.putInteger("Quality",selTexturequal.getSelectedIndex());
if (Setdebog.isChecked())
Preference.prefs.putInteger("log", Gdx.app.LOG_DEBUG);
else
Preference.prefs.putInteger("log", Gdx.app.LOG_INFO);
Preference.prefs.flush();
}
private Table SettingsOther() {
Table table = new Table();
table.pad(10, 10, 0, 10);
table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Game]"), AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3);
table.row();
table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10);
Settuto = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-tuto]"), AssetLoader.Skin_ui);
table.add(Settuto).left();
table.row();
Setdebog = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-debug]"), AssetLoader.Skin_ui);
table.add(Setdebog).left();
table.row();
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.row();
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");
table.add(Setflag);
table.row();
return table;
}
private Table SettingsVideo() {
Table table = new Table();
table.pad(10, 10, 0, 10);
table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Video]"),AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3);
table.row();
table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10);
SetVsynch = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-sync]"),AssetLoader.Skin_ui);
table.add(SetVsynch).left();
Table tablev1 = new Table();
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.setItems(resolutions.values());
tablev1.add(selResolution).left().row();
table.add(tablev1).left();
table.row();
SetFullscreen = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-full]"), AssetLoader.Skin_ui);
table.add(SetFullscreen).left();
Table tablev2 = new Table();
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.setItems(adaptation.values());
tablev2.add(selAdaptscreen).left().row();
table.add(tablev2).left();
table.row();
Table tablev3 = new Table();
tablev3.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-quality]"), AssetLoader.Skin_ui, "default-font", Color.WHITE)).left().row();
SetAnimation = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-animation]"),AssetLoader.Skin_ui);
table.add(SetAnimation).left();
selTexturequal = new SelectBox<quality>(AssetLoader.Skin_ui);
selTexturequal.setItems(quality.values());
tablev3.add(selTexturequal).left().row();
table.add(tablev3).left();
table.row();
if (Gdx.app.getType() == ApplicationType.Desktop) {
Graphics.DisplayMode[] modes = Gdx.graphics.getDisplayModes();
for (resolutions res : resolutions.values()) {
res.SetFull(false);
for (DisplayMode mode : modes) {
if (res.getResolutionX() == mode.width && res.getResolutionY() == mode.height)
res.SetFull(true);
}
}
Vector2 maxres = Preference.getmaxresolution();
resolutions.rmax.SetFull(true);
resolutions.rmax.setResolutionX((int) maxres.x);
resolutions.rmax.setResolutionY((int) maxres.y);
} else
selResolution.setDisabled(true);
return table;
}
private Table SettingsAudio() {
Table table = new Table();
table.pad(10, 10, 0, 10);
table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Audio]"), AssetLoader.Skin_level, "Fluoxetine-25", Color.ORANGE)).colspan(3);
table.row();
table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10);
SetSound = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-sound]"), AssetLoader.Skin_ui);
table.add(SetSound).left();
table.row();
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);
table.add(SetEffectvolume).left();
table.row();
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);
table.add(SetMusicvolume).left();
table.row();
return table;
}
private void onSaveClicked() {
this.setVisible(false);
writepref();
dialog.Show(AssetLoader.language.get("[dialog-gamescreen-preference]"), this.getStage());
}
private void onCancelClicked() {
this.setVisible(false);
}
private Table SettingsButtons() {
Table table = new Table();
table.pad(10, 10, 0, 10);
Setsave = new TextButton(AssetLoader.language.get("[WinOptions-gamescreen-save]"), AssetLoader.Skin_ui);
table.add(Setsave).padRight(30);
Setsave.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
onSaveClicked();
}
});
Setcancel = new TextButton(AssetLoader.language.get("[WinOptions-gamescreen-cancel]"), AssetLoader.Skin_ui);
table.add(Setcancel);
Setcancel.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
onCancelClicked();
}
});
return table;
}
}

View File

@ -0,0 +1,65 @@
package fr.evolving.dialogs;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.utils.Array;
import fr.evolving.assets.AssetLoader;
import fr.evolving.automata.Worlds;
public class SavingWindow extends Window {
private List selSaved;
private Worlds worlds;
ChangeEvent event;
public SavingWindow(Worlds worlds) {
super(AssetLoader.language.get("[winSave-gamescreen]"), AssetLoader.Skin_ui);
this.worlds=worlds;
this.add(savingPanel()).row();
this.setColor(1, 1, 1, 0.8f);
this.setVisible(false);
this.pack();
this.setBounds(50, 100, 250, 450);
}
private void onchanged() {
ChangeEvent event=new ChangeEvent();
event.setTarget(this);
event.setListenerActor(this);
event.setStage(this.getStage());
if (event.getStage()!=null)
this.fire(event);
}
private Table savingPanel() {
Table table = new Table();
table.pad(10, 10, 0, 10);
selSaved = new List(AssetLoader.Skin_ui);
selSaved.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
if (this.getTapCount() > 1) {
worlds.ReadGrid(selSaved.getSelectedIndex());
onchanged();
}
}
});
ScrollPane scroll = new ScrollPane(selSaved);
table.add(scroll).width(250).height(440).row();
return table;
}
public void refresh() {
Array<String> items = worlds.ViewGrids();
if (items != null)
selSaved.setItems(items);
}
}

View File

@ -1,4 +1,4 @@
package fr.evolving.UI; package fr.evolving.dialogs;
import com.badlogic.gdx.Input; import com.badlogic.gdx.Input;
import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.Stage;
@ -9,10 +9,10 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import fr.evolving.assets.AssetLoader; import fr.evolving.assets.AssetLoader;
public class WarnDialog extends Dialog { public class WarningDialog extends Dialog {
Label thelabel; Label thelabel;
public WarnDialog(Skin skin) { public WarningDialog(Skin skin) {
super(AssetLoader.language.get("[dialog-window]"), skin); super(AssetLoader.language.get("[dialog-window]"), skin);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
this.getContentTable() this.getContentTable()

View File

@ -60,8 +60,8 @@ import fr.evolving.UI.IconValue;
import fr.evolving.UI.Menu; import fr.evolving.UI.Menu;
import fr.evolving.UI.Objectives; import fr.evolving.UI.Objectives;
import fr.evolving.UI.TouchMaptiles; import fr.evolving.UI.TouchMaptiles;
import fr.evolving.UI.Translist;
import fr.evolving.UI.VertiBarre; import fr.evolving.UI.VertiBarre;
import fr.evolving.UI.WarnDialog;
import fr.evolving.UI.IconValue.Icon; import fr.evolving.UI.IconValue.Icon;
import fr.evolving.assets.AssetLoader; import fr.evolving.assets.AssetLoader;
import fr.evolving.assets.Preference; import fr.evolving.assets.Preference;
@ -72,26 +72,22 @@ import fr.evolving.automata.Transmuter;
import fr.evolving.automata.Transmuter.Angular; import fr.evolving.automata.Transmuter.Angular;
import fr.evolving.automata.Transmuter.CaseType; import fr.evolving.automata.Transmuter.CaseType;
import fr.evolving.automata.Worlds; import fr.evolving.automata.Worlds;
import fr.evolving.dialogs.PrefWindow;
import fr.evolving.dialogs.SavingWindow;
import fr.evolving.dialogs.WarningDialog;
import fr.evolving.renderers.GameRenderer; import fr.evolving.renderers.GameRenderer;
public class GameScreen implements Screen { public class GameScreen implements Screen {
private InputMultiplexer multiplexer; private InputMultiplexer multiplexer;
private Array<InputProcessor> processors; private Array<InputProcessor> processors;
private WarnDialog dialog;
private Stage stage, stage_info, stage_tooltip; private Stage stage, stage_info, stage_tooltip;
private GameRenderer Renderer; private GameRenderer Renderer;
private float runTime; private float runTime;
public Level level; public Level level;
private Window winOptions, winSave; private PrefWindow winOptions;
private CheckBox SetSound, SetVsynch, SetFullscreen, SetAnimation, Settuto, private SavingWindow winSave;
Setdebog, Setgrid, Setrefresh; private ImageButton info_up_nrj, info_up_temp, info_up, info_up_rayon,
private Slider SetEffectvolume, SetMusicvolume;
private TextButton Setcancel, Setsave;
private SelectBox<resolutions> selResolution;
private SelectBox<quality> selTexturequal;
private SelectBox<adaptation> selAdaptscreen;
private List selSaved;
private ImageButton Setflag, info_up_nrj, info_up_temp, info_up, info_up_rayon,
info_up_cycle, info_up_nrjval, info_up_tempval, info_up_rayonval, info_up_cycle, info_up_nrjval, info_up_tempval, info_up_rayonval,
info_up_cycleval, nextpage, previouspage; info_up_cycleval, nextpage, previouspage;
private ImageTextButton info_cout, info_tech, info_research, info_activation; private ImageTextButton info_cout, info_tech, info_research, info_activation;
@ -108,6 +104,7 @@ public class GameScreen implements Screen {
private TextArea info_desc, tooltip; private TextArea info_desc, tooltip;
public boolean unroll; public boolean unroll;
public Worlds worlds; public Worlds worlds;
public Translist translist;
public enum calling { public enum calling {
mouseover, mouseclick, mousedrag, longpress, tap, taptap, zoom, fling, pan, pinch mouseover, mouseclick, mousedrag, longpress, tap, taptap, zoom, fling, pan, pinch
@ -322,7 +319,6 @@ public class GameScreen implements Screen {
hideInfo(); hideInfo();
} }
}); });
dialog = new WarnDialog(AssetLoader.Skin_ui);
Gdx.app.debug("wirechem-GameScreen", "Création d'une tilemap"); Gdx.app.debug("wirechem-GameScreen", "Création d'une tilemap");
map = new TouchMaptiles(worlds,level, 128, 128); map = new TouchMaptiles(worlds,level, 128, 128);
if (Preference.prefs.getBoolean("Grid")) if (Preference.prefs.getBoolean("Grid"))
@ -677,9 +673,15 @@ public class GameScreen implements Screen {
@Override @Override
public void show() { public void show() {
Gdx.app.debug("wirechem-GameScreen","Création de la fenêtre d'option"); Gdx.app.debug("wirechem-GameScreen","Création de la fenêtre d'option");
Table Optiontable = Createoption(); winOptions = new PrefWindow();
stage.addActor(winOptions); stage.addActor(winOptions);
Table Savetable = Createsaving(); winSave = new SavingWindow(worlds);
winSave.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
prepare();
}
});
stage.addActor(winSave); stage.addActor(winSave);
Gdx.app.log("wirechem-GameScreen", "***** Affichage du niveau."); Gdx.app.log("wirechem-GameScreen", "***** Affichage du niveau.");
stage_info.addActor(info_tech); stage_info.addActor(info_tech);
@ -750,11 +752,11 @@ public class GameScreen implements Screen {
winOptions.setVisible(false); winOptions.setVisible(false);
winSave.setVisible(!winSave.isVisible()); winSave.setVisible(!winSave.isVisible());
if (winSave.isVisible()) if (winSave.isVisible())
readsaved(); winSave.refresh();
} else if (caller == "save") { } else if (caller == "save") {
Gdx.app.debug("wirechem-GameScreen", "Barre | Sauvegarde de la grille."); Gdx.app.debug("wirechem-GameScreen", "Barre | Sauvegarde de la grille.");
worlds.SaveGrid(); worlds.SaveGrid();
readsaved(); winSave.refresh();
} else if (caller == "levels") { } else if (caller == "levels") {
Gdx.app.debug("wirechem-GameScreen", "Barre | Affichage des niveaux."); Gdx.app.debug("wirechem-GameScreen", "Barre | Affichage des niveaux.");
exit(); exit();
@ -805,7 +807,7 @@ public class GameScreen implements Screen {
winOptions.setVisible(!winOptions.isVisible()); winOptions.setVisible(!winOptions.isVisible());
winSave.setVisible(false); winSave.setVisible(false);
if (winOptions.isVisible()) if (winOptions.isVisible())
readpref(); winOptions.refresh();
} else if (caller == "flag") { } else if (caller == "flag") {
if (AssetLoader.language.getLocale().getDisplayName() if (AssetLoader.language.getLocale().getDisplayName()
.contains("français")) { .contains("français")) {
@ -909,225 +911,5 @@ public class GameScreen implements Screen {
stage.dispose(); stage.dispose();
} }
public Table Createsaving() {
winSave = new Window(AssetLoader.language.get("[winSave-gamescreen]"), AssetLoader.Skin_ui);
winSave.add(savingPanel()).row();
winSave.setColor(1, 1, 1, 0.8f);
winSave.setVisible(false);
winSave.pack();
winSave.setBounds(50, 100, 250, 450);
return winSave;
}
private Table savingPanel() {
Table table = new Table();
table.pad(10, 10, 0, 10);
selSaved = new List(AssetLoader.Skin_ui);
selSaved.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
if (this.getTapCount() > 1) {
worlds.ReadGrid(selSaved.getSelectedIndex());
prepare();
}
}
});
ScrollPane scroll = new ScrollPane(selSaved);
table.add(scroll).width(250).height(440).row();
return table;
}
public void readsaved() {
Array<String> items = worlds.ViewGrids();
if (items != null)
selSaved.setItems(items);
}
public Table Createoption() {
winOptions = new Window(AssetLoader.language.get("[winOptions-gamescreen]"), AssetLoader.Skin_ui);
winOptions.add(SettingsVideo()).row();
winOptions.add(SettingsAudio()).row();
winOptions.add(SettingsOther()).row();
winOptions.add(SettingsButtons()).pad(10, 0, 10, 0);
winOptions.setColor(1, 1, 1, 0.8f);
winOptions.setVisible(false);
winOptions.pack();
winOptions.setPosition(100, 250);
return winOptions;
}
public void readpref() {
SetFullscreen.setChecked(Preference.prefs.getBoolean("Fullscreen"));
SetSound.setChecked(Preference.prefs.getBoolean("Sound"));
Settuto.setChecked(Preference.prefs.getBoolean("Tutorial"));
SetVsynch.setChecked(Preference.prefs.getBoolean("VSync"));
Setrefresh.setChecked(Preference.prefs.getBoolean("Refresh"));
SetAnimation.setChecked(Preference.prefs.getBoolean("Animation"));
Setflag.setChecked(Preference.prefs.getBoolean("Language"));
SetEffectvolume.setValue(Preference.prefs.getFloat("Effect"));
Setgrid.setChecked(Preference.prefs.getBoolean("Grid"));
SetMusicvolume.setValue(Preference.prefs.getFloat("Music"));
selResolution.setSelectedIndex(Preference.prefs.getInteger("Resolution"));
selAdaptscreen.setSelectedIndex(Preference.prefs.getInteger("Adaptation"));
selTexturequal.setSelectedIndex(Preference.prefs.getInteger("Quality"));
Setdebog.setChecked(Preference.prefs.getInteger("log") == Gdx.app.LOG_DEBUG);
}
public void writepref() {
Preference.prefs.putInteger("ResolutionX", selResolution.getSelected().getResolutionX());
Preference.prefs.putInteger("ResolutionY", selResolution.getSelected().getResolutionY());
Preference.prefs.putInteger("Resolution", selResolution.getSelectedIndex());
Preference.prefs.putBoolean("Fullscreen", SetFullscreen.isChecked());
Preference.prefs.putBoolean("Sound", SetSound.isChecked());
Preference.prefs.putBoolean("Grid", Setgrid.isChecked());
Preference.prefs.putBoolean("Tutorial", Settuto.isChecked());
Preference.prefs.putBoolean("VSync", SetVsynch.isChecked());
Preference.prefs.putBoolean("Refresh", Setrefresh.isChecked());
Preference.prefs.putBoolean("Animation", SetAnimation.isChecked());
Preference.prefs.putBoolean("Language", Setflag.isChecked());
Preference.prefs.putFloat("Effect", SetEffectvolume.getValue());
Preference.prefs.putFloat("Music", SetMusicvolume.getValue());
Preference.prefs.putInteger("Adaptation",selAdaptscreen.getSelectedIndex());
Preference.prefs.putInteger("Quality",selTexturequal.getSelectedIndex());
if (Setdebog.isChecked())
Preference.prefs.putInteger("log", Gdx.app.LOG_DEBUG);
else
Preference.prefs.putInteger("log", Gdx.app.LOG_INFO);
Preference.prefs.flush();
}
private Table SettingsOther() {
Table table = new Table();
table.pad(10, 10, 0, 10);
table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Game]"), AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3);
table.row();
table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10);
Settuto = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-tuto]"), AssetLoader.Skin_ui);
table.add(Settuto).left();
table.row();
Setdebog = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-debug]"), AssetLoader.Skin_ui);
table.add(Setdebog).left();
table.row();
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.row();
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");
table.add(Setflag);
table.row();
return table;
}
private Table SettingsVideo() {
Table table = new Table();
table.pad(10, 10, 0, 10);
table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Video]"),AssetLoader.Skin_level, "Fluoxetine-25",Color.ORANGE)).colspan(3);
table.row();
table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10);
SetVsynch = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-sync]"),AssetLoader.Skin_ui);
table.add(SetVsynch).left();
Table tablev1 = new Table();
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.setItems(resolutions.values());
tablev1.add(selResolution).left().row();
table.add(tablev1).left();
table.row();
SetFullscreen = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-full]"), AssetLoader.Skin_ui);
table.add(SetFullscreen).left();
Table tablev2 = new Table();
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.setItems(adaptation.values());
tablev2.add(selAdaptscreen).left().row();
table.add(tablev2).left();
table.row();
Table tablev3 = new Table();
tablev3.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-quality]"), AssetLoader.Skin_ui, "default-font", Color.WHITE)).left().row();
SetAnimation = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-animation]"),AssetLoader.Skin_ui);
table.add(SetAnimation).left();
selTexturequal = new SelectBox<quality>(AssetLoader.Skin_ui);
selTexturequal.setItems(quality.values());
tablev3.add(selTexturequal).left().row();
table.add(tablev3).left();
table.row();
if (Gdx.app.getType() == ApplicationType.Desktop) {
Graphics.DisplayMode[] modes = Gdx.graphics.getDisplayModes();
for (resolutions res : resolutions.values()) {
res.SetFull(false);
for (DisplayMode mode : modes) {
if (res.resx == mode.width && res.resy == mode.height)
res.SetFull(true);
}
}
Vector2 maxres = Preference.getmaxresolution();
resolutions.rmax.SetFull(true);
resolutions.rmax.setResolutionX((int) maxres.x);
resolutions.rmax.setResolutionY((int) maxres.y);
} else
selResolution.setDisabled(true);
return table;
}
private Table SettingsAudio() {
Table table = new Table();
table.pad(10, 10, 0, 10);
table.add(new Label(AssetLoader.language.get("[WinOptions-gamescreen-Audio]"), AssetLoader.Skin_level, "Fluoxetine-25", Color.ORANGE)).colspan(3);
table.row();
table.columnDefaults(0).padRight(10);
table.columnDefaults(1).padRight(10);
SetSound = new CheckBox(AssetLoader.language.get("[WinOptions-gamescreen-sound]"), AssetLoader.Skin_ui);
table.add(SetSound).left();
table.row();
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);
table.add(SetEffectvolume).left();
table.row();
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);
table.add(SetMusicvolume).left();
table.row();
return table;
}
private void onSaveClicked() {
winOptions.setVisible(false);
writepref();
dialog.Show(
AssetLoader.language.get("[dialog-gamescreen-preference]"),
stage);
}
private void onCancelClicked() {
winOptions.setVisible(false);
}
private Table SettingsButtons() {
Table table = new Table();
table.pad(10, 10, 0, 10);
Setsave = new TextButton(AssetLoader.language.get("[WinOptions-gamescreen-save]"), AssetLoader.Skin_ui);
table.add(Setsave).padRight(30);
Setsave.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
onSaveClicked();
}
});
Setcancel = new TextButton(AssetLoader.language.get("[WinOptions-gamescreen-cancel]"), AssetLoader.Skin_ui);
table.add(Setcancel);
Setcancel.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
onCancelClicked();
}
});
return table;
}
} }

View File

@ -29,7 +29,6 @@ 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.WarnDialog;
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;
@ -39,6 +38,7 @@ import fr.evolving.automata.Transmuter;
import fr.evolving.automata.Worlds; import fr.evolving.automata.Worlds;
import fr.evolving.automata.Worlds.State; import fr.evolving.automata.Worlds.State;
import fr.evolving.database.Base; import fr.evolving.database.Base;
import fr.evolving.dialogs.WarningDialog;
import fr.evolving.renderers.LevelRenderer; import fr.evolving.renderers.LevelRenderer;
public class LevelScreen implements Screen { public class LevelScreen implements Screen {
@ -49,7 +49,7 @@ public class LevelScreen implements Screen {
private TimerTask ScrollTask; private TimerTask ScrollTask;
private Stage stage; private Stage stage;
private Table table; private Table table;
private WarnDialog dialog; private WarningDialog dialog;
private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer; private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer;
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;
@ -64,9 +64,6 @@ public class LevelScreen implements Screen {
public ButtonLevel selected; public ButtonLevel selected;
public int addervalue; public int addervalue;
public Translist test;
public void play() { public void play() {
if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) { if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) {
if (worlds.getWorld() < 0) if (worlds.getWorld() < 0)
@ -272,17 +269,6 @@ public class LevelScreen implements Screen {
} }
public LevelScreen(Worlds aworlds) { public LevelScreen(Worlds aworlds) {
Array<Transmuter> test2=new Array<Transmuter>();
test2.add(AssetLoader.getTransmuter("<>"));
test2.add(AssetLoader.getTransmuter(">"));
test2.add(AssetLoader.getTransmuter("++"));
test2.add(AssetLoader.getTransmuter("+"));
test2.add(AssetLoader.getTransmuter("+-+-"));
test2.add(AssetLoader.getTransmuter("00"));
test=new Translist(test2,new Color(1f,1f,1f,0.25f));
test.setPosition(512, 512);
test.setWidth(256);
test.setHeight(256);
this.worlds = aworlds; this.worlds = aworlds;
addervalue=1; addervalue=1;
worlds.addListener(new ChangeListener() { worlds.addListener(new ChangeListener() {
@ -328,7 +314,7 @@ public class LevelScreen implements Screen {
stage = new Stage(AssetLoader.viewport); stage = new Stage(AssetLoader.viewport);
table = new Table(); table = new Table();
Renderer = new LevelRenderer(this); Renderer = new LevelRenderer(this);
dialog = new WarnDialog(AssetLoader.Skin_ui); dialog = new WarningDialog(AssetLoader.Skin_ui);
Gdx.app.debug("wirechem-LevelScreen", "Mise en place du timer."); Gdx.app.debug("wirechem-LevelScreen", "Mise en place du timer.");
ScrollTimer = new Timer(); ScrollTimer = new Timer();
ScrollTask = new TimerTask() { ScrollTask = new TimerTask() {
@ -898,10 +884,6 @@ public class LevelScreen implements Screen {
stage.addActor(up_temp); stage.addActor(up_temp);
stage.addActor(up_rayon); stage.addActor(up_rayon);
stage.addActor(research); stage.addActor(research);
stage.addActor(test);
Gdx.input.setInputProcessor(stage); Gdx.input.setInputProcessor(stage);
Gdx.app.debug("wirechem-LevelScreen", "Début dans la bande son \'intro\'"); Gdx.app.debug("wirechem-LevelScreen", "Début dans la bande son \'intro\'");
AssetLoader.intro.setLooping(true); AssetLoader.intro.setLooping(true);