feat: ajout de la gestion de l'upgrade et du déblocage.
This commit is contained in:
parent
f2f11a4bfe
commit
b743bd62cc
|
@ -70,7 +70,12 @@ public class Translist extends Actor{
|
|||
public void setTransmuters(Array<Transmuter> transmuters) {
|
||||
this.transmuters=transmuters;
|
||||
whereis=0;
|
||||
assignTransmuter(whereis);
|
||||
if (transmuters!=null && transmuters.size>0)
|
||||
assignTransmuter(whereis);
|
||||
}
|
||||
|
||||
public Array<Transmuter> getTransmuters() {
|
||||
return this.transmuters;
|
||||
}
|
||||
|
||||
public void assignTransmuter(int where) {
|
||||
|
@ -116,7 +121,8 @@ public class Translist extends Actor{
|
|||
}
|
||||
|
||||
public void redraw() {
|
||||
Selected.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
if (Selected!=null)
|
||||
Selected.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
table.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
table.clear();
|
||||
table.add(Previous).left().pad(this.getWidth()/4).padTop(this.getHeight()).size(this.getWidth()/512*64, this.getHeight()/512*64);
|
||||
|
@ -154,7 +160,8 @@ public class Translist extends Actor{
|
|||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
Selected.draw(batch, parentAlpha);
|
||||
if (Selected!=null)
|
||||
Selected.draw(batch, (float) 1.0);
|
||||
table.draw(batch, parentAlpha);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,12 @@ public class PrefWindow extends Window {
|
|||
this.setVisible(false);
|
||||
this.pack();
|
||||
this.setPosition(100, 250);
|
||||
dialog = new WarningDialog(AssetLoader.Skin_ui);
|
||||
dialog = new WarningDialog();
|
||||
}
|
||||
|
||||
public void show() {
|
||||
if (dialog.getStage()==null)
|
||||
this.getParent().getStage().addActor(dialog);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
|
@ -202,7 +207,7 @@ public class PrefWindow extends Window {
|
|||
private void onSaveClicked() {
|
||||
this.setVisible(false);
|
||||
writepref();
|
||||
dialog.Show(AssetLoader.language.get("[dialog-gamescreen-preference]"), this.getStage());
|
||||
dialog.show(AssetLoader.language.get("[dialog-gamescreen-preference]"),this.getStage());
|
||||
}
|
||||
|
||||
private void onCancelClicked() {
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
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;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
|
@ -12,12 +12,10 @@ import fr.evolving.assets.AssetLoader;
|
|||
public class WarningDialog extends Dialog {
|
||||
Label thelabel;
|
||||
|
||||
public WarningDialog(Skin skin) {
|
||||
super(AssetLoader.language.get("[dialog-window]"), skin);
|
||||
public WarningDialog() {
|
||||
super(AssetLoader.language.get("[dialog-window]"), AssetLoader.Skin_ui);
|
||||
// TODO Auto-generated constructor stub
|
||||
this.getContentTable()
|
||||
.add(new ImageButton(AssetLoader.Skin_level, "Warnerbros"))
|
||||
.left();
|
||||
this.getContentTable().add(new ImageButton(AssetLoader.Skin_level, "Warnerbros")).left();
|
||||
thelabel = new Label("", AssetLoader.Skin_level);
|
||||
this.getContentTable().add(thelabel).right();
|
||||
this.setModal(true);
|
||||
|
@ -25,7 +23,7 @@ public class WarningDialog extends Dialog {
|
|||
this.key(Input.Keys.ENTER, true);
|
||||
}
|
||||
|
||||
public void Show(String info, Stage stage) {
|
||||
public void show(String info, Stage stage) {
|
||||
this.thelabel.setText(info);
|
||||
this.show(stage);
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ import fr.evolving.automata.Transmuter.CaseType;
|
|||
import fr.evolving.automata.Worlds;
|
||||
import fr.evolving.dialogs.PrefWindow;
|
||||
import fr.evolving.dialogs.SavingWindow;
|
||||
import fr.evolving.dialogs.UpDialog;
|
||||
import fr.evolving.dialogs.WarningDialog;
|
||||
import fr.evolving.renderers.GameRenderer;
|
||||
|
||||
|
@ -87,7 +88,8 @@ public class GameScreen implements Screen {
|
|||
public Level level;
|
||||
private PrefWindow winOptions;
|
||||
private SavingWindow winSave;
|
||||
private ImageButton info_up_nrj, info_up_temp, info_up, info_up_rayon,
|
||||
private UpDialog updialog;
|
||||
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_cycleval, nextpage, previouspage;
|
||||
private ImageTextButton info_cout, info_tech, info_research, info_activation;
|
||||
|
@ -319,6 +321,19 @@ public class GameScreen implements Screen {
|
|||
hideInfo();
|
||||
}
|
||||
});
|
||||
info_up2=new ImageButton(AssetLoader.Skin_level,"evolution2");
|
||||
info_up2.setPosition(1450, AssetLoader.height - 720);
|
||||
info_up2.addListener(new ClickListener() {
|
||||
@Override
|
||||
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())) {
|
||||
|
||||
hideInfo();
|
||||
}
|
||||
}
|
||||
});
|
||||
Gdx.app.debug("wirechem-GameScreen", "Création d'une tilemap");
|
||||
map = new TouchMaptiles(worlds,level, 128, 128);
|
||||
if (Preference.prefs.getBoolean("Grid"))
|
||||
|
@ -672,7 +687,8 @@ public class GameScreen implements Screen {
|
|||
|
||||
@Override
|
||||
public void show() {
|
||||
Gdx.app.debug("wirechem-GameScreen","Création de la fenêtre d'option");
|
||||
Gdx.app.debug("wirechem-GameScreen","Création des fenêtres");
|
||||
updialog=new UpDialog();
|
||||
winOptions = new PrefWindow();
|
||||
stage.addActor(winOptions);
|
||||
winSave = new SavingWindow(worlds);
|
||||
|
@ -698,6 +714,7 @@ public class GameScreen implements Screen {
|
|||
stage_info.addActor(info_nom);
|
||||
stage_info.addActor(info_cout);
|
||||
stage_info.addActor(info_up);
|
||||
stage_info.addActor(info_up2);
|
||||
stage_info.addActor(info_desc);
|
||||
//stage_tooltip.addActor(tooltip);
|
||||
stage.addActor(horizbar);
|
||||
|
@ -887,6 +904,7 @@ public class GameScreen implements Screen {
|
|||
+ transmuter.getUpgradeRayon()));
|
||||
info_up_rayonval.setColor(AssetLoader.Levelcolors[2]);
|
||||
info_up.setVisible(transmuter.isUpgradable(worlds.ReadResearch()));
|
||||
info_up2.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,7 @@ public class LevelScreen implements Screen {
|
|||
private ImageButton Previous, Next, Exit, logosmall, databaseSave, adder, signer;
|
||||
public Image MenuSolo, MenuMulti, MenuScenario;
|
||||
private ImageTextButton cout, tech, cycle, temp, rayon, nrj, up_cycle, up_temp, up_rayon, up_nrj, research, up;
|
||||
private TextButton buttonConnect, buttonPlay, buttonStat, buttonSave,
|
||||
buttonApply, buttonPlaythis;
|
||||
private TextButton buttonConnect, buttonPlay, buttonStat, buttonSave, buttonApply, buttonPlaythis;
|
||||
private ServerList Statdata, Userdata, Gamedata;
|
||||
private Worldlist Worlddata;
|
||||
private Label Statdatalabel, Userdatalabel, Gamedatalabel, Worlddatalabel;
|
||||
|
@ -314,7 +313,7 @@ public class LevelScreen implements Screen {
|
|||
stage = new Stage(AssetLoader.viewport);
|
||||
table = new Table();
|
||||
Renderer = new LevelRenderer(this);
|
||||
dialog = new WarningDialog(AssetLoader.Skin_ui);
|
||||
dialog = new WarningDialog();
|
||||
Gdx.app.debug("wirechem-LevelScreen", "Mise en place du timer.");
|
||||
ScrollTimer = new Timer();
|
||||
ScrollTask = new TimerTask() {
|
||||
|
@ -427,7 +426,7 @@ public class LevelScreen implements Screen {
|
|||
AssetLoader.Datahandler.Attach(Gamedata.getModel(),
|
||||
Gamedata.getUrl());
|
||||
if (!AssetLoader.Datahandler.verifyall()) {
|
||||
dialog.Show(AssetLoader.language.get("[dialog-levelscreen-errorloading]"),stage);
|
||||
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errorloading]"),stage);
|
||||
initlevel();
|
||||
} else
|
||||
menu();
|
||||
|
@ -456,7 +455,7 @@ public class LevelScreen implements Screen {
|
|||
Preference.prefs.putString("gamedata", Gamedata.getUrl());
|
||||
Preference.prefs.putString("statdata", Statdata.getUrl());
|
||||
Preference.prefs.flush();
|
||||
dialog.Show(
|
||||
dialog.show(
|
||||
AssetLoader.language.get("[dialog-levelscreen-savedatabase]"),stage);
|
||||
}
|
||||
});
|
||||
|
@ -490,10 +489,10 @@ public class LevelScreen implements Screen {
|
|||
buttonPlaythis.addListener(new ClickListener() {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
if (!AssetLoader.Datahandler.verifyall())
|
||||
dialog.Show(AssetLoader.language.get("[dialog-levelscreen-errorlevels]"),stage);
|
||||
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errorlevels]"),stage);
|
||||
else {
|
||||
if (Worlddata.getSelected() == null)
|
||||
dialog.Show(AssetLoader.language.get("[dialog-levelscreen-errornoworld]"), stage);
|
||||
dialog.show(AssetLoader.language.get("[dialog-levelscreen-errornoworld]"), stage);
|
||||
else {
|
||||
worlds.set((String) Worlddata.getSelected());
|
||||
Preference.prefs.flush();
|
||||
|
|
Loading…
Reference in New Issue