Cache indicator sprite in ResourceBarWidget at initialization
This commit is contained in:
@@ -34,6 +34,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
EWMA providedLerp = new EWMA(0.3f);
|
EWMA providedLerp = new EWMA(0.3f);
|
||||||
EWMA usedLerp = new EWMA(0.3f);
|
EWMA usedLerp = new EWMA(0.3f);
|
||||||
readonly World world;
|
readonly World world;
|
||||||
|
Sprite indicator;
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ResourceBarWidget(World world)
|
public ResourceBarWidget(World world)
|
||||||
@@ -43,6 +44,13 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Initialize(WidgetArgs args)
|
||||||
|
{
|
||||||
|
base.Initialize(args);
|
||||||
|
|
||||||
|
indicator = ChromeProvider.GetImage(IndicatorCollection, IndicatorImage);
|
||||||
|
}
|
||||||
|
|
||||||
public override void MouseEntered()
|
public override void MouseEntered()
|
||||||
{
|
{
|
||||||
if (TooltipContainer == null)
|
if (TooltipContainer == null)
|
||||||
@@ -72,7 +80,6 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var usedFrac = usedLerp.Update(used / scaleBy);
|
var usedFrac = usedLerp.Update(used / scaleBy);
|
||||||
|
|
||||||
var b = RenderBounds;
|
var b = RenderBounds;
|
||||||
var indicator = ChromeProvider.GetImage(IndicatorCollection, IndicatorImage);
|
|
||||||
|
|
||||||
var color = GetBarColor();
|
var color = GetBarColor();
|
||||||
if (Orientation == ResourceBarOrientation.Vertical)
|
if (Orientation == ResourceBarOrientation.Vertical)
|
||||||
|
|||||||
Reference in New Issue
Block a user