Added sector deployment UI

This commit is contained in:
Anuken 2020-03-16 23:09:07 -04:00
parent 928812142a
commit 32ffacf8f6
5 changed files with 23 additions and 14 deletions

Binary file not shown.

View File

@ -251,8 +251,8 @@ public class Control implements ApplicationListener, Loadable{
ui.loadAnd(() -> {
ui.planet.hide();
SaveSlot slot = sector.save;
//TODO remove for persistent sector slots
slot = null;
//TODO comment for new sector states
//slot = null;
if(slot != null){
try{
net.reset();

View File

@ -162,12 +162,15 @@ public class PlanetDialog extends FloatingDialog{
bloom.render();
Gl.disable(Gl.cullFace);
//Gl.disable(Gl.depthTest);
Gl.disable(Gl.depthTest);
if(false && selected != null){
Vec3 pos = cam.project(Tmp.v31.set(selected.tile.v).setLength(outlineRad));
if(selected != null){
addChild(stable);
Vec3 pos = cam.project(Tmp.v31.set(selected.tile.v).setLength(outlineRad).rotate(Vec3.Y, -planet.getRotation()).add(planet.position));
stable.setPosition(pos.x, pos.y, Align.center);
stable.draw();
stable.toFront();
}else{
stable.remove();
}
cam.update();
@ -225,12 +228,6 @@ public class PlanetDialog extends FloatingDialog{
if(selected != null){
drawSelection(selected);
drawBorders(selected, borderColor);
//TODO use better input
if(Core.input.keyTap(KeyCode.SPACE)){
control.playSector(selected);
ui.planet.hide();
}
}
batch.flush(Gl.triangles);
@ -277,6 +274,7 @@ public class PlanetDialog extends FloatingDialog{
}
private void updateSelected(){
float x = stable.getX(Align.center), y = stable.getY(Align.center);
stable.clear();
stable.background(Styles.black6);
@ -302,8 +300,17 @@ public class PlanetDialog extends FloatingDialog{
}
}).fillX().row();
stable.row();
stable.addButton("Launch", () -> {
if(selected != null){
control.playSector(selected);
hide();
}
}).size(120f, 50f).pad(2f);
stable.pack();
stable.setPosition(0, 0, Align.center);
stable.setPosition(x, y, Align.center);
}
private void setPlane(Sector sector){

View File

@ -404,6 +404,8 @@ public class ApplicationTests{
//infinite build range
state.rules.editor = true;
state.rules.infiniteResources = true;
state.rules.buildSpeedMultiplier = 999999f;
d1.set(0f, 0f);
d2.set(20f, 20f);
@ -411,7 +413,6 @@ public class ApplicationTests{
d1.addBuild(new BuildRequest(0, 0, 0, Blocks.copperWallLarge));
d2.addBuild(new BuildRequest(1, 1, 0, Blocks.copperWallLarge));
Time.setDeltaProvider(() -> 9999999f);
d1.update();
d2.update();

View File

@ -39,6 +39,7 @@ public class SectorDataGenerator{
for(Planet planet : content.<Planet>getBy(ContentType.planet)){
int[] count = {0};
if(planet.grid == null) continue;
Fi fi = Fi.get("planets").child(planet.name + ".dat");