diff --git a/core/assets/contributors b/core/assets/contributors index c90b956965..20e5b1e10c 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -154,3 +154,4 @@ zenonet AyuKo-o JojoFR1 Xasmedy +xStaBUx \ No newline at end of file diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 6667e9fab1..3b1234d681 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -606,31 +606,48 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ t.label(() -> mode == select ? "@sectors.select" : "").style(Styles.outlineLabel).color(Pal.accent); }), buttons, - //planet selection - new Table(t -> { - t.top().left(); - if(content.planets().count(this::selectable) > 1){ - t.table(Tex.pane, pt -> { - pt.margin(4f); - for(int i = 0; i < content.planets().size; i++){ - Planet planet = content.planets().get(i); - if(selectable(planet)){ - pt.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(190).height(40).growX().update(bb -> bb.setChecked(state.planet == planet)).with(w -> w.marginLeft(10f)).get().getChildren().get(1).setColor(planet.iconColor); - pt.row(); + // planet selection + new Table(t -> { + t.top().left(); + ScrollPane pane = new ScrollPane(null, Styles.smallPane); + t.add(pane).colspan(2).row(); + Table starsTable = new Table(Styles.black); + pane.setWidget(starsTable); + pane.setScrollingDisabled(true, false); + int starCount = 0; + for(Planet star : content.planets()){ + if(star.solarSystem != star) continue; + boolean hasSelectablePlanets = false; + for(Planet planet : content.planets()){ + if(planet.solarSystem == star && selectable(planet)){ + hasSelectablePlanets = true; + break; + } + } + if(!hasSelectablePlanets) continue; + starCount++; + 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); + }).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 -> { expandTable = c;