Beispiel #1
0
        public void Update(ListPage page)
        {
            if (CompareF.RectangleVsVector2(Boundary, MouseInput.MouseRealPosMenu()) == true)
            {
                if (_state != ListItemStatesEnum.selected)
                {
                    _state = ListItemStatesEnum.hover;
                }
                if (MouseInput.MouseStateNew.LeftButton == ButtonState.Released && MouseInput.MouseStateOld.LeftButton == ButtonState.Pressed)
                {
                    page.CloseOthers(this);
                    _state = ListItemStatesEnum.selected;
                }
            }
            else
            {
                if (_state != ListItemStatesEnum.selected)
                {
                    _state = ListItemStatesEnum.none;
                }
            }

            if (_state == ListItemStatesEnum.selected)
            {
                foreach (Keys key in Enum.GetValues(typeof(Keys)))
                {
                    if (KeyboardInput.KeyboardStateNew.IsKeyDown(key))
                    {
                        Game1.STP.ControlKeys[_key] = key;
                        _state = ListItemStatesEnum.none;
                    }
                }
            }
        }
Beispiel #2
0
        private UIControlsMenu() : base()
        {
            BtnBack = new Button(new Vector2(Globals.ButtonXPos, Globals.BackButtonPosY), "BACK", onBack, Globals.ChangeWindowTo, "Options", type: ButtonType.back);
            list    = new ListPage(new RectangleF(512 + 256 + 32, 512 + 256 + 192, 512 + 64, 64));

            int index = 0;

            foreach (KeyValuePair <string, Keys> key in Game1.STP.ControlKeys)
            {
                list._items.Add(new ListItemClassic(key.Key, index, new RectangleF(736, 30, 32 + list.Boundary.Position.X, (index * 32) + list.Boundary.Position.Y)));
                index++;
            }
        }