Simplify MenuPaletteEffect activation.
This commit is contained in:
@@ -28,9 +28,6 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
public CncIngameChromeLogic(Widget widget, World world)
|
||||
{
|
||||
this.world = world;
|
||||
world.WorldActor.Trait<MenuPaletteEffect>()
|
||||
.Fade(MenuPaletteEffect.EffectType.None);
|
||||
|
||||
ingameRoot = widget.Get("INGAME_ROOT");
|
||||
var playerRoot = ingameRoot.Get("PLAYER_ROOT");
|
||||
|
||||
|
||||
@@ -18,12 +18,16 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class MenuPaletteEffectInfo : ITraitInfo
|
||||
{
|
||||
[Desc("Time (in ticks) to fade between states")]
|
||||
public readonly int FadeLength = 10;
|
||||
|
||||
[Desc("Effect style to fade into")]
|
||||
public readonly MenuPaletteEffect.EffectType Effect = MenuPaletteEffect.EffectType.None;
|
||||
|
||||
public object Create(ActorInitializer init) { return new MenuPaletteEffect(this); }
|
||||
}
|
||||
|
||||
public class MenuPaletteEffect : IPaletteModifier, ITickRender
|
||||
public class MenuPaletteEffect : IPaletteModifier, ITickRender, IWorldLoaded
|
||||
{
|
||||
public enum EffectType { None, Black, Desaturated }
|
||||
public readonly MenuPaletteEffectInfo Info;
|
||||
@@ -84,5 +88,10 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WorldLoaded(World w, WorldRenderer wr)
|
||||
{
|
||||
Fade(Info.Effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,6 @@
|
||||
<Compile Include="Widgets\Logic\ReplayBrowserLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\ServerBrowserLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\ServerCreationLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\ShellmapDesaturationLogic.cs" />
|
||||
<Compile Include="Widgets\MoneyBinWidget.cs" />
|
||||
<Compile Include="Widgets\ObserverProductionIconsWidget.cs" />
|
||||
<Compile Include="Widgets\ObserverSupportPowerIconsWidget.cs" />
|
||||
|
||||
@@ -1,23 +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
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
public class ShellmapDesaturationLogic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public ShellmapDesaturationLogic(World world)
|
||||
{
|
||||
var paletteEffect = world.WorldActor.TraitOrDefault<MenuPaletteEffect>();
|
||||
if (paletteEffect != null)
|
||||
paletteEffect.Fade(MenuPaletteEffect.EffectType.Desaturated);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ Container@MENU_BACKGROUND:
|
||||
Height: WINDOW_BOTTOM
|
||||
Logic: CncMainMenuLogic
|
||||
Children:
|
||||
Container@SHELLMAP_DESATURATION:
|
||||
Logic: ShellmapDesaturationLogic
|
||||
Container@SHELLMAP_DECORATIONS:
|
||||
Children:
|
||||
Image@RETICLE:
|
||||
|
||||
@@ -990,6 +990,8 @@ Rules:
|
||||
-SpawnMPUnits:
|
||||
-MPStartLocations:
|
||||
-CrateSpawner:
|
||||
MenuPaletteEffect:
|
||||
Effect: Desaturated
|
||||
PlayMusicOnMapLoad:
|
||||
Music: map1
|
||||
Loop: true
|
||||
|
||||
Reference in New Issue
Block a user