From 6283a40a10c94e43d337c74dad17602b78478610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Sat, 8 Aug 2015 23:18:01 +0200 Subject: [PATCH] feat: ajout des informations dans la barre d'infos --- .../src/fr/evolving/automata/Positiver_I.java | 9 +- .../fr/evolving/automata/Positiver_II.java | 9 +- .../fr/evolving/automata/Positiver_III.java | 9 +- core/src/fr/evolving/automata/Transmuter.java | 4 + core/src/fr/evolving/screens/GameScreen.java | 187 ++++++++++++------ core/src/fr/evolving/worlds/GameRenderer.java | 4 +- 6 files changed, 153 insertions(+), 69 deletions(-) diff --git a/core/src/fr/evolving/automata/Positiver_I.java b/core/src/fr/evolving/automata/Positiver_I.java index 823a074..d629f71 100644 --- a/core/src/fr/evolving/automata/Positiver_I.java +++ b/core/src/fr/evolving/automata/Positiver_I.java @@ -10,7 +10,7 @@ import fr.evolving.automata.Transmuter.CaseType; import fr.evolving.automata.Transmuter.Class; public class Positiver_I extends Transmuter { - private static String Name; + private static String Name,Desc; private static Class theClass; private static int Price; private static int Technology; @@ -40,7 +40,8 @@ public class Positiver_I extends Transmuter { public Positiver_I(Level level) { super(level); - this.Name="Positiveur I"; + this.Name="Positiveur I"; + this.Desc="Positiveur de degré 1 avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec"; this.theClass=Class.Charge; this.Price=50; this.Technology=2; @@ -73,6 +74,10 @@ public class Positiver_I extends Transmuter { return this.Name; } + public String getDesc() { + return this.Desc; + } + public String getaClass() { return this.theClass.toString(); } diff --git a/core/src/fr/evolving/automata/Positiver_II.java b/core/src/fr/evolving/automata/Positiver_II.java index 6ed47ed..aa693c6 100644 --- a/core/src/fr/evolving/automata/Positiver_II.java +++ b/core/src/fr/evolving/automata/Positiver_II.java @@ -9,7 +9,7 @@ import fr.evolving.automata.Transmuter.CaseType; import fr.evolving.automata.Transmuter.Class; public class Positiver_II extends Transmuter { - private static String Name; + private static String Name,Desc; private static Class theClass; private static int Price; private static int Technology; @@ -38,7 +38,8 @@ public class Positiver_II extends Transmuter { public Positiver_II(Level level) { super(level); - this.Name="Positiveur II"; + this.Name="Positiveur II"; + this.Desc="Positiveur de degré 2 avec...blabla"; this.theClass=Class.Charge; this.Price=50; this.Technology=2; @@ -71,6 +72,10 @@ public class Positiver_II extends Transmuter { return this.Name; } + public String getDesc() { + return this.Desc; + } + public String getaClass() { return this.theClass.toString(); } diff --git a/core/src/fr/evolving/automata/Positiver_III.java b/core/src/fr/evolving/automata/Positiver_III.java index d3e3bba..f596cbf 100644 --- a/core/src/fr/evolving/automata/Positiver_III.java +++ b/core/src/fr/evolving/automata/Positiver_III.java @@ -9,7 +9,7 @@ import fr.evolving.automata.Transmuter.CaseType; import fr.evolving.automata.Transmuter.Class; public class Positiver_III extends Transmuter { - private static String Name; + private static String Name,Desc; private static Class theClass; private static int Price; private static int Technology; @@ -38,7 +38,8 @@ public class Positiver_III extends Transmuter { public Positiver_III(Level level) { super(level); - this.Name="Positiveur III"; + this.Name="Positiveur III"; + this.Desc="Positiveur de degré 3 avec...blabla"; this.theClass=Class.Charge; this.Price=50; this.Technology=2; @@ -71,6 +72,10 @@ public class Positiver_III extends Transmuter { return this.Name; } + public String getDesc() { + return this.Desc; + } + public String getaClass() { return this.theClass.toString(); } diff --git a/core/src/fr/evolving/automata/Transmuter.java b/core/src/fr/evolving/automata/Transmuter.java index e528af4..68ae5a9 100644 --- a/core/src/fr/evolving/automata/Transmuter.java +++ b/core/src/fr/evolving/automata/Transmuter.java @@ -22,6 +22,10 @@ public abstract class Transmuter { return ""; } + public String getDesc() { + return ""; + } + public String getaClass() { return ""; } diff --git a/core/src/fr/evolving/screens/GameScreen.java b/core/src/fr/evolving/screens/GameScreen.java index 5d62d78..34d95c2 100644 --- a/core/src/fr/evolving/screens/GameScreen.java +++ b/core/src/fr/evolving/screens/GameScreen.java @@ -28,6 +28,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Table; +import com.badlogic.gdx.scenes.scene2d.ui.TextArea; import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup; import com.badlogic.gdx.scenes.scene2d.utils.Align; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; @@ -55,7 +56,7 @@ public class GameScreen implements Screen { private Array processors; private Timer ScrollTimer; private TimerTask ScrollTask; - private Stage stage,stage2; + private Stage stage,stage_menu,stage_info; private HorizontalGroup table; private VerticalGroup table2; private GameWorld world; @@ -63,7 +64,7 @@ public class GameScreen implements Screen { private float runTime; public Level level; private ImageButton[] Barre; - private ImageTextButton cycle,temp,nrj,rayon,cout,tech; + private ImageTextButton cycle,temp,nrj,rayon,cout,tech,info_cout,info_tech,info_research,info_activation,info_up_nrj,info_up_temp,info_up_rayon,info_up_cycle,info_tree; private ImageTextButton[] Barre2; String[] tocreate={"run","stop","speed","separator","move","zoomp","zoomm","infos","separator","raz","save","levels","tree","exits","separator","screen","sound","tuto","settings","separator","stat"}; public Actor selected; @@ -74,7 +75,9 @@ public class GameScreen implements Screen { private Menu menu; private Actor menuactor; private float oldx,oldy; - private Label fpsLabel; + private Label fpsLabel,info_nom; + private TextArea info_desc,info_up_nrj_val,info_up_temp_val,info_up_rayon_val,info_up_cycle_val; + public boolean unroll; // This is the constructor, not the class declaration @@ -92,10 +95,12 @@ public class GameScreen implements Screen { multiplexer = new InputMultiplexer(); processors = new Array(); stage = new Stage(AssetLoader.viewport); - stage2 = new Stage(AssetLoader.viewport); + stage_menu = new Stage(AssetLoader.viewport); + stage_info = new Stage(AssetLoader.viewport); this.level=alevel; oldx=0; oldy=0; + unroll=false; world = new GameWorld(level); Renderer = new GameRenderer(this); world.setRenderer(Renderer); @@ -135,59 +140,7 @@ public class GameScreen implements Screen { @Override public void clicked(InputEvent event, float x, float y) { Gdx.app.debug(event.getListenerActor().toString(),"tests"); - level.Grid.Cells[10][0].Transmuter=new Positiver_I(level); - level.Grid.Cells[10][1].Transmuter=new Positiver_II(level); - level.Grid.Cells[10][2].Transmuter=new Positiver_I(level); - Gdx.app.debug("0 upgrade",String.valueOf(level.Grid.Cells[10][0].Transmuter.getUpgradeCycle())); - Gdx.app.debug("0 activation",String.valueOf(level.Grid.Cells[10][0].Transmuter.getActivationLevel())); - Gdx.app.debug("2 activation",String.valueOf(level.Grid.Cells[10][2].Transmuter.getActivationLevel())); - level.Grid.Cells[10][0].Transmuter.Activate(); - level.Grid.Cells[10][0].Transmuter.UpgradeCycle(); - Gdx.app.debug("0 activation",String.valueOf(level.Grid.Cells[10][0].Transmuter.getActivationLevel())); - Gdx.app.debug("2 activation",String.valueOf(level.Grid.Cells[10][2].Transmuter.getActivationLevel())); - level.Grid.Cells[10][0].Transmuter.Activate(); - Gdx.app.debug("0 activation",String.valueOf(level.Grid.Cells[10][0].Transmuter.getActivationLevel())); - Gdx.app.debug("2 upgrade",String.valueOf(level.Grid.Cells[10][2].Transmuter.getUpgradeCycle())); - Gdx.app.debug("0 upgrade",String.valueOf(level.Grid.Cells[10][0].Transmuter.getUpgradeCycle())); - level.Grid.Cells[10][0].Transmuter.UpgradeCycle(); - Gdx.app.debug("2 upgrade",String.valueOf(level.Grid.Cells[10][2].Transmuter.getUpgradeCycle())); - Gdx.app.debug("0 upgrade",String.valueOf(level.Grid.Cells[10][0].Transmuter.getUpgradeCycle())); - level.Grid.Cells[10][0].Transmuter.UpgradeCycle(); - Gdx.app.debug("2 upgrade",String.valueOf(level.Grid.Cells[10][2].Transmuter.getUpgradeCycle())); - Gdx.app.debug("0 upgrade",String.valueOf(level.Grid.Cells[10][0].Transmuter.getUpgradeCycle())); - level.Grid.Cells[10][0].Transmuter.UpgradeCycle(); - Gdx.app.debug("2 upgrade",String.valueOf(level.Grid.Cells[10][2].Transmuter.getUpgradeCycle())); - Gdx.app.debug("0 upgrade",String.valueOf(level.Grid.Cells[10][0].Transmuter.getUpgradeCycle())); - Gdx.app.debug("1 upgrade",String.valueOf(level.Grid.Cells[10][1].Transmuter.getUpgradeCycle())); - Gdx.app.debug("0 nom",String.valueOf(level.Grid.Cells[10][0].Transmuter.getName())); - Gdx.app.debug("1 nom",String.valueOf(level.Grid.Cells[10][1].Transmuter.getName())); - Gdx.app.debug("1 taille",String.valueOf(level.Grid.Cells[10][1].Transmuter.getTiles().size())); - level.Grid.Cells[10][0].Transmuter.UpgradeTemp(); - level.Grid.Cells[10][1].Transmuter.UpgradeTemp(); - level.Grid.Cells[10][2].Transmuter.UpgradeTemp(); - level.Grid.Cells[10][2].Transmuter.UpgradeNrj(); - level.Grid.Cells[10][2].Transmuter.setRotation(Angular.A90); - Gdx.app.debug("2 informations",String.valueOf(level.Grid.Cells[10][0].Transmuter.getInformations())); - Gdx.app.debug("2 informations",String.valueOf(level.Grid.Cells[10][1].Transmuter.getInformations())); - Gdx.app.debug("2 informations",String.valueOf(level.Grid.Cells[10][2].Transmuter.getInformations())); - level.Grid.Cells[5][5].Transmuter=new Positiver_I(level); - level.Grid.Cells[5][5].Transmuter.setRotation(Angular.A90); - level.Grid.Cells[8][8].Transmuter=new Positiver_II(level); - level.Grid.Cells[8][8].Transmuter.setRotation(Angular.A180); - level.Grid.Cells[2][2].Transmuter=new Positiver_I(level); - level.Grid.Cells[2][2].Transmuter.setRotation(Angular.A270); - level.Grid.Cells[7][2].Transmuter=new Positiver_III(level); - level.Grid.Cells[7][2].Transmuter.setRotation(Angular.A270); - Gdx.app.debug("7.2 A270 place main",String.valueOf(level.Grid.Cells[7][2].Transmuter.getPostitionMainTile(205))); - level.Grid.tiling_transmuter(); - int[] result; - result=level.Grid.Cells[5][5].Transmuter.getallTiles(); - for (int i=0;i=2 && selected.getName()=="move") { + if (this.getTapCount()>=2 && selected.getName()=="move") map.initzoom(); - } + hideInfo(); } }); } @@ -270,6 +223,7 @@ public class GameScreen implements Screen { menu.setMenuTile(2, 5, 78); menu.setMenuTile(3, 3, 79); Barre2[0].setChecked(true); + hideInfo(); } }); Barre2[1].addListener(new ClickListener(){ @@ -283,6 +237,7 @@ public class GameScreen implements Screen { menu.setMenuTransmuter(0,7,"Positiveur I",Angular.A00); menu.setMenuTransmuter(0,6,"Positiveur II",Angular.A00); menu.setMenuTransmuter(0,5,"Positiveur III",Angular.A00); + hideInfo(); } }); Barre2[2].addListener(new ClickListener(){ @@ -293,6 +248,7 @@ public class GameScreen implements Screen { menu.clear(); map.fillempty(53); selected=null; + hideInfo(); } }); Barre2[3].addListener(new ClickListener(){ @@ -303,6 +259,7 @@ public class GameScreen implements Screen { menu.clear(); map.fillempty(53); selected=null; + hideInfo(); } }); Barre2[4].addListener(new ClickListener(){ @@ -313,6 +270,7 @@ public class GameScreen implements Screen { menu.clear(); map.fillempty(53); selected=null; + hideInfo(); } }); Barre2[5].addListener(new ClickListener(){ @@ -323,6 +281,7 @@ public class GameScreen implements Screen { menu.clear(); map.fillempty(53); selected=null; + hideInfo(); } }); Barre2[6].addListener(new ClickListener(){ @@ -333,6 +292,7 @@ public class GameScreen implements Screen { menu.clear(); map.fillempty(53); selected=null; + hideInfo(); } }); Barre2[7].addListener(new ClickListener(){ @@ -343,6 +303,7 @@ public class GameScreen implements Screen { menu.clear(); map.fillempty(53); selected=null; + hideInfo(); } }); Gdx.app.debug(getClass().getSimpleName(),"Création de la barre de gestion du haut"); @@ -363,6 +324,47 @@ public class GameScreen implements Screen { objectives.setPosition(890,AssetLoader.height-95); buttonlevel=new ButtonLevel(level,true); buttonlevel.setPosition(1760,AssetLoader.height-125); + Gdx.app.debug(getClass().getSimpleName(),"Création de la barre d'information"); + info_tech=new ImageTextButton("0",AssetLoader.Skin_level,"info_tech"); + info_tech.setSize(48, 48); + info_tech.setPosition(1200, AssetLoader.height-775); + info_cout=new ImageTextButton("0",AssetLoader.Skin_level,"info_cout"); + info_cout.setSize(48, 48); + info_cout.setPosition(1280, AssetLoader.height-775); + info_research=new ImageTextButton("0",AssetLoader.Skin_level,"info_research"); + info_research.setSize(48, 48); + info_research.setPosition(1360, AssetLoader.height-775); + info_activation=new ImageTextButton("0",AssetLoader.Skin_level,"info_activation"); + info_activation.setSize(48, 48); + info_activation.setPosition(1440, AssetLoader.height-775); + info_up_cycle=new ImageTextButton("0",AssetLoader.Skin_level,"info_cycle"); + info_up_cycle.setSize(32, 32); + info_up_cycle.setPosition(1855, AssetLoader.height-810); + info_up_temp=new ImageTextButton("0",AssetLoader.Skin_level,"info_temp"); + info_up_temp.setSize(32, 32); + info_up_temp.setPosition(1855, AssetLoader.height-860); + info_up_rayon=new ImageTextButton("0",AssetLoader.Skin_level,"info_rayon"); + info_up_rayon.setSize(32, 32); + info_up_rayon.setPosition(1855, AssetLoader.height-910); + info_up_nrj=new ImageTextButton("0",AssetLoader.Skin_level,"info_nrj"); + info_up_nrj.setSize(32, 32); + info_up_nrj.setPosition(1855, AssetLoader.height-960); + info_tree=new ImageTextButton("Arbre...",AssetLoader.Skin_level,"info_tree"); + info_tree.setSize(48, 48); + info_tree.setPosition(1795, AssetLoader.height-760); + info_tree.getStyle().font.setScale(0.7f); + info_nom= new Label("Unknow",AssetLoader.Skin_level,"info_nom"); + info_nom.setPosition(1230, AssetLoader.height-710); + info_desc=new TextArea("Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description", AssetLoader.Skin_level, "info_desc") ; + info_desc.setBounds(1220, AssetLoader.height-965, 550, 150); + info_up_cycle_val=new TextArea("U: 0.1\nT: 0.5", AssetLoader.Skin_level, "info_up") ; + info_up_cycle_val.setBounds(1800, AssetLoader.height-840, 120, 50); + info_up_temp_val=new TextArea("U: 0.1\nT: 0.5", AssetLoader.Skin_level, "info_up") ; + info_up_temp_val.setBounds(1800, AssetLoader.height-875, 120, 50); + info_up_rayon_val=new TextArea("U: 0.1\nT: 0.5", AssetLoader.Skin_level, "info_up") ; + info_up_rayon_val.setBounds(1800, AssetLoader.height-925, 120, 50); + info_up_nrj_val=new TextArea("U: 0.1\nT: 0.5", AssetLoader.Skin_level, "info_up") ; + info_up_nrj_val.setBounds(1800, AssetLoader.height-975, 120, 50); Gdx.app.debug(getClass().getSimpleName(),"Création d'une tilemap"); map=new TouchMaptiles(level,128,128); map.setBounds(0, 0, AssetLoader.width, AssetLoader.height); @@ -393,6 +395,7 @@ public class GameScreen implements Screen { Vector2 coords=map.screentoworld(x, y); if (level.Grid.GetXY(coords.x,coords.y)!=null) { + Gdx.app.debug(event.getListenerActor().toString(),"Etat extension:"+unroll); if (level.Grid.GetXY(coords.x,coords.y).Copper) Gdx.app.debug(getClass().getSimpleName(),"*** Présence de cuivre"); if (level.Grid.GetXY(coords.x,coords.y).Fiber>0) @@ -402,9 +405,12 @@ public class GameScreen implements Screen { if (gotomain!=null) { Gdx.app.debug(event.getListenerActor().toString(),"transmuter deplacement vers origine:"+String.valueOf(gotomain.x)+","+String.valueOf(gotomain.y)+" coords:"+(coords.x+gotomain.x)+"x"+(coords.y+gotomain.y)); Gdx.app.debug(event.getListenerActor().toString(),level.Grid.getTransmuter(coords.x+gotomain.x,coords.y+gotomain.y).getInformations()); + showInfo(level.Grid.getTransmuter(coords.x+gotomain.x,coords.y+gotomain.y)); } } } + else + hideInfo(); return false; } else if (selected.getName()=="zoomp") @@ -619,6 +625,7 @@ public class GameScreen implements Screen { else if (tile>99) { Transmuter transmuter=AssetLoader.getTransmuter(tile); if (transmuter!=null) { + showInfo(transmuter); Vector2 gotomain=transmuter.getPostitionMainTile(tile); if (gotomain!=null) { coords2=menu.worldtoscreen((int)(coords.x+gotomain.x),(int)(coords.y+gotomain.y)); @@ -634,6 +641,8 @@ public class GameScreen implements Screen { } }); } + + @Override public void render(float delta) { @@ -641,9 +650,11 @@ public class GameScreen implements Screen { world.update(delta); fpsLabel.setText(Gdx.graphics.getFramesPerSecond()+"FPS"); Renderer.render(delta, runTime,0); - stage2.draw(); + stage_menu.draw(); Renderer.render(delta, runTime,1); stage.draw(); + if (unroll) + stage_info.draw(); Renderer.render(delta, runTime,2); } @@ -659,7 +670,22 @@ public class GameScreen implements Screen { table2.addActor(Barre2[i]); for (int i=0;i0); + info_tech.setText(String.valueOf(transmuter.getTechnology())); + info_cout.setVisible(transmuter.getPrice()>0); + info_cout.setText(String.valueOf(transmuter.getPrice())); + info_research.setVisible(transmuter.getResearch()>0); + info_research.setText(String.valueOf(transmuter.getResearch())); + info_activation.setVisible(transmuter.isActivable()); + info_activation.setText(String.valueOf(transmuter.getActivationLevel())); + info_up_cycle.setVisible(transmuter.isUpgradableCycle()); + info_up_cycle.setText(String.valueOf(transmuter.getUpgradeCycle())); + info_up_nrj.setVisible(transmuter.isUpgradableNrj()); + info_up_nrj.setText(String.valueOf(transmuter.getUpgradeNrj())); + info_up_temp.setVisible(transmuter.isUpgradableTemp()); + info_up_temp.setText(String.valueOf(transmuter.getUpgradeTemp())); + info_up_rayon.setVisible(transmuter.isUpgradableRayon()); + info_up_rayon.setText(String.valueOf(transmuter.getUpgradeRayon())); + info_up_cycle_val.setVisible(transmuter.isUpgradableCycle()); + info_up_cycle_val.setText(String.valueOf("A:"+transmuter.getUpgradeCycle()*10)); + info_up_nrj_val.setVisible(transmuter.isUpgradableNrj()); + info_up_nrj_val.setText(String.valueOf("U:"+transmuter.getUsedNrj()+"\nT:"+transmuter.getTurnNrj())); + info_up_temp_val.setVisible(transmuter.isUpgradableTemp()); + info_up_temp_val.setText(String.valueOf("U:"+transmuter.getUsedTemp()+"\nT:"+transmuter.getTurnTemp())); + info_up_rayon_val.setVisible(transmuter.isUpgradableRayon()); + info_up_rayon_val.setText(String.valueOf("U:"+transmuter.getUsedRayon()+"\nT:"+transmuter.getTurnRayon())); + } + + public void hideInfo() { + unroll=false; + + } + public void checkMenu(int menu,boolean check) { for (int i=0;i