Steam workshop publishing

This commit is contained in:
Anuken
2019-09-10 14:25:34 -04:00
parent 6fe55661ed
commit 7aa71a7201
5 changed files with 67 additions and 11 deletions
+3 -1
View File
@@ -191,7 +191,7 @@ wave.enemy = [lightgray]{0} Enemy Remaining
loadimage = Load Image
saveimage = Save Image
unknown = Unknown
custom = Custom
custom = Custom
builtin = Built-In
map.delete.confirm = Are you sure you want to delete this map? This action cannot be undone!
map.random = [accent]Random Map
@@ -199,6 +199,7 @@ map.nospawn = This map does not have any cores for the player to spawn in! Add a
map.nospawn.pvp = This map does not have any enemy cores for player to spawn into! Add[SCARLET] non-orange[] cores to this map in the editor.
map.nospawn.attack = This map does not have any enemy cores for player to attack! Add[SCARLET] red[] cores to this map in the editor.
map.invalid = Error loading map: corrupted or invalid map file.
map.publish.error = Error publishing map: {0}
editor.brush = Brush
editor.openin = Open In Editor
editor.oregen = Ore Generation
@@ -210,6 +211,7 @@ editor.waves = Waves:
editor.rules = Rules:
editor.generation = Generation:
editor.ingame = Edit In-Game
editor.publish.workshop = Publish On Workshop
editor.newmap = New Map
waves.title = Waves
waves.remove = Remove
@@ -151,7 +151,18 @@ public class MapEditorDialog extends Dialog implements Disposable{
menu.cont.row();
menu.cont.addImageTextButton("$editor.ingame", Icon.arrowSmall, this::playtest).padTop(-5).size(swidth * 2f + 10, 60f);
if(steam){
menu.cont.addImageTextButton("$editor.publish.workshop", Icon.arrowSmall, () -> {
Map map = save();
if(map != null){
platform.publishMap(map);
}
}).padTop(-3).size(swidth * 2f + 10, 60f);
menu.cont.row();
}
menu.cont.addImageTextButton("$editor.ingame", Icon.arrowSmall, this::playtest).padTop(-3).size(swidth * 2f + 10, 60f);
menu.cont.row();
@@ -265,13 +276,15 @@ public class MapEditorDialog extends Dialog implements Disposable{
});
}
private void save(){
private Map save(){
String name = editor.getTags().get("name", "").trim();
editor.getTags().put("rules", JsonIO.write(state.rules));
editor.getTags().remove("width");
editor.getTags().remove("height");
player.dead = true;
Map returned = null;
if(name.isEmpty()){
infoDialog.show();
Core.app.post(() -> ui.showErrorMessage("$editor.save.noname"));
@@ -282,11 +295,13 @@ public class MapEditorDialog extends Dialog implements Disposable{
}else{
maps.saveMap(editor.getTags());
ui.showInfoFade("$editor.saved");
returned = map;
}
}
menu.hide();
saved = true;
return returned;
}
/** Called when a built-in map save is attempted.*/
@@ -74,4 +74,9 @@ public class Rules{
public Rules copy(){
return JsonIO.copy(this);
}
/** Returns the gamemode that best fits these rules.*/
public Gamemode mode(){
return Gamemode.bestFit(this);
}
}