Fix FMV player widget display

This commit is contained in:
Paul Chote
2010-10-14 23:25:46 +13:00
parent 127cbf3f96
commit 185ba80e99
7 changed files with 48 additions and 3 deletions

View File

@@ -254,8 +254,6 @@ namespace OpenRA
JoinLocal(); JoinLocal();
StartGame(modData.Manifest.ShellmapUid); StartGame(modData.Manifest.ShellmapUid);
Game.AfterGameStart += world => Widget.OpenWindow("INGAME_ROOT", new Dictionary<string,object>{{"world", world},{"orderManager",orderManager}});
Game.ConnectionStateChanged += orderManager => Game.ConnectionStateChanged += orderManager =>
{ {
Widget.CloseWindow(); Widget.CloseWindow();

View File

@@ -19,6 +19,7 @@ using OpenRA.Orders;
using OpenRA.Traits; using OpenRA.Traits;
using XRandom = OpenRA.Thirdparty.Random; using XRandom = OpenRA.Thirdparty.Random;
using OpenRA.Widgets;
namespace OpenRA namespace OpenRA
{ {
@@ -117,6 +118,12 @@ namespace OpenRA
wlh.WorldLoaded(this); wlh.WorldLoaded(this);
} }
// Hacky workaround for orderManager visibility
public void OpenWindow(string widget)
{
Widget.OpenWindow(widget, new Dictionary<string,object>{{"world", this}, { "orderManager", orderManager }});
}
public Actor CreateActor( string name, TypeDictionary initDict ) public Actor CreateActor( string name, TypeDictionary initDict )
{ {
return CreateActor( true, name, initDict ); return CreateActor( true, name, initDict );

View File

@@ -21,7 +21,7 @@ using OpenRA.Mods.RA;
namespace OpenRA.Mods.Cnc namespace OpenRA.Mods.Cnc
{ {
class Gdi01ScriptInfo : TraitInfo<Gdi01Script> { } class Gdi01ScriptInfo : TraitInfo<Gdi01Script>, ITraitPrerequisite<OpenWidgetAtGameStartInfo> { }
class Gdi01Script: IWorldLoaded, ITick class Gdi01Script: IWorldLoaded, ITick
{ {

View File

@@ -263,6 +263,7 @@
<Compile Include="IdleAnimation.cs" /> <Compile Include="IdleAnimation.cs" />
<Compile Include="World\SmudgeLayer.cs" /> <Compile Include="World\SmudgeLayer.cs" />
<Compile Include="Scripting\Media.cs" /> <Compile Include="Scripting\Media.cs" />
<Compile Include="OpenWidgetAtGameStart.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,37 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 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 LICENSE.
*/
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class OpenWidgetAtGameStartInfo : ITraitInfo
{
public readonly string Widget = "INGAME_ROOT";
public object Create(ActorInitializer init) { return new OpenWidgetAtGameStart(this); }
}
public class OpenWidgetAtGameStart: IWorldLoaded
{
readonly OpenWidgetAtGameStartInfo Info;
public OpenWidgetAtGameStart(OpenWidgetAtGameStartInfo Info)
{
this.Info = Info;
}
public void WorldLoaded(World world)
{
// Todo: custom observer ui?
if (world.LocalPlayer != null)
world.OpenWindow(Info.Widget);
}
}
}

View File

@@ -42,6 +42,7 @@ Player:
PaletteFormat: cnc PaletteFormat: cnc
World: World:
OpenWidgetAtGameStart:
ScreenShaker: ScreenShaker:
NukePaletteEffect: NukePaletteEffect:
WaterPaletteRotation: WaterPaletteRotation:

View File

@@ -102,6 +102,7 @@ Player:
BasePalette: terrain BasePalette: terrain
World: World:
OpenWidgetAtGameStart:
ScreenShaker: ScreenShaker:
WaterPaletteRotation: WaterPaletteRotation:
ChronoshiftPaletteEffect: ChronoshiftPaletteEffect: