Remove color caches
This commit is contained in:
committed by
Matthias Mailänder
parent
239891070d
commit
6b463f9d9e
@@ -45,20 +45,16 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
public override object Create(ActorInitializer init) { return new WithTextControlGroupDecoration(init.Self, this); }
|
||||
}
|
||||
|
||||
public class WithTextControlGroupDecoration : IDecoration, INotifyOwnerChanged
|
||||
public class WithTextControlGroupDecoration : IDecoration
|
||||
{
|
||||
readonly WithTextControlGroupDecorationInfo info;
|
||||
readonly SpriteFont font;
|
||||
readonly CachedTransform<int, string> label;
|
||||
|
||||
Color color;
|
||||
|
||||
public WithTextControlGroupDecoration(Actor self, WithTextControlGroupDecorationInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
font = Game.Renderer.Fonts[info.Font];
|
||||
color = info.UsePlayerColor ? self.OwnerColor() : info.Color;
|
||||
|
||||
label = new CachedTransform<int, string>(g => self.World.ControlGroups.Groups[g]);
|
||||
}
|
||||
|
||||
@@ -74,14 +70,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var screenPos = container.GetDecorationOrigin(self, wr, info.Position, info.Margin);
|
||||
return new IRenderable[]
|
||||
{
|
||||
new UITextRenderable(font, self.CenterPosition, screenPos, 0, color, text)
|
||||
new UITextRenderable(font, self.CenterPosition, screenPos, 0, info.UsePlayerColor ? self.OwnerColor() : info.Color, text)
|
||||
};
|
||||
}
|
||||
|
||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
if (info.UsePlayerColor)
|
||||
color = self.OwnerColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user