Streamline mod changing after installation

- Don't return to the ModChooser after a successful installation.
 - Don't reload the ModChooser after a cancelled installation.
This commit is contained in:
Pavel Penev
2015-09-08 22:25:05 +03:00
parent 4401e1aa0c
commit 50ea12723c
3 changed files with 10 additions and 20 deletions

View File

@@ -8,7 +8,6 @@
*/
#endregion
using System;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
@@ -16,13 +15,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class InstallLogic : Widget
{
[ObjectCreator.UseCtor]
public InstallLogic(Widget widget, Action continueLoading, string mirrorListUrl, string modId)
public InstallLogic(Widget widget, string mirrorListUrl, string modId)
{
var panel = widget.Get("INSTALL_PANEL");
var widgetArgs = new WidgetArgs
{
{ "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
{ "continueLoading", continueLoading },
{ "afterInstall", () => { Game.InitializeMod(modId, new Arguments()); } },
{ "mirrorListUrl", mirrorListUrl },
{ "modId", modId }
};
@@ -38,14 +36,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
panel.Get<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
Ui.OpenWindow("INSTALL_FROMCD_PANEL", widgetArgs);
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = () =>
{
Game.RunAfterTick(() =>
{
Game.Settings.Game.PreviousMod = Game.ModData.Manifest.Mod.Id;
Game.InitializeMod("modchooser", null);
});
};
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = Ui.CloseWindow;
}
}
}