This commit is contained in:
Anuken
2023-05-10 13:00:49 -04:00
parent a3dbbe63c4
commit c5cf6f0af6

View File

@@ -606,48 +606,43 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
t.label(() -> mode == select ? "@sectors.select" : "").style(Styles.outlineLabel).color(Pal.accent); t.label(() -> mode == select ? "@sectors.select" : "").style(Styles.outlineLabel).color(Pal.accent);
}), }),
buttons, buttons,
// planet selection
new Table(t -> { // planet selection
t.top().left(); new Table(t -> {
ScrollPane pane = new ScrollPane(null, Styles.smallPane); t.top().left();
t.add(pane).colspan(2).row(); ScrollPane pane = new ScrollPane(null, Styles.smallPane);
Table starsTable = new Table(Styles.black); t.add(pane).colspan(2).row();
pane.setWidget(starsTable); Table starsTable = new Table(Styles.black);
pane.setScrollingDisabled(true, false); pane.setWidget(starsTable);
int starCount = 0; pane.setScrollingDisabled(true, false);
for(Planet star : content.planets()){
if(star.solarSystem != star) continue; int starCount = 0;
boolean hasSelectablePlanets = false; for(Planet star : content.planets()){
for(Planet planet : content.planets()){ if(star.solarSystem != star || !content.planets().contains(p -> p.solarSystem == star && selectable(p))) continue;
if(planet.solarSystem == star && selectable(planet)){
hasSelectablePlanets = true; starCount++;
break; if(starCount > 1) starsTable.add(star.localizedName).padLeft(10f).padBottom(10f).padTop(10f).left().width(190f).row();
Table planetTable = new Table();
starsTable.add(planetTable).left().row();
for(Planet planet : content.planets()){
if(planet.solarSystem == star && selectable(planet)){
Button planetButton = planetTable.button(planet.localizedName, Icon.icons.get(planet.icon + "Small", Icon.icons.get(planet.icon, Icon.commandRallySmall)), Styles.flatTogglet, () -> {
selected = null;
launchSector = null;
if(state.planet != planet){
newPresets.clear();
state.planet = planet;
rebuildExpand();
} }
} settings.put("lastplanet", planet.name);
if(!hasSelectablePlanets) continue; }).width(200).height(40).update(bb -> bb.setChecked(state.planet == planet)).with(w -> w.marginLeft(10f)).get();
starCount++; planetButton.getChildren().get(1).setColor(planet.iconColor);
if(starCount > 1) starsTable.add(star.localizedName).padLeft(10f).padBottom(10f).padTop(10f).left().width(190f).row(); planetButton.setColor(planet.iconColor);
Table planetTable = new Table(); planetTable.background(Tex.pane).row();
starsTable.add(planetTable).left().row();
for(Planet planet : content.planets()){
if(planet.solarSystem == star && selectable(planet)){
Button planetButton = planetTable.button(planet.localizedName, Icon.icons.get(planet.icon + "Small", Icon.icons.get(planet.icon, Icon.commandRallySmall)), Styles.flatTogglet, () -> {
selected = null;
launchSector = null;
if(state.planet != planet){
newPresets.clear();
state.planet = planet;
rebuildExpand();
}
settings.put("lastplanet", planet.name);
}).width(200).height(40).update(bb -> bb.setChecked(state.planet == planet)).with(w -> w.marginLeft(10f)).get();
planetButton.getChildren().get(1).setColor(planet.iconColor);
planetButton.setColor(planet.iconColor);
planetTable.background(Tex.pane).row();
}
}
} }
}), }
}
}),
new Table(c -> { new Table(c -> {
expandTable = c; expandTable = c;