feat: creation de l'élement horizbar et amélioration de menu afin d'alléger le gamerenderer et gamescreen
This commit is contained in:
parent
46c2627314
commit
aa9afa4cc5
|
@ -0,0 +1,157 @@
|
||||||
|
package fr.evolving.UI;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Game;
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Touchable;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Tooltip;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
|
||||||
|
import com.badlogic.gdx.utils.reflect.Method;
|
||||||
|
|
||||||
|
import fr.evolving.assets.AssetLoader;
|
||||||
|
import fr.evolving.screens.GameScreen;
|
||||||
|
import fr.evolving.screens.GameScreen.calling;
|
||||||
|
|
||||||
|
public class HorizBarre extends Actor {
|
||||||
|
private ImageButton[] Barre;
|
||||||
|
private HorizontalGroup table;
|
||||||
|
private java.lang.reflect.Method method;
|
||||||
|
private TextureRegion oneselection;
|
||||||
|
private Timer RotateTimer;
|
||||||
|
private TimerTask RotateTask;
|
||||||
|
private Actor selected;
|
||||||
|
private float rotation;
|
||||||
|
ChangeEvent event;
|
||||||
|
|
||||||
|
public HorizBarre(String[] tocreate, String methodname) {
|
||||||
|
Class<?> base;
|
||||||
|
try {
|
||||||
|
Class<?>[] params = {String.class, int.class};
|
||||||
|
base = Class.forName("fr.evolving.screens.GameScreen");
|
||||||
|
method = base.getDeclaredMethod(methodname, params);
|
||||||
|
} catch (ClassNotFoundException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer de rotation.");
|
||||||
|
oneselection = AssetLoader.Atlas_level.findRegion("circle");
|
||||||
|
rotation=0;
|
||||||
|
RotateTimer = new Timer();
|
||||||
|
RotateTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
rotation += 5;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RotateTimer.scheduleAtFixedRate(RotateTask, 0, 30);
|
||||||
|
|
||||||
|
this.setBounds(0, 0, 1920, 80);
|
||||||
|
Barre = new ImageButton[tocreate.length];
|
||||||
|
int i = 0;
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(), "Barre bas:" + Barre.length
|
||||||
|
+ " elements");
|
||||||
|
for (String item : tocreate) {
|
||||||
|
final String itemtocreate=item.replace("#", "");
|
||||||
|
Barre[i] = new ImageButton(AssetLoader.Skin_level, itemtocreate);
|
||||||
|
Barre[i].setTouchable(Touchable.enabled);
|
||||||
|
Barre[i].setName(itemtocreate);
|
||||||
|
if (item.contains("#"))
|
||||||
|
{
|
||||||
|
Barre[i++].addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
onchanged();
|
||||||
|
if (selected==null) selected = new Actor();
|
||||||
|
selected.setName(itemtocreate);
|
||||||
|
selected.setBounds(event.getListenerActor().getX(), event.getListenerActor().getY(), 64, 64);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Barre[i++].addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
String caller = event.getListenerActor().getName();
|
||||||
|
Gdx.app.debug("Barre", "Selection dans la Barre bas:"
|
||||||
|
+ caller);
|
||||||
|
try {
|
||||||
|
method.invoke(((Game) Gdx.app.getApplicationListener()).getScreen(), caller, this.getTapCount());
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Barre[15].setChecked(Gdx.graphics.isFullscreen());
|
||||||
|
Barre[16].setChecked(AssetLoader.intro.getVolume() > 0);
|
||||||
|
Barre[17].setChecked(AssetLoader.Tooltipmanager.enabled == true);
|
||||||
|
table = new HorizontalGroup();
|
||||||
|
table.bottom().padLeft(5f).padBottom(8f).space(10f);
|
||||||
|
this.setTouchable(Touchable.enabled);
|
||||||
|
table.setTouchable(Touchable.enabled);
|
||||||
|
for (i = 0; i < Barre.length; i++)
|
||||||
|
table.addActor(Barre[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unSelect() {
|
||||||
|
selected=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSelection() {
|
||||||
|
if (selected!=null)
|
||||||
|
return selected.getName();
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onchanged() {
|
||||||
|
ChangeEvent event=new ChangeEvent();
|
||||||
|
event.setTarget(this);
|
||||||
|
event.setListenerActor(this);
|
||||||
|
event.setStage(this.getStage());
|
||||||
|
if (event.getStage()!=null)
|
||||||
|
this.fire(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Actor hit(float x, float y, boolean touchable) {
|
||||||
|
return table.hit(x, y, touchable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
|
table.draw(batch, parentAlpha);
|
||||||
|
if (selected != null) {
|
||||||
|
batch.setColor(1f, 0f, 0f, 1f);
|
||||||
|
batch.draw(oneselection, selected.getX()+this.getX(),
|
||||||
|
selected.getY()+this.getY(),
|
||||||
|
selected.getWidth() / 2,
|
||||||
|
selected.getHeight() / 2,
|
||||||
|
selected.getWidth(),
|
||||||
|
selected.getHeight(), 1f, 1f, rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package fr.evolving.UI;
|
package fr.evolving.UI;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.maps.MapLayers;
|
import com.badlogic.gdx.maps.MapLayers;
|
||||||
import com.badlogic.gdx.maps.MapProperties;
|
import com.badlogic.gdx.maps.MapProperties;
|
||||||
import com.badlogic.gdx.maps.tiled.TiledMap;
|
import com.badlogic.gdx.maps.tiled.TiledMap;
|
||||||
|
@ -13,6 +16,9 @@ import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
|
||||||
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
|
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
import com.badlogic.gdx.utils.ObjectMap.Entries;
|
import com.badlogic.gdx.utils.ObjectMap.Entries;
|
||||||
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
import com.badlogic.gdx.utils.ObjectMap.Entry;
|
||||||
import com.badlogic.gdx.utils.OrderedMap;
|
import com.badlogic.gdx.utils.OrderedMap;
|
||||||
|
@ -36,6 +42,13 @@ public class Menu extends Actor {
|
||||||
private float decy;
|
private float decy;
|
||||||
private int size = 32;
|
private int size = 32;
|
||||||
private Level level;
|
private Level level;
|
||||||
|
private Actor selected;
|
||||||
|
private Transmuter selected_transmuter;
|
||||||
|
private TextureRegion oneselection;
|
||||||
|
private Timer RotateTimer;
|
||||||
|
private TimerTask RotateTask;
|
||||||
|
private float rotation;
|
||||||
|
ChangeEvent event;
|
||||||
|
|
||||||
public Menu(Level level) {
|
public Menu(Level level) {
|
||||||
this.tilesizex = 4;
|
this.tilesizex = 4;
|
||||||
|
@ -44,50 +57,168 @@ public class Menu extends Actor {
|
||||||
this.selpage=0;
|
this.selpage=0;
|
||||||
this.seltype=0;
|
this.seltype=0;
|
||||||
this.level=level;
|
this.level=level;
|
||||||
|
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(), "Création du Tiledmap et Maprenderer");
|
||||||
map = new TiledMap[3][Transmuter.Class.values().length];
|
map = new TiledMap[3][Transmuter.Class.values().length];
|
||||||
clear();
|
clear();
|
||||||
MapRenderer = new OrthogonalTiledMapRenderer(map[selpage][seltype], 1 / (float) size);
|
MapRenderer = new OrthogonalTiledMapRenderer(map[selpage][seltype], 1 / (float) size);
|
||||||
|
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(), "Caméra pour tilemap:"+ (tilesizex * size) + "x" + (tilesizey * size));
|
||||||
camera = new OrthographicCamera();
|
camera = new OrthographicCamera();
|
||||||
camera.setToOrtho(false, tilesizex * 32, tilesizex * 32
|
camera.setToOrtho(false, tilesizex * 32, tilesizex * 32 * AssetLoader.height / AssetLoader.width);
|
||||||
* AssetLoader.height / AssetLoader.width);
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Caméra pour tilemap:"
|
|
||||||
+ (tilesizex * size) + "x" + (tilesizey * size));
|
|
||||||
decx = -102f;
|
decx = -102f;
|
||||||
decy = -20f;
|
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);
|
||||||
|
camera.translate(decx, decy);
|
||||||
|
|
||||||
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Ajout des éléments de menu");
|
Gdx.app.debug(getClass().getSimpleName(), "Ajout des éléments de menu");
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer de rotation.");
|
||||||
|
oneselection = AssetLoader.Atlas_level.findRegion("circle");
|
||||||
|
selected = new Actor();
|
||||||
|
rotation=0;
|
||||||
|
RotateTimer = new Timer();
|
||||||
|
RotateTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
rotation += 5;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
RotateTimer.scheduleAtFixedRate(RotateTask, 0, 30);
|
||||||
|
|
||||||
|
Gdx.app.debug(getClass().getSimpleName(), "Ajout de l'évènements clicked");
|
||||||
|
this.addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
Gdx.app.debug("treetree", "xy"+x+","+y);
|
||||||
|
Vector2 coords = screentoworld(x, y);
|
||||||
|
MapProperties tile = getMenubyTile((int) coords.x,
|
||||||
|
(int) coords.y);
|
||||||
|
if (tile != null && tile.containsKey("name")) {
|
||||||
|
selected_transmuter=null;
|
||||||
|
EraseSurtile();
|
||||||
|
if (selected==null)
|
||||||
|
selected=new Actor();
|
||||||
|
if (tile.get("type").toString().startsWith("transmuter")) {
|
||||||
|
if (tile.containsKey("movetox")) {
|
||||||
|
coords.x += (Integer) tile.get("movetox");
|
||||||
|
coords.y += (Integer) tile.get("movetoy");
|
||||||
|
}
|
||||||
|
MapProperties tilenew = getMenubyTile((int) coords.x, (int) coords.y);
|
||||||
|
selected_transmuter = (Transmuter) ((Transmuter) tilenew.get("transmuter")).clone();
|
||||||
|
if (selected_transmuter != null) {
|
||||||
|
selected.setName("transmuter");
|
||||||
|
setSurtile((int) coords.x,(int) coords.y, selected_transmuter);
|
||||||
|
Gdx.app.debug("menu", "Choix transmuter:"+ selected_transmuter.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
selected.setName(tile.get("name").toString());
|
||||||
|
Vector2 coords2 = worldtoscreen((int) coords.x,
|
||||||
|
(int) coords.y);
|
||||||
|
Gdx.app.debug("menu","Coordonnées:" + x + "x" + y + " Menu:" + coords.x
|
||||||
|
+ "," + coords.y + " Ecran :" + coords2.x
|
||||||
|
+ "x" + coords2.y + " type:"
|
||||||
|
+ tile.get("type"));
|
||||||
|
selected.setBounds(coords2.x, coords2.y, 60, 60);
|
||||||
|
onchanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unSelect() {
|
||||||
|
selected=null;
|
||||||
|
selected_transmuter=null;
|
||||||
|
EraseSurtile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSelection() {
|
||||||
|
if (selected!=null)
|
||||||
|
return selected.getName();
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Transmuter getTransmuter() {
|
||||||
|
return selected_transmuter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onchanged() {
|
||||||
|
ChangeEvent event=new ChangeEvent();
|
||||||
|
event.setTarget(this);
|
||||||
|
event.setListenerActor(this);
|
||||||
|
event.setStage(this.getStage());
|
||||||
|
if (event.getStage()!=null)
|
||||||
|
this.fire(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPage(int page) {
|
public void setPage(int page) {
|
||||||
|
selected=null;
|
||||||
this.selpage=page;
|
this.selpage=page;
|
||||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||||
EraseSurtile();
|
EraseSurtile();
|
||||||
|
onchanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPageType(int page,int type) {
|
||||||
|
selected=null;
|
||||||
|
this.selpage=page;
|
||||||
|
this.seltype=type;
|
||||||
|
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||||
|
EraseSurtile();
|
||||||
|
onchanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNextEmpty() {
|
||||||
|
if (this.selpage>=this.nbpages-2) return true;
|
||||||
|
TiledMapTileLayer layer=(TiledMapTileLayer)map[selpage+1][seltype].getLayers().get(0);
|
||||||
|
boolean test=layer.getProperties().containsKey("noempty");
|
||||||
|
return (!layer.getProperties().containsKey("noempty"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPreviousEmpty() {
|
||||||
|
if (this.selpage<1) return true;
|
||||||
|
TiledMapTileLayer layer=(TiledMapTileLayer)map[selpage-1][seltype].getLayers().get(0);
|
||||||
|
return (!layer.getProperties().containsKey("noempty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NextPage() {
|
public void NextPage() {
|
||||||
if (this.selpage<nbpages-1)
|
if (this.selpage<nbpages-1) {
|
||||||
|
selected=null;
|
||||||
this.selpage++;
|
this.selpage++;
|
||||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||||
EraseSurtile();
|
EraseSurtile();
|
||||||
|
onchanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PreviousPage() {
|
public void PreviousPage() {
|
||||||
if (this.selpage>0)
|
if (this.selpage>0) {
|
||||||
|
selected=null;
|
||||||
this.selpage--;
|
this.selpage--;
|
||||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||||
EraseSurtile();
|
EraseSurtile();
|
||||||
|
onchanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPage() {
|
public int getPage() {
|
||||||
return this.selpage;
|
return this.selpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaxPage() {
|
||||||
|
return this.nbpages;
|
||||||
|
}
|
||||||
|
|
||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
this.seltype=type;
|
this.seltype=type;
|
||||||
|
selected=null;
|
||||||
this.MapRenderer.setMap(map[selpage][seltype]);
|
this.MapRenderer.setMap(map[selpage][seltype]);
|
||||||
|
onchanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
|
@ -148,19 +279,21 @@ public class Menu extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMenuTile(int x, int y, int tile, String title, int page) {
|
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);
|
TiledMapTileLayer layer = ((TiledMapTileLayer) map[page][0].getLayers().get(0));
|
||||||
|
Cell cell = layer.getCell(x, y);
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
cell.setTile(AssetLoader.tileSet.getTile(tile));
|
cell.setTile(AssetLoader.tileSet.getTile(tile));
|
||||||
cell.getTile().getProperties().put("name", title);
|
cell.getTile().getProperties().put("name", title);
|
||||||
cell.setRotation(0);
|
cell.setRotation(0);
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Tile find:" + tile
|
Gdx.app.debug(getClass().getSimpleName(), "Tile find:" + tile
|
||||||
+ " coords" + x + "," + y);
|
+ " coords" + x + "," + y);
|
||||||
|
layer.getProperties().put("noempty", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSurtile(int x, int y, Transmuter transmuter) {
|
public void setSurtile(int x, int y, Transmuter transmuter) {
|
||||||
if (transmuter != null) {
|
if (transmuter != null) {
|
||||||
Cell cell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(1)).getCell(x,y);
|
Cell cell = ((TiledMapTileLayer) map[selpage][seltype].getLayers().get(1)).getCell(x, y);
|
||||||
OrderedMap<Vector2, Integer> tiles = transmuter.getTilesidrotated();
|
OrderedMap<Vector2, Integer> tiles = transmuter.getTilesidrotated();
|
||||||
Entries<Vector2, Integer> iterator = tiles.iterator();
|
Entries<Vector2, Integer> iterator = tiles.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -172,7 +305,6 @@ public class Menu extends Actor {
|
||||||
tiles.keys().toArray().indexOf(all.key, false))
|
tiles.keys().toArray().indexOf(all.key, false))
|
||||||
.ordinal() + 80));
|
.ordinal() + 80));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,22 +327,21 @@ public class Menu extends Actor {
|
||||||
Transmuter transmuter = AssetLoader.getTransmuter(Name);
|
Transmuter transmuter = AssetLoader.getTransmuter(Name);
|
||||||
if (transmuter != null) {
|
if (transmuter != null) {
|
||||||
int type=transmuter.getaClass().ordinal();
|
int type=transmuter.getaClass().ordinal();
|
||||||
Cell cell = ((TiledMapTileLayer) map[page][type].getLayers().get(0)).getCell(x, y);
|
TiledMapTileLayer layer = ((TiledMapTileLayer) map[page][type].getLayers().get(0));
|
||||||
|
Cell cell = layer.getCell(x, y);
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Transmuter find:"
|
Gdx.app.debug(getClass().getSimpleName(), "Transmuter find:"
|
||||||
+ transmuter.getName() + " Angle:" + Angle + " coords"
|
+ transmuter.getName() + " Angle:" + Angle + " coords"
|
||||||
+ x + "," + y+" page:"+page+" type:"+type);
|
+ x + "," + y+" page:"+page+" type:"+type);
|
||||||
if (transmuter.getTechnology()<=level.Tech) {
|
if (transmuter.getTechnology()<=level.Tech) {
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Autorisé par le niveau");
|
Gdx.app.debug(getClass().getSimpleName(), "Autorisé par le niveau");
|
||||||
|
layer.getProperties().put("noempty", false);
|
||||||
transmuter.setRotation(Angle);
|
transmuter.setRotation(Angle);
|
||||||
Iterator<Entry<Vector2, Integer>> keySetIterator = transmuter
|
Iterator<Entry<Vector2, Integer>> keySetIterator = transmuter
|
||||||
.getTilesidrotated().iterator();
|
.getTilesidrotated().iterator();
|
||||||
while (keySetIterator.hasNext()) {
|
while (keySetIterator.hasNext()) {
|
||||||
Entry<Vector2, Integer> all = keySetIterator.next();
|
Entry<Vector2, Integer> all = keySetIterator.next();
|
||||||
Cell subcell = ((TiledMapTileLayer) map[page][type].getLayers().get(0))
|
Cell subcell = layer.getCell((int) (x + all.key.x), (int) (y + all.key.y));
|
||||||
.getCell((int) (x + all.key.x),
|
|
||||||
(int) (y + all.key.y));
|
|
||||||
subcell.setTile(AssetLoader.tileSet.getTile(all.value));
|
subcell.setTile(AssetLoader.tileSet.getTile(all.value));
|
||||||
subcell.setRotation(Angle.ordinal());
|
subcell.setRotation(Angle.ordinal());
|
||||||
subcell.getTile().getProperties()
|
subcell.getTile().getProperties()
|
||||||
|
@ -233,14 +364,14 @@ public class Menu extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 screentoworld(float x, float y) {
|
public Vector2 screentoworld(float x, float y) {
|
||||||
int xx = (int) ((x - 1531f) / 60f);
|
int xx = (int) (x / 60f);
|
||||||
int yy = (int) ((y - (AssetLoader.height - 776f)) / 60f);
|
int yy = (int) (y / 60f);
|
||||||
return new Vector2(xx, yy);
|
return new Vector2(xx, yy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 worldtoscreen(int x, int y) {
|
public Vector2 worldtoscreen(int x, int y) {
|
||||||
float xx = 1531.0f + x * 60f;
|
float xx = x * 60f;
|
||||||
float yy = AssetLoader.height - 776.0f + y * 60f;
|
float yy = y * 60f;
|
||||||
return new Vector2(xx, yy);
|
return new Vector2(xx, yy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +382,15 @@ public class Menu extends Actor {
|
||||||
MapRenderer.setView(camera);
|
MapRenderer.setView(camera);
|
||||||
MapRenderer.render();
|
MapRenderer.render();
|
||||||
batch.begin();
|
batch.begin();
|
||||||
|
if (selected != null) {
|
||||||
|
batch.setColor(1f, 0f, 0f, 1f);
|
||||||
|
batch.draw(oneselection, selected.getX()+this.getX(),
|
||||||
|
selected.getY()+this.getY(),
|
||||||
|
selected.getWidth() / 2,
|
||||||
|
selected.getHeight() / 2,
|
||||||
|
selected.getWidth(),
|
||||||
|
selected.getHeight(), 1f, 1f, rotation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@ import com.badlogic.gdx.maps.tiled.TiledMap;
|
||||||
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
|
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
|
||||||
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
|
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
|
||||||
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
|
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
|
||||||
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
|
|
||||||
import fr.evolving.assets.AssetLoader;
|
import fr.evolving.assets.AssetLoader;
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class Positiver_II extends Transmuter {
|
||||||
public void Upgrade() {
|
public void Upgrade() {
|
||||||
if (this.Upgrade == null)
|
if (this.Upgrade == null)
|
||||||
return;
|
return;
|
||||||
this.Unlock.SetShowed(true);
|
this.Upgrade.SetShowed(true);
|
||||||
this.SetShowed(false);
|
this.SetShowed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ public class GameRenderer {
|
||||||
private ShapeRenderer shapeRenderer;
|
private ShapeRenderer shapeRenderer;
|
||||||
private SpriteBatch batcher;
|
private SpriteBatch batcher;
|
||||||
private GameScreen GameScreen;
|
private GameScreen GameScreen;
|
||||||
private TextureRegion oneselection;
|
|
||||||
private float rotation;
|
|
||||||
|
|
||||||
public GameRenderer(GameScreen GameScreen) {
|
public GameRenderer(GameScreen GameScreen) {
|
||||||
this.GameScreen = GameScreen;
|
this.GameScreen = GameScreen;
|
||||||
|
@ -23,12 +21,6 @@ public class GameRenderer {
|
||||||
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
batcher.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
shapeRenderer = new ShapeRenderer();
|
shapeRenderer = new ShapeRenderer();
|
||||||
shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
|
shapeRenderer.setProjectionMatrix(AssetLoader.Camera.combined);
|
||||||
oneselection = AssetLoader.Atlas_level.findRegion("circle");
|
|
||||||
rotation = 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void evolve() {
|
|
||||||
rotation += 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(float delta, float runTime, int layer) {
|
public void render(float delta, float runTime, int layer) {
|
||||||
|
@ -52,17 +44,6 @@ public class GameRenderer {
|
||||||
} else if (layer == 2) {
|
} else if (layer == 2) {
|
||||||
shapeRenderer.begin(ShapeType.Filled);
|
shapeRenderer.begin(ShapeType.Filled);
|
||||||
shapeRenderer.end();
|
shapeRenderer.end();
|
||||||
batcher.begin();
|
|
||||||
if (GameScreen.selected != null) {
|
|
||||||
batcher.setColor(1f, 0f, 0f, 1f);
|
|
||||||
batcher.draw(oneselection, GameScreen.selected.getX(),
|
|
||||||
GameScreen.selected.getY(),
|
|
||||||
GameScreen.selected.getWidth() / 2,
|
|
||||||
GameScreen.selected.getHeight() / 2,
|
|
||||||
GameScreen.selected.getWidth(),
|
|
||||||
GameScreen.selected.getHeight(), 1f, 1f, rotation);
|
|
||||||
}
|
|
||||||
batcher.end();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ import com.badlogic.gdx.utils.ObjectMap.Entry;
|
||||||
import com.badlogic.gdx.utils.OrderedMap;
|
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.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;
|
||||||
|
@ -69,17 +70,13 @@ import fr.evolving.renderers.GameRenderer;
|
||||||
public class GameScreen implements Screen {
|
public class GameScreen implements Screen {
|
||||||
private InputMultiplexer multiplexer;
|
private InputMultiplexer multiplexer;
|
||||||
private Array<InputProcessor> processors;
|
private Array<InputProcessor> processors;
|
||||||
private Timer ScrollTimer;
|
|
||||||
private WarnDialog dialog;
|
private WarnDialog dialog;
|
||||||
private TimerTask ScrollTask;
|
private Stage stage, stage_map, stage_info, stage_tooltip;
|
||||||
private Stage stage, stage_menu, stage_info, stage_tooltip;
|
|
||||||
private HorizontalGroup table;
|
|
||||||
private VerticalGroup table2;
|
private VerticalGroup table2;
|
||||||
private GameRenderer Renderer;
|
private GameRenderer Renderer;
|
||||||
private float runTime;
|
private float runTime;
|
||||||
public Level level;
|
public Level level;
|
||||||
private Window winOptions, winSave;
|
private Window winOptions, winSave;
|
||||||
private ImageButton[] Barre;
|
|
||||||
private CheckBox SetSound, SetVsynch, SetFullscreen, SetAnimation, Settuto,
|
private CheckBox SetSound, SetVsynch, SetFullscreen, SetAnimation, Settuto,
|
||||||
Setdebog, Setrefresh;
|
Setdebog, Setrefresh;
|
||||||
private Slider SetEffectvolume, SetMusicvolume;
|
private Slider SetEffectvolume, SetMusicvolume;
|
||||||
|
@ -88,23 +85,21 @@ public class GameScreen implements Screen {
|
||||||
private SelectBox<quality> selTexturequal;
|
private SelectBox<quality> selTexturequal;
|
||||||
private SelectBox<adaptation> selAdaptscreen;
|
private SelectBox<adaptation> selAdaptscreen;
|
||||||
private List selSaved;
|
private List selSaved;
|
||||||
private ImageButton Setflag, info_up_nrj, info_up_temp, 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, SetFlag, nextpage, previouspage;
|
info_up_cycleval, nextpage, previouspage;
|
||||||
private ImageTextButton cycle, temp, nrj, rayon, cout, tech, research,
|
private ImageTextButton cycle, temp, nrj, rayon, cout, tech, research,
|
||||||
info_cout, info_tech, info_research, info_activation;
|
info_cout, info_tech, info_research, info_activation;
|
||||||
private ImageTextButton[] Barre2;
|
private ImageTextButton[] Barre2;
|
||||||
String[] tocreate = { "run", "stop", "speed", "separator", "move", "zoomp",
|
String[] tocreate = { "run", "stop", "speed", "separator", "move#", "zoomp#",
|
||||||
"zoomm", "infos", "separator", "raz", "save", "levels", "tree",
|
"zoomm#", "infos#", "separator", "raz", "save", "levels", "tree",
|
||||||
"exits", "separator", "screen", "sound", "tuto", "settings",
|
"exits", "separator", "screen", "sound", "tuto", "settings",
|
||||||
"separator", "stat" };
|
"separator", "stat" };
|
||||||
public Actor selected;
|
|
||||||
public Transmuter selected_transmuter;
|
|
||||||
private ButtonLevel buttonlevel;
|
private ButtonLevel buttonlevel;
|
||||||
private Objectives objectives;
|
private Objectives objectives;
|
||||||
private TouchMaptiles map;
|
private TouchMaptiles map;
|
||||||
private Menu menu;
|
private Menu menu;
|
||||||
private Actor menuactor;
|
private HorizBarre horizbar;
|
||||||
private float oldx, oldy;
|
private float oldx, oldy;
|
||||||
private Label fpsLabel, info_nom;
|
private Label fpsLabel, info_nom;
|
||||||
private TextArea info_desc, tooltip;
|
private TextArea info_desc, tooltip;
|
||||||
|
@ -219,12 +214,19 @@ public class GameScreen implements Screen {
|
||||||
this.level.Grid.tiling_copper();
|
this.level.Grid.tiling_copper();
|
||||||
this.level.Grid.tiling_transmuter();
|
this.level.Grid.tiling_transmuter();
|
||||||
}
|
}
|
||||||
Gdx.app.debug(getClass().getSimpleName(),
|
Gdx.app.debug(getClass().getSimpleName(),"Création des Barres verticales & horizontales.");
|
||||||
"Création des Barres verticales & horizontales.");
|
horizbar=new HorizBarre(tocreate,"preparebarre");
|
||||||
table = new HorizontalGroup();
|
horizbar.addListener(new ChangeListener() {
|
||||||
table.bottom().padLeft(5f).padBottom(8f).space(10f);
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
Gdx.app.debug("Barre", "Element changé");
|
||||||
|
map.tempclear();
|
||||||
|
map.fillempty(60);
|
||||||
|
menu.unSelect();
|
||||||
|
}
|
||||||
|
});
|
||||||
table2 = new VerticalGroup();
|
table2 = new VerticalGroup();
|
||||||
table2.setPosition(AssetLoader.width, AssetLoader.height - 360);
|
table2.setPosition(AssetLoader.width, AssetLoader.height - 375);
|
||||||
table2.right();
|
table2.right();
|
||||||
table2.space(10f);
|
table2.space(10f);
|
||||||
Gdx.app.debug(
|
Gdx.app.debug(
|
||||||
|
@ -235,49 +237,21 @@ public class GameScreen implements Screen {
|
||||||
multiplexer = new InputMultiplexer();
|
multiplexer = new InputMultiplexer();
|
||||||
processors = new Array<InputProcessor>();
|
processors = new Array<InputProcessor>();
|
||||||
stage = new Stage(AssetLoader.viewport);
|
stage = new Stage(AssetLoader.viewport);
|
||||||
stage_menu = new Stage(AssetLoader.viewport);
|
stage_map = new Stage(AssetLoader.viewport);
|
||||||
stage_info = new Stage(AssetLoader.viewport);
|
stage_info = new Stage(AssetLoader.viewport);
|
||||||
stage_tooltip = new Stage(AssetLoader.viewport);
|
stage_tooltip = new Stage(AssetLoader.viewport);
|
||||||
oldx = 0;
|
oldx = 0;
|
||||||
oldy = 0;
|
oldy = 0;
|
||||||
unroll = false;
|
unroll = false;
|
||||||
Renderer = new GameRenderer(this);
|
Renderer = new GameRenderer(this);
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Mise en place du timer.");
|
|
||||||
ScrollTimer = new Timer();
|
|
||||||
ScrollTask = new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Renderer.evolve();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ScrollTimer.scheduleAtFixedRate(ScrollTask, 0, 30);
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Création des barres");
|
Gdx.app.debug(getClass().getSimpleName(), "Création des barres");
|
||||||
tooltip = new TextArea("tooltip:x\r\n tooltip:y",
|
tooltip = new TextArea("tooltip:x\r\n tooltip:y",
|
||||||
AssetLoader.Skin_level, "info_tooltip");
|
AssetLoader.Skin_level, "info_tooltip");
|
||||||
tooltip.setBounds(541, 27, 100, 50);
|
tooltip.setBounds(541, 27, 100, 50);
|
||||||
Barre = new ImageButton[tocreate.length];
|
|
||||||
int i = 0;
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Barre bas:" + Barre.length
|
|
||||||
+ " elements");
|
|
||||||
for (String tocreateitem : tocreate) {
|
|
||||||
Barre[i] = new ImageButton(AssetLoader.Skin_level, tocreateitem);
|
|
||||||
Barre[i].setName(tocreateitem);
|
|
||||||
Barre[i].addListener(new ClickListener() {
|
|
||||||
@Override
|
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
|
||||||
Actor caller = event.getListenerActor();
|
|
||||||
Gdx.app.debug("Barre", "Selection dans la Barre bas:"
|
|
||||||
+ caller.getName());
|
|
||||||
preparebarre(caller, this.getTapCount());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Barre[i++].addListener(new Tooltip(tooltip,
|
|
||||||
AssetLoader.Tooltipmanager));
|
|
||||||
}
|
|
||||||
Barre2 = new ImageTextButton[Transmuter.Class.values().length];
|
Barre2 = new ImageTextButton[Transmuter.Class.values().length];
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Menu:" + Barre2.length
|
Gdx.app.debug(getClass().getSimpleName(), "Menu:" + Barre2.length
|
||||||
+ " elements");
|
+ " elements");
|
||||||
for (i = 0; i < Barre2.length; i++) {
|
for (int i = 0; i < Barre2.length; i++) {
|
||||||
Barre2[i] = new ImageTextButton(
|
Barre2[i] = new ImageTextButton(
|
||||||
AssetLoader.language.get(Transmuter.Class.values()[i]
|
AssetLoader.language.get(Transmuter.Class.values()[i]
|
||||||
.toString()), AssetLoader.Skin_level);
|
.toString()), AssetLoader.Skin_level);
|
||||||
|
@ -293,35 +267,41 @@ public class GameScreen implements Screen {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Barre[15].setChecked(Gdx.graphics.isFullscreen());
|
|
||||||
Barre[16].setChecked(AssetLoader.intro.getVolume() > 0);
|
|
||||||
Barre[17].setChecked(AssetLoader.Tooltipmanager.enabled == true);
|
|
||||||
Gdx.app.debug(getClass().getSimpleName(),
|
Gdx.app.debug(getClass().getSimpleName(),
|
||||||
"Création de la barre de gestion du haut");
|
"Création de la barre de gestion du haut");
|
||||||
cycle = new ImageTextButton(String.valueOf(level.Cycle),
|
cycle = new ImageTextButton(String.valueOf(level.Cycle),
|
||||||
AssetLoader.Skin_level, "cycle2");
|
AssetLoader.Skin_level, "cycle2");
|
||||||
|
cycle.setVisible(level.aWorld>=1);
|
||||||
cycle.setPosition(10, AssetLoader.height - 74);
|
cycle.setPosition(10, AssetLoader.height - 74);
|
||||||
temp = new ImageTextButton(String.valueOf(level.Temp),
|
temp = new ImageTextButton(String.valueOf(level.Temp),
|
||||||
AssetLoader.Skin_level, "temp2");
|
AssetLoader.Skin_level, "temp2");
|
||||||
|
temp.setVisible(level.aWorld>=2);
|
||||||
temp.setPosition(210, AssetLoader.height - 74);
|
temp.setPosition(210, AssetLoader.height - 74);
|
||||||
nrj = new ImageTextButton(String.valueOf(level.Nrj),
|
|
||||||
AssetLoader.Skin_level, "nrj2");
|
|
||||||
nrj.setPosition(410, AssetLoader.height - 74);
|
|
||||||
rayon = new ImageTextButton(String.valueOf(level.Rayon),
|
rayon = new ImageTextButton(String.valueOf(level.Rayon),
|
||||||
AssetLoader.Skin_level, "rayon2");
|
AssetLoader.Skin_level, "rayon2");
|
||||||
rayon.setPosition(610, AssetLoader.height - 74);
|
rayon.setVisible(level.aWorld>=3);
|
||||||
|
rayon.setPosition(410, AssetLoader.height - 74);
|
||||||
|
nrj = new ImageTextButton(String.valueOf(level.Nrj),
|
||||||
|
AssetLoader.Skin_level, "nrj2");
|
||||||
|
nrj.setVisible(level.aWorld>=4);
|
||||||
|
nrj.setPosition(610, AssetLoader.height - 74);
|
||||||
tech = new ImageTextButton(String.valueOf(level.Tech),
|
tech = new ImageTextButton(String.valueOf(level.Tech),
|
||||||
AssetLoader.Skin_level, "tech2");
|
AssetLoader.Skin_level, "tech2");
|
||||||
tech.setPosition(1345, AssetLoader.height - 74);
|
tech.setPosition(1345, AssetLoader.height - 74);
|
||||||
|
tech.setVisible(level.Tech==1);
|
||||||
cout = new ImageTextButton(String.valueOf(level.Cout),
|
cout = new ImageTextButton(String.valueOf(level.Cout),
|
||||||
AssetLoader.Skin_level, "cout2");
|
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),
|
research = new ImageTextButton(String.valueOf(0),
|
||||||
AssetLoader.Skin_level, "research2");
|
AssetLoader.Skin_level, "research2");
|
||||||
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);
|
||||||
|
objectives.setVisible(level.Cout>0);
|
||||||
buttonlevel = new ButtonLevel(level, true, 1.0f);
|
buttonlevel = new ButtonLevel(level, true, 1.0f);
|
||||||
buttonlevel.setPosition(1760, AssetLoader.height - 125);
|
buttonlevel.setPosition(1760, AssetLoader.height - 125);
|
||||||
buttonlevel.addListener(new ClickListener() {
|
buttonlevel.addListener(new ClickListener() {
|
||||||
|
@ -383,6 +363,15 @@ public class GameScreen implements Screen {
|
||||||
"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",
|
"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");
|
AssetLoader.Skin_level, "info_desc");
|
||||||
info_desc.setBounds(1220, AssetLoader.height - 965, 575, 150);
|
info_desc.setBounds(1220, AssetLoader.height - 965, 575, 150);
|
||||||
|
info_up=new ImageButton(AssetLoader.Skin_level,"evolution");
|
||||||
|
info_up.setPosition(1375, AssetLoader.height - 720);
|
||||||
|
info_up.addListener(new ClickListener() {
|
||||||
|
@Override
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
if (menu.getTransmuter()!=null && menu.getTransmuter().isUpgradable())
|
||||||
|
menu.getTransmuter().Upgrade();
|
||||||
|
}
|
||||||
|
});
|
||||||
dialog = new WarnDialog(AssetLoader.Skin_ui);
|
dialog = new WarnDialog(AssetLoader.Skin_ui);
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Création d'une tilemap");
|
Gdx.app.debug(getClass().getSimpleName(), "Création d'une tilemap");
|
||||||
map = new TouchMaptiles(level, 128, 128);
|
map = new TouchMaptiles(level, 128, 128);
|
||||||
|
@ -459,89 +448,75 @@ public class GameScreen implements Screen {
|
||||||
});
|
});
|
||||||
Gdx.app.debug(getClass().getSimpleName(), "Création du menu");
|
Gdx.app.debug(getClass().getSimpleName(), "Création du menu");
|
||||||
nextpage=new ImageButton(AssetLoader.Skin_level,"extend");
|
nextpage=new ImageButton(AssetLoader.Skin_level,"extend");
|
||||||
nextpage.setPosition(1860, AssetLoader.height - 350);
|
nextpage.setPosition(1850, AssetLoader.height - 370);
|
||||||
nextpage.addListener(new ClickListener() {
|
nextpage.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
if (!nextpage.isDisabled()) {
|
||||||
menu.NextPage();
|
menu.NextPage();
|
||||||
Gdx.app.debug("menu", "Page suivante:"+menu.getPage());
|
Gdx.app.debug("menu", "Page suivante:"+menu.getPage());
|
||||||
map.tempclear();
|
map.tempclear();
|
||||||
map.fillempty(53);
|
map.fillempty(53);
|
||||||
selected = null;
|
|
||||||
hideInfo();
|
hideInfo();
|
||||||
|
nextpage.setDisabled(menu.isNextEmpty());
|
||||||
|
previouspage.setDisabled(menu.isPreviousEmpty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
previouspage=new ImageButton(AssetLoader.Skin_level,"extend2");
|
previouspage=new ImageButton(AssetLoader.Skin_level,"extend2");
|
||||||
previouspage.setPosition(1830, AssetLoader.height - 350);
|
previouspage.setPosition(1800, AssetLoader.height - 370);
|
||||||
previouspage.addListener(new ClickListener() {
|
previouspage.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
if (!previouspage.isDisabled()) {
|
||||||
menu.PreviousPage();
|
menu.PreviousPage();
|
||||||
Gdx.app.debug("menu", "Page précédente:"+menu.getPage());
|
Gdx.app.debug("menu", "Page précédente:"+menu.getPage());
|
||||||
map.tempclear();
|
map.tempclear();
|
||||||
map.fillempty(53);
|
map.fillempty(53);
|
||||||
selected = null;
|
|
||||||
hideInfo();
|
hideInfo();
|
||||||
|
nextpage.setDisabled(menu.isNextEmpty());
|
||||||
|
previouspage.setDisabled(menu.isPreviousEmpty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu = new Menu(level);
|
menu = new Menu(level);
|
||||||
map.addListener(new ClickListener() {
|
menu.setBounds(1531f, AssetLoader.height-780, 264, 480);
|
||||||
|
menu.addListener(new ChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
mapexit = true;
|
Gdx.app.debug("Menu", "Element changé");
|
||||||
Vector2 coords = menu.screentoworld(x, y);
|
|
||||||
MapProperties tile = menu.getMenubyTile((int) coords.x,
|
|
||||||
(int) coords.y);
|
|
||||||
if (tile != null && tile.containsKey("name")) {
|
|
||||||
menu.EraseSurtile();
|
|
||||||
map.tempclear();
|
map.tempclear();
|
||||||
if (menuactor == null)
|
|
||||||
menuactor = new Actor();
|
|
||||||
map.fillempty(60);
|
map.fillempty(60);
|
||||||
selected = menuactor;
|
if (menu.getTransmuter() != null)
|
||||||
if (tile.get("type").toString().startsWith("transmuter")) {
|
showInfo(menu.getTransmuter());
|
||||||
if (tile.containsKey("movetox")) {
|
else
|
||||||
coords.x += (Integer) tile.get("movetox");
|
hideInfo();
|
||||||
coords.y += (Integer) tile.get("movetoy");
|
horizbar.unSelect();
|
||||||
}
|
|
||||||
MapProperties tilenew = menu.getMenubyTile(
|
|
||||||
(int) coords.x, (int) coords.y);
|
|
||||||
selected_transmuter = (Transmuter) ((Transmuter) tilenew
|
|
||||||
.get("transmuter")).clone();
|
|
||||||
if (selected_transmuter != null) {
|
|
||||||
selected.setName("transmuter");
|
|
||||||
showInfo(selected_transmuter);
|
|
||||||
menu.setSurtile((int) coords.x,
|
|
||||||
(int) coords.y, selected_transmuter);
|
|
||||||
Gdx.app.debug("menu", "Choix transmuter:"
|
|
||||||
+ selected_transmuter.getName());
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
selected.setName(tile.get("name").toString());
|
|
||||||
Vector2 coords2 = menu.worldtoscreen((int) coords.x,
|
|
||||||
(int) coords.y);
|
|
||||||
Gdx.app.debug(
|
|
||||||
"menu",
|
|
||||||
"Coordonnées:" + x + "x" + y + " Menu:" + coords.x
|
|
||||||
+ "," + coords.y + " Ecran :" + coords2.x
|
|
||||||
+ "x" + coords2.y + " type:"
|
|
||||||
+ tile.get("type"));
|
|
||||||
menuactor.setBounds(coords2.x, coords2.y, 60, 60);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getselected() {
|
||||||
|
if (menu.getSelection()==null)
|
||||||
|
if (horizbar.getSelection()==null)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return horizbar.getSelection();
|
||||||
|
else
|
||||||
|
return menu.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
boolean event_coordination(float x, float y, int button, calling call,
|
boolean event_coordination(float x, float y, int button, calling call,
|
||||||
String[] exec) {
|
String[] exec) {
|
||||||
if (selected != null) {
|
Gdx.app.debug("menu", "xy"+x+","+y);
|
||||||
if (Arrays.asList(exec).contains(selected.getName())) {
|
if (getselected() != null) {
|
||||||
|
if (Arrays.asList(exec).contains(getselected())) {
|
||||||
Vector2 coords = map.screentoworld(x, y);
|
Vector2 coords = map.screentoworld(x, y);
|
||||||
if (level.Grid.GetXY(coords.x, coords.y) != null) {
|
if (level.Grid.GetXY(coords.x, coords.y) != null) {
|
||||||
mapexit = false;
|
mapexit = false;
|
||||||
if (call != calling.mouseover)
|
if (call != calling.mouseover)
|
||||||
Gdx.app.debug("evenement", "mode:" + call + " outil:"
|
Gdx.app.debug("evenement", "mode:" + call + " outil:"
|
||||||
+ selected.getName() + " X: " + coords.x
|
+ getselected() + " X: " + coords.x
|
||||||
+ " Y: " + coords.y + " button:" + button);
|
+ " Y: " + coords.y + " button:" + button);
|
||||||
Method method;
|
Method method;
|
||||||
try {
|
try {
|
||||||
|
@ -551,7 +526,7 @@ public class GameScreen implements Screen {
|
||||||
int.class, int.class, boolean.class, int.class,
|
int.class, int.class, boolean.class, int.class,
|
||||||
calling.class };
|
calling.class };
|
||||||
method = base.getDeclaredMethod(
|
method = base.getDeclaredMethod(
|
||||||
"map_" + selected.getName(), params);
|
"map_" + getselected(), params);
|
||||||
method.invoke(this, (float) x, (float) y,
|
method.invoke(this, (float) x, (float) y,
|
||||||
(int) coords.x, (int) coords.y, true,
|
(int) coords.x, (int) coords.y, true,
|
||||||
(int) button, (calling) call);
|
(int) button, (calling) call);
|
||||||
|
@ -575,45 +550,45 @@ public class GameScreen implements Screen {
|
||||||
int button, calling call) {
|
int button, calling call) {
|
||||||
if (call == calling.taptap && button == 0
|
if (call == calling.taptap && button == 0
|
||||||
|| (call == calling.mouseclick && button == 1)) {
|
|| (call == calling.mouseclick && button == 1)) {
|
||||||
Angular angle = selected_transmuter.getRotation();
|
Angular angle = menu.getTransmuter().getRotation();
|
||||||
if (angle == Angular.A00)
|
if (angle == Angular.A00)
|
||||||
selected_transmuter.setRotation(Angular.A90);
|
menu.getTransmuter().setRotation(Angular.A90);
|
||||||
else if (angle == Angular.A90)
|
else if (angle == Angular.A90)
|
||||||
selected_transmuter.setRotation(Angular.A180);
|
menu.getTransmuter().setRotation(Angular.A180);
|
||||||
else if (angle == Angular.A180)
|
else if (angle == Angular.A180)
|
||||||
selected_transmuter.setRotation(Angular.A270);
|
menu.getTransmuter().setRotation(Angular.A270);
|
||||||
else if (angle == Angular.A270)
|
else if (angle == Angular.A270)
|
||||||
selected_transmuter.setRotation(Angular.A00);
|
menu.getTransmuter().setRotation(Angular.A00);
|
||||||
}
|
}
|
||||||
map.tempclear();
|
map.tempclear();
|
||||||
boolean positionisgood = true;
|
boolean positionisgood = true;
|
||||||
int color = 0;
|
int color = 0;
|
||||||
OrderedMap<Vector2, Integer> tiles = selected_transmuter
|
OrderedMap<Vector2, Integer> tiles = menu.getTransmuter()
|
||||||
.getTilesidrotated();
|
.getTilesidrotated();
|
||||||
Entries<Vector2, Integer> iterator = tiles.iterator();
|
Entries<Vector2, Integer> iterator = tiles.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entry<Vector2, Integer> all = iterator.next();
|
Entry<Vector2, Integer> all = iterator.next();
|
||||||
color = 63;
|
color = 63;
|
||||||
int index = tiles.keys().toArray().indexOf(all.key, false);
|
int index = tiles.keys().toArray().indexOf(all.key, false);
|
||||||
if (((selected_transmuter.getTilestype(index) == CaseType.Nimporte)
|
if ((( menu.getTransmuter().getTilestype(index) == CaseType.Nimporte)
|
||||||
|| (!level.Grid.getFiber(x + all.key.x, y + all.key.y)
|
|| (!level.Grid.getFiber(x + all.key.x, y + all.key.y)
|
||||||
&& !level.Grid.getCopper(x + all.key.x, y
|
&& !level.Grid.getCopper(x + all.key.x, y
|
||||||
+ all.key.y) && selected_transmuter
|
+ all.key.y) && menu.getTransmuter()
|
||||||
.getTilestype(index) == CaseType.Rien)
|
.getTilestype(index) == CaseType.Rien)
|
||||||
|| (level.Grid.getFiber(x + all.key.x, y + all.key.y)
|
|| (level.Grid.getFiber(x + all.key.x, y + all.key.y)
|
||||||
&& level.Grid.getCopper(x + all.key.x, y
|
&& level.Grid.getCopper(x + all.key.x, y
|
||||||
+ all.key.y) && selected_transmuter
|
+ all.key.y) && menu.getTransmuter()
|
||||||
.getTilestype(index) == CaseType.Tout)
|
.getTilestype(index) == CaseType.Tout)
|
||||||
|| (level.Grid.getCopper(x + all.key.x, y + all.key.y) && selected_transmuter
|
|| (level.Grid.getCopper(x + all.key.x, y + all.key.y) && menu.getTransmuter()
|
||||||
.getTilestype(index) == CaseType.Cuivre)
|
.getTilestype(index) == CaseType.Cuivre)
|
||||||
|| (level.Grid.getFiber(x + all.key.x, y + all.key.y) && selected_transmuter
|
|| (level.Grid.getFiber(x + all.key.x, y + all.key.y) && menu.getTransmuter()
|
||||||
.getTilestype(index) == CaseType.Fibre)
|
.getTilestype(index) == CaseType.Fibre)
|
||||||
|| (level.Grid.getFiber(x + all.key.x, y + all.key.y)
|
|| (level.Grid.getFiber(x + all.key.x, y + all.key.y)
|
||||||
&& !level.Grid.getCopper(x + all.key.x, y
|
&& !level.Grid.getCopper(x + all.key.x, y
|
||||||
+ all.key.y) && selected_transmuter
|
+ all.key.y) && menu.getTransmuter()
|
||||||
.getTilestype(index) == CaseType.Fibre_seul) || (level.Grid
|
.getTilestype(index) == CaseType.Fibre_seul) || (level.Grid
|
||||||
.getCopper(x + all.key.x, y + all.key.y)
|
.getCopper(x + all.key.x, y + all.key.y)
|
||||||
&& !level.Grid.getFiber(x + all.key.x, y + all.key.y) && selected_transmuter
|
&& !level.Grid.getFiber(x + all.key.x, y + all.key.y) && menu.getTransmuter()
|
||||||
.getTilestype(index) == CaseType.Cuivre_seul))
|
.getTilestype(index) == CaseType.Cuivre_seul))
|
||||||
&& (level.Grid.getTransmutercalc(x + all.key.x, y
|
&& (level.Grid.getTransmutercalc(x + all.key.x, y
|
||||||
+ all.key.y) == 0))
|
+ all.key.y) == 0))
|
||||||
|
@ -621,10 +596,10 @@ public class GameScreen implements Screen {
|
||||||
else
|
else
|
||||||
positionisgood = false;
|
positionisgood = false;
|
||||||
map.tempdraw(x + all.key.x, y + all.key.y, all.value,
|
map.tempdraw(x + all.key.x, y + all.key.y, all.value,
|
||||||
selected_transmuter.getRotation().ordinal(), color);
|
menu.getTransmuter().getRotation().ordinal(), color);
|
||||||
}
|
}
|
||||||
if ((call == calling.longpress && button == 0) && positionisgood) {
|
if ((call == calling.longpress && button == 0) && positionisgood) {
|
||||||
level.Grid.GetXY(x, y).Transmuter = (Transmuter) selected_transmuter
|
level.Grid.GetXY(x, y).Transmuter = (Transmuter) menu.getTransmuter()
|
||||||
.clone();
|
.clone();
|
||||||
if (alone)
|
if (alone)
|
||||||
level.Grid.tiling_transmuter();
|
level.Grid.tiling_transmuter();
|
||||||
|
@ -803,7 +778,7 @@ public class GameScreen implements Screen {
|
||||||
if (Preference.prefs.getBoolean("Refresh"))
|
if (Preference.prefs.getBoolean("Refresh"))
|
||||||
fpsLabel.setText(Gdx.graphics.getFramesPerSecond() + "FPS");
|
fpsLabel.setText(Gdx.graphics.getFramesPerSecond() + "FPS");
|
||||||
Renderer.render(delta, runTime, 0);
|
Renderer.render(delta, runTime, 0);
|
||||||
stage_menu.draw();
|
stage_map.draw();
|
||||||
Renderer.render(delta, runTime, 1);
|
Renderer.render(delta, runTime, 1);
|
||||||
stage.draw();
|
stage.draw();
|
||||||
if (unroll)
|
if (unroll)
|
||||||
|
@ -828,8 +803,6 @@ public class GameScreen implements Screen {
|
||||||
Gdx.app.log("*****", "Affichage du niveau.");
|
Gdx.app.log("*****", "Affichage du niveau.");
|
||||||
for (int i = 0; i < Barre2.length; i++)
|
for (int i = 0; i < Barre2.length; i++)
|
||||||
table2.addActor(Barre2[i]);
|
table2.addActor(Barre2[i]);
|
||||||
for (int i = 0; i < Barre.length; i++)
|
|
||||||
table.addActor(Barre[i]);
|
|
||||||
stage_info.addActor(info_tech);
|
stage_info.addActor(info_tech);
|
||||||
stage_info.addActor(info_research);
|
stage_info.addActor(info_research);
|
||||||
stage_info.addActor(info_activation);
|
stage_info.addActor(info_activation);
|
||||||
|
@ -843,9 +816,11 @@ public class GameScreen implements Screen {
|
||||||
stage_info.addActor(info_up_cycleval);
|
stage_info.addActor(info_up_cycleval);
|
||||||
stage_info.addActor(info_nom);
|
stage_info.addActor(info_nom);
|
||||||
stage_info.addActor(info_cout);
|
stage_info.addActor(info_cout);
|
||||||
|
stage_info.addActor(info_up);
|
||||||
stage_info.addActor(info_desc);
|
stage_info.addActor(info_desc);
|
||||||
stage_menu.addActor(map);
|
stage_map.addActor(map);
|
||||||
// stage_tooltip.addActor(tooltip);
|
//stage_tooltip.addActor(tooltip);
|
||||||
|
stage.addActor(horizbar);
|
||||||
stage.addActor(nextpage);
|
stage.addActor(nextpage);
|
||||||
stage.addActor(previouspage);
|
stage.addActor(previouspage);
|
||||||
stage.addActor(objectives);
|
stage.addActor(objectives);
|
||||||
|
@ -857,67 +832,72 @@ public class GameScreen implements Screen {
|
||||||
stage.addActor(temp);
|
stage.addActor(temp);
|
||||||
stage.addActor(cycle);
|
stage.addActor(cycle);
|
||||||
stage.addActor(table2);
|
stage.addActor(table2);
|
||||||
stage.addActor(table);
|
|
||||||
stage.addActor(tech);
|
stage.addActor(tech);
|
||||||
stage.addActor(cout);
|
stage.addActor(cout);
|
||||||
stage.addActor(research);
|
stage.addActor(research);
|
||||||
stage.addActor(menu);
|
stage.addActor(menu);
|
||||||
// gesturedetector=new GestureDetector(null);
|
// gesturedetector=new GestureDetector(null);
|
||||||
// processors.add(gesturedetector);
|
// processors.add(gesturedetector);
|
||||||
|
//processors.add(stage_tooltip);
|
||||||
|
processors.add(stage_info);
|
||||||
processors.add(stage);
|
processors.add(stage);
|
||||||
processors.add(stage_menu);
|
processors.add(stage_map);
|
||||||
multiplexer.setProcessors(processors);
|
multiplexer.setProcessors(processors);
|
||||||
Gdx.input.setInputProcessor(multiplexer);
|
Gdx.input.setInputProcessor(multiplexer);
|
||||||
preparemenu(0);
|
preparemenu(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preparebarre(Actor caller, int count) {
|
public void preparebarre(String caller, int count) {
|
||||||
map.fillempty(53);
|
map.fillempty(53);
|
||||||
map.tempclear();
|
map.tempclear();
|
||||||
menu.EraseSurtile();
|
menu.EraseSurtile();
|
||||||
hideInfo();
|
hideInfo();
|
||||||
if (caller.getName() == "run") {
|
if (caller == "run") {
|
||||||
} else if (caller.getName() == "stop") {
|
Gdx.app.debug("pop", menu.getX()+","+menu.getY()+","+menu.getWidth()+","+menu.getHeight());
|
||||||
} else if (caller.getName() == "speed") {
|
menu.setWidth(1920);
|
||||||
} else if (caller.getName() == "move") {
|
menu.setHeight(1080);
|
||||||
selected = caller;
|
} else if (caller == "stop") {
|
||||||
|
map.setBounds(500, 200, 500, 400);
|
||||||
|
} else if (caller == "speed") {
|
||||||
|
} else if (caller == "move") {
|
||||||
|
//selected = caller;
|
||||||
if (count >= 2)
|
if (count >= 2)
|
||||||
map.initzoom();
|
map.initzoom();
|
||||||
} else if (caller.getName() == "zoomp") {
|
} else if (caller == "zoomp") {
|
||||||
selected = caller;
|
//selected = caller;
|
||||||
if (count >= 2)
|
if (count >= 2)
|
||||||
map.initzoom();
|
map.initzoom();
|
||||||
} else if (caller.getName() == "zoomm") {
|
} else if (caller == "zoomm") {
|
||||||
selected = caller;
|
//selected = caller;
|
||||||
if (count >= 2)
|
if (count >= 2)
|
||||||
map.initzoom();
|
map.initzoom();
|
||||||
} else if (caller.getName() == "infos") {
|
} else if (caller == "infos") {
|
||||||
selected = caller;
|
//selected = caller;
|
||||||
if (count >= 2)
|
if (count >= 2)
|
||||||
map.initzoom();
|
map.initzoom();
|
||||||
} else if (caller.getName() == "raz") {
|
} else if (caller == "raz") {
|
||||||
winOptions.setVisible(false);
|
winOptions.setVisible(false);
|
||||||
winSave.setVisible(!winSave.isVisible());
|
winSave.setVisible(!winSave.isVisible());
|
||||||
if (winSave.isVisible())
|
if (winSave.isVisible())
|
||||||
readsaved();
|
readsaved();
|
||||||
} else if (caller.getName() == "save") {
|
} else if (caller == "save") {
|
||||||
Gdx.app.log("save", "Ok");
|
Gdx.app.log("save", "Ok");
|
||||||
Gdx.app.debug("Barre", "Sauvegarde de la grille.");
|
Gdx.app.debug("Barre", "Sauvegarde de la grille.");
|
||||||
Gdx.app.debug("Barre", AssetLoader.Datahandler.user().toString());
|
Gdx.app.debug("Barre", AssetLoader.Datahandler.user().toString());
|
||||||
AssetLoader.Datahandler.user().setGrid(0, level.id, level.Grid);
|
AssetLoader.Datahandler.user().setGrid(0, level.id, level.Grid);
|
||||||
readsaved();
|
readsaved();
|
||||||
} else if (caller.getName() == "levels") {
|
} else if (caller == "levels") {
|
||||||
Gdx.app.debug("Barre", "Affichage des niveaux.");
|
Gdx.app.debug("Barre", "Affichage des niveaux.");
|
||||||
AssetLoader.Datahandler.user().setGrid(0, level.id, "LAST",
|
AssetLoader.Datahandler.user().setGrid(0, level.id, "LAST",
|
||||||
this.level.Grid);
|
this.level.Grid);
|
||||||
((Game) Gdx.app.getApplicationListener())
|
((Game) Gdx.app.getApplicationListener())
|
||||||
.setScreen(new LevelScreen(level.aWorld));
|
.setScreen(new LevelScreen(level.aWorld));
|
||||||
} else if (caller.getName() == "tree") {
|
} else if (caller == "tree") {
|
||||||
} else if (caller.getName() == "exits") {
|
} else if (caller == "exits") {
|
||||||
AssetLoader.Datahandler.user().setGrid(0, level.id, "LAST",
|
AssetLoader.Datahandler.user().setGrid(0, level.id, "LAST",
|
||||||
this.level.Grid);
|
this.level.Grid);
|
||||||
Gdx.app.exit();
|
Gdx.app.exit();
|
||||||
} else if (caller.getName() == "screen") {
|
} else if (caller == "screen") {
|
||||||
DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
|
DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
|
||||||
if (Gdx.graphics.isFullscreen()) {
|
if (Gdx.graphics.isFullscreen()) {
|
||||||
Gdx.app.debug("Barre", "vers fenetre.");
|
Gdx.app.debug("Barre", "vers fenetre.");
|
||||||
|
@ -928,8 +908,8 @@ public class GameScreen implements Screen {
|
||||||
Gdx.graphics.setDisplayMode(currentMode.width,
|
Gdx.graphics.setDisplayMode(currentMode.width,
|
||||||
currentMode.height, true);
|
currentMode.height, true);
|
||||||
}
|
}
|
||||||
((ImageButton) caller).setChecked(Gdx.graphics.isFullscreen());
|
//((ImageButton) caller).setChecked(Gdx.graphics.isFullscreen());
|
||||||
} else if (caller.getName() == "sound") {
|
} else if (caller == "sound") {
|
||||||
if (AssetLoader.intro.getVolume() > 0) {
|
if (AssetLoader.intro.getVolume() > 0) {
|
||||||
Gdx.app.debug("Barre", "arret son.");
|
Gdx.app.debug("Barre", "arret son.");
|
||||||
AssetLoader.intro.setVolume(0f);
|
AssetLoader.intro.setVolume(0f);
|
||||||
|
@ -937,9 +917,9 @@ public class GameScreen implements Screen {
|
||||||
Gdx.app.debug("Barre", "marche son.");
|
Gdx.app.debug("Barre", "marche son.");
|
||||||
AssetLoader.intro.setVolume(1f);
|
AssetLoader.intro.setVolume(1f);
|
||||||
}
|
}
|
||||||
((ImageButton) caller)
|
//((ImageButton) caller)
|
||||||
.setChecked(AssetLoader.intro.getVolume() > 0);
|
//.setChecked(AssetLoader.intro.getVolume() > 0);
|
||||||
} else if (caller.getName() == "tuto") {
|
} else if (caller == "tuto") {
|
||||||
if (AssetLoader.Tooltipmanager.enabled) {
|
if (AssetLoader.Tooltipmanager.enabled) {
|
||||||
Gdx.app.debug("Barre", "arret tuto.");
|
Gdx.app.debug("Barre", "arret tuto.");
|
||||||
AssetLoader.Tooltipmanager.enabled = false;
|
AssetLoader.Tooltipmanager.enabled = false;
|
||||||
|
@ -947,14 +927,14 @@ public class GameScreen implements Screen {
|
||||||
Gdx.app.debug("Barre", "marche tuto.");
|
Gdx.app.debug("Barre", "marche tuto.");
|
||||||
AssetLoader.Tooltipmanager.enabled = true;
|
AssetLoader.Tooltipmanager.enabled = true;
|
||||||
}
|
}
|
||||||
((ImageButton) caller)
|
//((ImageButton) caller)
|
||||||
.setChecked(AssetLoader.Tooltipmanager.enabled);
|
//.setChecked(AssetLoader.Tooltipmanager.enabled);
|
||||||
} else if (caller.getName() == "settings") {
|
} else if (caller == "settings") {
|
||||||
winOptions.setVisible(!winOptions.isVisible());
|
winOptions.setVisible(!winOptions.isVisible());
|
||||||
winSave.setVisible(false);
|
winSave.setVisible(false);
|
||||||
if (winOptions.isVisible())
|
if (winOptions.isVisible())
|
||||||
readpref();
|
readpref();
|
||||||
} else if (caller.getName() == "flag") {
|
} else if (caller == "flag") {
|
||||||
if (AssetLoader.language.getLocale().getDisplayName()
|
if (AssetLoader.language.getLocale().getDisplayName()
|
||||||
.contains("français")) {
|
.contains("français")) {
|
||||||
Gdx.app.debug("Barre", "Langue USA");
|
Gdx.app.debug("Barre", "Langue USA");
|
||||||
|
@ -963,9 +943,9 @@ public class GameScreen implements Screen {
|
||||||
Gdx.app.debug("Barre", "Langue FR");
|
Gdx.app.debug("Barre", "Langue FR");
|
||||||
AssetLoader.language = AssetLoader.french;
|
AssetLoader.language = AssetLoader.french;
|
||||||
}
|
}
|
||||||
((ImageButton) caller).setChecked(AssetLoader.language.getLocale()
|
//((ImageButton) caller).setChecked(AssetLoader.language.getLocale()
|
||||||
.getDisplayName().contains("français"));
|
// .getDisplayName().contains("français"));
|
||||||
} else if (caller.getName() == "stat") {
|
} else if (caller == "stat") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,11 +953,11 @@ public class GameScreen implements Screen {
|
||||||
checkMenu(menuitem, true);
|
checkMenu(menuitem, true);
|
||||||
map.tempclear();
|
map.tempclear();
|
||||||
map.fillempty(53);
|
map.fillempty(53);
|
||||||
selected = null;
|
horizbar.unSelect();
|
||||||
menu.EraseSurtile();
|
|
||||||
hideInfo();
|
hideInfo();
|
||||||
menu.setType(menuitem);
|
menu.setPageType(0,menuitem);
|
||||||
menu.setPage(0);
|
nextpage.setDisabled(menu.isNextEmpty());
|
||||||
|
previouspage.setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showInfo(Transmuter transmuter) {
|
public void showInfo(Transmuter transmuter) {
|
||||||
|
|
Loading…
Reference in New Issue