Campaign mechanics

This commit is contained in:
Anuken
2020-07-06 21:53:34 -04:00
parent a6523630bf
commit 56ffe5aea8
22 changed files with 196 additions and 54 deletions

View File

@@ -34,6 +34,12 @@ public class PausedDialog extends BaseDialog{
});
if(!mobile){
//TODO localize
cont.label(() -> state.getSector() == null ? "" :
"[lightgray]Next turn in [accent]" + state.getSector().displayTimeRemaining())
.visible(() -> state.getSector() != null).colspan(2);
cont.row();
float dw = 220f;
cont.defaults().width(dw).height(55).pad(5f);
@@ -45,7 +51,10 @@ public class PausedDialog extends BaseDialog{
//}else{
// cont.button("$database", Icon.book, ui.database::show);
//}
cont.button("placeholder", Icon.warning, () -> ui.showInfo("go away"));
//TODO remove
cont.button("launch core", Icon.warning, () -> ui.planet.show(state.getSector(), player.team().core()))
.disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements))
.visible(() -> state.isCampaign());
cont.button("$settings", Icon.settings, ui.settings::show);
if(!state.rules.tutorial){

View File

@@ -7,6 +7,7 @@ import arc.graphics.gl.*;
import arc.input.*;
import arc.math.*;
import arc.math.geom.*;
import arc.scene.*;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
@@ -197,19 +198,36 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
cont.clear();
titleTable.remove();
//add listener to the background rect, so it doesn't get unnecessary touch input
cont.rect((x, y, w, h) -> planets.render(this)).grow().get().addListener(new ElementGestureListener(){
@Override
public void tap(InputEvent event, float x, float y, int count, KeyCode button){
if(hovered != null && (mode == launch ? canLaunch(hovered) && hovered != launchSector : hovered.unlocked())){
selected = hovered;
}
if(selected != null){
updateSelected();
}
cont.stack(
new Element(){
{
//add listener to the background rect, so it doesn't get unnecessary touch input
addListener(new ElementGestureListener(){
@Override
public void tap(InputEvent event, float x, float y, int count, KeyCode button){
if(hovered != null && (mode == launch ? canLaunch(hovered) && hovered != launchSector : hovered.unlocked())){
selected = hovered;
}
if(selected != null){
updateSelected();
}
}
});
}
});
@Override
public void draw(){
planets.render(PlanetDialog.this);
}
},
new Table(t -> {
//TODO localize
t.top();
t.label(() -> "Turn " + universe.turn()).style(Styles.outlineLabel).color(Pal.accent);
})).grow();
}
@Override