separate content install from loadscreen

This commit is contained in:
Matthias Mailänder
2014-05-25 07:20:34 +02:00
parent 08b1c989d6
commit 351c759793
12 changed files with 38 additions and 32 deletions

View File

@@ -32,6 +32,7 @@ namespace OpenRA
public readonly IReadOnlyDictionary<string, string> MapFolders; public readonly IReadOnlyDictionary<string, string> MapFolders;
public readonly MiniYaml LoadScreen; public readonly MiniYaml LoadScreen;
public readonly MiniYaml LobbyDefaults; public readonly MiniYaml LobbyDefaults;
public readonly IReadOnlyDictionary<string, string> ContentInstaller;
public readonly Dictionary<string, Pair<string, int>> Fonts; public readonly Dictionary<string, Pair<string, int>> Fonts;
public readonly Size TileSize = new Size(24, 24); public readonly Size TileSize = new Size(24, 24);
public readonly string NewsUrl; public readonly string NewsUrl;
@@ -71,6 +72,7 @@ namespace OpenRA
LoadScreen = yaml["LoadScreen"]; LoadScreen = yaml["LoadScreen"];
LobbyDefaults = yaml["LobbyDefaults"]; LobbyDefaults = yaml["LobbyDefaults"];
ContentInstaller = YamlDictionary(yaml, "ContentInstaller");
Fonts = yaml["Fonts"].ToDictionary(my => Fonts = yaml["Fonts"].ToDictionary(my =>
{ {
var nd = my.ToDictionary(); var nd = my.ToDictionary();

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc
r = Game.Renderer; r = Game.Renderer;
if (r == null) return; if (r == null) return;
var s = new Sheet("mods/cnc/uibits/chrome.png"); var s = new Sheet(loadInfo["Image"]);
var res = r.Resolution; var res = r.Resolution;
bounds = new Rectangle(0, 0, res.Width, res.Height); bounds = new Rectangle(0, 0, res.Width, res.Height);
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Cnc
if (!setup && r.Fonts != null) if (!setup && r.Fonts != null)
{ {
loadingFont = r.Fonts["BigBold"]; loadingFont = r.Fonts["BigBold"];
loadingText = "Loading"; loadingText = loadInfo["Text"];
loadingPos = new float2((bounds.Width - loadingFont.Measure(loadingText).X) / 2, barY); loadingPos = new float2((bounds.Width - loadingFont.Measure(loadingText).X) / 2, barY);
versionFont = r.Fonts["Regular"]; versionFont = r.Fonts["Regular"];
@@ -127,15 +127,16 @@ namespace OpenRA.Mods.Cnc
void TestAndContinue() void TestAndContinue()
{ {
Ui.ResetAll(); Ui.ResetAll();
if (!loadInfo["TestFiles"].Split(',').All(f => GlobalFileSystem.Exists(f.Trim()))) var installData = Game.modData.Manifest.ContentInstaller;
if (!installData["TestFiles"].Split(',').All(f => GlobalFileSystem.Exists(f.Trim())))
{ {
var args = new WidgetArgs() var args = new WidgetArgs()
{ {
{ "continueLoading", () => TestAndContinue() }, { "continueLoading", () => TestAndContinue() },
{ "installData", loadInfo } { "installData", installData }
}; };
Ui.LoadWidget(loadInfo["InstallerBackgroundWidget"], Ui.Root, args); Ui.LoadWidget(installData["InstallerBackgroundWidget"], Ui.Root, args);
Ui.OpenWindow(loadInfo["InstallerMenuWidget"], args); Ui.OpenWindow(installData["InstallerMenuWidget"], args);
} }
else else
Game.LoadShellMap(); Game.LoadShellMap();

View File

@@ -20,7 +20,6 @@ namespace OpenRA.Mods.RA
{ {
public class DefaultLoadScreen : ILoadScreen public class DefaultLoadScreen : ILoadScreen
{ {
Dictionary<string, string> info;
Stopwatch lastUpdate = Stopwatch.StartNew(); Stopwatch lastUpdate = Stopwatch.StartNew();
Renderer r; Renderer r;
@@ -31,8 +30,6 @@ namespace OpenRA.Mods.RA
public void Init(Manifest m, Dictionary<string, string> info) public void Init(Manifest m, Dictionary<string, string> info)
{ {
this.info = info;
// Avoid standard loading mechanisms so we // Avoid standard loading mechanisms so we
// can display the loadscreen as early as possible // can display the loadscreen as early as possible
r = Game.Renderer; r = Game.Renderer;
@@ -78,14 +75,15 @@ namespace OpenRA.Mods.RA
void TestAndContinue() void TestAndContinue()
{ {
Ui.ResetAll(); Ui.ResetAll();
if (!info["TestFiles"].Split(',').All(f => GlobalFileSystem.Exists(f.Trim()))) var installData = Game.modData.Manifest.ContentInstaller;
if (!installData["TestFiles"].Split(',').All(f => GlobalFileSystem.Exists(f.Trim())))
{ {
var args = new WidgetArgs() var args = new WidgetArgs()
{ {
{ "continueLoading", () => TestAndContinue() }, { "continueLoading", () => TestAndContinue() },
{ "installData", info } { "installData", installData }
}; };
Ui.OpenWindow(info["InstallerMenuWidget"], args); Ui.OpenWindow(installData["InstallerMenuWidget"], args);
} }
else else
Game.LoadShellMap(); Game.LoadShellMap();

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc
public void Init(Manifest m, Dictionary<string, string> info) public void Init(Manifest m, Dictionary<string, string> info)
{ {
var sheet = new Sheet("mods/modchooser/chrome.png"); var sheet = new Sheet(info["Image"]);
var res = Game.Renderer.Resolution; var res = Game.Renderer.Resolution;
bounds = new Rectangle(0, 0, res.Width, res.Height); bounds = new Rectangle(0, 0, res.Width, res.Height);
sprite = new Sprite(sheet, new Rectangle(0,0,1024,480), TextureChannel.Alpha); sprite = new Sprite(sheet, new Rectangle(0,0,1024,480), TextureChannel.Alpha);

View File

@@ -22,14 +22,14 @@ namespace OpenRA.Mods.RA.Widgets.Logic
public class DownloadPackagesLogic public class DownloadPackagesLogic
{ {
Widget panel; Widget panel;
Dictionary<string, string> installData; IReadOnlyDictionary<string, string> installData;
ProgressBarWidget progressBar; ProgressBarWidget progressBar;
LabelWidget statusLabel; LabelWidget statusLabel;
Action afterInstall; Action afterInstall;
string mirror; string mirror;
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
public DownloadPackagesLogic(Widget widget, Dictionary<string, string> installData, Action afterInstall) public DownloadPackagesLogic(Widget widget, IReadOnlyDictionary<string, string> installData, Action afterInstall)
{ {
this.installData = installData; this.installData = installData;
this.afterInstall = afterInstall; this.afterInstall = afterInstall;

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
public class InstallLogic : Widget public class InstallLogic : Widget
{ {
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
public InstallLogic(Widget widget, Dictionary<string, string> installData, Action continueLoading) public InstallLogic(Widget widget, IReadOnlyDictionary<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()
@@ -30,15 +30,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
panel.Get<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () => panel.Get<ButtonWidget>("DOWNLOAD_BUTTON").OnClick = () =>
Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", args); Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", args);
if (installData.ContainsKey("FilesToCopy") && !string.IsNullOrEmpty(installData["FilesToCopy"]) &&
installData.ContainsKey("FilesToExtract") && !string.IsNullOrEmpty(installData["FilesToExtract"]))
{
args = new WidgetArgs(args)
{
{ "filesToCopy", installData["FilesToCopy"].Split(',') },
{ "filesToExtract", installData["FilesToExtract"].Split(',') },
};
}
panel.Get<ButtonWidget>("INSTALL_BUTTON").OnClick = () => panel.Get<ButtonWidget>("INSTALL_BUTTON").OnClick = () =>
Ui.OpenWindow("INSTALL_FROMCD_PANEL", args); Ui.OpenWindow("INSTALL_FROMCD_PANEL", args);

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,

View File

@@ -127,11 +127,15 @@ TileSets:
mods/cnc/tilesets/jungle.yaml mods/cnc/tilesets/jungle.yaml
LoadScreen: CncLoadScreen LoadScreen: CncLoadScreen
Image: mods/cnc/uibits/chrome.png
Text: Loading
ContentInstaller:
TestFiles: conquer.mix, desert.mix, general.mix, sounds.mix, speech.mix, temperat.mix, tempicnh.mix, winter.mix
InstallerBackgroundWidget: INSTALL_BACKGROUND
InstallerMenuWidget: INSTALL_PANEL InstallerMenuWidget: INSTALL_PANEL
FilesToCopy: CONQUER.MIX, DESERT.MIX, SCORES.MIX, SOUNDS.MIX, TEMPERAT.MIX, WINTER.MIX FilesToCopy: CONQUER.MIX, DESERT.MIX, SCORES.MIX, SOUNDS.MIX, TEMPERAT.MIX, WINTER.MIX
FilesToExtract: speech.mix, tempicnh.mix, transit.mix FilesToExtract: speech.mix, tempicnh.mix, transit.mix
InstallerBackgroundWidget: INSTALL_BACKGROUND
TestFiles: conquer.mix, desert.mix, general.mix, sounds.mix, speech.mix, temperat.mix, tempicnh.mix, winter.mix
PackageMirrorList: http://openra.net/packages/cnc-mirrors.txt PackageMirrorList: http://openra.net/packages/cnc-mirrors.txt
ServerTraits: ServerTraits:

View File

@@ -112,11 +112,13 @@ Translations:
LoadScreen: DefaultLoadScreen LoadScreen: DefaultLoadScreen
Image: mods/d2k/uibits/loadscreen.png Image: mods/d2k/uibits/loadscreen.png
Text: Filling Crates..., Breeding Sandworms...
ContentInstaller:
InstallerMenuWidget: INSTALL_PANEL InstallerMenuWidget: INSTALL_PANEL
# TODO: check if DATA.R8 is at 1.03 patch level with 4840 frames # TODO: check if DATA.R8 is at 1.03 patch level with 4840 frames
TestFiles: BLOXBASE.R8, BLOXBAT.R8, BLOXBGBS.R8, BLOXICE.R8, BLOXTREE.R8, BLOXWAST.R8, DATA.R8, SOUND.RS TestFiles: BLOXBASE.R8, BLOXBAT.R8, BLOXBGBS.R8, BLOXICE.R8, BLOXTREE.R8, BLOXWAST.R8, DATA.R8, SOUND.RS
PackageMirrorList: http://openra.net/packages/d2k-103-mirrors.txt PackageMirrorList: http://openra.net/packages/d2k-103-mirrors.txt
Text: Filling Crates..., Breeding Sandworms...
ServerTraits: ServerTraits:
LobbyCommands LobbyCommands

View File

@@ -24,6 +24,7 @@ Notifications:
mods/modchooser/notifications.yaml mods/modchooser/notifications.yaml
LoadScreen: ModChooserLoadScreen LoadScreen: ModChooserLoadScreen
Image: mods/modchooser/chrome.png
ChromeMetrics: ChromeMetrics:
mods/modchooser/metrics.yaml mods/modchooser/metrics.yaml
@@ -47,4 +48,6 @@ Fonts:
TinyBold: TinyBold:
Font:FreeSansBold.ttf Font:FreeSansBold.ttf
Size:10 Size:10
LobbyDefaults:
LobbyDefaults:
ContentInstaller:

View File

@@ -129,10 +129,12 @@ Translations:
LoadScreen: DefaultLoadScreen LoadScreen: DefaultLoadScreen
Image: mods/ra/uibits/loadscreen.png Image: mods/ra/uibits/loadscreen.png
Text: Filling Crates..., Charging Capacitors..., Reticulating Splines..., Planting Trees..., Building Bridges..., Aging Empires..., Compiling EVA..., Constructing Pylons..., Activating Skynet..., Splitting Atoms...
ContentInstaller:
InstallerMenuWidget: INSTALL_PANEL InstallerMenuWidget: INSTALL_PANEL
TestFiles: allies.mix, conquer.mix, general.mix, interior.mix, redalert.mix, russian.mix, scores.mix, snow.mix, sounds.mix, temperat.mix TestFiles: allies.mix, conquer.mix, general.mix, interior.mix, redalert.mix, russian.mix, scores.mix, snow.mix, sounds.mix, temperat.mix
PackageMirrorList: http://openra.net/packages/ra-mirrors.txt PackageMirrorList: http://openra.net/packages/ra-mirrors.txt
Text: Filling Crates..., Charging Capacitors..., Reticulating Splines..., Planting Trees..., Building Bridges..., Aging Empires..., Compiling EVA..., Constructing Pylons..., Activating Skynet..., Splitting Atoms...
ServerTraits: ServerTraits:
LobbyCommands LobbyCommands

View File

@@ -154,6 +154,9 @@ Translations:
LoadScreen: DefaultLoadScreen LoadScreen: DefaultLoadScreen
Image: mods/ts/uibits/loadscreen.png Image: mods/ts/uibits/loadscreen.png
Text: Updating EVA installation..., Changing perspective...
ContentInstaller:
InstallerMenuWidget: INSTALL_PANEL InstallerMenuWidget: INSTALL_PANEL
TestFiles: cache.mix, conquer.mix, isosnow.mix, isotemp.mix, local.mix, sidec01.mix, sidec02.mix, sno.mix, snow.mix, sounds.mix, speech01.mix, tem.mix, temperat.mix TestFiles: cache.mix, conquer.mix, isosnow.mix, isotemp.mix, local.mix, sidec01.mix, sidec02.mix, sno.mix, snow.mix, sounds.mix, speech01.mix, tem.mix, temperat.mix
PackageMirrorList: http://openra.net/packages/ts-mirrors.txt PackageMirrorList: http://openra.net/packages/ts-mirrors.txt