Tiberian Sun Loadscreen
we need at least one file to get the DLL built
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -51,4 +52,7 @@
|
|||||||
<Name>OpenRA.FileFormats</Name>
|
<Name>OpenRA.FileFormats</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="TSLoadScreen.cs" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
92
OpenRA.Mods.TS/TSLoadScreen.cs
Normal file
92
OpenRA.Mods.TS/TSLoadScreen.cs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 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.Drawing;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Network;
|
||||||
|
using OpenRA.Support;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.TS
|
||||||
|
{
|
||||||
|
public class TSLoadScreen : ILoadScreen
|
||||||
|
{
|
||||||
|
Dictionary<string, string> Info;
|
||||||
|
static string[] Comments = new[] { "Updating EVA installation..." };
|
||||||
|
|
||||||
|
Stopwatch lastLoadScreen = new Stopwatch();
|
||||||
|
Rectangle StripeRect;
|
||||||
|
Sprite Stripe, Logo;
|
||||||
|
float2 LogoPos;
|
||||||
|
|
||||||
|
Renderer r;
|
||||||
|
public void Init(Dictionary<string, string> info)
|
||||||
|
{
|
||||||
|
Info = info;
|
||||||
|
// Avoid standard loading mechanisms so we
|
||||||
|
// can display loadscreen as early as possible
|
||||||
|
r = Game.Renderer;
|
||||||
|
if (r == null) return;
|
||||||
|
|
||||||
|
var s = new Sheet(Info["LoadScreenImage"]);
|
||||||
|
Logo = new Sprite(s, new Rectangle(0,0,256,256), TextureChannel.Alpha);
|
||||||
|
Stripe = new Sprite(s, new Rectangle(256,0,256,256), TextureChannel.Alpha);
|
||||||
|
StripeRect = new Rectangle(0, Renderer.Resolution.Height/2 - 128, Renderer.Resolution.Width, 256);
|
||||||
|
LogoPos = new float2(Renderer.Resolution.Width/2 - 128, Renderer.Resolution.Height/2 - 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Display()
|
||||||
|
{
|
||||||
|
if (r == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Update text at most every 0.5 seconds
|
||||||
|
if (lastLoadScreen.ElapsedTime() < 0.5)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (r.Fonts == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastLoadScreen.Reset();
|
||||||
|
var text = Comments.Random(Game.CosmeticRandom);
|
||||||
|
var textSize = r.Fonts["Bold"].Measure(text);
|
||||||
|
|
||||||
|
r.BeginFrame(float2.Zero, 1f);
|
||||||
|
WidgetUtils.FillRectWithSprite(StripeRect, Stripe);
|
||||||
|
r.RgbaSpriteRenderer.DrawSprite(Logo, LogoPos);
|
||||||
|
r.Fonts["Bold"].DrawText(text, new float2(Renderer.Resolution.Width - textSize.X - 20, Renderer.Resolution.Height - textSize.Y - 20), Color.White);
|
||||||
|
r.EndFrame( new NullInputHandler() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartGame()
|
||||||
|
{
|
||||||
|
TestAndContinue();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestAndContinue()
|
||||||
|
{
|
||||||
|
Ui.ResetAll();
|
||||||
|
if (!FileSystem.Exists(Info["TestFile"]))
|
||||||
|
{
|
||||||
|
var args = new WidgetArgs()
|
||||||
|
{
|
||||||
|
{ "continueLoading", () => TestAndContinue() },
|
||||||
|
{ "installData", Info }
|
||||||
|
};
|
||||||
|
Ui.OpenWindow(Info["InstallerMenuWidget"], args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Game.LoadShellMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ Music:
|
|||||||
|
|
||||||
Movies:
|
Movies:
|
||||||
|
|
||||||
LoadScreen: RALoadScreen
|
LoadScreen: TSLoadScreen
|
||||||
LoadScreenImage: mods/ts/uibits/loadscreen.png
|
LoadScreenImage: mods/ts/uibits/loadscreen.png
|
||||||
InstallerMenuWidget: INSTALL_PANEL
|
InstallerMenuWidget: INSTALL_PANEL
|
||||||
TestFile: tibsun.mix
|
TestFile: tibsun.mix
|
||||||
|
|||||||
Reference in New Issue
Block a user