feat: ajout de la gestion total de l'upgrade et l'unlock autrement que par une fenêtre de dialogue.
This commit is contained in:
parent
054b079026
commit
8bf3441a21
|
@ -224,10 +224,6 @@ public class Menu extends Actor {
|
||||||
return this.seltype;
|
return this.seltype;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upate() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
clearall();
|
clearall();
|
||||||
if (worlds.isDebug())
|
if (worlds.isDebug())
|
||||||
|
@ -275,6 +271,8 @@ public class Menu extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearall() {
|
private void clearall() {
|
||||||
|
unSelect();
|
||||||
|
setPage(0);
|
||||||
for (int k=0;k<Transmuter.Class.values().length;k++)
|
for (int k=0;k<Transmuter.Class.values().length;k++)
|
||||||
for (int j=0;j<nbpages;j++){
|
for (int j=0;j<nbpages;j++){
|
||||||
map[j][k].getTileSets().addTileSet(AssetLoader.tileSet);
|
map[j][k].getTileSets().addTileSet(AssetLoader.tileSet);
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ public class Translist extends Actor{
|
||||||
Table table;
|
Table table;
|
||||||
int whereis;
|
int whereis;
|
||||||
Color color;
|
Color color;
|
||||||
|
ChangeEvent event;
|
||||||
|
|
||||||
public Translist(Array<Transmuter> transmuters,Color color) {
|
public Translist(Array<Transmuter> transmuters,Color color) {
|
||||||
this.color=color;
|
this.color=color;
|
||||||
|
@ -37,6 +39,7 @@ public class Translist extends Actor{
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
Gdx.app.debug("wirechem-Translist", "Previous transmuter");
|
Gdx.app.debug("wirechem-Translist", "Previous transmuter");
|
||||||
previousTransmuter();
|
previousTransmuter();
|
||||||
|
onchanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Next=new ImageButton(AssetLoader.Skin_level, "extend");
|
Next=new ImageButton(AssetLoader.Skin_level, "extend");
|
||||||
|
@ -45,6 +48,7 @@ public class Translist extends Actor{
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
Gdx.app.debug("wirechem-Translist", "Next transmuter");
|
Gdx.app.debug("wirechem-Translist", "Next transmuter");
|
||||||
nextTransmuter();
|
nextTransmuter();
|
||||||
|
onchanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.addListener(new ClickListener() {
|
this.addListener(new ClickListener() {
|
||||||
|
@ -58,6 +62,15 @@ public class Translist extends Actor{
|
||||||
setTransmuters(transmuters);
|
setTransmuters(transmuters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 setColor(Color color) {
|
public void setColor(Color color) {
|
||||||
this.color=color;
|
this.color=color;
|
||||||
assignTransmuter(whereis);
|
assignTransmuter(whereis);
|
||||||
|
@ -69,6 +82,7 @@ public class Translist extends Actor{
|
||||||
|
|
||||||
public void setTransmuters(Array<Transmuter> transmuters) {
|
public void setTransmuters(Array<Transmuter> transmuters) {
|
||||||
this.transmuters=transmuters;
|
this.transmuters=transmuters;
|
||||||
|
onchanged();
|
||||||
whereis=0;
|
whereis=0;
|
||||||
if (transmuters!=null && transmuters.size>0)
|
if (transmuters!=null && transmuters.size>0)
|
||||||
assignTransmuter(whereis);
|
assignTransmuter(whereis);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class Worlds extends Actor {
|
||||||
public int ReadResearch() {
|
public int ReadResearch() {
|
||||||
if (research==-2)
|
if (research==-2)
|
||||||
research=AssetLoader.Datahandler.user().getResearchpoint(0);
|
research=AssetLoader.Datahandler.user().getResearchpoint(0);
|
||||||
return research;
|
return research+5800;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveResearch() {
|
public void SaveResearch() {
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
package fr.evolving.dialogs;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Container;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
|
||||||
|
|
||||||
import fr.evolving.UI.Translist;
|
|
||||||
import fr.evolving.assets.AssetLoader;
|
|
||||||
import fr.evolving.automata.Transmuter;
|
|
||||||
|
|
||||||
public class UpDialog extends Dialog {
|
|
||||||
private Translist translist;
|
|
||||||
private Container<Translist> container;
|
|
||||||
|
|
||||||
public UpDialog() {
|
|
||||||
super(AssetLoader.language.get("[dialog-window]"), AssetLoader.Skin_ui);
|
|
||||||
translist=new Translist(AssetLoader.allTransmuter, new Color(0.5f,0.5f,0.5f,1f));
|
|
||||||
container=new Container<Translist>(translist);
|
|
||||||
this.getContentTable().add(container).left();
|
|
||||||
this.setModal(true);
|
|
||||||
this.button("Ok");
|
|
||||||
this.key(Input.Keys.ENTER, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTransmuters(Array<Transmuter> transmuters) {
|
|
||||||
translist.setTransmuters(transmuters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Array<Transmuter> getTransmuters() {
|
|
||||||
return translist.getTransmuters();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Batch batch, float parentAlpha)
|
|
||||||
{
|
|
||||||
super.draw(batch, parentAlpha);
|
|
||||||
this.getContentTable().draw(batch, parentAlpha);
|
|
||||||
|
|
||||||
//container.draw(batch, parentAlpha);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
public Actor hit(float x, float y, boolean touchable){
|
|
||||||
Actor actor=super.hit(x, y, touchable);
|
|
||||||
if (actor==null)
|
|
||||||
return translist.hit(x, y, touchable);
|
|
||||||
else
|
|
||||||
return actor;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -26,6 +26,7 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Touchable;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
|
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
|
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
|
||||||
|
@ -74,7 +75,6 @@ import fr.evolving.automata.Transmuter.CaseType;
|
||||||
import fr.evolving.automata.Worlds;
|
import fr.evolving.automata.Worlds;
|
||||||
import fr.evolving.dialogs.PrefWindow;
|
import fr.evolving.dialogs.PrefWindow;
|
||||||
import fr.evolving.dialogs.SavingWindow;
|
import fr.evolving.dialogs.SavingWindow;
|
||||||
import fr.evolving.dialogs.UpDialog;
|
|
||||||
import fr.evolving.dialogs.WarningDialog;
|
import fr.evolving.dialogs.WarningDialog;
|
||||||
import fr.evolving.renderers.GameRenderer;
|
import fr.evolving.renderers.GameRenderer;
|
||||||
|
|
||||||
|
@ -88,11 +88,11 @@ public class GameScreen implements Screen {
|
||||||
public Level level;
|
public Level level;
|
||||||
private PrefWindow winOptions;
|
private PrefWindow winOptions;
|
||||||
private SavingWindow winSave;
|
private SavingWindow winSave;
|
||||||
private UpDialog updialog;
|
|
||||||
private ImageButton info_up_nrj, info_up_temp, info_up, info_up2, info_up_rayon,
|
private ImageButton info_up_nrj, info_up_temp, info_up, info_up2, info_up_rayon,
|
||||||
info_up_cycle, info_up_nrjval, info_up_tempval, info_up_rayonval,
|
info_up_cycle, info_up_nrjval, info_up_tempval, info_up_rayonval,
|
||||||
info_up_cycleval, nextpage, previouspage;
|
info_up_cycleval, nextpage, previouspage;
|
||||||
private ImageTextButton info_cout, info_tech, info_research, info_activation;
|
private ImageTextButton info_cout, info_tech, info_research, info_activation;
|
||||||
|
private TextButton info_choose;
|
||||||
private IconValue cycle, temp, nrj, rayon, cout, tech, research;
|
private IconValue cycle, temp, nrj, rayon, cout, tech, research;
|
||||||
String[] tocreate;
|
String[] tocreate;
|
||||||
private ButtonLevel buttonlevel;
|
private ButtonLevel buttonlevel;
|
||||||
|
@ -106,7 +106,7 @@ public class GameScreen implements Screen {
|
||||||
private TextArea info_desc, tooltip;
|
private TextArea info_desc, tooltip;
|
||||||
public boolean unroll;
|
public boolean unroll;
|
||||||
public Worlds worlds;
|
public Worlds worlds;
|
||||||
public Translist translist;
|
public Translist info_upgrade;
|
||||||
|
|
||||||
public enum calling {
|
public enum calling {
|
||||||
mouseover, mouseclick, mousedrag, longpress, tap, taptap, zoom, fling, pan, pinch
|
mouseover, mouseclick, mousedrag, longpress, tap, taptap, zoom, fling, pan, pinch
|
||||||
|
@ -318,20 +318,66 @@ public class GameScreen implements Screen {
|
||||||
menu.getTransmuter().Upgrade();
|
menu.getTransmuter().Upgrade();
|
||||||
menu.update();
|
menu.update();
|
||||||
info_up.setVisible(false);
|
info_up.setVisible(false);
|
||||||
|
nextpage.setDisabled(menu.isNextEmpty());
|
||||||
|
previouspage.setDisabled(menu.isPreviousEmpty());
|
||||||
hideInfo();
|
hideInfo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
info_choose = new TextButton(AssetLoader.language.get("[info_choose-gamescreen]"), AssetLoader.Skin_ui);
|
||||||
|
info_choose.setBounds(1575, AssetLoader.height-710, 290, 45);
|
||||||
|
info_choose.setVisible(false);
|
||||||
|
info_choose.addListener(new ClickListener() {
|
||||||
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
|
worlds.ModResearch(-info_upgrade.getTransmuter().getResearch());
|
||||||
|
info_upgrade.getTransmuter().Unlock();
|
||||||
|
menu.update();
|
||||||
|
info_up2.setVisible(false);
|
||||||
|
nextpage.setDisabled(menu.isNextEmpty());
|
||||||
|
previouspage.setDisabled(menu.isPreviousEmpty());
|
||||||
|
hideInfo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
info_upgrade=new Translist(null, AssetLoader.Skin_level.getColor("grey"));
|
||||||
|
info_upgrade.setBounds(1590,AssetLoader.height-620,256,256);
|
||||||
|
info_upgrade.setVisible(false);
|
||||||
|
info_upgrade.addListener(new ChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
Gdx.app.debug("wirechem-GameScreen", "info_upgrade | Element changé");
|
||||||
|
Translist tranlist=(Translist)actor;
|
||||||
|
showInfo(tranlist.getTransmuter());
|
||||||
|
if (tranlist.getTransmuter().getResearch()>worlds.ReadResearch())
|
||||||
|
{
|
||||||
|
info_choose.setDisabled(true);
|
||||||
|
info_choose.setTouchable(Touchable.disabled);
|
||||||
|
tranlist.setColor(AssetLoader.Skin_level.getColor("red"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info_choose.setDisabled(false);
|
||||||
|
info_choose.setTouchable(Touchable.enabled);
|
||||||
|
tranlist.setColor(AssetLoader.Skin_level.getColor("grey"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
info_up2=new ImageButton(AssetLoader.Skin_level,"evolution2");
|
info_up2=new ImageButton(AssetLoader.Skin_level,"evolution2");
|
||||||
info_up2.setPosition(1450, AssetLoader.height - 720);
|
info_up2.setPosition(1450, AssetLoader.height - 720);
|
||||||
info_up2.addListener(new ClickListener() {
|
info_up2.addListener(new ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
//updialog.setTransmuters(menu.getTransmuter().getUnlock());
|
|
||||||
updialog.show(stage);
|
|
||||||
if (menu.getTransmuter()!=null && menu.getTransmuter().isUnlockable(worlds.ReadResearch())) {
|
if (menu.getTransmuter()!=null && menu.getTransmuter().isUnlockable(worlds.ReadResearch())) {
|
||||||
|
//info_upgrade.setTransmuters(AssetLoader.allTransmuter);
|
||||||
hideInfo();
|
info_upgrade.setTransmuters(menu.getTransmuter().getUnlock());
|
||||||
|
info_up2.setVisible(false);
|
||||||
|
info_upgrade.setVisible(true);
|
||||||
|
info_choose.setVisible(true);
|
||||||
|
menu.setVisible(false);
|
||||||
|
vertibar.setVisible(false);
|
||||||
|
nextpage.setVisible(false);
|
||||||
|
previouspage.setVisible(false);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
info_upgrade.setVisible(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Gdx.app.debug("wirechem-GameScreen", "Création d'une tilemap");
|
Gdx.app.debug("wirechem-GameScreen", "Création d'une tilemap");
|
||||||
|
@ -404,7 +450,7 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
|
|
||||||
public void map_transmuter(float realx, float realy, int x, int y, boolean alone,int button, calling call) {
|
public void map_transmuter(float realx, float realy, int x, int y, boolean alone,int button, calling call) {
|
||||||
if (!worlds.isDebug() && level.Cout<menu.getTransmuter().getPrice())
|
if (menu.getTransmuter()==null || (!worlds.isDebug() && level.Cout<menu.getTransmuter().getPrice()))
|
||||||
return;
|
return;
|
||||||
if (call == calling.taptap && button == 0
|
if (call == calling.taptap && button == 0
|
||||||
|| (call == calling.mouseclick && button == 1)) {
|
|| (call == calling.mouseclick && button == 1)) {
|
||||||
|
@ -688,7 +734,6 @@ public class GameScreen implements Screen {
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
Gdx.app.debug("wirechem-GameScreen","Création des fenêtres");
|
Gdx.app.debug("wirechem-GameScreen","Création des fenêtres");
|
||||||
updialog=new UpDialog();
|
|
||||||
winOptions = new PrefWindow();
|
winOptions = new PrefWindow();
|
||||||
stage.addActor(winOptions);
|
stage.addActor(winOptions);
|
||||||
winSave = new SavingWindow(worlds);
|
winSave = new SavingWindow(worlds);
|
||||||
|
@ -716,6 +761,8 @@ public class GameScreen implements Screen {
|
||||||
stage_info.addActor(info_up);
|
stage_info.addActor(info_up);
|
||||||
stage_info.addActor(info_up2);
|
stage_info.addActor(info_up2);
|
||||||
stage_info.addActor(info_desc);
|
stage_info.addActor(info_desc);
|
||||||
|
stage_info.addActor(info_upgrade);
|
||||||
|
stage_info.addActor(info_choose);
|
||||||
//stage_tooltip.addActor(tooltip);
|
//stage_tooltip.addActor(tooltip);
|
||||||
stage.addActor(horizbar);
|
stage.addActor(horizbar);
|
||||||
if (worlds.getInformations().Cout>0 || worlds.getInformations().Tech>=1 || worlds.isDebug()) {
|
if (worlds.getInformations().Cout>0 || worlds.getInformations().Tech>=1 || worlds.isDebug()) {
|
||||||
|
@ -868,7 +915,7 @@ public class GameScreen implements Screen {
|
||||||
public void showInfo(Transmuter transmuter) {
|
public void showInfo(Transmuter transmuter) {
|
||||||
if (transmuter == null)
|
if (transmuter == null)
|
||||||
return;
|
return;
|
||||||
unroll = true;
|
unroll = true;
|
||||||
info_nom.setText(transmuter.getName());
|
info_nom.setText(transmuter.getName());
|
||||||
info_desc.setText(transmuter.getDesc());
|
info_desc.setText(transmuter.getDesc());
|
||||||
info_tech.setVisible(transmuter.getTechnology() > 0);
|
info_tech.setVisible(transmuter.getTechnology() > 0);
|
||||||
|
@ -903,12 +950,18 @@ public class GameScreen implements Screen {
|
||||||
AssetLoader.Atlas_level.findRegion("jauge"
|
AssetLoader.Atlas_level.findRegion("jauge"
|
||||||
+ transmuter.getUpgradeRayon()));
|
+ transmuter.getUpgradeRayon()));
|
||||||
info_up_rayonval.setColor(AssetLoader.Levelcolors[2]);
|
info_up_rayonval.setColor(AssetLoader.Levelcolors[2]);
|
||||||
info_up.setVisible(transmuter.isUpgradable(worlds.ReadResearch()));
|
info_up.setVisible(!info_upgrade.isVisible() && transmuter.isUpgradable(worlds.ReadResearch()));
|
||||||
info_up2.setVisible(true);
|
info_up2.setVisible(!info_upgrade.isVisible() && transmuter.isUnlockable(worlds.ReadResearch()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideInfo() {
|
public void hideInfo() {
|
||||||
|
info_upgrade.setVisible(false);
|
||||||
|
info_choose.setVisible(false);
|
||||||
|
menu.setVisible(true);
|
||||||
|
vertibar.setVisible(true);
|
||||||
|
nextpage.setVisible(true);
|
||||||
|
previouspage.setVisible(true);
|
||||||
unroll = false;
|
unroll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue