Progress on sector state

This commit is contained in:
Anuken
2020-05-30 21:04:41 -04:00
parent 8a4824e72d
commit 0842c3f0a0
20 changed files with 314 additions and 211 deletions

View File

@@ -9,6 +9,7 @@ import arc.input.*;
import arc.math.*;
import arc.math.geom.*;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*;
import arc.struct.*;
@@ -152,6 +153,17 @@ public class PlanetDialog extends BaseDialog{
shown(this::setup);
}
/** show with no limitations, just as a map. */
@Override
public Dialog show(){
//TODO
return super.show();
}
public void show(Sector selected, int range){
//TODO
}
void makeBloom(){
if(bloom != null){
bloom.dispose();
@@ -413,7 +425,7 @@ public class PlanetDialog extends BaseDialog{
stable.table(t -> {
t.left();
selected.save.meta.exportRates.each(entry -> {
selected.save.meta.secinfo.exportRates().each(entry -> {
int total = (int)(entry.value * turnDuration / 60f);
if(total > 1){
t.image(entry.key.icon(Cicon.small)).padRight(3);
@@ -421,7 +433,24 @@ public class PlanetDialog extends BaseDialog{
t.row();
}
});
});
}).row();
}
//stored resources
if(selected.hasBase() && selected.save.meta.secinfo.coreItems.size > 0){
stable.add("Stored Resources:").row();
stable.table(t -> {
t.left();
for(Item item : content.items()){
int amount = selected.save.meta.secinfo.coreItems.get(item);
if(amount > 0){
t.image(item.icon(Cicon.small)).padRight(3);
t.add(ui.formatAmount(amount)).color(Color.lightGray);
t.row();
}
}
}).row();
}
//display how many turns this sector has been attacked

View File

@@ -43,29 +43,31 @@ public class BlockConfigFragment extends Fragment{
}
public void showConfig(Tilec tile){
configTile = tile;
if(tile.configTapped()){
configTile = tile;
table.visible(true);
table.clear();
tile.buildConfiguration(table);
table.pack();
table.setTransform(true);
table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
Actions.scaleTo(1f, 1f, 0.07f, Interp.pow3Out));
table.visible(true);
table.clear();
tile.buildConfiguration(table);
table.pack();
table.setTransform(true);
table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
Actions.scaleTo(1f, 1f, 0.07f, Interp.pow3Out));
table.update(() -> {
if(configTile != null && configTile.shouldHideConfigure(player)){
hideConfig();
return;
}
table.update(() -> {
if(configTile != null && configTile.shouldHideConfigure(player)){
hideConfig();
return;
}
table.setOrigin(Align.center);
if(configTile == null || configTile.block() == Blocks.air || !configTile.isValid()){
hideConfig();
}else{
configTile.updateTableAlign(table);
}
});
table.setOrigin(Align.center);
if(configTile == null || configTile.block() == Blocks.air || !configTile.isValid()){
hideConfig();
}else{
configTile.updateTableAlign(table);
}
});
}
}
public boolean hasConfigMouse(){

View File

@@ -326,9 +326,9 @@ public class HudFragment extends Fragment{
c.clearChildren();
for(Item item : content.items()){
if(state.stats.getExport(item) >= 1){
if(state.secinfo.getExport(item) >= 1){
c.image(item.icon(Cicon.small));
c.label(() -> (int)state.stats.getExport(item) + " /s").color(Color.lightGray);
c.label(() -> (int)state.secinfo.getExport(item) + " /s").color(Color.lightGray);
c.row();
}
}
@@ -337,7 +337,7 @@ public class HudFragment extends Fragment{
c.update(() -> {
boolean wrong = false;
for(Item item : content.items()){
boolean has = state.stats.getExport(item) >= 1;
boolean has = state.secinfo.getExport(item) >= 1;
if(used.get(item.id) != has){
used.set(item.id, has);
wrong = true;