Added map default rule editing
This commit is contained in:
@@ -199,6 +199,7 @@ editor.mapinfo = Map Info
|
||||
editor.author = Author:
|
||||
editor.description = Description:
|
||||
editor.waves = Waves:
|
||||
editor.rules = Rules:
|
||||
waves.title = Waves
|
||||
waves.remove = Remove
|
||||
waves.never = <never>
|
||||
|
||||
@@ -42,6 +42,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
private MapGenerateDialog generateDialog;
|
||||
private ScrollPane pane;
|
||||
private FloatingDialog menu;
|
||||
private Rules lastSavedRules;
|
||||
private boolean saved = false;
|
||||
private boolean shownWithMap = false;
|
||||
private Array<Block> blocksOut = new Array<>();
|
||||
@@ -193,6 +194,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
editor.clearOp();
|
||||
Core.scene.setScrollFocus(view);
|
||||
if(!shownWithMap){
|
||||
state.rules = new Rules();
|
||||
editor.beginEdit(200, 200);
|
||||
}
|
||||
shownWithMap = false;
|
||||
@@ -216,12 +218,15 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
state.set(State.menu);
|
||||
shownWithMap = true;
|
||||
show();
|
||||
state.rules = (lastSavedRules == null ? new Rules() : lastSavedRules);
|
||||
lastSavedRules = null;
|
||||
editor.renderer().updateAll();
|
||||
}
|
||||
|
||||
private void playtest(){
|
||||
menu.hide();
|
||||
ui.loadAnd(() -> {
|
||||
lastSavedRules = state.rules;
|
||||
hide();
|
||||
//only reset the player; logic.reset() will clear entities, which we do not want
|
||||
player.reset();
|
||||
|
||||
@@ -4,12 +4,16 @@ import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.ObjectMap;
|
||||
import io.anuke.arc.scene.ui.TextArea;
|
||||
import io.anuke.arc.scene.ui.TextField;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.game.Rules;
|
||||
import io.anuke.mindustry.ui.dialogs.CustomRulesDialog;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
|
||||
public class MapInfoDialog extends FloatingDialog{
|
||||
private final MapEditor editor;
|
||||
private final WaveInfoDialog waveinfo;
|
||||
private final CustomRulesDialog ruleinfo = new CustomRulesDialog();
|
||||
|
||||
public MapInfoDialog(MapEditor editor){
|
||||
super("$editor.mapinfo");
|
||||
@@ -54,14 +58,13 @@ public class MapInfoDialog extends FloatingDialog{
|
||||
}).size(400, 55f).get();
|
||||
author.setMessageText("$unknown");
|
||||
|
||||
cont.row();
|
||||
cont.add("$editor.rules").padRight(8).left();
|
||||
cont.addButton("$edit", () -> ruleinfo.show(Vars.state.rules, () -> Vars.state.rules = new Rules())).left().width(200f);;
|
||||
|
||||
cont.row();
|
||||
cont.add("$editor.waves").padRight(8).left();
|
||||
cont.table(t -> {
|
||||
t.add().growX();
|
||||
t.label(() -> tags.containsKey("waves") ? "" : Core.bundle.get("editor.default")).left();
|
||||
t.add().growX();
|
||||
t.addButton("$edit", waveinfo::show).growY().width(200f);
|
||||
}).size(400, 55f);
|
||||
cont.addButton("$edit", waveinfo::show).left().width(200f);
|
||||
|
||||
name.change();
|
||||
description.change();
|
||||
|
||||
@@ -8,10 +8,8 @@ public class ServerLauncher{
|
||||
|
||||
public static void main(String[] args){
|
||||
try{
|
||||
|
||||
Net.setClientProvider(new ArcNetClient());
|
||||
Net.setServerProvider(new ArcNetServer());
|
||||
|
||||
new HeadlessApplication(new MindustryServer(args), null, throwable -> CrashSender.send(throwable, f -> {}));
|
||||
}catch(Throwable t){
|
||||
CrashSender.send(t, f -> {});
|
||||
|
||||
Reference in New Issue
Block a user