Exemplo n.º 1
0
 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());
 }
Exemplo n.º 2
0
 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());
 }