Remove save dialog when creating a new map.

This commit is contained in:
Paul Chote
2025-03-02 21:24:22 +00:00
committed by Gustas Kažukauskas
parent 1707dbd92b
commit 9913ecb42f
3 changed files with 18 additions and 23 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Linq;
using OpenRA.FileSystem;
using OpenRA.Mods.Common.Terrain;
using OpenRA.Widgets;
@@ -69,24 +70,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (map.Rules.TerrainInfo is ITerrainInfoNotifyMapCreated notifyMapCreated)
notifyMapCreated.MapCreated(map);
Action<string> afterSave = uid =>
{
map.Dispose();
Game.LoadEditor(uid);
Ui.CloseWindow();
onSelect(uid);
};
Ui.OpenWindow("SAVE_MAP_PANEL", new WidgetArgs()
{
{ "onSave", afterSave },
{ "onExit", () => { Ui.CloseWindow(); onExit(); } },
{ "map", map },
{ "world", world },
{ "playerDefinitions", map.PlayerDefinitions },
{ "actorDefinitions", map.ActorDefinitions }
});
var package = new ZipFileLoader.ReadWriteZipFile();
map.Save(package);
map = new Map(modData, package);
Game.LoadEditor(map);
Ui.CloseWindow();
onSelect(map.Uid);
};
}
}