Sector bugfixes / More sector info
This commit is contained in:
@@ -371,6 +371,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
if(selectAlpha > 0.001f){
|
||||
|
||||
|
||||
for(Sector sec : planet.sectors){
|
||||
if(sec.hasBase()){
|
||||
for(Sector enemy : sec.near()){
|
||||
@@ -378,6 +380,18 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
planets.drawArc(planet, enemy.tile.v, sec.tile.v, Team.crux.color.write(Tmp.c2).a(selectAlpha), Color.clear, 0.24f, 110f, 25);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(selected != null && selected != sec && selected.hasBase()){
|
||||
//imports
|
||||
if(sec.info.getRealDestination() == selected && sec.info.anyExports()){
|
||||
planets.drawArc(planet, sec.tile.v, selected.tile.v, Color.gray.write(Tmp.c2).a(selectAlpha), Pal.accent, 0.4f, 90f, 25);
|
||||
}
|
||||
//exports
|
||||
if(selected.info.getRealDestination() == sec && selected.info.anyExports()){
|
||||
planets.drawArc(planet, selected.tile.v, sec.tile.v, Pal.place.write(Tmp.c2).a(selectAlpha), Pal.accent, 0.4f, 90f, 25);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -605,6 +619,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
void displayItems(Table c, float scl, ObjectMap<Item, ExportStat> stats, String name){
|
||||
displayItems(c, scl, stats, name, t -> {});
|
||||
}
|
||||
|
||||
void displayItems(Table c, float scl, ObjectMap<Item, ExportStat> stats, String name, Cons<Table> builder){
|
||||
Table t = new Table().left();
|
||||
|
||||
int i = 0;
|
||||
@@ -622,8 +640,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
if(t.getChildren().any()){
|
||||
c.add(name).left().row();
|
||||
c.add(t).padLeft(10f).left().row();
|
||||
c.defaults().left();
|
||||
c.add(name).row();
|
||||
builder.get(c);
|
||||
c.add(t).padLeft(10f).row();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,11 +680,21 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
displayItems(c, sector.getProductionScale(), sector.info.production, "@sectors.production");
|
||||
|
||||
//export
|
||||
displayItems(c, sector.getProductionScale(), sector.info.export, "@sectors.export");
|
||||
displayItems(c, sector.getProductionScale(), sector.info.export, "@sectors.export", t -> {
|
||||
if(sector.info.destination != null){
|
||||
String ic = sector.info.destination.iconChar();
|
||||
t.add(Iconc.rightOpen + " " + (ic == null || ic.isEmpty() ? "" : ic + " ") + sector.info.destination.name()).padLeft(10f).row();
|
||||
}
|
||||
});
|
||||
|
||||
//import
|
||||
if(sector.hasBase()){
|
||||
displayItems(c, 1f, sector.info.importStats(), "@sectors.import");
|
||||
displayItems(c, 1f, sector.info.importStats(sector.planet), "@sectors.import", t -> {
|
||||
sector.info.eachImport(sector.planet, other -> {
|
||||
String ic = other.iconChar();
|
||||
t.add(Iconc.rightOpen + " " + (ic == null || ic.isEmpty() ? "" : ic + " ") + other.name()).padLeft(10f).row();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ItemSeq items = sector.items();
|
||||
|
||||
@@ -15,6 +15,7 @@ import mindustry.core.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.input.*;
|
||||
@@ -38,6 +39,7 @@ public class PlacementFragment extends Fragment{
|
||||
Block menuHoverBlock;
|
||||
Displayable hover;
|
||||
Object lastDisplayState;
|
||||
Team lastTeam;
|
||||
boolean wasHovered;
|
||||
Table blockTable, toggler, topTable;
|
||||
ScrollPane blockPane;
|
||||
@@ -283,13 +285,14 @@ public class PlacementFragment extends Fragment{
|
||||
|
||||
//don't refresh unnecessarily
|
||||
//refresh only when the hover state changes, or the displayed block changes
|
||||
if(wasHovered == isHovered && lastDisplayState == displayState) return;
|
||||
if(wasHovered == isHovered && lastDisplayState == displayState && lastTeam == player.team()) return;
|
||||
|
||||
topTable.clear();
|
||||
topTable.top().left().margin(5);
|
||||
|
||||
lastDisplayState = displayState;
|
||||
wasHovered = isHovered;
|
||||
lastTeam = player.team();
|
||||
|
||||
//show details of selected block, with costs
|
||||
if(displayBlock != null){
|
||||
|
||||
Reference in New Issue
Block a user