Animate the C&C color picker preview.

This commit is contained in:
Paul Chote
2014-04-02 00:22:50 +13:00
parent 143d3aa083
commit 6be25468bb
3 changed files with 12 additions and 1 deletions

View File

@@ -110,6 +110,7 @@ NEW:
Fixed Obelisk of Light charge animation and sound not playing.
Replaced or improved several mouse cursors.
Added Minibibs for bibless buildings.
The Construction Yard fans now turn in the color picker preview.
Engine:
Converted Aircraft CruiseAltitude to world coordinates.
Converted Health Radius to world coordinates.

View File

@@ -20,6 +20,15 @@ namespace OpenRA.Mods.RA.Widgets.Logic
[ObjectCreator.UseCtor]
public ColorPickerLogic(Widget widget, HSLColor initialColor, Action<HSLColor> onChange, WorldRenderer worldRenderer)
{
var ticker = widget.GetOrNull<LogicTickerWidget>("ANIMATE_PREVIEW");
if (ticker != null)
{
var preview = widget.Get<SpriteSequenceWidget>("PREVIEW");
var anim = preview.GetAnimation();
anim.PlayRepeating(anim.CurrentSequence.Name);
ticker.OnTick = () => anim.Tick();
}
var hueSlider = widget.Get<SliderWidget>("HUE");
var mixer = widget.Get<ColorMixerWidget>("MIXER");
var randomButton = widget.GetOrNull<ButtonWidget>("RANDOM_BUTTON");

View File

@@ -4,6 +4,7 @@ Background@COLOR_CHOOSER:
Width:234
Height:105
Children:
LogicTicker@ANIMATE_PREVIEW:
Background@HUEBG:
Background:panel-black
X:5
@@ -29,7 +30,7 @@ Background@COLOR_CHOOSER:
Y:2
Width:144
Height:72
SpriteSequence@FACT:
SpriteSequence@PREVIEW:
X:153
Y:1
Width:80