diff --git a/core/assets/maps/tarFields.msav b/core/assets/maps/tarFields.msav index 53c67a18cb..006be2fb0f 100644 Binary files a/core/assets/maps/tarFields.msav and b/core/assets/maps/tarFields.msav differ diff --git a/core/assets/maps/windsweptIslands.msav b/core/assets/maps/windsweptIslands.msav index 347c8ce3f4..d5e838b60d 100644 Binary files a/core/assets/maps/windsweptIslands.msav and b/core/assets/maps/windsweptIslands.msav differ diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index a7796f9c41..8ad9051067 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -87,7 +87,7 @@ public class TechTree implements ContentList{ node(bridgeConduit); - node(pulseConduit, () -> { + node(pulseConduit, Seq.with(new SectorComplete(windsweptIslands)), () -> { node(phaseConduit, () -> { }); @@ -114,7 +114,7 @@ public class TechTree implements ContentList{ }); node(laserDrill, () -> { - node(blastDrill, () -> { + node(blastDrill, Seq.with(new SectorComplete(nuclearComplex)), () -> { }); @@ -143,8 +143,8 @@ public class TechTree implements ContentList{ }); }); - node(plastaniumCompressor, () -> { - node(phaseWeaver, () -> { + node(plastaniumCompressor, Seq.with(new SectorComplete(windsweptIslands)), () -> { + node(phaseWeaver, Seq.with(new SectorComplete(tarFields)), () -> { }); }); diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index 9d1de8042b..a99eb7d975 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -59,6 +59,8 @@ public class SectorInfo{ public float secondsPassed; /** Display name. */ public @Nullable String name; + /** Displayed icon. */ + public @Nullable String icon; /** Version of generated waves. When it doesn't match, new waves are generated. */ public int waveVersion = -1; diff --git a/core/src/mindustry/type/Sector.java b/core/src/mindustry/type/Sector.java index dd44b1d74d..918a2f3a7a 100644 --- a/core/src/mindustry/type/Sector.java +++ b/core/src/mindustry/type/Sector.java @@ -5,11 +5,13 @@ import arc.func.*; import arc.graphics.*; import arc.math.*; import arc.math.geom.*; +import arc.scene.style.*; import arc.struct.*; import arc.util.*; import mindustry.*; import mindustry.game.Saves.*; import mindustry.game.*; +import mindustry.gen.*; import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.world.modules.*; @@ -119,6 +121,11 @@ public class Sector{ saveInfo(); } + @Nullable + public TextureRegionDrawable icon(){ + return info.icon == null ? null : Icon.icons.get(info.icon); + } + public boolean isCaptured(){ return save != null && !info.waves; } diff --git a/core/src/mindustry/ui/dialogs/PaletteDialog.java b/core/src/mindustry/ui/dialogs/PaletteDialog.java index 6a6a666226..e9d643a4b2 100644 --- a/core/src/mindustry/ui/dialogs/PaletteDialog.java +++ b/core/src/mindustry/ui/dialogs/PaletteDialog.java @@ -2,9 +2,7 @@ package mindustry.ui.dialogs; import arc.func.*; import arc.graphics.*; -import arc.input.*; import arc.scene.ui.*; -import arc.scene.ui.layout.*; import mindustry.gen.*; import mindustry.ui.*; @@ -19,28 +17,24 @@ public class PaletteDialog extends Dialog{ } private void build(){ - Table table = new Table(); - cont.add(table); + cont.table(table -> { + for(int i = 0; i < playerColors.length; i++){ + Color color = playerColors[i]; - for(int i = 0; i < playerColors.length; i++){ - Color color = playerColors[i]; + ImageButton button = table.button(Tex.whiteui, Styles.clearTogglei, 34, () -> { + cons.get(color); + hide(); + }).size(48).get(); + button.setChecked(player.color().equals(color)); + button.getStyle().imageUpColor = color; - ImageButton button = table.button(Tex.whiteui, Styles.clearTogglei, 34, () -> { - cons.get(color); - hide(); - }).size(48).get(); - button.setChecked(player.color().equals(color)); - button.getStyle().imageUpColor = color; - - if(i % 4 == 3){ - table.row(); + if(i % 4 == 3){ + table.row(); + } } - } - - keyDown(key -> { - if(key == KeyCode.escape || key == KeyCode.back) hide(); }); + closeOnBack(); } public void show(Cons cons){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 48235b0b3a..da81ad3802 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -218,7 +218,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ for(Sector sec : planet.sectors){ if(sec != hovered){ - var icon = (sec.isAttacked() ? Icon.warning : !sec.hasBase() && sec.preset != null && sec.preset.unlocked() ? Icon.terrain : null); + var preficon = sec.icon(); + var icon = (sec.isAttacked() ? Icon.warning : !sec.hasBase() && sec.preset != null && sec.preset.unlocked() && preficon == null ? Icon.terrain : preficon); var color = sec.preset != null && !sec.hasBase() ? Team.derelict.color : Team.sharded.color; if(icon != null){ @@ -236,10 +237,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ planets.drawPlane(hovered, () -> { Draw.color(hovered.isAttacked() ? Pal.remove : Color.white, Pal.accent, Mathf.absin(5f, 1f)); - TextureRegion icon = hovered.locked() && !canSelect(hovered) ? Icon.lock.getRegion() : hovered.isAttacked() ? Icon.warning.getRegion() : null; + var icon = hovered.locked() && !canSelect(hovered) ? Icon.lock : hovered.isAttacked() ? Icon.warning : hovered.icon(); if(icon != null){ - Draw.rect(icon, 0, 0); + Draw.rect(icon.getRegion(), 0, 0); } Draw.reset(); @@ -378,6 +379,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ stable.table(title -> { title.add("[accent]" + sector.name()); if(sector.preset == null){ + title.add().growX(); + title.button(Icon.pencilSmall, Styles.clearPartiali, () -> { ui.showTextInput("@sectors.rename", "@name", 20, sector.name(), v -> { sector.setName(v); @@ -385,6 +388,40 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ }); }).size(40f).padLeft(4); } + + var icon = Icon.icons.get(sector.info.icon + "Small"); + + title.button(icon == null ? Icon.noneSmall : icon, Styles.clearPartiali, () -> { + new Dialog(""){{ + closeOnBack(); + setFillParent(true); + cont.pane(t -> { + t.defaults().size(48); + + t.button(Icon.none, Styles.clearTogglei, () -> { + sector.info.icon = null; + sector.saveInfo(); + hide(); + updateSelected(); + }).checked(sector.info.icon == null); + + int i = 1; + for(var entry : Icon.icons.entries()){ + if(entry.key.endsWith("Small") || entry.key.contains("none")) continue; + String key = entry.key; + + t.button(entry.value, Styles.cleari, () -> { + sector.info.icon = key; + sector.saveInfo(); + hide(); + updateSelected(); + }).checked(entry.key.equals(sector.info.icon)); + + if(++i % 8 == 0) t.row(); + } + }); + }}.show(); + }).size(40f); }).row(); stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row();