Move the mod-level initialisation code back into the load screen.
This commit is contained in:
@@ -331,45 +331,7 @@ namespace OpenRA
|
|||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
modData.LoadScreen.StartGame(args);
|
||||||
var window = args != null ? args.GetValue("Launch.Window", null) : null;
|
|
||||||
if (!string.IsNullOrEmpty(window))
|
|
||||||
{
|
|
||||||
var installData = modData.Manifest.ContentInstaller;
|
|
||||||
if (installData.InstallerBackgroundWidget != null)
|
|
||||||
Ui.LoadWidget(installData.InstallerBackgroundWidget, Ui.Root, new WidgetArgs());
|
|
||||||
|
|
||||||
Widgets.Ui.OpenWindow(window, new WidgetArgs());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
modData.LoadScreen.StartGame();
|
|
||||||
Settings.Save();
|
|
||||||
var replay = args != null ? args.GetValue("Launch.Replay", null) : null;
|
|
||||||
if (!string.IsNullOrEmpty(replay))
|
|
||||||
Game.JoinReplay(replay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void TestAndContinue()
|
|
||||||
{
|
|
||||||
Ui.ResetAll();
|
|
||||||
var installData = modData.Manifest.ContentInstaller;
|
|
||||||
if (!installData.TestFiles.All(f => GlobalFileSystem.Exists(f)))
|
|
||||||
{
|
|
||||||
var args = new WidgetArgs()
|
|
||||||
{
|
|
||||||
{ "continueLoading", () => InitializeMod(Game.Settings.Game.Mod, null) },
|
|
||||||
};
|
|
||||||
|
|
||||||
if (installData.InstallerBackgroundWidget != null)
|
|
||||||
Ui.LoadWidget(installData.InstallerBackgroundWidget, Ui.Root, args);
|
|
||||||
|
|
||||||
Ui.OpenWindow(installData.InstallerMenuWidget, args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LoadShellMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadShellMap()
|
public static void LoadShellMap()
|
||||||
|
|||||||
@@ -184,6 +184,6 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
void Init(Manifest m, Dictionary<string, string> info);
|
void Init(Manifest m, Dictionary<string, string> info);
|
||||||
void Display();
|
void Display();
|
||||||
void StartGame();
|
void StartGame(Arguments args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.Common.LoadScreens;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc
|
namespace OpenRA.Mods.Cnc
|
||||||
{
|
{
|
||||||
public sealed class CncLoadScreen : ILoadScreen
|
public sealed class CncLoadScreen : BlankLoadScreen
|
||||||
{
|
{
|
||||||
|
readonly NullInputHandler nih = new NullInputHandler();
|
||||||
|
|
||||||
Dictionary<string, string> loadInfo;
|
Dictionary<string, string> loadInfo;
|
||||||
Stopwatch loadTimer = Stopwatch.StartNew();
|
Stopwatch loadTimer = Stopwatch.StartNew();
|
||||||
Sheet sheet;
|
Sheet sheet;
|
||||||
@@ -27,9 +30,8 @@ namespace OpenRA.Mods.Cnc
|
|||||||
Sprite nodLogo, gdiLogo, evaLogo, brightBlock, dimBlock;
|
Sprite nodLogo, gdiLogo, evaLogo, brightBlock, dimBlock;
|
||||||
Rectangle bounds;
|
Rectangle bounds;
|
||||||
Renderer r;
|
Renderer r;
|
||||||
readonly NullInputHandler nih = new NullInputHandler();
|
|
||||||
|
|
||||||
public void Init(Manifest m, Dictionary<string, string> info)
|
public override void Init(Manifest m, Dictionary<string, string> info)
|
||||||
{
|
{
|
||||||
loadInfo = info;
|
loadInfo = info;
|
||||||
|
|
||||||
@@ -72,7 +74,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
string loadingText, versionText;
|
string loadingText, versionText;
|
||||||
float2 loadingPos, versionPos;
|
float2 loadingPos, versionPos;
|
||||||
|
|
||||||
public void Display()
|
public override void Display()
|
||||||
{
|
{
|
||||||
if (r == null || loadTimer.Elapsed.TotalSeconds < 0.25)
|
if (r == null || loadTimer.Elapsed.TotalSeconds < 0.25)
|
||||||
return;
|
return;
|
||||||
@@ -118,12 +120,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
r.EndFrame(nih);
|
r.EndFrame(nih);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartGame()
|
public override void Dispose()
|
||||||
{
|
|
||||||
Game.TestAndContinue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
{
|
||||||
if (sheet != null)
|
if (sheet != null)
|
||||||
sheet.Dispose();
|
sheet.Dispose();
|
||||||
|
|||||||
78
OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs
Normal file
78
OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
|
* 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
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.FileSystem;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.LoadScreens
|
||||||
|
{
|
||||||
|
public class BlankLoadScreen : ILoadScreen
|
||||||
|
{
|
||||||
|
public virtual void Init(Manifest m, Dictionary<string, string> info) { }
|
||||||
|
|
||||||
|
public virtual void Display()
|
||||||
|
{
|
||||||
|
if (Game.Renderer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Draw a black screen
|
||||||
|
Game.Renderer.BeginFrame(int2.Zero, 1f);
|
||||||
|
Game.Renderer.EndFrame(new NullInputHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestAndContinue()
|
||||||
|
{
|
||||||
|
Ui.ResetAll();
|
||||||
|
var installData = Game.modData.Manifest.ContentInstaller;
|
||||||
|
if (!installData.TestFiles.All(f => GlobalFileSystem.Exists(f)))
|
||||||
|
{
|
||||||
|
var args = new WidgetArgs()
|
||||||
|
{
|
||||||
|
{ "continueLoading", () => Game.InitializeMod(Game.Settings.Game.Mod, null) },
|
||||||
|
};
|
||||||
|
|
||||||
|
if (installData.InstallerBackgroundWidget != null)
|
||||||
|
Ui.LoadWidget(installData.InstallerBackgroundWidget, Ui.Root, args);
|
||||||
|
|
||||||
|
Ui.OpenWindow(installData.InstallerMenuWidget, args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Game.LoadShellMap();
|
||||||
|
|
||||||
|
Game.Settings.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartGame(Arguments args)
|
||||||
|
{
|
||||||
|
var window = args != null ? args.GetValue("Launch.Window", null) : null;
|
||||||
|
if (!string.IsNullOrEmpty(window))
|
||||||
|
{
|
||||||
|
var installData = Game.modData.Manifest.ContentInstaller;
|
||||||
|
if (installData.InstallerBackgroundWidget != null)
|
||||||
|
Ui.LoadWidget(installData.InstallerBackgroundWidget, Ui.Root, new WidgetArgs());
|
||||||
|
|
||||||
|
Ui.OpenWindow(window, new WidgetArgs());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TestAndContinue();
|
||||||
|
|
||||||
|
var replay = args != null ? args.GetValue("Launch.Replay", null) : null;
|
||||||
|
if (!string.IsNullOrEmpty(replay))
|
||||||
|
Game.JoinReplay(replay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Dispose() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ using OpenRA.Widgets;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.LoadScreens
|
namespace OpenRA.Mods.Common.LoadScreens
|
||||||
{
|
{
|
||||||
public sealed class DefaultLoadScreen : ILoadScreen
|
public sealed class LogoStripeLoadScreen : BlankLoadScreen
|
||||||
{
|
{
|
||||||
Stopwatch lastUpdate = Stopwatch.StartNew();
|
Stopwatch lastUpdate = Stopwatch.StartNew();
|
||||||
Renderer r;
|
Renderer r;
|
||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
Sprite stripe, logo;
|
Sprite stripe, logo;
|
||||||
string[] messages;
|
string[] messages;
|
||||||
|
|
||||||
public void Init(Manifest m, Dictionary<string, string> info)
|
public override void Init(Manifest m, Dictionary<string, string> 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
|
||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
logoPos = new float2(r.Resolution.Width / 2 - 128, r.Resolution.Height / 2 - 128);
|
logoPos = new float2(r.Resolution.Width / 2 - 128, r.Resolution.Height / 2 - 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Display()
|
public override void Display()
|
||||||
{
|
{
|
||||||
if (r == null)
|
if (r == null)
|
||||||
return;
|
return;
|
||||||
@@ -66,12 +66,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
r.EndFrame(new NullInputHandler());
|
r.EndFrame(new NullInputHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartGame()
|
public override void Dispose()
|
||||||
{
|
|
||||||
Game.TestAndContinue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
{
|
||||||
if (sheet != null)
|
if (sheet != null)
|
||||||
sheet.Dispose();
|
sheet.Dispose();
|
||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
r.EndFrame(new NullInputHandler());
|
r.EndFrame(new NullInputHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartGame()
|
public void StartGame(Arguments args)
|
||||||
{
|
{
|
||||||
Ui.LoadWidget("MODCHOOSER", Ui.Root, new WidgetArgs());
|
Ui.LoadWidget("MODCHOOSER", Ui.Root, new WidgetArgs());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
|
||||||
* 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
|
|
||||||
* as published by the Free Software Foundation. For more information,
|
|
||||||
* see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.LoadScreens
|
|
||||||
{
|
|
||||||
public sealed class NullLoadScreen : ILoadScreen
|
|
||||||
{
|
|
||||||
public void Init(Manifest m, Dictionary<string, string> info) { }
|
|
||||||
|
|
||||||
public void Display()
|
|
||||||
{
|
|
||||||
if (Game.Renderer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Draw a black screen
|
|
||||||
Game.Renderer.BeginFrame(int2.Zero, 1f);
|
|
||||||
Game.Renderer.EndFrame(new NullInputHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartGame()
|
|
||||||
{
|
|
||||||
Ui.ResetAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -78,9 +78,7 @@
|
|||||||
<Compile Include="Graphics\TextRenderable.cs" />
|
<Compile Include="Graphics\TextRenderable.cs" />
|
||||||
<Compile Include="Graphics\VoxelActorPreview.cs" />
|
<Compile Include="Graphics\VoxelActorPreview.cs" />
|
||||||
<Compile Include="Graphics\VoxelRenderable.cs" />
|
<Compile Include="Graphics\VoxelRenderable.cs" />
|
||||||
<Compile Include="LoadScreens\DefaultLoadScreen.cs" />
|
|
||||||
<Compile Include="LoadScreens\ModChooserLoadScreen.cs" />
|
<Compile Include="LoadScreens\ModChooserLoadScreen.cs" />
|
||||||
<Compile Include="LoadScreens\NullLoadScreen.cs" />
|
|
||||||
<Compile Include="Orders\DeployOrderTargeter.cs" />
|
<Compile Include="Orders\DeployOrderTargeter.cs" />
|
||||||
<Compile Include="Orders\EnterAlliedActorTargeter.cs" />
|
<Compile Include="Orders\EnterAlliedActorTargeter.cs" />
|
||||||
<Compile Include="Orders\UnitOrderTargeter.cs" />
|
<Compile Include="Orders\UnitOrderTargeter.cs" />
|
||||||
@@ -239,6 +237,8 @@
|
|||||||
<Compile Include="SpriteLoaders\ShpD2Loader.cs" />
|
<Compile Include="SpriteLoaders\ShpD2Loader.cs" />
|
||||||
<Compile Include="Widgets\Logic\SettingsLogic.cs" />
|
<Compile Include="Widgets\Logic\SettingsLogic.cs" />
|
||||||
<Compile Include="Widgets\TerrainTemplatePreviewWidget.cs" />
|
<Compile Include="Widgets\TerrainTemplatePreviewWidget.cs" />
|
||||||
|
<Compile Include="LoadScreens\LogoStripeLoadScreen.cs" />
|
||||||
|
<Compile Include="LoadScreens\BlankLoadScreen.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ Movies:
|
|||||||
Translations:
|
Translations:
|
||||||
./mods/d2k/languages/english.yaml
|
./mods/d2k/languages/english.yaml
|
||||||
|
|
||||||
LoadScreen: DefaultLoadScreen
|
LoadScreen: LogoStripeLoadScreen
|
||||||
Image: ./mods/d2k/uibits/loadscreen.png
|
Image: ./mods/d2k/uibits/loadscreen.png
|
||||||
Text: Filling Crates..., Breeding Sandworms...
|
Text: Filling Crates..., Breeding Sandworms...
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ Movies:
|
|||||||
Translations:
|
Translations:
|
||||||
./mods/ra/languages/english.yaml
|
./mods/ra/languages/english.yaml
|
||||||
|
|
||||||
LoadScreen: DefaultLoadScreen
|
LoadScreen: LogoStripeLoadScreen
|
||||||
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...
|
Text: Filling Crates..., Charging Capacitors..., Reticulating Splines..., Planting Trees..., Building Bridges..., Aging Empires..., Compiling EVA..., Constructing Pylons..., Activating Skynet..., Splitting Atoms...
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ Movies:
|
|||||||
Translations:
|
Translations:
|
||||||
./mods/ts/languages/english.yaml
|
./mods/ts/languages/english.yaml
|
||||||
|
|
||||||
LoadScreen: DefaultLoadScreen
|
LoadScreen: LogoStripeLoadScreen
|
||||||
Image: ./mods/ts/uibits/loadscreen.png
|
Image: ./mods/ts/uibits/loadscreen.png
|
||||||
Text: Updating EVA installation..., Changing perspective...
|
Text: Updating EVA installation..., Changing perspective...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user