Make sure palettes are updated if colors are toggled in game runtime
And fix MutablePalette's not getting updated
This commit is contained in:
committed by
Matthias Mailänder
parent
5fc36bd45f
commit
239891070d
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Lint;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
@@ -19,18 +20,20 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
public class TogglePlayerStanceColorHotkeyLogic : SingleHotkeyBaseLogic
|
||||
{
|
||||
readonly World world;
|
||||
readonly WorldRenderer worldRenderer;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public TogglePlayerStanceColorHotkeyLogic(Widget widget, World world, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
||||
public TogglePlayerStanceColorHotkeyLogic(Widget widget, World world, WorldRenderer worldRenderer, ModData modData, Dictionary<string, MiniYaml> logicArgs)
|
||||
: base(widget, modData, "TogglePlayerStanceColorKey", "WORLD_KEYHANDLER", logicArgs)
|
||||
{
|
||||
this.world = world;
|
||||
this.worldRenderer = worldRenderer;
|
||||
}
|
||||
|
||||
protected override bool OnHotkeyActivated(KeyInput e)
|
||||
{
|
||||
Game.Settings.Game.UsePlayerStanceColors ^= true;
|
||||
Player.SetupRelationshipColors(world.Players, world.LocalPlayer);
|
||||
Player.SetupRelationshipColors(world.Players, world.LocalPlayer, worldRenderer, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
cb.OnClick = () =>
|
||||
{
|
||||
gs.UsePlayerStanceColors = cb.IsChecked() ^ true;
|
||||
Player.SetupRelationshipColors(world.Players, world.LocalPlayer);
|
||||
Player.SetupRelationshipColors(world.Players, world.LocalPlayer, worldRenderer, false);
|
||||
};
|
||||
|
||||
if (panel.GetOrNull<CheckboxWidget>("PAUSE_SHELLMAP_CHECKBOX") != null)
|
||||
|
||||
Reference in New Issue
Block a user