Beispiel #1
0
        public override void Update(float dt)
        {
            base.Update(dt);

            var selected = Selected == Id;

            if (selected)
            {
                SelectedInstance = this;
            }

            if (wasSelected && !selected)
            {
                Tween.To(UiLabel.DefaultTint, Tint, x => Tint = x, 0.1f);
                Tween.To(1f, scale, x => scale = x, 0.1f);
            }
            else if (selected && !wasSelected)
            {
                Tween.To(1, Tint, x => Tint = x, 0.1f);
                Tween.To(1 + ScaleMod * 0.2f, scale, x => scale = x, 0.1f);
            }

            if (selected && Input.WasPressed(Controls.UiSelect, GamepadComponent.Current, true))
            {
                OnClick();
            }

            wasSelected = selected;
        }
Beispiel #2
0
        protected override void OnUnhover()
        {
            if (GamepadComponent.Current == null && Selected == Id)
            {
                Selected         = -1;
                SelectedInstance = null;
            }

            if (Selected != Id)
            {
                base.OnUnhover();
            }
        }
Beispiel #3
0
        protected override void OnHover()
        {
            if (Selected != Id)
            {
                if (SelectedInstance == null && Type != ButtonType.Slider)
                {
                    SelectedInstance = this;
                    Selected         = Id;
                }
                else
                {
                    base.OnHover();
                    return;
                }
            }

            PlaySfx("ui_moving");
        }