add a dump everything to PNG options for @xanax

This commit is contained in:
Matthias Mailänder
2013-04-28 20:36:18 +02:00
parent 7f40f59d85
commit 0c1b6f21b9
4 changed files with 39 additions and 10 deletions

View File

@@ -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<string> AvailableShps = new List<string>();
[ObjectCreator.UseCtor]
public AssetBrowserLogic(Widget widget, Action onExit, World world)
{
@@ -95,10 +96,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
template = panel.Get<ScrollItemWidget>("ASSET_TEMPLATE");
PopulateAssetList();
var palette = (WidgetUtils.ActiveModId() == "d2k") ? "d2k.pal" : "egopal.pal";
panel.Get<ButtonWidget>("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<ButtonWidget>("EXTRACT_BUTTON").OnClick = () =>
{
var ExtractGameFilesList = new List<string[]>();
var ExportToPngList = new List<string[]>();
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);
}
}
}
}

View File

@@ -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();

View File

@@ -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

View File

@@ -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: