Use ActorPreviewWidget for the color pickers.

This commit is contained in:
Paul Chote
2015-02-09 23:48:42 +00:00
parent aa9db669e7
commit 8d51fb0e66
18 changed files with 63 additions and 100 deletions

View File

@@ -218,7 +218,6 @@
<Compile Include="Traits\World\ActorMap.cs" />
<Compile Include="Widgets\HotkeyEntryWidget.cs" />
<Compile Include="Widgets\SpriteWidget.cs" />
<Compile Include="Widgets\SpriteSequenceWidget.cs" />
<Compile Include="Widgets\RGBASpriteWidget.cs" />
<Compile Include="Scripting\ScriptContext.cs" />
<Compile Include="Scripting\ScriptActorInterface.cs" />

View File

@@ -1,65 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2015 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
using System;
using OpenRA.Graphics;
namespace OpenRA.Widgets
{
public class SpriteSequenceWidget : SpriteWidget
{
public string Unit = null;
public string Sequence = null;
public int Frame = 0;
public int Facing = 0;
public Func<Animation> GetAnimation;
public Func<int> GetFacing;
[ObjectCreator.UseCtor]
public SpriteSequenceWidget(WorldRenderer worldRenderer)
: base(worldRenderer)
{
GetAnimation = () => null;
}
public override void Initialize(WidgetArgs args)
{
base.Initialize(args);
if (Unit != null && Sequence != null)
{
var anim = new Animation(WorldRenderer.World, Unit, () => Facing);
anim.PlayFetchIndex(Sequence, () => Frame);
GetAnimation = () => anim;
}
GetSprite = () =>
{
var anim = GetAnimation();
return anim != null ? anim.Image : null;
};
}
protected SpriteSequenceWidget(SpriteSequenceWidget other)
: base(other)
{
Unit = other.Unit;
Sequence = other.Sequence;
Frame = other.Frame;
Facing = other.Facing;
GetAnimation = other.GetAnimation;
GetFacing = other.GetFacing;
}
public override Widget Clone() { return new SpriteSequenceWidget(this); }
}
}