protected SceneFirstMenu(PositronGame game) : base(game) { UIGroup = new UIElementGroup(); SceneEntry += (sender, e) => { _Game.SetInputAccepters("Main Menu", new IInputAccepter[] { UIGroup }); }; SceneExit += (sender, e) => { _Game.RemoveInputAccepters("Main Menu"); }; SetupPlayerOnExit(); }
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()); }