Added zone class / Dialog method inline
This commit is contained in:
@@ -239,6 +239,8 @@ error.mapnotfound = Map file not found!
|
|||||||
error.io = Network I/O error.
|
error.io = Network I/O error.
|
||||||
error.any = Unknown network error.
|
error.any = Unknown network error.
|
||||||
|
|
||||||
|
zone.wasteland.name = Wasteland
|
||||||
|
|
||||||
settings.language = Language
|
settings.language = Language
|
||||||
settings.reset = Reset to Defaults
|
settings.reset = Reset to Defaults
|
||||||
settings.rebind = Rebind
|
settings.rebind = Rebind
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ void main() {
|
|||||||
float spacing = SPACE * u_scl;
|
float spacing = SPACE * u_scl;
|
||||||
|
|
||||||
gl_FragColor = mix(c * v_color, u_color,
|
gl_FragColor = mix(c * v_color, u_color,
|
||||||
(1.0-step(0.1, texture2D(u_texture, v_texCoord.xy).a)) *
|
(1.0-step(0.001, texture2D(u_texture, v_texCoord.xy).a)) *
|
||||||
step(0.1,
|
step(0.001,
|
||||||
//cardinals
|
//cardinals
|
||||||
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v).a +
|
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v).a +
|
||||||
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v).a +
|
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v).a +
|
||||||
|
|||||||
17
core/src/io/anuke/mindustry/content/Zones.java
Normal file
17
core/src/io/anuke/mindustry/content/Zones.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.game.ContentList;
|
||||||
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
|
import io.anuke.mindustry.type.Zone;
|
||||||
|
|
||||||
|
public class Zones implements ContentList{
|
||||||
|
public Zone wasteland;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(){
|
||||||
|
|
||||||
|
wasteland = new Zone("wasteland"){{
|
||||||
|
deployCost = new ItemStack[]{new ItemStack(Items.copper, 2)};
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,10 +16,7 @@ import io.anuke.mindustry.entities.traits.TypeTrait;
|
|||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.game.MappableContent;
|
import io.anuke.mindustry.game.MappableContent;
|
||||||
import io.anuke.mindustry.type.ContentType;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Item;
|
|
||||||
import io.anuke.mindustry.type.Liquid;
|
|
||||||
import io.anuke.mindustry.type.Recipe;
|
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.ColorMapper;
|
import io.anuke.mindustry.world.ColorMapper;
|
||||||
import io.anuke.mindustry.world.LegacyColorMapper;
|
import io.anuke.mindustry.world.LegacyColorMapper;
|
||||||
@@ -38,39 +35,21 @@ public class ContentLoader{
|
|||||||
private MappableContent[][] temporaryMapper;
|
private MappableContent[][] temporaryMapper;
|
||||||
private ObjectSet<Consumer<Content>> initialization = new ObjectSet<>();
|
private ObjectSet<Consumer<Content>> initialization = new ObjectSet<>();
|
||||||
private ContentList[] content = {
|
private ContentList[] content = {
|
||||||
//effects
|
|
||||||
new Fx(),
|
new Fx(),
|
||||||
|
|
||||||
//items
|
|
||||||
new Items(),
|
new Items(),
|
||||||
|
|
||||||
//status effects
|
|
||||||
new StatusEffects(),
|
new StatusEffects(),
|
||||||
|
|
||||||
//liquids
|
|
||||||
new Liquids(),
|
new Liquids(),
|
||||||
|
|
||||||
//bullets
|
|
||||||
new Bullets(),
|
new Bullets(),
|
||||||
|
|
||||||
//weapons
|
|
||||||
new Weapons(),
|
new Weapons(),
|
||||||
|
|
||||||
//mechs
|
|
||||||
new Mechs(),
|
new Mechs(),
|
||||||
|
|
||||||
//units
|
|
||||||
new UnitTypes(),
|
new UnitTypes(),
|
||||||
|
|
||||||
//blocks
|
|
||||||
new Blocks(),
|
new Blocks(),
|
||||||
|
new Recipes(),
|
||||||
|
new Zones(),
|
||||||
|
|
||||||
//not really a content class, but this makes initialization easier
|
//these are not really content classes, but this makes initialization easier
|
||||||
new ColorMapper(),
|
new ColorMapper(),
|
||||||
new LegacyColorMapper(),
|
new LegacyColorMapper(),
|
||||||
|
|
||||||
//recipes
|
|
||||||
new Recipes(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**Creates all content types.*/
|
/**Creates all content types.*/
|
||||||
@@ -237,6 +216,10 @@ public class ContentLoader{
|
|||||||
return (BulletType) getByID(ContentType.bullet, id);
|
return (BulletType) getByID(ContentType.bullet, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Array<Zone> zones(){
|
||||||
|
return getBy(ContentType.zone);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers sync IDs for all types of sync entities.
|
* Registers sync IDs for all types of sync entities.
|
||||||
* Do not register units here!
|
* Do not register units here!
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import io.anuke.arc.util.Time;
|
|||||||
import io.anuke.mindustry.content.Mechs;
|
import io.anuke.mindustry.content.Mechs;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.Saves;
|
import io.anuke.mindustry.game.Saves;
|
||||||
@@ -28,8 +27,6 @@ import io.anuke.mindustry.input.InputHandler;
|
|||||||
import io.anuke.mindustry.input.MobileInput;
|
import io.anuke.mindustry.input.MobileInput;
|
||||||
import io.anuke.mindustry.maps.Map;
|
import io.anuke.mindustry.maps.Map;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
|
||||||
import io.anuke.mindustry.type.Recipe;
|
|
||||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -254,12 +251,12 @@ public class Control implements ApplicationListener{
|
|||||||
|
|
||||||
Time.run(5f, () -> {
|
Time.run(5f, () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("WARNING!");
|
FloatingDialog dialog = new FloatingDialog("WARNING!");
|
||||||
dialog.buttons().addButton("$ok", () -> {
|
dialog.buttons.addButton("$ok", () -> {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
Core.settings.put("4.0-warning-2", true);
|
Core.settings.put("4.0-warning-2", true);
|
||||||
Core.settings.save();
|
Core.settings.save();
|
||||||
}).size(100f, 60f);
|
}).size(100f, 60f);
|
||||||
dialog.content().add("Reminder: The alpha version you are about to play is very unstable, and is [accent]not representative of the final 4.0 release.[]\n\n " +
|
dialog.cont.add("Reminder: The alpha version you are about to play is very unstable, and is [accent]not representative of the final 4.0 release.[]\n\n " +
|
||||||
"\nThere is currently[scarlet] no sound implemented[]; this is intentional.\n" +
|
"\nThere is currently[scarlet] no sound implemented[]; this is intentional.\n" +
|
||||||
"All current art and UI is temporary, and will be re-drawn before release. " +
|
"All current art and UI is temporary, and will be re-drawn before release. " +
|
||||||
"\n\n[accent]Saves and maps may be corrupted without warning between updates.").wrap().width(400f);
|
"\n\n[accent]Saves and maps may be corrupted without warning between updates.").wrap().width(400f);
|
||||||
|
|||||||
@@ -225,19 +225,19 @@ public class UI implements ApplicationListener{
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showTextInput(String title, String text, String def, TextFieldFilter filter, Consumer<String> confirmed){
|
public void showTextInput(String titleText, String text, String def, TextFieldFilter filter, Consumer<String> confirmed){
|
||||||
new Dialog(title, "dialog"){{
|
new Dialog(titleText, "dialog"){{
|
||||||
content().margin(30).add(text).padRight(6f);
|
cont.margin(30).add(text).padRight(6f);
|
||||||
TextField field = content().addField(def, t -> {
|
TextField field = cont.addField(def, t -> {
|
||||||
}).size(170f, 50f).get();
|
}).size(170f, 50f).get();
|
||||||
field.setTextFieldFilter((f, c) -> field.getText().length() < 12 && filter.acceptChar(f, c));
|
field.setTextFieldFilter((f, c) -> field.getText().length() < 12 && filter.acceptChar(f, c));
|
||||||
Platform.instance.addDialog(field);
|
Platform.instance.addDialog(field);
|
||||||
buttons().defaults().size(120, 54).pad(4);
|
buttons.defaults().size(120, 54).pad(4);
|
||||||
buttons().addButton("$ok", () -> {
|
buttons.addButton("$ok", () -> {
|
||||||
confirmed.accept(field.getText());
|
confirmed.accept(field.getText());
|
||||||
hide();
|
hide();
|
||||||
}).disabled(b -> field.getText().isEmpty());
|
}).disabled(b -> field.getText().isEmpty());
|
||||||
buttons().addButton("$cancel", this::hide);
|
buttons.addButton("$cancel", this::hide);
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,17 +255,17 @@ public class UI implements ApplicationListener{
|
|||||||
|
|
||||||
public void showInfo(String info){
|
public void showInfo(String info){
|
||||||
new Dialog("", "dialog"){{
|
new Dialog("", "dialog"){{
|
||||||
getCell(content()).growX();
|
getCell(cont).growX();
|
||||||
content().margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
||||||
buttons().addButton("$ok", this::hide).size(90, 50).pad(4);
|
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showInfo(String info, Runnable clicked){
|
public void showInfo(String info, Runnable clicked){
|
||||||
new Dialog("", "dialog"){{
|
new Dialog("", "dialog"){{
|
||||||
getCell(content()).growX();
|
getCell(cont).growX();
|
||||||
content().margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
||||||
buttons().addButton("$ok", () -> {
|
buttons.addButton("$ok", () -> {
|
||||||
clicked.run();
|
clicked.run();
|
||||||
hide();
|
hide();
|
||||||
}).size(90, 50).pad(4);
|
}).size(90, 50).pad(4);
|
||||||
@@ -274,25 +274,25 @@ public class UI implements ApplicationListener{
|
|||||||
|
|
||||||
public void showError(String text){
|
public void showError(String text){
|
||||||
new Dialog("$error.title", "dialog"){{
|
new Dialog("$error.title", "dialog"){{
|
||||||
content().margin(15).add(text).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
cont.margin(15).add(text).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
||||||
buttons().addButton("$ok", this::hide).size(90, 50).pad(4);
|
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showText(String title, String text){
|
public void showText(String titleText, String text){
|
||||||
new Dialog(title, "dialog"){{
|
new Dialog(titleText, "dialog"){{
|
||||||
content().margin(15).add(text).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
cont.margin(15).add(text).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
||||||
buttons().addButton("$ok", this::hide).size(90, 50).pad(4);
|
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showConfirm(String title, String text, Runnable confirmed){
|
public void showConfirm(String title, String text, Runnable confirmed){
|
||||||
FloatingDialog dialog = new FloatingDialog(title);
|
FloatingDialog dialog = new FloatingDialog(title);
|
||||||
dialog.content().add(text).width(400f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
dialog.cont.add(text).width(400f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||||
dialog.buttons().defaults().size(200f, 54f).pad(2f);
|
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.buttons().addButton("$cancel", dialog::hide);
|
dialog.buttons.addButton("$cancel", dialog::hide);
|
||||||
dialog.buttons().addButton("$ok", () -> {
|
dialog.buttons.addButton("$ok", () -> {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
confirmed.run();
|
confirmed.run();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
float isize = 16 * 2f;
|
float isize = 16 * 2f;
|
||||||
float swidth = 180f;
|
float swidth = 180f;
|
||||||
|
|
||||||
menu.content().table(t -> {
|
menu.cont.table(t -> {
|
||||||
t.defaults().size(swidth, 60f).padBottom(5).padRight(5).padLeft(5);
|
t.defaults().size(swidth, 60f).padBottom(5).padRight(5).padLeft(5);
|
||||||
|
|
||||||
t.addImageTextButton("$editor.savemap", "icon-floppy-16", isize, this::save).size(swidth * 2f + 10, 60f).colspan(2);
|
t.addImageTextButton("$editor.savemap", "icon-floppy-16", isize, this::save).size(swidth * 2f + 10, 60f).colspan(2);
|
||||||
@@ -140,9 +140,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
t.row();
|
t.row();
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.content().row();
|
menu.cont.row();
|
||||||
|
|
||||||
menu.content().addImageTextButton("$quit", "icon-back", isize, () -> {
|
menu.cont.addImageTextButton("$quit", "icon-back", isize, () -> {
|
||||||
tryExit();
|
tryExit();
|
||||||
menu.hide();
|
menu.hide();
|
||||||
}).padTop(-5).size(swidth * 2f + 10, 60f);
|
}).padTop(-5).size(swidth * 2f + 10, 60f);
|
||||||
@@ -249,7 +249,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
float h = 90f;
|
float h = 90f;
|
||||||
|
|
||||||
dialog.content().defaults().size(360f, h).padBottom(5).padRight(5).padLeft(5);
|
dialog.cont.defaults().size(360f, h).padBottom(5).padRight(5).padLeft(5);
|
||||||
|
|
||||||
for(int i = 0; i < arguments.length; i += 4){
|
for(int i = 0; i < arguments.length; i += 4){
|
||||||
String name = (String) arguments[i];
|
String name = (String) arguments[i];
|
||||||
@@ -257,7 +257,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
String iconname = (String) arguments[i + 2];
|
String iconname = (String) arguments[i + 2];
|
||||||
Runnable listenable = (Runnable) arguments[i + 3];
|
Runnable listenable = (Runnable) arguments[i + 3];
|
||||||
|
|
||||||
TextButton button = dialog.content().addButton(name, () -> {
|
TextButton button = dialog.cont.addButton(name, () -> {
|
||||||
listenable.run();
|
listenable.run();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
menu.hide();
|
menu.hide();
|
||||||
@@ -273,7 +273,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
button.row();
|
button.row();
|
||||||
|
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
@@ -316,7 +316,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
public void updateSelectedBlock(){
|
public void updateSelectedBlock(){
|
||||||
Block block = editor.getDrawBlock();
|
Block block = editor.getDrawBlock();
|
||||||
for(int j = 0; j < content.blocks().size; j++){
|
for(int j = 0; j < Vars.content.blocks().size; j++){
|
||||||
if(block.id == j && j < blockgroup.getButtons().size){
|
if(block.id == j && j < blockgroup.getButtons().size){
|
||||||
blockgroup.getButtons().get(j).setChecked(true);
|
blockgroup.getButtons().get(j).setChecked(true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -28,42 +28,42 @@ public class MapInfoDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setup(){
|
private void setup(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
ObjectMap<String, String> tags = editor.getTags();
|
ObjectMap<String, String> tags = editor.getTags();
|
||||||
|
|
||||||
content().add("$editor.name").padRight(8).left();
|
cont.add("$editor.name").padRight(8).left();
|
||||||
|
|
||||||
content().defaults().padTop(15);
|
cont.defaults().padTop(15);
|
||||||
|
|
||||||
name = content().addField(tags.get("name", ""), text -> {
|
name = cont.addField(tags.get("name", ""), text -> {
|
||||||
tags.put("name", text);
|
tags.put("name", text);
|
||||||
}).size(400, 55f).get();
|
}).size(400, 55f).get();
|
||||||
name.setMessageText("$unknown");
|
name.setMessageText("$unknown");
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
content().add("$editor.description").padRight(8).left();
|
cont.add("$editor.description").padRight(8).left();
|
||||||
|
|
||||||
description = content().addArea(tags.get("description", ""), "textarea", text -> {
|
description = cont.addArea(tags.get("description", ""), "textarea", text -> {
|
||||||
tags.put("description", text);
|
tags.put("description", text);
|
||||||
}).size(400f, 140f).get();
|
}).size(400f, 140f).get();
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
content().add("$editor.author").padRight(8).left();
|
cont.add("$editor.author").padRight(8).left();
|
||||||
|
|
||||||
author = content().addField(tags.get("author", Core.settings.getString("mapAuthor", "")), text -> {
|
author = cont.addField(tags.get("author", Core.settings.getString("mapAuthor", "")), text -> {
|
||||||
tags.put("author", text);
|
tags.put("author", text);
|
||||||
Core.settings.put("mapAuthor", text);
|
Core.settings.put("mapAuthor", text);
|
||||||
Core.settings.save();
|
Core.settings.save();
|
||||||
}).size(400, 55f).get();
|
}).size(400, 55f).get();
|
||||||
author.setMessageText("$unknown");
|
author.setMessageText("$unknown");
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
content().add().padRight(8).left();
|
cont.add().padRight(8).left();
|
||||||
content().addCheck("$editor.oregen", enabled -> {
|
cont.addCheck("$editor.oregen", enabled -> {
|
||||||
tags.put("oregen", enabled ? "1" : "0");
|
tags.put("oregen", enabled ? "1" : "0");
|
||||||
}).update(c -> c.setChecked(!tags.get("oregen", "0").equals("0"))).left();
|
}).update(c -> c.setChecked(!tags.get("oregen", "0").equals("0"))).left();
|
||||||
|
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ public class MapLoadDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons().defaults().size(200f, 50f);
|
buttons.defaults().size(200f, 50f);
|
||||||
buttons().addButton("$cancel", this::hide);
|
buttons.addButton("$cancel", this::hide);
|
||||||
buttons().add(button);
|
buttons.add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuild(){
|
public void rebuild(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
if(world.maps.all().size > 0){
|
if(world.maps.all().size > 0){
|
||||||
selected = world.maps.all().first();
|
selected = world.maps.all().first();
|
||||||
}
|
}
|
||||||
@@ -69,11 +69,11 @@ public class MapLoadDialog extends FloatingDialog{
|
|||||||
if(world.maps.all().size == 0){
|
if(world.maps.all().size == 0){
|
||||||
table.add("$maps.none").center();
|
table.add("$maps.none").center();
|
||||||
}else{
|
}else{
|
||||||
content().add("$editor.loadmap");
|
cont.add("$editor.loadmap");
|
||||||
}
|
}
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
content().add(pane);
|
cont.add(pane);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class MapResizeDialog extends FloatingDialog{
|
|||||||
public MapResizeDialog(MapEditor editor, BiConsumer<Integer, Integer> cons){
|
public MapResizeDialog(MapEditor editor, BiConsumer<Integer, Integer> cons){
|
||||||
super("$editor.resizemap");
|
super("$editor.resizemap");
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
content().clear();
|
cont.clear();
|
||||||
MapTileData data = editor.getMap();
|
MapTileData data = editor.getMap();
|
||||||
width = data.width();
|
width = data.width();
|
||||||
height = data.height();
|
height = data.height();
|
||||||
@@ -47,14 +47,14 @@ public class MapResizeDialog extends FloatingDialog{
|
|||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
content().row();
|
cont.row();
|
||||||
content().add(table);
|
cont.add(table);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons().defaults().size(200f, 50f);
|
buttons.defaults().size(200f, 50f);
|
||||||
buttons().addButton("$cancel", this::hide);
|
buttons.addButton("$cancel", this::hide);
|
||||||
buttons().addButton("$editor.resize", () -> {
|
buttons.addButton("$editor.resize", () -> {
|
||||||
cons.accept(width, height);
|
cons.accept(width, height);
|
||||||
hide();
|
hide();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ public class MapSaveDialog extends FloatingDialog{
|
|||||||
Platform.instance.addDialog(field);
|
Platform.instance.addDialog(field);
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
content().clear();
|
cont.clear();
|
||||||
content().label(() -> {
|
cont.label(() -> {
|
||||||
Map map = world.maps.getByName(field.getText());
|
Map map = world.maps.getByName(field.getText());
|
||||||
if(map != null){
|
if(map != null){
|
||||||
if(map.custom){
|
if(map.custom){
|
||||||
@@ -34,13 +34,13 @@ public class MapSaveDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}).colspan(2);
|
}).colspan(2);
|
||||||
content().row();
|
cont.row();
|
||||||
content().add("$editor.mapname").padRight(14f);
|
cont.add("$editor.mapname").padRight(14f);
|
||||||
content().add(field).size(220f, 48f);
|
cont.add(field).size(220f, 48f);
|
||||||
});
|
});
|
||||||
|
|
||||||
buttons().defaults().size(200f, 50f).pad(2f);
|
buttons.defaults().size(200f, 50f).pad(2f);
|
||||||
buttons().addButton("$cancel", this::hide);
|
buttons.addButton("$cancel", this::hide);
|
||||||
|
|
||||||
TextButton button = new TextButton("$save");
|
TextButton button = new TextButton("$save");
|
||||||
button.clicked(() -> {
|
button.clicked(() -> {
|
||||||
@@ -50,7 +50,7 @@ public class MapSaveDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
button.setDisabled(this::invalid);
|
button.setDisabled(this::invalid);
|
||||||
buttons().add(button);
|
buttons.add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(){
|
public void save(){
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.anuke.mindustry.Vars;
|
|||||||
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||||
import io.anuke.mindustry.type.ContentType;
|
import io.anuke.mindustry.type.ContentType;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
|
|
||||||
/**Stores player unlocks. Clientside only.*/
|
/**Stores player unlocks. Clientside only.*/
|
||||||
public class GlobalData{
|
public class GlobalData{
|
||||||
@@ -25,6 +26,22 @@ public class GlobalData{
|
|||||||
items.getAndIncrement(item, 0, amount);
|
items.getAndIncrement(item, 0, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasItems(ItemStack[] stacks){
|
||||||
|
for(ItemStack stack : stacks){
|
||||||
|
if(items.get(stack.item, 0) < stack.amount){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeItems(ItemStack[] stacks){
|
||||||
|
for(ItemStack stack : stacks){
|
||||||
|
items.getAndIncrement(stack.item, 0, -stack.amount);
|
||||||
|
}
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
public ObjectIntMap<Item> items(){
|
public ObjectIntMap<Item> items(){
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ public abstract class MappableContent extends Content {
|
|||||||
* Returns the unqiue name of this piece of content.
|
* Returns the unqiue name of this piece of content.
|
||||||
* The name only needs to be unique for all content of this type.
|
* The name only needs to be unique for all content of this type.
|
||||||
* Do not use IDs for names! Make sure this string stays constant with each update unless removed.
|
* Do not use IDs for names! Make sure this string stays constant with each update unless removed.
|
||||||
* (e.g. having a recipe and a block, both with name "wall" is fine, as they are different types).
|
|
||||||
*/
|
*/
|
||||||
public abstract String getContentName();
|
public abstract String getContentName();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class BlockRenderer{
|
|||||||
private final static int initialRequests = 32 * 32;
|
private final static int initialRequests = 32 * 32;
|
||||||
private final static int expandr = 6;
|
private final static int expandr = 6;
|
||||||
private final static boolean disableShadows = false;
|
private final static boolean disableShadows = false;
|
||||||
private final static Color shadowColor = new Color(0, 0, 0, 0.15f);
|
private final static Color shadowColor = new Color(0, 0, 0, 0.19f);
|
||||||
|
|
||||||
public final FloorRenderer floor = new FloorRenderer();
|
public final FloorRenderer floor = new FloorRenderer();
|
||||||
|
|
||||||
|
|||||||
@@ -197,10 +197,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
if(!guides.contains(type) && !Core.settings.getBool(type, false)){
|
if(!guides.contains(type) && !Core.settings.getBool(type, false)){
|
||||||
FloatingDialog dialog = new FloatingDialog("$" + type + ".title");
|
FloatingDialog dialog = new FloatingDialog("$" + type + ".title");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.content().left();
|
dialog.cont.left();
|
||||||
dialog.content().add("$" + type).growX().wrap();
|
dialog.cont.add("$" + type).growX().wrap();
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
dialog.content().addCheck("$showagain", false, checked -> {
|
dialog.cont.addCheck("$showagain", false, checked -> {
|
||||||
Core.settings.put(type, checked);
|
Core.settings.put(type, checked);
|
||||||
Core.settings.save();
|
Core.settings.save();
|
||||||
}).growX().left().get().left();
|
}).growX().left().get().left();
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ public enum ContentType {
|
|||||||
status,
|
status,
|
||||||
unit,
|
unit,
|
||||||
weather,
|
weather,
|
||||||
effect
|
effect,
|
||||||
|
zone
|
||||||
}
|
}
|
||||||
|
|||||||
42
core/src/io/anuke/mindustry/type/Zone.java
Normal file
42
core/src/io/anuke/mindustry/type/Zone.java
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package io.anuke.mindustry.type;
|
||||||
|
|
||||||
|
import io.anuke.arc.Core;
|
||||||
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
|
import io.anuke.mindustry.game.UnlockableContent;
|
||||||
|
|
||||||
|
public class Zone extends UnlockableContent{
|
||||||
|
public final String name;
|
||||||
|
public ItemStack[] deployCost = {};
|
||||||
|
|
||||||
|
public Zone(String name){
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHidden(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//neither of these are implemented, as zones are not displayed in a normal fashion... yet
|
||||||
|
@Override
|
||||||
|
public void displayInfo(Table table){}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion getContentIcon(){ return null; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContentName(){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String localizedName(){
|
||||||
|
return Core.bundle.get("zone."+name+".name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContentType getContentType(){
|
||||||
|
return ContentType.zone;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import io.anuke.mindustry.io.Contributors;
|
|||||||
import io.anuke.mindustry.io.Contributors.Contributor;
|
import io.anuke.mindustry.io.Contributors.Contributor;
|
||||||
import io.anuke.mindustry.ui.Links;
|
import io.anuke.mindustry.ui.Links;
|
||||||
import io.anuke.mindustry.ui.Links.LinkEntry;
|
import io.anuke.mindustry.ui.Links.LinkEntry;
|
||||||
import io.anuke.arc.Core;
|
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.arc.scene.ui.ScrollPane;
|
import io.anuke.arc.scene.ui.ScrollPane;
|
||||||
import io.anuke.arc.scene.ui.layout.Cell;
|
import io.anuke.arc.scene.ui.layout.Cell;
|
||||||
@@ -35,8 +34,8 @@ public class AboutDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
buttons().clear();
|
buttons.clear();
|
||||||
|
|
||||||
float h = UIUtils.portrait() ? 90f : 80f;
|
float h = UIUtils.portrait() ? 90f : 80f;
|
||||||
float w = UIUtils.portrait() ? 330f : 600f;
|
float w = UIUtils.portrait() ? 330f : 600f;
|
||||||
@@ -80,18 +79,18 @@ public class AboutDialog extends FloatingDialog{
|
|||||||
|
|
||||||
shown(() -> Time.run(1f, () -> Core.scene.setScrollFocus(pane)));
|
shown(() -> Time.run(1f, () -> Core.scene.setScrollFocus(pane)));
|
||||||
|
|
||||||
content().add(pane).growX();
|
cont.add(pane).growX();
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
buttons().addButton("$credits", this::showCredits).size(200f, 64f);
|
buttons.addButton("$credits", this::showCredits).size(200f, 64f);
|
||||||
|
|
||||||
if(!ios && !OS.isMac){
|
if(!ios && !OS.isMac){
|
||||||
buttons().addButton("$changelog.title", ui.changelog::show).size(200f, 64f);
|
buttons.addButton("$changelog.title", ui.changelog::show).size(200f, 64f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UIUtils.portrait()){
|
if(UIUtils.portrait()){
|
||||||
for(Cell<?> cell : buttons().getCells()){
|
for(Cell<?> cell : buttons.getCells()){
|
||||||
cell.width(140f);
|
cell.width(140f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,14 +100,14 @@ public class AboutDialog extends FloatingDialog{
|
|||||||
public void showCredits(){
|
public void showCredits(){
|
||||||
FloatingDialog dialog = new FloatingDialog("$credits");
|
FloatingDialog dialog = new FloatingDialog("$credits");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.content().add("$credits.text");
|
dialog.cont.add("$credits.text");
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
if(!contributors.isEmpty()){
|
if(!contributors.isEmpty()){
|
||||||
dialog.content().addImage("blank").color(Palette.accent).fillX().height(3f).pad(3f);
|
dialog.cont.addImage("blank").color(Palette.accent).fillX().height(3f).pad(3f);
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
dialog.content().add("$contributors");
|
dialog.cont.add("$contributors");
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
dialog.content().pane(new Table(){{
|
dialog.cont.pane(new Table(){{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
left();
|
left();
|
||||||
for(Contributor c : contributors){
|
for(Contributor c : contributors){
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class AdminsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setup(){
|
private void setup(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
float w = 400f, h = 80f;
|
float w = 400f, h = 80f;
|
||||||
|
|
||||||
@@ -53,6 +53,6 @@ public class AdminsDialog extends FloatingDialog{
|
|||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(pane);
|
cont.add(pane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class BansDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setup(){
|
private void setup(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
float w = 400f, h = 80f;
|
float w = 400f, h = 80f;
|
||||||
|
|
||||||
@@ -49,6 +49,6 @@ public class BansDialog extends FloatingDialog{
|
|||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(pane);
|
cont.add(pane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ChangelogDialog extends FloatingDialog{
|
|||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
content().add("$changelog.loading");
|
cont.add("$changelog.loading");
|
||||||
|
|
||||||
if(!ios && !OS.isMac){
|
if(!ios && !OS.isMac){
|
||||||
Changelogs.getChangelog(result -> {
|
Changelogs.getChangelog(result -> {
|
||||||
@@ -39,8 +39,8 @@ public class ChangelogDialog extends FloatingDialog{
|
|||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
ScrollPane pane = new ScrollPane(table);
|
ScrollPane pane = new ScrollPane(table);
|
||||||
|
|
||||||
content().clear();
|
cont.clear();
|
||||||
content().add(pane).grow();
|
cont.add(pane).grow();
|
||||||
|
|
||||||
if(versions == null){
|
if(versions == null){
|
||||||
table.add("$changelog.error");
|
table.add("$changelog.error");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ColorPickDialog extends Dialog{
|
|||||||
|
|
||||||
private void build(){
|
private void build(){
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
content().add(table);
|
cont.add(table);
|
||||||
|
|
||||||
for(int i = 0; i < playerColors.length; i++){
|
for(int i = 0; i < playerColors.length; i++){
|
||||||
Color color = playerColors[i];
|
Color color = playerColors[i];
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class ContentInfoDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void show(UnlockableContent content){
|
public void show(UnlockableContent content){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.margin(10);
|
table.margin(10);
|
||||||
@@ -21,7 +21,7 @@ public class ContentInfoDialog extends FloatingDialog{
|
|||||||
content.displayInfo(table);
|
content.displayInfo(table);
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(table);
|
ScrollPane pane = new ScrollPane(table);
|
||||||
content().add(pane);
|
cont.add(pane);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ public class ControlsDialog extends KeybindDialog{
|
|||||||
setStyle(Core.scene.skin.get("dialog", WindowStyle.class));
|
setStyle(Core.scene.skin.get("dialog", WindowStyle.class));
|
||||||
|
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
title().setAlignment(Align.center);
|
title.setAlignment(Align.center);
|
||||||
getTitleTable().row();
|
titleTable.row();
|
||||||
getTitleTable().add(new Image("white"))
|
titleTable.add(new Image("white"))
|
||||||
.growX().height(3f).pad(4f).get().setColor(Palette.accent);
|
.growX().height(3f).pad(4f).get().setColor(Palette.accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("$back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
buttons.addImageTextButton("$back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key -> {
|
keyDown(key -> {
|
||||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class CustomGameDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
Table maps = new Table();
|
Table maps = new Table();
|
||||||
maps.marginRight(14);
|
maps.marginRight(14);
|
||||||
@@ -56,8 +56,8 @@ public class CustomGameDialog extends FloatingDialog{
|
|||||||
selmode.add(modes);
|
selmode.add(modes);
|
||||||
selmode.addButton("?", this::displayGameModeHelp).width(50f).fillY().padLeft(18f);
|
selmode.addButton("?", this::displayGameModeHelp).width(50f).fillY().padLeft(18f);
|
||||||
|
|
||||||
content().add(selmode);
|
cont.add(selmode);
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
Difficulty[] ds = Difficulty.values();
|
Difficulty[] ds = Difficulty.values();
|
||||||
|
|
||||||
@@ -82,8 +82,8 @@ public class CustomGameDialog extends FloatingDialog{
|
|||||||
state.difficulty = (ds[Mathf.mod(state.difficulty.ordinal() + 1, ds.length)]);
|
state.difficulty = (ds[Mathf.mod(state.difficulty.ordinal() + 1, ds.length)]);
|
||||||
}).width(s);
|
}).width(s);
|
||||||
|
|
||||||
content().add(sdif);
|
cont.add(sdif);
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
float images = 146f;
|
float images = 146f;
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ public class CustomGameDialog extends FloatingDialog{
|
|||||||
maps.add("$maps.none").pad(50);
|
maps.add("$maps.none").pad(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(pane).uniformX();
|
cont.add(pane).uniformX();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayGameModeHelp(){
|
private void displayGameModeHelp(){
|
||||||
@@ -146,8 +146,8 @@ public class CustomGameDialog extends FloatingDialog{
|
|||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
d.content().add(pane);
|
d.cont.add(pane);
|
||||||
d.buttons().addButton("$ok", d::hide).size(110, 50).pad(10f);
|
d.buttons.addButton("$ok", d::hide).size(110, 50).pad(10f);
|
||||||
d.show();
|
d.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ import io.anuke.arc.collection.ObjectIntMap;
|
|||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
import io.anuke.mindustry.type.ItemType;
|
import io.anuke.mindustry.type.ItemType;
|
||||||
|
import io.anuke.mindustry.type.Zone;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.data;
|
||||||
|
|
||||||
public class DeployDialog extends FloatingDialog{
|
public class DeployDialog extends FloatingDialog{
|
||||||
|
|
||||||
@@ -15,28 +19,45 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
buttons().clear();
|
buttons.clear();
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
content().stack(new Table(){{
|
cont.stack(new Table(){{
|
||||||
top().left().margin(10);
|
top().left().margin(10);
|
||||||
|
|
||||||
ObjectIntMap<Item> items = Vars.data.items();
|
ObjectIntMap<Item> items = data.items();
|
||||||
for(Item item : Vars.content.items()){
|
for(Item item : Vars.content.items()){
|
||||||
if(item.type == ItemType.material && Vars.data.isUnlocked(item)){
|
if(item.type == ItemType.material && data.isUnlocked(item)){
|
||||||
add(items.get(item, 0) + "").left();
|
add(items.get(item, 0) + "").left();
|
||||||
addImage(item.region).size(8*4).pad(4);
|
addImage(item.region).size(8*4).pad(4);
|
||||||
add("[LIGHT_GRAY]" + item.localizedName()).left();
|
add("[LIGHT_GRAY]" + item.localizedName()).left();
|
||||||
row();
|
row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}}, new Table(){{
|
}}, new Table(){{
|
||||||
addButton("Wasteland", () -> {
|
|
||||||
hide();
|
for(Zone zone : Vars.content.zones()){
|
||||||
Vars.world.generator.playRandomMap();
|
if(data.isUnlocked(zone)){
|
||||||
}).size(190f, 60f);
|
table(t -> {
|
||||||
|
t.addButton(zone.localizedName(), () -> {
|
||||||
|
data.removeItems(zone.deployCost);
|
||||||
|
hide();
|
||||||
|
Vars.world.generator.playRandomMap();
|
||||||
|
}).size(150f).disabled(b -> !data.hasItems(zone.deployCost));
|
||||||
|
t.row();
|
||||||
|
t.table(req -> {
|
||||||
|
req.left();
|
||||||
|
for(ItemStack stack : zone.deployCost){
|
||||||
|
req.addImage(stack.item.region).size(8*3);
|
||||||
|
req.add(stack.amount + "").left();
|
||||||
|
}
|
||||||
|
}).pad(3).growX();
|
||||||
|
}).pad(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
}}).grow();
|
}}).grow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ public class DiscordDialog extends Dialog{
|
|||||||
|
|
||||||
float h = 70f;
|
float h = 70f;
|
||||||
|
|
||||||
content().margin(12f);
|
cont.margin(12f);
|
||||||
|
|
||||||
Color color = Color.valueOf("7289da");
|
Color color = Color.valueOf("7289da");
|
||||||
|
|
||||||
content().table(t -> {
|
cont.table(t -> {
|
||||||
t.background("button").margin(0);
|
t.background("button").margin(0);
|
||||||
|
|
||||||
t.table(img -> {
|
t.table(img -> {
|
||||||
@@ -36,13 +36,13 @@ public class DiscordDialog extends Dialog{
|
|||||||
t.add("$discord").color(Palette.accent).growX().padLeft(10f);
|
t.add("$discord").color(Palette.accent).growX().padLeft(10f);
|
||||||
}).size(470f, h).pad(10f);
|
}).size(470f, h).pad(10f);
|
||||||
|
|
||||||
buttons().defaults().size(170f, 50);
|
buttons.defaults().size(170f, 50);
|
||||||
|
|
||||||
buttons().addButton("$back", this::hide);
|
buttons.addButton("$back", this::hide);
|
||||||
buttons().addButton("$copylink", () -> {
|
buttons.addButton("$copylink", () -> {
|
||||||
Core.app.getClipboard().setContents(discordURL);
|
Core.app.getClipboard().setContents(discordURL);
|
||||||
});
|
});
|
||||||
buttons().addButton("$openlink", () -> {
|
buttons.addButton("$openlink", () -> {
|
||||||
if(!Core.net.openURI(discordURL)){
|
if(!Core.net.openURI(discordURL)){
|
||||||
ui.showError("$linkfail");
|
ui.showError("$linkfail");
|
||||||
Core.app.getClipboard().setContents(discordURL);
|
Core.app.getClipboard().setContents(discordURL);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupWidgets(){
|
private void setupWidgets(){
|
||||||
content().margin(-10);
|
cont.margin(-10);
|
||||||
|
|
||||||
Table content = new Table();
|
Table content = new Table();
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
|
|
||||||
content.add(buttons).growX();
|
content.add(buttons).growX();
|
||||||
|
|
||||||
content().add(content);
|
cont.add(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFileFieldStatus(){
|
private void updateFileFieldStatus(){
|
||||||
@@ -264,7 +264,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
@Override
|
@Override
|
||||||
public Dialog show(){
|
public Dialog show(){
|
||||||
Time.runTask(2f, () -> {
|
Time.runTask(2f, () -> {
|
||||||
content().clear();
|
cont.clear();
|
||||||
setupWidgets();
|
setupWidgets();
|
||||||
super.show();
|
super.show();
|
||||||
Core.scene.setScrollFocus(pane);
|
Core.scene.setScrollFocus(pane);
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ public class FloatingDialog extends Dialog{
|
|||||||
public FloatingDialog(String title){
|
public FloatingDialog(String title){
|
||||||
super(title, "dialog");
|
super(title, "dialog");
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
title().setAlignment(Align.center);
|
this.title.setAlignment(Align.center);
|
||||||
getTitleTable().row();
|
titleTable.row();
|
||||||
getTitleTable().addImage("white", Palette.accent)
|
titleTable.addImage("white", Palette.accent)
|
||||||
.growX().height(3f).pad(4f);
|
.growX().height(3f).pad(4f);
|
||||||
|
|
||||||
hidden(() -> {
|
hidden(() -> {
|
||||||
@@ -63,7 +63,7 @@ public class FloatingDialog extends Dialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("$back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
buttons.addImageTextButton("$back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key -> {
|
keyDown(key -> {
|
||||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK) {
|
if(key == KeyCode.ESCAPE || key == KeyCode.BACK) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class GenViewDialog extends FloatingDialog{
|
|||||||
public GenViewDialog(){
|
public GenViewDialog(){
|
||||||
super("generate view");
|
super("generate view");
|
||||||
|
|
||||||
content().add(new GenView()).grow();
|
cont.add(new GenView()).grow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GenView extends Element{
|
public class GenView extends Element{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class HostDialog extends FloatingDialog{
|
|||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
content().table(t -> {
|
cont.table(t -> {
|
||||||
t.add("$name").padRight(10);
|
t.add("$name").padRight(10);
|
||||||
t.addField(Core.settings.getString("name"), text -> {
|
t.addField(Core.settings.getString("name"), text -> {
|
||||||
player.name = text;
|
player.name = text;
|
||||||
@@ -43,11 +43,11 @@ public class HostDialog extends FloatingDialog{
|
|||||||
button.update(() -> button.getStyle().imageUpColor = player.color);
|
button.update(() -> button.getStyle().imageUpColor = player.color);
|
||||||
}).width(w).height(70f).pad(4).colspan(3);
|
}).width(w).height(70f).pad(4).colspan(3);
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
content().add().width(65f);
|
cont.add().width(65f);
|
||||||
|
|
||||||
content().addButton("$host", () -> {
|
cont.addButton("$host", () -> {
|
||||||
if(Core.settings.getString("name").trim().isEmpty()){
|
if(Core.settings.getString("name").trim().isEmpty()){
|
||||||
ui.showInfo("$noname");
|
ui.showInfo("$noname");
|
||||||
return;
|
return;
|
||||||
@@ -66,6 +66,6 @@ public class HostDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
}).width(w).height(70f);
|
}).width(w).height(70f);
|
||||||
|
|
||||||
content().addButton("?", () -> ui.showInfo("$host.info")).size(65f, 70f).padLeft(6f);
|
cont.addButton("?", () -> ui.showInfo("$host.info")).size(65f, 70f).padLeft(6f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,28 +35,28 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
|
|
||||||
loadServers();
|
loadServers();
|
||||||
|
|
||||||
buttons().add().width(60f);
|
buttons.add().width(60f);
|
||||||
buttons().add().growX();
|
buttons.add().growX();
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
buttons().add().growX();
|
buttons.add().growX();
|
||||||
buttons().addButton("?", () -> ui.showInfo("$join.info")).size(60f, 64f);
|
buttons.addButton("?", () -> ui.showInfo("$join.info")).size(60f, 64f);
|
||||||
|
|
||||||
add = new FloatingDialog("$joingame.title");
|
add = new FloatingDialog("$joingame.title");
|
||||||
add.content().add("$joingame.ip").padRight(5f).left();
|
add.cont.add("$joingame.ip").padRight(5f).left();
|
||||||
|
|
||||||
TextField field = add.content().addField(Core.settings.getString("ip"), text -> {
|
TextField field = add.cont.addField(Core.settings.getString("ip"), text -> {
|
||||||
Core.settings.put("ip", text);
|
Core.settings.put("ip", text);
|
||||||
Core.settings.save();
|
Core.settings.save();
|
||||||
}).size(320f, 54f).get();
|
}).size(320f, 54f).get();
|
||||||
|
|
||||||
Platform.instance.addDialog(field, 100);
|
Platform.instance.addDialog(field, 100);
|
||||||
|
|
||||||
add.content().row();
|
add.cont.row();
|
||||||
add.buttons().defaults().size(140f, 60f).pad(4f);
|
add.buttons.defaults().size(140f, 60f).pad(4f);
|
||||||
add.buttons().addButton("$cancel", add::hide);
|
add.buttons.addButton("$cancel", add::hide);
|
||||||
add.buttons().addButton("$ok", () -> {
|
add.buttons.addButton("$ok", () -> {
|
||||||
if(renaming == null){
|
if(renaming == null){
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
server.setIP(Core.settings.getString("ip"));
|
server.setIP(Core.settings.getString("ip"));
|
||||||
@@ -74,7 +74,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
}).disabled(b -> Core.settings.getString("ip").isEmpty() || Net.active());
|
}).disabled(b -> Core.settings.getString("ip").isEmpty() || Net.active());
|
||||||
|
|
||||||
add.shown(() -> {
|
add.shown(() -> {
|
||||||
add.getTitleLabel().setText(renaming != null ? "$server.edit" : "$server.add");
|
add.title.setText(renaming != null ? "$server.edit" : "$server.add");
|
||||||
if(renaming != null){
|
if(renaming != null){
|
||||||
field.setText(renaming.displayIP());
|
field.setText(renaming.displayIP());
|
||||||
}
|
}
|
||||||
@@ -200,8 +200,8 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
setupRemote();
|
setupRemote();
|
||||||
refreshRemote();
|
refreshRemote();
|
||||||
|
|
||||||
content().clear();
|
cont.clear();
|
||||||
content().table(t -> {
|
cont.table(t -> {
|
||||||
t.add("$name").padRight(10);
|
t.add("$name").padRight(10);
|
||||||
t.addField(Core.settings.getString("name"), text -> {
|
t.addField(Core.settings.getString("name"), text -> {
|
||||||
player.name = text;
|
player.name = text;
|
||||||
@@ -218,10 +218,10 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
}).size(54f).get();
|
}).size(54f).get();
|
||||||
button.update(() -> button.getStyle().imageUpColor = player.color);
|
button.update(() -> button.getStyle().imageUpColor = player.color);
|
||||||
}).width(w).height(70f).pad(4);
|
}).width(w).height(70f).pad(4);
|
||||||
content().row();
|
cont.row();
|
||||||
content().add(pane).width(w + 38).pad(0);
|
cont.add(pane).width(w + 38).pad(0);
|
||||||
content().row();
|
cont.row();
|
||||||
content().addCenteredImageTextButton("$server.add", "icon-add", 14 * 3, () -> {
|
cont.addCenteredImageTextButton("$server.add", "icon-add", 14 * 3, () -> {
|
||||||
renaming = null;
|
renaming = null;
|
||||||
add.show();
|
add.show();
|
||||||
}).marginLeft(6).width(w).height(80f).update(button -> {
|
}).marginLeft(6).width(w).height(80f).update(button -> {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class LanguageDialog extends FloatingDialog{
|
|||||||
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).pad(2).row();
|
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).pad(2).row();
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(pane);
|
cont.add(pane);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Locale getLocale(){
|
public Locale getLocale(){
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setup(){
|
protected void setup(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
slots = new Table();
|
slots = new Table();
|
||||||
pane = new ScrollPane(slots);
|
pane = new ScrollPane(slots);
|
||||||
@@ -132,7 +132,7 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
slots.row();
|
slots.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(pane);
|
cont.add(pane);
|
||||||
|
|
||||||
addSetup();
|
addSetup();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ public class LocalPlayerDialog extends FloatingDialog{
|
|||||||
private void rebuild(){
|
private void rebuild(){
|
||||||
float size = 140f;
|
float size = 140f;
|
||||||
|
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
if(players.length > 1){
|
if(players.length > 1){
|
||||||
content().addImageButton("icon-cancel", 14 * 2, () -> {
|
cont.addImageButton("icon-cancel", 14 * 2, () -> {
|
||||||
control.removePlayer();
|
control.removePlayer();
|
||||||
rebuild();
|
rebuild();
|
||||||
}).size(50f, size).pad(5).bottom();
|
}).size(50f, size).pad(5).bottom();
|
||||||
}else{
|
}else{
|
||||||
content().add().size(50f, size);
|
cont.add().size(50f, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Player player : players){
|
for(Player player : players){
|
||||||
@@ -48,11 +48,11 @@ public class LocalPlayerDialog extends FloatingDialog{
|
|||||||
table.row();
|
table.row();
|
||||||
table.add(stack).size(size);
|
table.add(stack).size(size);
|
||||||
|
|
||||||
content().add(table).pad(5);
|
cont.add(table).pad(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(players.length < 4){
|
if(players.length < 4){
|
||||||
content().addImageButton("icon-add", 14 * 2, () -> {
|
cont.addImageButton("icon-add", 14 * 2, () -> {
|
||||||
control.addPlayer(players.length);
|
control.addPlayer(players.length);
|
||||||
rebuild();
|
rebuild();
|
||||||
}).size(50f, size).pad(5).bottom();
|
}).size(50f, size).pad(5).bottom();
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
super("$maps");
|
super("$maps");
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
buttons().addImageTextButton("$editor.importmap", "icon-add", 14 * 2, () -> {
|
buttons.addImageTextButton("$editor.importmap", "icon-add", 14 * 2, () -> {
|
||||||
Platform.instance.showFileChooser("$editor.importmap", "Map File", file -> {
|
Platform.instance.showFileChooser("$editor.importmap", "Map File", file -> {
|
||||||
try{
|
try{
|
||||||
DataInputStream stream = new DataInputStream(file.read());
|
DataInputStream stream = new DataInputStream(file.read());
|
||||||
@@ -68,7 +68,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
Table maps = new Table();
|
Table maps = new Table();
|
||||||
maps.marginRight(24);
|
maps.marginRight(24);
|
||||||
@@ -104,7 +104,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
maps.add("$maps.none");
|
maps.add("$maps.none");
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(pane).uniformX();
|
cont.add(pane).uniformX();
|
||||||
}
|
}
|
||||||
|
|
||||||
void showMapInfo(Map map){
|
void showMapInfo(Map map){
|
||||||
@@ -112,7 +112,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
|
|
||||||
float mapsize = UIUtils.portrait() ? 160f : 300f;
|
float mapsize = UIUtils.portrait() ? 160f : 300f;
|
||||||
Table table = dialog.content();
|
Table table = dialog.cont;
|
||||||
|
|
||||||
table.stack(new Image(map.texture).setScaling(Scaling.fit), new BorderImage(map.texture).setScaling(Scaling.fit)).size(mapsize);
|
table.stack(new Image(map.texture).setScaling(Scaling.fit), new BorderImage(map.texture).setScaling(Scaling.fit)).size(mapsize);
|
||||||
|
|
||||||
|
|||||||
@@ -40,30 +40,30 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
content().table(t -> missionTable = t).colspan(mobile ? 3 : 2);
|
cont.table(t -> missionTable = t).colspan(mobile ? 3 : 2);
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
if(!mobile){
|
if(!mobile){
|
||||||
float dw = 210f;
|
float dw = 210f;
|
||||||
content().defaults().width(dw).height(50).pad(5f);
|
cont.defaults().width(dw).height(50).pad(5f);
|
||||||
|
|
||||||
content().addButton("$back", this::hide).colspan(2).width(dw*2 + 20f);
|
cont.addButton("$back", this::hide).colspan(2).width(dw*2 + 20f);
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
content().addButton("$unlocks", ui.unlocks::show);
|
cont.addButton("$unlocks", ui.unlocks::show);
|
||||||
content().addButton("$settings", ui.settings::show);
|
cont.addButton("$settings", ui.settings::show);
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
content().addButton("$savegame", save::show);
|
cont.addButton("$savegame", save::show);
|
||||||
content().addButton("$loadgame", load::show).disabled(b -> Net.active());
|
cont.addButton("$loadgame", load::show).disabled(b -> Net.active());
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
content().addButton("$hostserver", ui.host::show).disabled(b -> Net.active()).colspan(2).width(dw*2 + 20f);
|
cont.addButton("$hostserver", ui.host::show).disabled(b -> Net.active()).colspan(2).width(dw*2 + 20f);
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
content().addButton("$quit", () -> {
|
cont.addButton("$quit", () -> {
|
||||||
ui.showConfirm("$confirm", "$quit.confirm", () -> {
|
ui.showConfirm("$confirm", "$quit.confirm", () -> {
|
||||||
if(Net.client()) netClient.disconnectQuietly();
|
if(Net.client()) netClient.disconnectQuietly();
|
||||||
runExitSave();
|
runExitSave();
|
||||||
@@ -72,18 +72,18 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
}).colspan(2).width(dw + 10f);
|
}).colspan(2).width(dw + 10f);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
content().defaults().size(120f).pad(5);
|
cont.defaults().size(120f).pad(5);
|
||||||
float isize = 14f * 4;
|
float isize = 14f * 4;
|
||||||
|
|
||||||
content().addRowImageTextButton("$back", "icon-play-2", isize, this::hide);
|
cont.addRowImageTextButton("$back", "icon-play-2", isize, this::hide);
|
||||||
content().addRowImageTextButton("$settings", "icon-tools", isize, ui.settings::show);
|
cont.addRowImageTextButton("$settings", "icon-tools", isize, ui.settings::show);
|
||||||
content().addRowImageTextButton("$save", "icon-save", isize, save::show);
|
cont.addRowImageTextButton("$save", "icon-save", isize, save::show);
|
||||||
|
|
||||||
content().row();
|
cont.row();
|
||||||
|
|
||||||
content().addRowImageTextButton("$load", "icon-load", isize, load::show).disabled(b -> Net.active());
|
cont.addRowImageTextButton("$load", "icon-load", isize, load::show).disabled(b -> Net.active());
|
||||||
content().addRowImageTextButton("$hostserver.mobile", "icon-host", isize, ui.host::show).disabled(b -> Net.active());
|
cont.addRowImageTextButton("$hostserver.mobile", "icon-host", isize, ui.host::show).disabled(b -> Net.active());
|
||||||
content().addRowImageTextButton("$quit", "icon-quit", isize, () -> {
|
cont.addRowImageTextButton("$quit", "icon-quit", isize, () -> {
|
||||||
ui.showConfirm("$confirm", "$quit.confirm", () -> {
|
ui.showConfirm("$confirm", "$quit.confirm", () -> {
|
||||||
if(Net.client()) netClient.disconnectQuietly();
|
if(Net.client()) netClient.disconnectQuietly();
|
||||||
runExitSave();
|
runExitSave();
|
||||||
|
|||||||
@@ -21,26 +21,26 @@ public class RestartDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rebuild(){
|
void rebuild(){
|
||||||
buttons().clear();
|
buttons.clear();
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
buttons().margin(10);
|
buttons.margin(10);
|
||||||
|
|
||||||
if(state.mode.isPvp){
|
if(state.mode.isPvp){
|
||||||
content().add(Core.bundle.format("gameover.pvp",winner.localized())).pad(6);
|
cont.add(Core.bundle.format("gameover.pvp",winner.localized())).pad(6);
|
||||||
buttons().addButton("$menu", () -> {
|
buttons.addButton("$menu", () -> {
|
||||||
hide();
|
hide();
|
||||||
state.set(State.menu);
|
state.set(State.menu);
|
||||||
logic.reset();
|
logic.reset();
|
||||||
}).size(130f, 60f);
|
}).size(130f, 60f);
|
||||||
}else{
|
}else{
|
||||||
if(control.isHighScore()){
|
if(control.isHighScore()){
|
||||||
content().add("$highscore").pad(6);
|
cont.add("$highscore").pad(6);
|
||||||
content().row();
|
cont.row();
|
||||||
}
|
}
|
||||||
content().add(Core.bundle.format("wave.lasted", state.wave)).pad(12);
|
cont.add(Core.bundle.format("wave.lasted", state.wave)).pad(12);
|
||||||
|
|
||||||
buttons().addButton("$menu", () -> {
|
buttons.addButton("$menu", () -> {
|
||||||
hide();
|
hide();
|
||||||
state.set(State.menu);
|
state.set(State.menu);
|
||||||
logic.reset();
|
logic.reset();
|
||||||
|
|||||||
@@ -8,11 +8,8 @@ import io.anuke.arc.input.KeyCode;
|
|||||||
import io.anuke.arc.scene.Element;
|
import io.anuke.arc.scene.Element;
|
||||||
import io.anuke.arc.scene.event.InputEvent;
|
import io.anuke.arc.scene.event.InputEvent;
|
||||||
import io.anuke.arc.scene.event.InputListener;
|
import io.anuke.arc.scene.event.InputListener;
|
||||||
import io.anuke.arc.scene.ui.Image;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.ScrollPane;
|
|
||||||
import io.anuke.arc.scene.ui.SettingsDialog;
|
|
||||||
import io.anuke.arc.scene.ui.SettingsDialog.SettingsTable.Setting;
|
import io.anuke.arc.scene.ui.SettingsDialog.SettingsTable.Setting;
|
||||||
import io.anuke.arc.scene.ui.Slider;
|
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
import io.anuke.arc.util.Align;
|
import io.anuke.arc.util.Align;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@@ -49,14 +46,14 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
});
|
});
|
||||||
|
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
title().setAlignment(Align.center);
|
title.setAlignment(Align.center);
|
||||||
getTitleTable().row();
|
titleTable.row();
|
||||||
getTitleTable().add(new Image("white"))
|
titleTable.add(new Image("white"))
|
||||||
.growX().height(3f).pad(4f).get().setColor(Palette.accent);
|
.growX().height(3f).pad(4f).get().setColor(Palette.accent);
|
||||||
|
|
||||||
content().clearChildren();
|
cont.clearChildren();
|
||||||
content().remove();
|
cont.remove();
|
||||||
buttons().remove();
|
buttons.remove();
|
||||||
|
|
||||||
menu = new Table();
|
menu = new Table();
|
||||||
|
|
||||||
@@ -113,7 +110,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
row();
|
row();
|
||||||
add(pane).grow().top();
|
add(pane).grow().top();
|
||||||
row();
|
row();
|
||||||
add(buttons()).fillX();
|
add(buttons).fillX();
|
||||||
|
|
||||||
hidden(this::back);
|
hidden(this::back);
|
||||||
|
|
||||||
@@ -141,16 +138,16 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
table.addButton("$settings.cleardata", () -> {
|
table.addButton("$settings.cleardata", () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("$settings.cleardata");
|
FloatingDialog dialog = new FloatingDialog("$settings.cleardata");
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.content().defaults().size(230f, 60f).pad(3);
|
dialog.cont.defaults().size(230f, 60f).pad(3);
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.content().addButton("$settings.clearunlocks", () -> {
|
dialog.cont.addButton("$settings.clearunlocks", () -> {
|
||||||
ui.showConfirm("$confirm", "$settings.clear.confirm", () -> {
|
ui.showConfirm("$confirm", "$settings.clear.confirm", () -> {
|
||||||
data.reset();
|
data.reset();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
dialog.content().addButton("$settings.clearall", () -> {
|
dialog.cont.addButton("$settings.clearall", () -> {
|
||||||
ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||||
ObjectMap<String, Object> map = new ObjectMap<>();
|
ObjectMap<String, Object> map = new ObjectMap<>();
|
||||||
for(String value : Core.settings.keys()){
|
for(String value : Core.settings.keys()){
|
||||||
@@ -169,7 +166,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
Core.app.exit();
|
Core.app.exit();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}).size(220f, 60f).pad(6).left();
|
}).size(220f, 60f).pad(6).left();
|
||||||
table.add();
|
table.add();
|
||||||
@@ -214,7 +211,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("$menu", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
buttons.addImageTextButton("$menu", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||||
|
|
||||||
keyDown(key -> {
|
keyDown(key -> {
|
||||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
if(key == KeyCode.ESCAPE || key == KeyCode.BACK)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class TraceDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
public void show(Player player, SessionInfo info){
|
public void show(Player player, SessionInfo info){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
Table table = new Table("clear");
|
Table table = new Table("clear");
|
||||||
table.margin(14);
|
table.margin(14);
|
||||||
@@ -48,7 +48,7 @@ public class TraceDialog extends FloatingDialog{
|
|||||||
table.add(Core.bundle.format("trace.lastblockplaced", info.lastBlockPlaced.formalName));
|
table.add(Core.bundle.format("trace.lastblockplaced", info.lastBlockPlaced.formalName));
|
||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
content().add(table);
|
cont.add(table);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
}*/
|
}*/
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ public class UnlocksDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rebuild(){
|
void rebuild(){
|
||||||
content().clear();
|
cont.clear();
|
||||||
|
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.margin(20);
|
table.margin(20);
|
||||||
ScrollPane pane = new ScrollPane(table);
|
ScrollPane pane = new ScrollPane(table);
|
||||||
|
|
||||||
Array<Content>[] allContent = content.getContentMap();
|
Array<Content>[] allContent = Vars.content.getContentMap();
|
||||||
|
|
||||||
for(int j = 0; j < allContent.length; j ++){
|
for(int j = 0; j < allContent.length; j ++){
|
||||||
ContentType type = ContentType.values()[j];
|
ContentType type = ContentType.values()[j];
|
||||||
@@ -77,6 +77,6 @@ public class UnlocksDialog extends FloatingDialog{
|
|||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(pane);
|
cont.add(pane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
table.margin(6f);
|
table.margin(6f);
|
||||||
table.defaults().size(mobile ? 16 * 3 : 16 * 2).space(6f);
|
table.defaults().size(16 * 2.5f).space(6f);
|
||||||
|
|
||||||
if(tile.block().hasItems){
|
if(tile.block().hasItems){
|
||||||
|
|
||||||
|
|||||||
@@ -119,12 +119,14 @@ public class ChatFragment extends Table{
|
|||||||
chatfield.tapped(() -> {
|
chatfield.tapped(() -> {
|
||||||
Dialog dialog = new Dialog("", "dialog");
|
Dialog dialog = new Dialog("", "dialog");
|
||||||
dialog.setFillParent(true);
|
dialog.setFillParent(true);
|
||||||
dialog.content().top();
|
dialog.cont.top();
|
||||||
dialog.content().defaults().height(65f);
|
dialog.cont.defaults().height(65f);
|
||||||
TextField to = dialog.content().addField("", t-> {}).pad(15).width(250f).get();
|
TextField to = dialog.cont.addField("", t-> {}).pad(15).width(250f).get();
|
||||||
to.setMaxLength(maxTextLength);
|
to.setMaxLength(maxTextLength);
|
||||||
to.keyDown(KeyCode.ENTER, () -> dialog.content().find("okb").fireClick());
|
to.keyDown(KeyCode.ENTER, () -> {
|
||||||
dialog.content().addButton("$ok", () -> {
|
dialog.cont.find("okb").fireClick();
|
||||||
|
});
|
||||||
|
dialog.cont.addButton("$ok", () -> {
|
||||||
chatfield.clearText();
|
chatfield.clearText();
|
||||||
chatfield.appendText(to.getText());
|
chatfield.appendText(to.getText());
|
||||||
chatfield.change();
|
chatfield.change();
|
||||||
|
|||||||
@@ -329,9 +329,9 @@ public class HudFragment extends Fragment{
|
|||||||
new FloatingDialog("$mission.info"){{
|
new FloatingDialog("$mission.info"){{
|
||||||
shouldPause = true;
|
shouldPause = true;
|
||||||
setFillParent(false);
|
setFillParent(false);
|
||||||
getCell(content()).growX();
|
getCell(cont).growX();
|
||||||
content().margin(15).add(str).width(400f).wrap().get().setAlignment(Align.left, Align.left);
|
cont.margin(15).add(str).width(400f).wrap().get().setAlignment(Align.left, Align.left);
|
||||||
buttons().addButton("$continue", this::hide).size(140, 60).pad(4);
|
buttons.addButton("$continue", this::hide).size(140, 60).pad(4);
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,27 +146,27 @@ public class MenuFragment extends Fragment{
|
|||||||
|
|
||||||
FloatingDialog dialog = new FloatingDialog("$play");
|
FloatingDialog dialog = new FloatingDialog("$play");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.content().defaults().height(66f).width(w).padRight(5f);
|
dialog.cont.defaults().height(66f).width(w).padRight(5f);
|
||||||
|
|
||||||
dialog.content().add(new MenuButton("icon-play-2", "$map.random", () -> {
|
dialog.cont.add(new MenuButton("icon-play-2", "$map.random", () -> {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
world.generator.playRandomMap();
|
world.generator.playRandomMap();
|
||||||
})).width(bw).colspan(2);
|
})).width(bw).colspan(2);
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
|
|
||||||
dialog.content().add(new MenuButton("icon-add", "$joingame", () -> {
|
dialog.cont.add(new MenuButton("icon-add", "$joingame", () -> {
|
||||||
ui.join.show();
|
ui.join.show();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
dialog.content().add(new MenuButton("icon-editor", "$customgame", () -> {
|
dialog.cont.add(new MenuButton("icon-editor", "$customgame", () -> {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
ui.levels.show();
|
ui.levels.show();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
dialog.content().row();
|
dialog.cont.row();
|
||||||
|
|
||||||
dialog.content().add(new MenuButton("icon-load", "$loadgame", () -> {
|
dialog.cont.add(new MenuButton("icon-load", "$loadgame", () -> {
|
||||||
ui.load.show();
|
ui.load.show();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
})).width(bw).colspan(2);
|
})).width(bw).colspan(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user