unify {RA,Cnc}DownloadPackagesLogic
This commit is contained in:
@@ -19,21 +19,21 @@ using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
public class RADownloadPackagesLogic
|
||||
public class DownloadPackagesLogic
|
||||
{
|
||||
Widget panel;
|
||||
Dictionary<string,string> installData;
|
||||
ProgressBarWidget progressBar;
|
||||
LabelWidget statusLabel;
|
||||
Action continueLoading;
|
||||
Action afterInstall;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public RADownloadPackagesLogic([ObjectCreator.Param] Widget widget,
|
||||
public DownloadPackagesLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] Dictionary<string,string> installData,
|
||||
[ObjectCreator.Param] Action continueLoading)
|
||||
[ObjectCreator.Param] Action afterInstall)
|
||||
{
|
||||
this.installData = installData;
|
||||
this.continueLoading = continueLoading;
|
||||
this.afterInstall = afterInstall;
|
||||
|
||||
panel = widget.GetWidget("INSTALL_DOWNLOAD_PANEL");
|
||||
progressBar = panel.GetWidget<ProgressBarWidget>("PROGRESS_BAR");
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
// Save the package to a temp file
|
||||
var file = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
var dest = new string[] { Platform.SupportDir, "Content", "ra" }.Aggregate(Path.Combine);
|
||||
var dest = new string[] { Platform.SupportDir, "Content", Game.modData.Manifest.Mods[0] }.Aggregate(Path.Combine);
|
||||
|
||||
Action<DownloadProgressChangedEventArgs> onDownloadProgress = i =>
|
||||
{
|
||||
@@ -99,7 +99,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
Game.RunAfterTick(() =>
|
||||
{
|
||||
Widget.CloseWindow();
|
||||
continueLoading();
|
||||
afterInstall();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var panel = widget.GetWidget("INSTALL_PANEL");
|
||||
var args = new WidgetArgs()
|
||||
{
|
||||
{ "continueLoading", () => { Widget.CloseWindow(); continueLoading(); } },
|
||||
{ "afterInstall", () => { Widget.CloseWindow(); continueLoading(); } },
|
||||
{ "installData", installData }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user