feat: ajout d'un actor iconvalue qui permet d'afficher des données du niveau en "live"
This commit is contained in:
parent
87a63a44bb
commit
fd74d60194
|
@ -0,0 +1,73 @@
|
||||||
|
package fr.evolving.UI;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
|
|
||||||
|
import fr.evolving.automata.Worlds;
|
||||||
|
|
||||||
|
public class IconValue extends ImageTextButton{
|
||||||
|
|
||||||
|
public enum Icon{tech,cout,research,cycle,temp,rayon,nrj};
|
||||||
|
Icon icon;
|
||||||
|
boolean showmaximum;
|
||||||
|
Worlds worlds;
|
||||||
|
|
||||||
|
public IconValue(Icon icon,Worlds worlds, Skin skin) {
|
||||||
|
super("", skin,icon.toString()+"2");
|
||||||
|
this.icon=icon;
|
||||||
|
this.worlds=worlds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetShowMaximum(boolean value)
|
||||||
|
{
|
||||||
|
showmaximum=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void act(float delta)
|
||||||
|
{
|
||||||
|
switch(this.icon) {
|
||||||
|
case tech:
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Tech));
|
||||||
|
this.setVisible(worlds.getInformations().Tech>=1);
|
||||||
|
break;
|
||||||
|
case cout:
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Cout));
|
||||||
|
this.setVisible(worlds.getInformations().Cout>0);
|
||||||
|
break;
|
||||||
|
case research:
|
||||||
|
this.setText(String.valueOf(worlds.ReadResearch()));
|
||||||
|
this.setVisible(worlds.ReadResearch()>0);
|
||||||
|
break;
|
||||||
|
case cycle:
|
||||||
|
this.setVisible(worlds.getWorld()>=1);
|
||||||
|
if (showmaximum)
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Cycle)+"/"+String.valueOf(worlds.getInformations().Maxcycle));
|
||||||
|
else
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Cycle));
|
||||||
|
break;
|
||||||
|
case temp:
|
||||||
|
this.setVisible(worlds.getWorld()>=2);
|
||||||
|
if (showmaximum)
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Temp)+"/"+String.valueOf(worlds.getInformations().Maxtemp));
|
||||||
|
else
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Temp));
|
||||||
|
break;
|
||||||
|
case rayon:
|
||||||
|
this.setVisible(worlds.getWorld()>=3);
|
||||||
|
if (showmaximum)
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Rayon)+"/"+String.valueOf(worlds.getInformations().Maxrayon));
|
||||||
|
else
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Rayon));
|
||||||
|
break;
|
||||||
|
case nrj:
|
||||||
|
this.setVisible(worlds.getWorld()>=4);
|
||||||
|
if (showmaximum)
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Nrj)+"/"+String.valueOf(worlds.getInformations().Maxnrj));
|
||||||
|
else
|
||||||
|
this.setText(String.valueOf(worlds.getInformations().Nrj));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ public class LevelRenderer {
|
||||||
shapeRenderer = new ShapeRenderer();
|
shapeRenderer = new ShapeRenderer();
|
||||||
Laser = new Laser();
|
Laser = new Laser();
|
||||||
AssetLoader.viewport.apply();
|
AssetLoader.viewport.apply();
|
||||||
font = AssetLoader.Skin_level.getFont("OpenDyslexicAlta-22");
|
font = AssetLoader.Skin_level.getFont("OpenDyslexicAlta-25");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void evolve() {
|
public void evolve() {
|
||||||
|
@ -146,7 +146,7 @@ public class LevelRenderer {
|
||||||
* AssetLoader.ratio,
|
* AssetLoader.ratio,
|
||||||
10,
|
10,
|
||||||
0.5f,
|
0.5f,
|
||||||
!LevelScreen.buttonLevels[i].level.Locked,
|
!LevelScreen.buttonLevels[found].level.Locked,
|
||||||
LevelScreen.buttonLevels[i]
|
LevelScreen.buttonLevels[i]
|
||||||
.getLevelcolor(),
|
.getLevelcolor(),
|
||||||
LevelScreen.buttonLevels[found]
|
LevelScreen.buttonLevels[found]
|
||||||
|
@ -162,7 +162,7 @@ public class LevelRenderer {
|
||||||
* AssetLoader.ratio,
|
* AssetLoader.ratio,
|
||||||
10,
|
10,
|
||||||
0.5f,
|
0.5f,
|
||||||
!LevelScreen.buttonLevels[i].level.Locked,
|
!LevelScreen.buttonLevels[found].level.Locked,
|
||||||
LevelScreen.buttonLevels[i]
|
LevelScreen.buttonLevels[i]
|
||||||
.getLevelcolor(),
|
.getLevelcolor(),
|
||||||
LevelScreen.buttonLevels[found]
|
LevelScreen.buttonLevels[found]
|
||||||
|
|
|
@ -35,6 +35,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.List;
|
import com.badlogic.gdx.scenes.scene2d.ui.List;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
|
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.Slider;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
|
||||||
|
@ -55,11 +56,13 @@ import com.badlogic.gdx.utils.OrderedMap;
|
||||||
|
|
||||||
import fr.evolving.UI.ButtonLevel;
|
import fr.evolving.UI.ButtonLevel;
|
||||||
import fr.evolving.UI.HorizBarre;
|
import fr.evolving.UI.HorizBarre;
|
||||||
|
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.VertiBarre;
|
import fr.evolving.UI.VertiBarre;
|
||||||
import fr.evolving.UI.WarnDialog;
|
import fr.evolving.UI.WarnDialog;
|
||||||
|
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;
|
||||||
import fr.evolving.automata.Level;
|
import fr.evolving.automata.Level;
|
||||||
|
@ -90,8 +93,8 @@ public class GameScreen implements Screen {
|
||||||
private ImageButton Setflag, info_up_nrj, info_up_temp, info_up, info_up_rayon,
|
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 cycle, temp, nrj, rayon, cout, tech, research,
|
private ImageTextButton info_cout, info_tech, info_research, info_activation;
|
||||||
info_cout, info_tech, info_research, info_activation;
|
private IconValue cycle, temp, nrj, rayon, cout, tech, research;
|
||||||
String[] tocreate;
|
String[] tocreate;
|
||||||
private ButtonLevel buttonlevel;
|
private ButtonLevel buttonlevel;
|
||||||
private Objectives objectives;
|
private Objectives objectives;
|
||||||
|
@ -248,27 +251,20 @@ public class GameScreen implements Screen {
|
||||||
tooltip = new TextArea("tooltip:x\r\n tooltip:y",AssetLoader.Skin_level, "info_tooltip");
|
tooltip = new TextArea("tooltip:x\r\n tooltip:y",AssetLoader.Skin_level, "info_tooltip");
|
||||||
tooltip.setBounds(541, 27, 100, 50);
|
tooltip.setBounds(541, 27, 100, 50);
|
||||||
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du haut");
|
Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du haut");
|
||||||
cycle = new ImageTextButton(String.valueOf(level.Cycle),AssetLoader.Skin_level, "cycle2");
|
cycle = new IconValue(Icon.cycle,worlds, AssetLoader.Skin_level);
|
||||||
cycle.setVisible(level.aWorld>=1);
|
|
||||||
cycle.setPosition(10, AssetLoader.height - 74);
|
cycle.setPosition(10, AssetLoader.height - 74);
|
||||||
temp = new ImageTextButton(String.valueOf(level.Temp),AssetLoader.Skin_level, "temp2");
|
temp = new IconValue(Icon.temp,worlds, AssetLoader.Skin_level);
|
||||||
temp.setVisible(level.aWorld>=2);
|
|
||||||
temp.setPosition(210, AssetLoader.height - 74);
|
temp.setPosition(210, AssetLoader.height - 74);
|
||||||
rayon = new ImageTextButton(String.valueOf(level.Rayon),AssetLoader.Skin_level, "rayon2");
|
rayon = new IconValue(Icon.rayon,worlds, AssetLoader.Skin_level);
|
||||||
rayon.setVisible(level.aWorld>=3);
|
|
||||||
rayon.setPosition(410, AssetLoader.height - 74);
|
rayon.setPosition(410, AssetLoader.height - 74);
|
||||||
nrj = new ImageTextButton(String.valueOf(level.Nrj),AssetLoader.Skin_level, "nrj2");
|
nrj = new IconValue(Icon.nrj,worlds, AssetLoader.Skin_level);
|
||||||
nrj.setVisible(level.aWorld>=4);
|
|
||||||
nrj.setPosition(610, AssetLoader.height - 74);
|
nrj.setPosition(610, AssetLoader.height - 74);
|
||||||
tech = new ImageTextButton(String.valueOf(level.Tech),AssetLoader.Skin_level, "tech2");
|
tech = new IconValue(Icon.tech,worlds, AssetLoader.Skin_level);
|
||||||
tech.setPosition(1345, AssetLoader.height - 74);
|
tech.setPosition(1345, AssetLoader.height - 74);
|
||||||
tech.setVisible(level.Tech>=1);
|
cout = new IconValue(Icon.cout,worlds, AssetLoader.Skin_level);
|
||||||
cout = new ImageTextButton(String.valueOf(level.Cout),AssetLoader.Skin_level, "cout2");
|
|
||||||
cout.setVisible(level.Cout>0);
|
|
||||||
cout.setPosition(1445, AssetLoader.height - 74);
|
cout.setPosition(1445, AssetLoader.height - 74);
|
||||||
research = new ImageTextButton(String.valueOf(0),AssetLoader.Skin_level, "research2");
|
research = new IconValue(Icon.research,worlds, AssetLoader.Skin_level);
|
||||||
research.setPosition(1545, AssetLoader.height - 74);
|
research.setPosition(1545, AssetLoader.height - 74);
|
||||||
research.setVisible(level.Special || level.aWorld>0);
|
|
||||||
objectives = new Objectives();
|
objectives = new Objectives();
|
||||||
objectives.setVictory(level.Victory);
|
objectives.setVictory(level.Victory);
|
||||||
objectives.setPosition(890, AssetLoader.height - 95);
|
objectives.setPosition(890, AssetLoader.height - 95);
|
||||||
|
@ -716,6 +712,7 @@ public class GameScreen implements Screen {
|
||||||
menu.EraseSurtile();
|
menu.EraseSurtile();
|
||||||
hideInfo();
|
hideInfo();
|
||||||
if (caller == "run") {
|
if (caller == "run") {
|
||||||
|
worlds.getInformations().Cout-=15;
|
||||||
} else if (caller == "stop") {
|
} else if (caller == "stop") {
|
||||||
} else if (caller == "speed") {
|
} else if (caller == "speed") {
|
||||||
} else if (caller == "move") {
|
} else if (caller == "move") {
|
||||||
|
|
Loading…
Reference in New Issue