diff --git a/OpenRA.Mods.RA/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/AssetBrowserLogic.cs index 1d3d5ea16b..61a7c060dc 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/AssetBrowserLogic.cs @@ -26,14 +26,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic static ShpImageWidget spriteImage; static TextFieldWidget filenameInput; static SliderWidget frameSlider; - static ButtonWidget playButton; - static ButtonWidget pauseButton; + static ButtonWidget playButton, pauseButton; static ScrollPanelWidget assetList; static ScrollItemWidget template; public enum SourceType { Folders, Packages } public static SourceType AssetSource = SourceType.Folders; + public static List AvailableShps = new List(); + [ObjectCreator.UseCtor] public AssetBrowserLogic(Widget widget, Action onExit, World world) { @@ -95,10 +96,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic template = panel.Get("ASSET_TEMPLATE"); PopulateAssetList(); + var palette = (WidgetUtils.ActiveModId() == "d2k") ? "d2k.pal" : "egopal.pal"; + panel.Get("EXPORT_BUTTON").OnClick = () => { - var palette = (WidgetUtils.ActiveModId() == "d2k") ? "d2k.pal" : "egopal.pal"; - var ExtractGameFiles = new string[][] { new string[] {"--extract", WidgetUtils.ActiveModId(), palette}, @@ -115,7 +116,32 @@ namespace OpenRA.Mods.RA.Widgets.Logic { "ExtractGameFiles", ExtractGameFiles }, { "ExportToPng", ExportToPng } }; + + Ui.OpenWindow("EXTRACT_ASSETS_PANEL", args); + }; + panel.Get("EXTRACT_BUTTON").OnClick = () => + { + var ExtractGameFilesList = new List(); + var ExportToPngList = new List(); + + ExtractGameFilesList.Add(new string[] { "--extract", WidgetUtils.ActiveModId(), palette} ); + + foreach (var shp in AvailableShps) + { + ExtractGameFilesList.Add(new string[] { "--extract", WidgetUtils.ActiveModId(), shp } ); + ExportToPngList.Add(new string[] { "--png", shp, palette } ); + } + + var ExtractGameFiles = ExtractGameFilesList.ToArray(); + var ExportToPng = ExportToPngList.ToArray(); + + var args = new WidgetArgs() + { + { "ExtractGameFiles", ExtractGameFiles }, + { "ExportToPng", ExportToPng } + }; + Ui.OpenWindow("EXTRACT_ASSETS_PANEL", args); }; @@ -171,6 +197,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public static void PopulateAssetList() { assetList.RemoveChildren(); + AvailableShps.Clear(); if (AssetSource == SourceType.Folders) { @@ -180,14 +207,20 @@ namespace OpenRA.Mods.RA.Widgets.Logic { var shps = Directory.GetFiles(folder, "*.shp"); foreach (var shp in shps) + { AddAsset(assetList, shp, template); + AvailableShps.Add(shp); + } } } } if (AssetSource == SourceType.Packages) foreach (var hiddenFile in Rules.PackageContents.Keys) + { AddAsset(assetList, hiddenFile, template); + AvailableShps.Add(hiddenFile); + } } } } diff --git a/OpenRA.Mods.RA/Widgets/Logic/ExtractGameFilesLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ExtractGameFilesLogic.cs index db4520ff65..0acdb3293d 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ExtractGameFilesLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ExtractGameFilesLogic.cs @@ -46,9 +46,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic extractingContainer = panel.Get("EXTRACTING"); this.ExtractGameFiles = ExtractGameFiles; - foreach (var s in ExtractGameFiles) - foreach (var ss in s) - Console.WriteLine(ss); this.ExportToPng = ExportToPng; Extract(); diff --git a/mods/ra/chrome/assetbrowser.yaml b/mods/ra/chrome/assetbrowser.yaml index 619a562a5b..fbb639cf1f 100644 --- a/mods/ra/chrome/assetbrowser.yaml +++ b/mods/ra/chrome/assetbrowser.yaml @@ -99,7 +99,6 @@ Background@ASSETBROWSER_BG: Height:25 Text:Extract all to PNG Font:Bold - Disabled: yes Button@EXPORT_BUTTON: X:PARENT_RIGHT - 200 Y:PARENT_BOTTOM - 200 diff --git a/mods/ra/mix/conquer.yaml b/mods/ra/mix/conquer.yaml index 91f479af5c..83bba64bc1 100644 --- a/mods/ra/mix/conquer.yaml +++ b/mods/ra/mix/conquer.yaml @@ -28,7 +28,7 @@ agun.shp: agunmake.shp: apc.shp: apwr.shp: -apwramke.shp: +apwrmake.shp: armor.shp: art-exp1.shp: arty.shp: @@ -39,7 +39,7 @@ atomicup.shp: atomsfx.shp: badr.shp: bar3bhr.shp: -bar3blue.shp: +bar3blu.shp: bar3red.shp: bar3rhr.shp: barb.shp: