Sector items display fixes
This commit is contained in:
@@ -265,10 +265,9 @@ public class SectorInfo{
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @return a newly allocated map with import statistics. Use sparingly. */
|
/** @return a newly allocated map with import statistics. Use sparingly. */
|
||||||
|
//TODO this can be a float map
|
||||||
public ObjectMap<Item, ExportStat> importStats(){
|
public ObjectMap<Item, ExportStat> importStats(){
|
||||||
//build empty import stats
|
|
||||||
ObjectMap<Item, ExportStat> imports = new ObjectMap<>();
|
ObjectMap<Item, ExportStat> imports = new ObjectMap<>();
|
||||||
//for all sectors on all planets that have bases and export to this sector
|
//for all sectors on all planets that have bases and export to this sector
|
||||||
for(Planet planet : content.planets()){
|
for(Planet planet : content.planets()){
|
||||||
|
|||||||
@@ -603,17 +603,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
selectAlpha = Mathf.lerpDelta(selectAlpha, Mathf.num(planets.zoom < 1.9f), 0.1f);
|
selectAlpha = Mathf.lerpDelta(selectAlpha, Mathf.num(planets.zoom < 1.9f), 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showStats(Sector sector){
|
void displayItems(Table c, float scl, ObjectMap<Item, ExportStat> stats, String name){
|
||||||
BaseDialog dialog = new BaseDialog(sector.name());
|
|
||||||
|
|
||||||
dialog.cont.pane(c -> {
|
|
||||||
Cons2<ObjectMap<Item, ExportStat>, String> display = (stats, name) -> {
|
|
||||||
Table t = new Table().left();
|
Table t = new Table().left();
|
||||||
|
|
||||||
float scl = sector.getProductionScale();
|
int i = 0;
|
||||||
|
|
||||||
int[] i = {0};
|
|
||||||
|
|
||||||
for(var item : content.items()){
|
for(var item : content.items()){
|
||||||
var stat = stats.get(item);
|
var stat = stats.get(item);
|
||||||
if(stat == null) continue;
|
if(stat == null) continue;
|
||||||
@@ -621,7 +614,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
if(total > 1){
|
if(total > 1){
|
||||||
t.image(item.uiIcon).padRight(3);
|
t.image(item.uiIcon).padRight(3);
|
||||||
t.add(UI.formatAmount(total) + " " + Core.bundle.get("unit.perminute")).color(Color.lightGray).padRight(3);
|
t.add(UI.formatAmount(total) + " " + Core.bundle.get("unit.perminute")).color(Color.lightGray).padRight(3);
|
||||||
if(++i[0] % 3 == 0){
|
if(++i % 3 == 0){
|
||||||
t.row();
|
t.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,8 +624,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
c.add(name).left().row();
|
c.add(name).left().row();
|
||||||
c.add(t).padLeft(10f).left().row();
|
c.add(t).padLeft(10f).left().row();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
void showStats(Sector sector){
|
||||||
|
BaseDialog dialog = new BaseDialog(sector.name());
|
||||||
|
|
||||||
|
dialog.cont.pane(c -> {
|
||||||
c.defaults().padBottom(5);
|
c.defaults().padBottom(5);
|
||||||
|
|
||||||
c.add(Core.bundle.get("sectors.time") + " [accent]" + sector.save.getPlayTime()).left().row();
|
c.add(Core.bundle.get("sectors.time") + " [accent]" + sector.save.getPlayTime()).left().row();
|
||||||
@@ -655,14 +652,14 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//production
|
//production
|
||||||
display.get(sector.info.production, "@sectors.production");
|
displayItems(c, sector.getProductionScale(), sector.info.production, "@sectors.production");
|
||||||
|
|
||||||
//export
|
//export
|
||||||
display.get(sector.info.export, "@sectors.export");
|
displayItems(c, sector.getProductionScale(), sector.info.export, "@sectors.export");
|
||||||
|
|
||||||
//import
|
//import
|
||||||
if(sector.hasBase()){
|
if(sector.hasBase()){
|
||||||
display.get(sector.info.importStats(), "@sectors.import");
|
displayItems(c, 1f, sector.info.importStats(), "@sectors.import");
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemSeq items = sector.items();
|
ItemSeq items = sector.items();
|
||||||
|
|||||||
Reference in New Issue
Block a user