public UIButton(Scene scene, double x, double y, SpriteBase.SpriteFrame free, SpriteBase.SpriteFrame selected, UIElementGroup grp) : base(scene.HUD, x, y, free.Texture) { _Group = grp; _Group.Add(this); _ToFree = new SpriteAnimation(false, false, free); _ToSelected = new SpriteAnimation(false, false, selected); Refresh += (sender, e) => { var animation = this == _Group.ElementFocused ? _ToSelected : _ToFree; _AnimationFrameIndex = _AnimationCurrent == animation ? _AnimationFrameIndex : animation.FrameCount - _AnimationFrameIndex - 1; _AnimationCurrent = animation; }; OnRefresh(this, new EventArgs()); }
public UIButton(Scene scene, double x, double y, SpriteBase.SpriteFrame free) : this(scene, x, y, free, free) { }
public UIButton(Scene scene, double x, double y, SpriteBase.SpriteFrame free, SpriteBase.SpriteFrame selected) : this(scene, x, y, free, selected, new UIElementGroup()) { }