auto-restart the game after getting the game-files

This commit is contained in:
Matthias Mailänder
2012-06-25 14:47:08 +02:00
committed by Chris Forbes
parent a64629f1c5
commit 5318380bfa
6 changed files with 19 additions and 10 deletions

View File

@@ -77,6 +77,7 @@ namespace OpenRA.Mods.D2k
{
var args = new WidgetArgs()
{
{ "continueLoading", () => TestAndContinue() },
{ "installData", Info }
};
Ui.OpenWindow(Info["InstallerMenuWidget"], args);

View File

@@ -25,13 +25,13 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
Dictionary<string,string> installData;
ProgressBarWidget progressBar;
LabelWidget statusLabel;
//Action afterInstall;
Action afterInstall;
[ObjectCreator.UseCtor]
public D2kDownloadPackagesLogic(Widget widget, Dictionary<string,string> installData, Action afterInstall)
{
this.installData = installData;
//this.afterInstall = afterInstall;
this.afterInstall = afterInstall;
panel = widget.Get("INSTALL_DOWNLOAD_PANEL");
progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
Game.RunAfterTick(() =>
{
Ui.CloseWindow();
//afterInstall();
afterInstall();
});
}
};

View File

@@ -25,11 +25,12 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
Widget panel;
ProgressBarWidget progressBar;
LabelWidget statusLabel;
Action continueLoading;
ButtonWidget retryButton, backButton;
Widget extractingContainer, copyFilesContainer;
[ObjectCreator.UseCtor]
public D2kExtractGameFilesLogic(Widget widget)
public D2kExtractGameFilesLogic(Widget widget, Action continueLoading)
{
panel = widget.Get("EXTRACT_GAMEFILES_PANEL");
progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
@@ -43,7 +44,9 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
extractingContainer = panel.Get("EXTRACTING");
copyFilesContainer = panel.Get("COPY_FILES");
Extract();
this.continueLoading = continueLoading;
}
void Extract()
@@ -536,6 +539,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
progressBar.Percentage = 100;
statusLabel.GetText = () => "Extraction and conversion complete.";
backButton.IsDisabled = () => false;
continueLoading();
});
}
catch

View File

@@ -24,11 +24,12 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
Widget panel;
ProgressBarWidget progressBar;
LabelWidget statusLabel;
Action continueLoading;
ButtonWidget retryButton, backButton;
Widget installingContainer, insertDiskContainer;
[ObjectCreator.UseCtor]
public D2kInstallFromCDLogic(Widget widget)
public D2kInstallFromCDLogic(Widget widget, Action continueLoading)
{
panel = widget.Get("INSTALL_FROMCD_PANEL");
progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
@@ -42,7 +43,9 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
installingContainer = panel.Get("INSTALLING");
insertDiskContainer = panel.Get("INSERT_DISK");
CheckForDisk();
this.continueLoading = continueLoading;
}
public static bool IsValidDisk(string diskRoot)
@@ -114,6 +117,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
{
statusLabel.GetText = () => "Music has been copied.";
backButton.IsDisabled = () => false;
continueLoading();
});
}
catch

View File

@@ -17,13 +17,14 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
public class D2kInstallLogic
{
[ObjectCreator.UseCtor]
public D2kInstallLogic(Widget widget, Dictionary<string,string> installData)
public D2kInstallLogic(Widget widget, Dictionary<string,string> installData, Action continueLoading)
{
var panel = widget.Get("INSTALL_PANEL");
var args = new WidgetArgs()
{
{ "afterInstall", () => { Ui.CloseWindow(); Game.Exit(); } },
{ "installData", installData }
{ "afterInstall", () => { Ui.CloseWindow(); continueLoading(); } },
{ "installData", installData },
{ "continueLoading", continueLoading }
};
panel.Get<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>

View File

@@ -36,4 +36,3 @@
# put TilesetBuilder.Export into OpenRA.Utility to call the functions directly when extracting game-files (instead of opening a GUI)
# group number metrics are off, should use DrawText not pips SHP
# AcceptSmudges should be a string and not a boolean or array to seperate SmudgeTypes
# start the game after getting the game-file