diff --git a/core/src/fr/evolving/dialogs/PrefWindow.java b/core/src/fr/evolving/dialogs/PrefWindow.java new file mode 100644 index 0000000..406c1d7 --- /dev/null +++ b/core/src/fr/evolving/dialogs/PrefWindow.java @@ -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 selResolution; + private SelectBox selTexturequal; + private SelectBox 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(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(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(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; + } + + +} \ No newline at end of file diff --git a/core/src/fr/evolving/dialogs/SavingWindow.java b/core/src/fr/evolving/dialogs/SavingWindow.java new file mode 100644 index 0000000..8f8f9b1 --- /dev/null +++ b/core/src/fr/evolving/dialogs/SavingWindow.java @@ -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 items = worlds.ViewGrids(); + if (items != null) + selSaved.setItems(items); + } + + +} \ No newline at end of file diff --git a/core/src/fr/evolving/UI/WarnDialog.java b/core/src/fr/evolving/dialogs/WarningDialog.java similarity index 88% rename from core/src/fr/evolving/UI/WarnDialog.java rename to core/src/fr/evolving/dialogs/WarningDialog.java index f5a9dfb..34a2130 100644 --- a/core/src/fr/evolving/UI/WarnDialog.java +++ b/core/src/fr/evolving/dialogs/WarningDialog.java @@ -1,4 +1,4 @@ -package fr.evolving.UI; +package fr.evolving.dialogs; import com.badlogic.gdx.Input; import com.badlogic.gdx.scenes.scene2d.Stage; @@ -9,10 +9,10 @@ import com.badlogic.gdx.scenes.scene2d.ui.Skin; import fr.evolving.assets.AssetLoader; -public class WarnDialog extends Dialog { +public class WarningDialog extends Dialog { Label thelabel; - public WarnDialog(Skin skin) { + public WarningDialog(Skin skin) { super(AssetLoader.language.get("[dialog-window]"), skin); // TODO Auto-generated constructor stub this.getContentTable() diff --git a/core/src/fr/evolving/screens/GameScreen.java b/core/src/fr/evolving/screens/GameScreen.java index 4a7947f..08a141b 100644 --- a/core/src/fr/evolving/screens/GameScreen.java +++ b/core/src/fr/evolving/screens/GameScreen.java @@ -60,8 +60,8 @@ import fr.evolving.UI.IconValue; import fr.evolving.UI.Menu; import fr.evolving.UI.Objectives; import fr.evolving.UI.TouchMaptiles; +import fr.evolving.UI.Translist; import fr.evolving.UI.VertiBarre; -import fr.evolving.UI.WarnDialog; import fr.evolving.UI.IconValue.Icon; import fr.evolving.assets.AssetLoader; 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.CaseType; 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; public class GameScreen implements Screen { private InputMultiplexer multiplexer; private Array processors; - private WarnDialog dialog; + private Stage stage, stage_info, stage_tooltip; private GameRenderer Renderer; private float runTime; public Level level; - private Window winOptions, winSave; - private CheckBox SetSound, SetVsynch, SetFullscreen, SetAnimation, Settuto, - Setdebog, Setgrid, Setrefresh; - private Slider SetEffectvolume, SetMusicvolume; - private TextButton Setcancel, Setsave; - private SelectBox selResolution; - private SelectBox selTexturequal; - private SelectBox selAdaptscreen; - private List selSaved; - private ImageButton Setflag, info_up_nrj, info_up_temp, info_up, info_up_rayon, + private PrefWindow winOptions; + private SavingWindow winSave; + private ImageButton 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_cycleval, nextpage, previouspage; private ImageTextButton info_cout, info_tech, info_research, info_activation; @@ -108,6 +104,7 @@ public class GameScreen implements Screen { private TextArea info_desc, tooltip; public boolean unroll; public Worlds worlds; + public Translist translist; public enum calling { mouseover, mouseclick, mousedrag, longpress, tap, taptap, zoom, fling, pan, pinch @@ -322,7 +319,6 @@ public class GameScreen implements Screen { hideInfo(); } }); - dialog = new WarnDialog(AssetLoader.Skin_ui); Gdx.app.debug("wirechem-GameScreen", "Création d'une tilemap"); map = new TouchMaptiles(worlds,level, 128, 128); if (Preference.prefs.getBoolean("Grid")) @@ -677,9 +673,15 @@ public class GameScreen implements Screen { @Override public void show() { Gdx.app.debug("wirechem-GameScreen","Création de la fenêtre d'option"); - Table Optiontable = Createoption(); + winOptions = new PrefWindow(); 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); Gdx.app.log("wirechem-GameScreen", "***** Affichage du niveau."); stage_info.addActor(info_tech); @@ -750,11 +752,11 @@ public class GameScreen implements Screen { winOptions.setVisible(false); winSave.setVisible(!winSave.isVisible()); if (winSave.isVisible()) - readsaved(); + winSave.refresh(); } else if (caller == "save") { Gdx.app.debug("wirechem-GameScreen", "Barre | Sauvegarde de la grille."); worlds.SaveGrid(); - readsaved(); + winSave.refresh(); } else if (caller == "levels") { Gdx.app.debug("wirechem-GameScreen", "Barre | Affichage des niveaux."); exit(); @@ -805,7 +807,7 @@ public class GameScreen implements Screen { winOptions.setVisible(!winOptions.isVisible()); winSave.setVisible(false); if (winOptions.isVisible()) - readpref(); + winOptions.refresh(); } else if (caller == "flag") { if (AssetLoader.language.getLocale().getDisplayName() .contains("français")) { @@ -909,225 +911,5 @@ public class GameScreen implements Screen { 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 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(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(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(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; - } + } diff --git a/core/src/fr/evolving/screens/LevelScreen.java b/core/src/fr/evolving/screens/LevelScreen.java index daf4af7..9463ad9 100644 --- a/core/src/fr/evolving/screens/LevelScreen.java +++ b/core/src/fr/evolving/screens/LevelScreen.java @@ -29,7 +29,6 @@ import fr.evolving.UI.Objectives; import fr.evolving.UI.ServerList; import fr.evolving.UI.Transhower; import fr.evolving.UI.Translist; -import fr.evolving.UI.WarnDialog; import fr.evolving.UI.Worldlist; import fr.evolving.assets.AssetLoader; import fr.evolving.assets.InitWorlds; @@ -39,6 +38,7 @@ import fr.evolving.automata.Transmuter; import fr.evolving.automata.Worlds; import fr.evolving.automata.Worlds.State; import fr.evolving.database.Base; +import fr.evolving.dialogs.WarningDialog; import fr.evolving.renderers.LevelRenderer; public class LevelScreen implements Screen { @@ -49,7 +49,7 @@ public class LevelScreen implements Screen { private TimerTask ScrollTask; private Stage stage; private Table table; - private WarnDialog dialog; + private WarningDialog dialog; private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer; public Image MenuSolo, MenuMulti, MenuScenario; private ImageTextButton cout, tech, cycle, temp, rayon, nrj, up_cycle, up_temp, up_rayon, up_nrj, research, up; @@ -63,9 +63,6 @@ public class LevelScreen implements Screen { private Objectives Victory; public ButtonLevel selected; public int addervalue; - - public Translist test; - public void play() { if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) { @@ -272,17 +269,6 @@ public class LevelScreen implements Screen { } public LevelScreen(Worlds aworlds) { - Array test2=new Array(); - 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; addervalue=1; worlds.addListener(new ChangeListener() { @@ -328,7 +314,7 @@ public class LevelScreen implements Screen { stage = new Stage(AssetLoader.viewport); table = new Table(); 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."); ScrollTimer = new Timer(); ScrollTask = new TimerTask() { @@ -898,10 +884,6 @@ public class LevelScreen implements Screen { stage.addActor(up_temp); stage.addActor(up_rayon); stage.addActor(research); - - stage.addActor(test); - - Gdx.input.setInputProcessor(stage); Gdx.app.debug("wirechem-LevelScreen", "Début dans la bande son \'intro\'"); AssetLoader.intro.setLooping(true);