feat: changement de l'actor menu vers un véritable menu multipage.
This commit is contained in:
parent
45078a3b68
commit
a87352fd61
|
@ -18,40 +18,35 @@ import com.badlogic.gdx.utils.ObjectMap.Entry;
|
|||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.assets.AssetLoader;
|
||||
import fr.evolving.automata.Level;
|
||||
import fr.evolving.automata.Transmuter;
|
||||
import fr.evolving.automata.Transmuter.Angular;
|
||||
|
||||
public class Menu extends Actor {
|
||||
|
||||
private TiledMap map;
|
||||
private TiledMap[][] map;
|
||||
private OrthogonalTiledMapRenderer MapRenderer;
|
||||
private OrthographicCamera camera;
|
||||
private int tilesizex;
|
||||
private int tilesizey;
|
||||
private int nbpages;
|
||||
private int selpage;
|
||||
private int seltype;
|
||||
private float decx;
|
||||
private float decy;
|
||||
private int size = 32;
|
||||
private Level level;
|
||||
|
||||
public Menu(int tilesizex, int tilesizey) {
|
||||
this.tilesizex = tilesizex;
|
||||
this.tilesizey = tilesizey;
|
||||
map = new TiledMap();
|
||||
map.getTileSets().addTileSet(AssetLoader.tileSet);
|
||||
MapLayers layers = map.getLayers();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
TiledMapTileLayer layer = new TiledMapTileLayer(tilesizex,
|
||||
tilesizey, 128, 128);
|
||||
for (int x = 0; x < layer.getWidth(); x++) {
|
||||
for (int y = 0; y < layer.getHeight(); y++) {
|
||||
Cell cell = new Cell();
|
||||
if (i == 0)
|
||||
cell.setTile(AssetLoader.tileSet.getTile(54));
|
||||
layer.setCell(x, y, cell);
|
||||
}
|
||||
}
|
||||
layers.add(layer);
|
||||
}
|
||||
map.getLayers().get(1).setOpacity(0.5f);
|
||||
MapRenderer = new OrthogonalTiledMapRenderer(map, 1 / (float) size);
|
||||
public Menu(Level level) {
|
||||
this.tilesizex = 4;
|
||||
this.tilesizey = 8;
|
||||
this.nbpages=3;
|
||||
this.selpage=0;
|
||||
this.seltype=0;
|
||||
this.level=level;
|
||||
map = new TiledMap[3][Transmuter.Class.values().length];
|
||||
clear();
|
||||
MapRenderer = new OrthogonalTiledMapRenderer(map[selpage][seltype], 1 / (float) size);
|
||||
camera = new OrthographicCamera();
|
||||
camera.setToOrtho(false, tilesizex * 32, tilesizex * 32
|
||||
* AssetLoader.height / AssetLoader.width);
|
||||
|
@ -59,22 +54,101 @@ public class Menu extends Actor {
|
|||
+ (tilesizex * size) + "x" + (tilesizey * size));
|
||||
decx = -102f;
|
||||
decy = -20f;
|
||||
if (AssetLoader.ratio == 1.44f)
|
||||
decy -= 24;
|
||||
if (AssetLoader.ratio == 1.44f) decy -= 24;
|
||||
camera.translate(decx, decy);
|
||||
Gdx.app.debug(getClass().getSimpleName(), "Décalage:" + decx + "x"
|
||||
+ decy);
|
||||
Gdx.app.debug(getClass().getSimpleName(), "Décalage:" + decx + "x"+ decy);
|
||||
Gdx.app.debug(getClass().getSimpleName(), "Ajout des éléments de menu");
|
||||
init();
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
this.selpage=page;
|
||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||
EraseSurtile();
|
||||
}
|
||||
|
||||
public void NextPage() {
|
||||
if (this.selpage<nbpages-1)
|
||||
this.selpage++;
|
||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||
EraseSurtile();
|
||||
}
|
||||
|
||||
public void PreviousPage() {
|
||||
if (this.selpage>0)
|
||||
this.selpage--;
|
||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||
EraseSurtile();
|
||||
}
|
||||
|
||||
public int getPage() {
|
||||
return this.selpage;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.seltype=type;
|
||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.seltype;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.setMenuTile(0, 7, 71, "copper_pen",0);
|
||||
this.setMenuTile(1, 7, 72, "copper_brush",0);
|
||||
this.setMenuTile(2, 7, 73, "copper_eraser",0);
|
||||
this.setMenuTile(1, 5, 70, "blank",0);
|
||||
this.setMenuTile(0, 6, 74, "fiber_pen",0);
|
||||
this.setMenuTile(1, 6, 75, "fiber_brush",0);
|
||||
this.setMenuTile(2, 6, 76, "fiber_eraser",0);
|
||||
this.setMenuTile(0, 5, 77, "transmuter_eraser",0);
|
||||
this.setMenuTile(2, 5, 78, "all_eraser",0);
|
||||
this.setMenuTile(3, 3, 79, "cleaner",0);
|
||||
this.setMenuTransmuter(0, 7, "Positiveur I", Angular.A00,0);
|
||||
this.setMenuTransmuter(2, 7, "Negativeur I", Angular.A00,0);
|
||||
this.setMenuTransmuter(0, 6, "Positiveur II", Angular.A00,0);
|
||||
this.setMenuTransmuter(2, 6, "Negativeur II", Angular.A00,0);
|
||||
this.setMenuTransmuter(0, 5, "Positiveur III", Angular.A00,0);
|
||||
this.setMenuTransmuter(1, 5, "Negativeur III", Angular.A00,0);
|
||||
this.setMenuTransmuter(0, 4, "Inverseur I", Angular.A00,0);
|
||||
this.setMenuTransmuter(1, 4, "Inverseur II", Angular.A00,0);
|
||||
this.setMenuTransmuter(0, 3, "Neutraliseur I", Angular.A00,0);
|
||||
this.setMenuTransmuter(1, 3, "Neutraliseur II", Angular.A00,0);
|
||||
this.setMenuTransmuter(0, 7, "Antiretour", Angular.A00,0);
|
||||
this.setMenuTransmuter(1, 6, "Distributeur", Angular.A00,1);
|
||||
this.setMenuTransmuter(1, 4, "Insufleur 33%", Angular.A00,0);
|
||||
this.setMenuTransmuter(1, 1, "Insufleur 50%", Angular.A00,0);
|
||||
this.setMenuTransmuter(1, 2, "Insufleur 100%", Angular.A00,1);
|
||||
this.setMenuTransmuter(0, 7, "Positiveur non activable",Angular.A00,0);
|
||||
this.setMenuTransmuter(1, 7, "Negativeur non activable",Angular.A00,0);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(0);
|
||||
for (int x = 0; x < layer.getWidth(); x++)
|
||||
for (int y = 0; y < layer.getHeight(); y++)
|
||||
layer.getCell(x, y).setTile(AssetLoader.tileSet.getTile(54));
|
||||
for (int k=0;k<Transmuter.Class.values().length;k++)
|
||||
for (int j=0;j<nbpages;j++){
|
||||
map[j][k]=new TiledMap();
|
||||
map[j][k].getTileSets().addTileSet(AssetLoader.tileSet);
|
||||
MapLayers layers = map[j][k].getLayers();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
TiledMapTileLayer layer = new TiledMapTileLayer(tilesizex,
|
||||
tilesizey, 128, 128);
|
||||
for (int x = 0; x < layer.getWidth(); x++) {
|
||||
for (int y = 0; y < layer.getHeight(); y++) {
|
||||
Cell cell = new Cell();
|
||||
if (i == 0)
|
||||
cell.setTile(AssetLoader.tileSet.getTile(54));
|
||||
layer.setCell(x, y, cell);
|
||||
}
|
||||
}
|
||||
layers.add(layer);
|
||||
}
|
||||
map[j][k].getLayers().get(1).setOpacity(0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMenuTile(int x, int y, int tile, String title) {
|
||||
Cell cell = ((TiledMapTileLayer) map.getLayers().get(0)).getCell(x, y);
|
||||
private void setMenuTile(int x, int y, int tile, String title, int page) {
|
||||
Cell cell = ((TiledMapTileLayer) map[page][0].getLayers().get(0)).getCell(x, y);
|
||||
if (cell != null) {
|
||||
cell.setTile(AssetLoader.tileSet.getTile(tile));
|
||||
cell.getTile().getProperties().put("name", title);
|
||||
|
@ -84,15 +158,14 @@ public class Menu extends Actor {
|
|||
}
|
||||
}
|
||||
|
||||
public void setMenuTransmuterSurtile(int x, int y, Transmuter transmuter) {
|
||||
public void setSurtile(int x, int y, Transmuter transmuter) {
|
||||
if (transmuter != null) {
|
||||
Cell cell = ((TiledMapTileLayer) map.getLayers().get(1)).getCell(x,
|
||||
y);
|
||||
Cell cell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(1)).getCell(x,y);
|
||||
OrderedMap<Vector2, Integer> tiles = transmuter.getTilesidrotated();
|
||||
Entries<Vector2, Integer> iterator = tiles.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Entry<Vector2, Integer> all = iterator.next();
|
||||
Cell subcell = ((TiledMapTileLayer) map.getLayers().get(1))
|
||||
Cell subcell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(1))
|
||||
.getCell((int) (x + all.key.x), (int) (y + all.key.y));
|
||||
subcell.setTile(AssetLoader.tileSet.getTile(transmuter
|
||||
.getTilestype(
|
||||
|
@ -103,8 +176,8 @@ public class Menu extends Actor {
|
|||
}
|
||||
}
|
||||
|
||||
public void EraseMenuTransmuterSurtile() {
|
||||
TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(1);
|
||||
public void EraseSurtile() {
|
||||
TiledMapTileLayer layer = (TiledMapTileLayer) map[selpage][seltype].getLayers().get(1);
|
||||
for (int x = 0; x < layer.getWidth(); x++)
|
||||
for (int y = 0; y < layer.getHeight(); y++)
|
||||
layer.getCell(x, y).setTile(null);
|
||||
|
@ -118,29 +191,33 @@ public class Menu extends Actor {
|
|||
return tilesizey;
|
||||
}
|
||||
|
||||
public void setMenuTransmuter(int x, int y, String Name,
|
||||
Transmuter.Angular Angle) {
|
||||
Cell cell = ((TiledMapTileLayer) map.getLayers().get(0)).getCell(x, y);
|
||||
if (cell != null) {
|
||||
Transmuter transmuter = AssetLoader.getTransmuter(Name);
|
||||
if (transmuter != null) {
|
||||
private void setMenuTransmuter(int x, int y, String Name, Transmuter.Angular Angle,int page) {
|
||||
Transmuter transmuter = AssetLoader.getTransmuter(Name);
|
||||
if (transmuter != null) {
|
||||
int type=transmuter.getaClass().ordinal();
|
||||
Cell cell = ((TiledMapTileLayer) map[page][type].getLayers().get(0)).getCell(x, y);
|
||||
if (cell != null) {
|
||||
|
||||
Gdx.app.debug(getClass().getSimpleName(), "Transmuter find:"
|
||||
+ transmuter.getName() + " Angle:" + Angle + " coords"
|
||||
+ x + "," + y);
|
||||
transmuter.setRotation(Angle);
|
||||
Iterator<Entry<Vector2, Integer>> keySetIterator = transmuter
|
||||
.getTilesidrotated().iterator();
|
||||
while (keySetIterator.hasNext()) {
|
||||
Entry<Vector2, Integer> all = keySetIterator.next();
|
||||
Cell subcell = ((TiledMapTileLayer) map.getLayers().get(0))
|
||||
.getCell((int) (x + all.key.x),
|
||||
(int) (y + all.key.y));
|
||||
subcell.setTile(AssetLoader.tileSet.getTile(all.value));
|
||||
subcell.setRotation(Angle.ordinal());
|
||||
subcell.getTile().getProperties()
|
||||
.put("movetox", (int) -all.key.x);
|
||||
subcell.getTile().getProperties()
|
||||
.put("movetoy", (int) -all.key.y);
|
||||
+ x + "," + y+" page:"+page+" type:"+type);
|
||||
if (transmuter.getTechnology()<=level.Tech) {
|
||||
Gdx.app.debug(getClass().getSimpleName(), "Autorisé par le niveau");
|
||||
transmuter.setRotation(Angle);
|
||||
Iterator<Entry<Vector2, Integer>> keySetIterator = transmuter
|
||||
.getTilesidrotated().iterator();
|
||||
while (keySetIterator.hasNext()) {
|
||||
Entry<Vector2, Integer> all = keySetIterator.next();
|
||||
Cell subcell = ((TiledMapTileLayer) map[page][type].getLayers().get(0))
|
||||
.getCell((int) (x + all.key.x),
|
||||
(int) (y + all.key.y));
|
||||
subcell.setTile(AssetLoader.tileSet.getTile(all.value));
|
||||
subcell.setRotation(Angle.ordinal());
|
||||
subcell.getTile().getProperties()
|
||||
.put("movetox", (int) -all.key.x);
|
||||
subcell.getTile().getProperties()
|
||||
.put("movetoy", (int) -all.key.y);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -148,7 +225,7 @@ public class Menu extends Actor {
|
|||
}
|
||||
|
||||
public MapProperties getMenubyTile(int x, int y) {
|
||||
Cell cell = ((TiledMapTileLayer) map.getLayers().get(0)).getCell(x, y);
|
||||
Cell cell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(0)).getCell(x, y);
|
||||
if (cell != null)
|
||||
return cell.getTile().getProperties();
|
||||
else
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Insufler100 extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -39,7 +41,7 @@ public class Insufler100 extends Transmuter {
|
|||
super(level);
|
||||
this.Name = "Insufleur 100%";
|
||||
this.Desc = "Insufleur blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
|
||||
this.theClass = Class.Charge;
|
||||
this.theClass = Class.Direction;
|
||||
this.Price = 50;
|
||||
this.Technology = 2;
|
||||
this.Research = 0;
|
||||
|
@ -92,8 +94,8 @@ public class Insufler100 extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class Insufler33 extends Transmuter {
|
|||
super(level);
|
||||
this.Name = "Insufleur 33%";
|
||||
this.Desc = "Insufleur 33% avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
|
||||
this.theClass = Class.Charge;
|
||||
this.theClass = Class.Direction;
|
||||
this.Price = 50;
|
||||
this.Technology = 2;
|
||||
this.Research = 0;
|
||||
|
@ -94,8 +94,8 @@ public class Insufler33 extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.badlogic.gdx.utils.ObjectMap.Values;
|
|||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.CaseType;
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Insufler50 extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
|
@ -41,7 +42,7 @@ public class Insufler50 extends Transmuter {
|
|||
super(level);
|
||||
this.Name = "Insufleur 50%";
|
||||
this.Desc = "Insufleur 50% avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
|
||||
this.theClass = Class.Charge;
|
||||
this.theClass = Class.Direction;
|
||||
this.Price = 50;
|
||||
this.Technology = 2;
|
||||
this.Research = 0;
|
||||
|
@ -94,8 +95,8 @@ public class Insufler50 extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Inverter_I extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -41,7 +43,7 @@ public class Inverter_I extends Transmuter {
|
|||
this.Desc = "Inverseur 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;
|
||||
this.Technology = 3;
|
||||
this.Research = 0;
|
||||
this.Upgrade = new Inverter_II(level);
|
||||
this.Unlock = null;
|
||||
|
@ -76,8 +78,8 @@ public class Inverter_I extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Inverter_II extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -76,8 +78,8 @@ public class Inverter_II extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Negativer extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -39,7 +41,7 @@ public class Negativer extends Transmuter {
|
|||
super(level);
|
||||
this.Name = "Negativeur non activable";
|
||||
this.Desc = "Negativeur avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
|
||||
this.theClass = Class.Charge;
|
||||
this.theClass = Class.Scenario;
|
||||
this.Price = 50;
|
||||
this.Technology = 2;
|
||||
this.Research = 0;
|
||||
|
@ -76,8 +78,8 @@ public class Negativer extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Negativer_I extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -78,8 +80,8 @@ public class Negativer_I extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Negativer_II extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -41,7 +43,7 @@ public class Negativer_II extends Transmuter {
|
|||
this.Desc = "Negativeur de degré 3 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;
|
||||
this.Technology = 5;
|
||||
this.Research = 0;
|
||||
this.Upgrade = new Negativer_III(level);
|
||||
this.Unlock = null;
|
||||
|
@ -78,8 +80,8 @@ public class Negativer_II extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Negativer_III extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -77,8 +79,8 @@ public class Negativer_III extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Neutraliser_I extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -76,8 +78,8 @@ public class Neutraliser_I extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Neutraliser_II extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -76,8 +78,8 @@ public class Neutraliser_II extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Oneway extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -39,9 +41,9 @@ public class Oneway extends Transmuter {
|
|||
super(level);
|
||||
this.Name = "Antiretour";
|
||||
this.Desc = "Antiretour avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
|
||||
this.theClass = Class.Charge;
|
||||
this.theClass = Class.Direction;
|
||||
this.Price = 50;
|
||||
this.Technology = 2;
|
||||
this.Technology = 5;
|
||||
this.Research = 0;
|
||||
this.Upgrade = new Positiver_II(level);
|
||||
this.Unlock = null;
|
||||
|
@ -76,8 +78,8 @@ public class Oneway extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Positiver extends Transmuter {
|
|||
super(level);
|
||||
this.Name = "Positiveur non activable";
|
||||
this.Desc = "Positiveur ...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec";
|
||||
this.theClass = Class.Charge;
|
||||
this.theClass = Class.Scenario;
|
||||
this.Price = 50;
|
||||
this.Technology = 2;
|
||||
this.Research = 0;
|
||||
|
@ -76,8 +76,8 @@ public class Positiver extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Positiver_I extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -78,8 +80,8 @@ public class Positiver_I extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class Positiver_II extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -78,8 +80,8 @@ public class Positiver_II extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -76,8 +76,8 @@ public class Positiver_III extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -37,8 +37,8 @@ public abstract class Transmuter implements Cloneable, Serializable {
|
|||
return "";
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return "";
|
||||
public Class getaClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.badlogic.gdx.math.Vector2;
|
|||
import com.badlogic.gdx.utils.ObjectMap.Values;
|
||||
import com.badlogic.gdx.utils.OrderedMap;
|
||||
|
||||
import fr.evolving.automata.Transmuter.Class;
|
||||
|
||||
public class distributor extends Transmuter {
|
||||
private static String Name, Desc;
|
||||
private static Class theClass;
|
||||
|
@ -84,8 +86,8 @@ public class distributor extends Transmuter {
|
|||
return this.Desc;
|
||||
}
|
||||
|
||||
public String getaClass() {
|
||||
return this.theClass.toString();
|
||||
public Class getaClass() {
|
||||
return this.theClass;
|
||||
}
|
||||
|
||||
public void ProcessCycle() {
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.badlogic.gdx.InputProcessor;
|
|||
import com.badlogic.gdx.Screen;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.input.GestureDetector;
|
||||
import com.badlogic.gdx.maps.MapProperties;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
|
@ -27,6 +28,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
|
|||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.List;
|
||||
|
@ -36,12 +38,14 @@ import com.badlogic.gdx.scenes.scene2d.ui.Slider;
|
|||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextArea;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Tooltip;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectMap.Entries;
|
||||
|
@ -86,7 +90,7 @@ public class GameScreen implements Screen {
|
|||
private List selSaved;
|
||||
private ImageButton Setflag, info_up_nrj, info_up_temp, info_up_rayon,
|
||||
info_up_cycle, info_up_nrjval, info_up_tempval, info_up_rayonval,
|
||||
info_up_cycleval, SetFlag;
|
||||
info_up_cycleval, SetFlag, nextpage, previouspage;
|
||||
private ImageTextButton cycle, temp, nrj, rayon, cout, tech, research,
|
||||
info_cout, info_tech, info_research, info_activation;
|
||||
private ImageTextButton[] Barre2;
|
||||
|
@ -453,7 +457,34 @@ public class GameScreen implements Screen {
|
|||
event_coordination(x, y, 0, calling.mousedrag, exec);
|
||||
}
|
||||
});
|
||||
menu = new Menu(4, 8);
|
||||
Gdx.app.debug(getClass().getSimpleName(), "Création du menu");
|
||||
nextpage=new ImageButton(AssetLoader.Skin_level,"extend");
|
||||
nextpage.setPosition(1860, AssetLoader.height - 350);
|
||||
nextpage.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
menu.NextPage();
|
||||
Gdx.app.debug("menu", "Page suivante:"+menu.getPage());
|
||||
map.tempclear();
|
||||
map.fillempty(53);
|
||||
selected = null;
|
||||
hideInfo();
|
||||
}
|
||||
});
|
||||
previouspage=new ImageButton(AssetLoader.Skin_level,"extend2");
|
||||
previouspage.setPosition(1830, AssetLoader.height - 350);
|
||||
previouspage.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
menu.PreviousPage();
|
||||
Gdx.app.debug("menu", "Page précédente:"+menu.getPage());
|
||||
map.tempclear();
|
||||
map.fillempty(53);
|
||||
selected = null;
|
||||
hideInfo();
|
||||
}
|
||||
});
|
||||
menu = new Menu(level);
|
||||
map.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
|
@ -462,7 +493,7 @@ public class GameScreen implements Screen {
|
|||
MapProperties tile = menu.getMenubyTile((int) coords.x,
|
||||
(int) coords.y);
|
||||
if (tile != null && tile.containsKey("name")) {
|
||||
menu.EraseMenuTransmuterSurtile();
|
||||
menu.EraseSurtile();
|
||||
map.tempclear();
|
||||
if (menuactor == null)
|
||||
menuactor = new Actor();
|
||||
|
@ -480,7 +511,7 @@ public class GameScreen implements Screen {
|
|||
if (selected_transmuter != null) {
|
||||
selected.setName("transmuter");
|
||||
showInfo(selected_transmuter);
|
||||
menu.setMenuTransmuterSurtile((int) coords.x,
|
||||
menu.setSurtile((int) coords.x,
|
||||
(int) coords.y, selected_transmuter);
|
||||
Gdx.app.debug("menu", "Choix transmuter:"
|
||||
+ selected_transmuter.getName());
|
||||
|
@ -815,6 +846,8 @@ public class GameScreen implements Screen {
|
|||
stage_info.addActor(info_desc);
|
||||
stage_menu.addActor(map);
|
||||
// stage_tooltip.addActor(tooltip);
|
||||
stage.addActor(nextpage);
|
||||
stage.addActor(previouspage);
|
||||
stage.addActor(objectives);
|
||||
stage.addActor(buttonlevel);
|
||||
stage.addActor(rayon);
|
||||
|
@ -841,7 +874,7 @@ public class GameScreen implements Screen {
|
|||
public void preparebarre(Actor caller, int count) {
|
||||
map.fillempty(53);
|
||||
map.tempclear();
|
||||
menu.EraseMenuTransmuterSurtile();
|
||||
menu.EraseSurtile();
|
||||
hideInfo();
|
||||
if (caller.getName() == "run") {
|
||||
} else if (caller.getName() == "stop") {
|
||||
|
@ -938,52 +971,13 @@ public class GameScreen implements Screen {
|
|||
|
||||
public void preparemenu(int menuitem) {
|
||||
checkMenu(menuitem, true);
|
||||
menu.clear();
|
||||
map.tempclear();
|
||||
map.fillempty(53);
|
||||
selected = null;
|
||||
menu.EraseMenuTransmuterSurtile();
|
||||
menu.EraseSurtile();
|
||||
hideInfo();
|
||||
if (menuitem == 0) {
|
||||
menu.setMenuTile(0, 7, 71, "copper_pen");
|
||||
menu.setMenuTile(1, 7, 72, "copper_brush");
|
||||
menu.setMenuTile(2, 7, 73, "copper_eraser");
|
||||
menu.setMenuTile(1, 5, 70, "blank");
|
||||
menu.setMenuTile(0, 6, 74, "fiber_pen");
|
||||
menu.setMenuTile(1, 6, 75, "fiber_brush");
|
||||
menu.setMenuTile(2, 6, 76, "fiber_eraser");
|
||||
menu.setMenuTile(0, 5, 77, "transmuter_eraser");
|
||||
menu.setMenuTile(2, 5, 78, "all_eraser");
|
||||
menu.setMenuTile(3, 3, 79, "cleaner");
|
||||
} else if (menuitem == 1) {
|
||||
menu.setMenuTransmuter(0, 7, "Positiveur I", Angular.A00);
|
||||
menu.setMenuTransmuter(2, 7, "Negativeur I", Angular.A00);
|
||||
menu.setMenuTransmuter(0, 6, "Positiveur II", Angular.A00);
|
||||
menu.setMenuTransmuter(2, 6, "Negativeur II", Angular.A00);
|
||||
menu.setMenuTransmuter(0, 5, "Positiveur III", Angular.A00);
|
||||
menu.setMenuTransmuter(1, 5, "Negativeur III", Angular.A00);
|
||||
menu.setMenuTransmuter(0, 4, "Inverseur I", Angular.A00);
|
||||
menu.setMenuTransmuter(1, 4, "Inverseur II", Angular.A00);
|
||||
menu.setMenuTransmuter(0, 3, "Neutraliseur I", Angular.A00);
|
||||
menu.setMenuTransmuter(1, 3, "Neutraliseur II", Angular.A00);
|
||||
} else if (menuitem == 2) {
|
||||
menu.setMenuTransmuter(0, 7, "Antiretour", Angular.A00);
|
||||
menu.setMenuTransmuter(1, 6, "Distributeur", Angular.A00);
|
||||
menu.setMenuTransmuter(1, 2, "Insufleur 33%", Angular.A00);
|
||||
} else if (menuitem == 3) {
|
||||
menu.setMenuTransmuter(1, 2, "Insufleur 50%", Angular.A00);
|
||||
} else if (menuitem == 4) {
|
||||
menu.setMenuTransmuter(1, 2, "Insufleur 100%", Angular.A00);
|
||||
} else if (menuitem == 5) {
|
||||
|
||||
} else if (menuitem == 6) {
|
||||
|
||||
} else if (menuitem == 7) {
|
||||
menu.setMenuTransmuter(0, 7, "Positiveur non activable",
|
||||
Angular.A00);
|
||||
menu.setMenuTransmuter(1, 7, "Negativeur non activable",
|
||||
Angular.A00);
|
||||
}
|
||||
menu.setType(menuitem);
|
||||
menu.setPage(0);
|
||||
}
|
||||
|
||||
public void showInfo(Transmuter transmuter) {
|
||||
|
|
Loading…
Reference in New Issue