SetPressed() публичный Метод

public SetPressed ( bool pressed_, bool toggle = true ) : void
pressed_ bool
toggle bool
Результат void
Пример #1
0
        private void UpdateButton(Button button, bool sel)
        {
            if (current == -1)
            {
                if (button.Collide(Mouse.GetState().Position.X, Mouse.GetState().Position.Y))
                {
                    if (Mouse.GetState().LeftButton == ButtonState.Pressed)
                    {
                        button.SetPressed(true);
                    }
                    else
                    {
                        if (button.IsPressed())
                        {
                            Audio.GetInstance().Play(Load<SoundEffect>("Audio/buttonClick"));
                        }
                        button.SetPressed(false);
                    }

                    if (startHovering)
                    {
                        Audio.GetInstance().Play(Load<SoundEffect>("Audio/buttonHover"));
                        startHovering = false;
                    }

                    hovering = true;
                }
            }
            else
            {
                startHovering = true;

                if (sel && buttonPressed && !input.select())
                {
                    Audio.GetInstance().Play(Load<SoundEffect>("Audio/buttonClick"));
                    button.SetPressed(false);
                }
                else if (sel)
                {
                    button.SetPressed(true);
                }
                else
                {
                    button.SetPressed(false, false);
                }
            }
        }