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() var args = new WidgetArgs()
{ {
{ "continueLoading", () => TestAndContinue() },
{ "installData", Info } { "installData", Info }
}; };
Ui.OpenWindow(Info["InstallerMenuWidget"], args); Ui.OpenWindow(Info["InstallerMenuWidget"], args);

View File

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

View File

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

View File

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

View File

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

View File

@@ -35,5 +35,4 @@
# infantry-only areas (Rough) do not show the dark-green mouse cursor # infantry-only areas (Rough) do not show the dark-green mouse cursor
# put TilesetBuilder.Export into OpenRA.Utility to call the functions directly when extracting game-files (instead of opening a GUI) # 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 # 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 # AcceptSmudges should be a string and not a boolean or array to seperate SmudgeTypes
# start the game after getting the game-file