UI polish
BIN
core/assets-raw/sprites/ui/button-square-down.9.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
core/assets-raw/sprites/ui/button-square-over.9.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
core/assets-raw/sprites/ui/button-square.9.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
@ -216,7 +216,7 @@ editor.errorsave = Error saving file:\n[accent]{0}
|
||||
editor.errorimage = That's an image, not a map. Don't go around changing extensions expecting it to work.\n\nIf you want to import a legacy map, use the 'import legacy map' button in the editor.
|
||||
editor.errorlegacy = This map is too old, and uses a legacy map format that is no longer supported.
|
||||
editor.errorheader = This map file is either not valid or corrupt.
|
||||
editor.errorname = Map has no name defined.
|
||||
editor.errorname = Map has no name defined. Are you trying to load a save file?
|
||||
editor.update = Update
|
||||
editor.randomize = Randomize
|
||||
editor.apply = Apply
|
||||
|
Before Width: | Height: | Size: 460 KiB After Width: | Height: | Size: 464 KiB |
@ -54,6 +54,12 @@
|
||||
down: button-down,
|
||||
up: button
|
||||
},
|
||||
square: {
|
||||
over: button-square-over,
|
||||
disabled: button-disabled,
|
||||
down: button-square-down,
|
||||
up: button-square
|
||||
},
|
||||
toggle: {
|
||||
checked: button-down,
|
||||
down: button-down,
|
||||
@ -70,6 +76,15 @@
|
||||
down: button-down,
|
||||
up: button
|
||||
},
|
||||
square: {
|
||||
font: default,
|
||||
fontColor: white,
|
||||
disabledFontColor: gray,
|
||||
over: button-square-over,
|
||||
disabled: button-disabled,
|
||||
down: button-square-down,
|
||||
up: button-square
|
||||
},
|
||||
node: {
|
||||
disabled: button,
|
||||
font: default,
|
||||
@ -298,8 +313,8 @@
|
||||
font: default,
|
||||
fontColor: white
|
||||
},
|
||||
small: {
|
||||
font: default,
|
||||
outline: {
|
||||
font: outline,
|
||||
fontColor: white
|
||||
}
|
||||
},
|
||||
|
BIN
core/assets/zones/craters.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
core/assets/zones/desertWastes.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
core/assets/zones/desolateRift.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
core/assets/zones/frozenForest.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
core/assets/zones/groundZero.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
core/assets/zones/nuclearComplex.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
core/assets/zones/overgrowth.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
core/assets/zones/ruinousShores.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
core/assets/zones/saltFlats.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
core/assets/zones/stainedMountains.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
core/assets/zones/tarFields.png
Normal file
After Width: | Height: | Size: 14 KiB |
@ -3,6 +3,7 @@ package io.anuke.mindustry.type;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.function.*;
|
||||
import io.anuke.arc.graphics.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.arc.scene.ui.layout.*;
|
||||
import io.anuke.arc.util.*;
|
||||
@ -27,6 +28,7 @@ public class Zone extends UnlockableContent{
|
||||
public int configureWave = 15;
|
||||
public int launchPeriod = 10;
|
||||
public Loadout loadout = Loadouts.basicShard;
|
||||
public Texture preview;
|
||||
|
||||
protected ItemStack[] baseLaunchCost = {};
|
||||
protected Array<ItemStack> startingItems = new Array<>();
|
||||
@ -152,6 +154,11 @@ public class Zone extends UnlockableContent{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
preview = new Texture(Core.files.internal("zones/" + name + ".png"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alwaysUnlocked(){
|
||||
return alwaysUnlocked;
|
||||
|
@ -10,6 +10,7 @@ import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.scene.*;
|
||||
import io.anuke.arc.scene.ui.*;
|
||||
import io.anuke.arc.scene.ui.layout.*;
|
||||
import io.anuke.arc.scene.utils.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.core.GameState.*;
|
||||
@ -24,7 +25,7 @@ import io.anuke.mindustry.ui.TreeLayout.*;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class DeployDialog extends FloatingDialog{
|
||||
private final float nodeSize = Unit.dp.scl(210f);
|
||||
private final float nodeSize = Unit.dp.scl(230f);
|
||||
private ObjectSet<ZoneNode> nodes = new ObjectSet<>();
|
||||
private ZoneInfoDialog info = new ZoneInfoDialog();
|
||||
private Rectangle bounds = new Rectangle();
|
||||
@ -35,7 +36,8 @@ public class DeployDialog extends FloatingDialog{
|
||||
ZoneNode root = new ZoneNode(Zones.groundZero, null);
|
||||
|
||||
TreeLayout layout = new TreeLayout();
|
||||
layout.gapBetweenLevels = layout.gapBetweenNodes = Unit.dp.scl(50f);
|
||||
layout.gapBetweenLevels = layout.gapBetweenNodes = Unit.dp.scl(60f);
|
||||
layout.gapBetweenNodes = Unit.dp.scl(120f);
|
||||
layout.layout(root);
|
||||
bounds.set(layout.getBounds());
|
||||
bounds.y += nodeSize*0.4f;
|
||||
@ -78,10 +80,18 @@ public class DeployDialog extends FloatingDialog{
|
||||
}}.setScaling(Scaling.fit));
|
||||
|
||||
if(control.saves.getZoneSlot() != null){
|
||||
float size = 230f;
|
||||
|
||||
stack.add(new Table(t -> {
|
||||
SaveSlot slot = control.saves.getZoneSlot();
|
||||
|
||||
TextButton button = t.addButton(Core.bundle.format("resume", slot.getZone().localizedName()), () -> {
|
||||
Stack sub = new Stack();
|
||||
|
||||
if(control.saves.getZoneSlot().getZone() != null){
|
||||
sub.add(new Table(f -> f.margin(4f).add(new Image(control.saves.getZoneSlot().getZone().preview).setScaling(Scaling.fit)).color(Color.DARK_GRAY).grow()));
|
||||
}
|
||||
|
||||
TextButton button = Elements.newButton(Core.bundle.format("resume", slot.getZone().localizedName()), "square", () -> {
|
||||
|
||||
hide();
|
||||
ui.loadAnd(() -> {
|
||||
@ -95,7 +105,11 @@ public class DeployDialog extends FloatingDialog{
|
||||
show();
|
||||
}
|
||||
});
|
||||
}).size(230f).get();
|
||||
});
|
||||
|
||||
sub.add(button);
|
||||
|
||||
t.add(sub).size(size);
|
||||
|
||||
String color = "[lightgray]";
|
||||
|
||||
@ -149,13 +163,12 @@ public class DeployDialog extends FloatingDialog{
|
||||
drawDefaultBackground(x, y);
|
||||
}
|
||||
|
||||
void buildButton(Zone zone, TextButton button){
|
||||
void buildButton(Zone zone, Button button){
|
||||
button.setDisabled(() -> hidden(zone));
|
||||
button.clicked(() -> info.show(zone));
|
||||
|
||||
if(zone.unlocked()){
|
||||
button.addImage("icon-terrain").size(iconsize).padRight(3);
|
||||
button.labelWrap(zone.localizedName()).width(140).growX();
|
||||
button.labelWrap(zone.localizedName()).style("outline").width(140).growX().get().setAlignment(Align.center);
|
||||
}else{
|
||||
button.addImage("icon-locked");
|
||||
button.row();
|
||||
@ -170,14 +183,26 @@ public class DeployDialog extends FloatingDialog{
|
||||
|
||||
{
|
||||
for(ZoneNode node : nodes){
|
||||
TextButton button = new TextButton("", "node");
|
||||
button.setSize(node.width, node.height);
|
||||
button.update(() -> {
|
||||
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center);
|
||||
});
|
||||
button.clearChildren();
|
||||
Stack stack = new Stack();
|
||||
Tmp.v1.set(node.width, node.height);
|
||||
if(node.zone.preview != null){
|
||||
Tmp.v1.set(Scaling.fit.apply(node.zone.preview.getWidth(), node.zone.preview.getHeight(), node.width, node.height));
|
||||
}
|
||||
|
||||
stack.setSize(Tmp.v1.x, Tmp.v1.y);
|
||||
if(node.zone.unlocked() && node.zone.preview != null){
|
||||
stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview)
|
||||
.setScaling(Scaling.stretch)).color(Color.DARK_GRAY).grow()));
|
||||
}else{
|
||||
stack.add(new Table(t -> t.margin(4f).add(new Image("whiteui", Color.BLACK).setScaling(Scaling.stretch)).grow()));
|
||||
}
|
||||
|
||||
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
|
||||
|
||||
Button button = new Button("square");
|
||||
buildButton(node.zone, button);
|
||||
addChild(button);
|
||||
stack.add(button);
|
||||
addChild(stack);
|
||||
}
|
||||
|
||||
dragged((x, y) -> {
|
||||
@ -206,7 +231,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
|
||||
for(ZoneNode node : nodes){
|
||||
for(ZoneNode child : node.allChildren){
|
||||
Lines.stroke(Unit.dp.scl(3f), node.zone.locked() || child.zone.locked() ? Pal.gray : Pal.accent);
|
||||
Lines.stroke(Unit.dp.scl(4f), node.zone.locked() || child.zone.locked() ? Pal.gray : Pal.gray);
|
||||
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
||||
}
|
||||
}
|
||||
@ -225,7 +250,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
this.zone = zone;
|
||||
this.parent = parent;
|
||||
this.width = this.height = nodeSize;
|
||||
this.height /= 2f;
|
||||
//this.height /= 2f;
|
||||
nodes.add(this);
|
||||
|
||||
arr.selectFrom(content.zones(), other -> other.zoneRequirements.length > 0 && other.zoneRequirements[0].zone == zone);
|
||||
|
@ -75,7 +75,15 @@ public class MapsDialog extends FloatingDialog{
|
||||
map = world.maps.makeLegacyMap(file);
|
||||
}
|
||||
|
||||
String name = map.tags.get("name");
|
||||
//when you attempt to import a save, it will have no name, so generate one
|
||||
String name = map.tags.getOr("name", () -> {
|
||||
String result = "unknown";
|
||||
int number = 0;
|
||||
while(world.maps.byName(result + number++) != null);
|
||||
return result + number;
|
||||
});
|
||||
|
||||
//this will never actually get called, but it remains just in case
|
||||
if(name == null){
|
||||
ui.showError("$editor.errorname");
|
||||
return;
|
||||
|
@ -240,7 +240,7 @@ public class Block extends BlockStorage{
|
||||
font.draw(text, dx, dy + layout.height + 1, Align.center);
|
||||
dy -= 1f;
|
||||
Lines.stroke(2f, Color.DARK_GRAY);
|
||||
Lines.line(dx - layout.width / 2f - 2f, dy, dx + layout.width / 2f + 2f, dy);
|
||||
Lines.line(dx - layout.width / 2f - 2f, dy, dx + layout.width / 2f + 1.5f, dy);
|
||||
Lines.stroke(1f, color);
|
||||
Lines.line(dx - layout.width / 2f - 2f, dy, dx + layout.width / 2f + 1.5f, dy);
|
||||
|
||||
|