Пример #1
0
        public void Update()
        {
            this.mouse    = Mouse.GetState();
            this.keyboard = Keyboard.GetState();

            this.UpdateCursor();

            if (this.keyboard.IsKeyDown(Keys.Enter) && this.previousKeyboard.IsKeyUp(Keys.Enter) &&
                this.controlScreenItems.Count != 0)
            {
                if (this.controlScreenItems[this.selectedEntry].ItemText == "Back")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.MainMenu);
                }
            }

            if (this.mouse.LeftButton == ButtonState.Pressed)
            {
                foreach (var item in this.controlScreenItems)
                {
                    if (this.mouse.X > item.ItemPosition.X && this.mouse.X < item.ItemPosition.X + item.ItemTexture.Bounds.Width &&
                        this.mouse.Y > item.ItemPosition.Y && this.mouse.Y < item.ItemPosition.Y + item.ItemTexture.Bounds.Height)
                    {
                        if (item.ItemText == "Back")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.MainMenu);
                            break;
                        }
                    }
                }
            }

            this.previousKeyboard = this.keyboard;
        }
Пример #2
0
        public void Update()
        {
            this.mouse    = Mouse.GetState();
            this.keyboard = Keyboard.GetState();

            this.UpdateCursor();

            if (this.keyboard.IsKeyDown(Keys.Right) && this.previousKeyboard.IsKeyUp(Keys.Right))
            {
                this.chooseHeroList[this.selectedEntry].Selected = false;
                if (this.selectedEntry < this.chooseHeroList.Count - 1)
                {
                    this.selectedEntry++;
                }

                this.chooseHeroList[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Left) && this.previousKeyboard.IsKeyUp(Keys.Left))
            {
                this.chooseHeroList[this.selectedEntry].Selected = false;
                if (this.selectedEntry > 0)
                {
                    this.selectedEntry--;
                }

                this.chooseHeroList[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Enter) && this.previousKeyboard.IsKeyUp(Keys.Enter))
            {
                if (this.inMenu)
                {
                    HeroName = this.chooseHeroList[this.selectedEntry].ItemText;
                    Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                }
            }

            if (this.previousMouse.LeftButton == ButtonState.Released && this.mouse.LeftButton == ButtonState.Pressed)
            {
                foreach (var item in this.chooseHeroList)
                {
                    if (this.mouse.X > item.ItemPosition.X && this.mouse.X < item.ItemPosition.X + item.ItemTexture.Bounds.Width &&
                        this.mouse.Y > item.ItemPosition.Y && this.mouse.Y < item.ItemPosition.Y + item.ItemTexture.Bounds.Height)
                    {
                        HeroName = item.ItemText;
                        Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                    }
                }
            }

            this.previousMouse    = this.mouse;
            this.previousKeyboard = this.keyboard;
            this.inMenu           = true;
        }
Пример #3
0
        public void Update()
        {
            this.mouse    = Mouse.GetState();
            this.keyboard = Keyboard.GetState();

            this.UpdateCursor();

            if (this.keyboard.IsKeyDown(Keys.Down) && this.previousKeyboard.IsKeyUp(Keys.Down))
            {
                PMainMenuItems[this.selectedEntry].Selected = false;
                if (this.selectedEntry < PMainMenuItems.Count - 1)
                {
                    this.selectedEntry++;
                }

                PMainMenuItems[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Up) && this.previousKeyboard.IsKeyUp(Keys.Up))
            {
                PMainMenuItems[this.selectedEntry].Selected = false;
                if (this.selectedEntry > 0)
                {
                    this.selectedEntry--;
                }

                PMainMenuItems[this.selectedEntry].Selected = true;
            }

            if (this.keyboard.IsKeyDown(Keys.Enter) && this.previousKeyboard.IsKeyUp(Keys.Enter))
            {
                if (PMainMenuItems[this.selectedEntry].ItemText == "NEW GAME")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.ChooseHeroWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "RESUME GAME")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "CONTROLS")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.ControlWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "ABOUT")
                {
                    Rpg.ActiveWindowSet(EnumActiveWindow.AboutWindow);
                }

                if (PMainMenuItems[this.selectedEntry].ItemText == "EXIT GAME")
                {
                    Environment.Exit(1);
                }
            }

            if (this.previousMouse.LeftButton == ButtonState.Released && this.mouse.LeftButton == ButtonState.Pressed)
            {
                foreach (var item in PMainMenuItems)
                {
                    if (this.mouse.X > item.ItemPosition.X && this.mouse.X < item.ItemPosition.X + item.ItemTexture.Bounds.Width &&
                        this.mouse.Y > item.ItemPosition.Y && this.mouse.Y < item.ItemPosition.Y + item.ItemTexture.Bounds.Height)
                    {
                        if (item.ItemText == "NEW GAME")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.ChooseHeroWindow);
                            break;
                        }

                        if (item.ItemText == "RESUME GAME")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.GameWindow);
                            break;
                        }

                        if (item.ItemText == "CONTROLS")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.ControlWindow);
                            break;
                        }

                        if (item.ItemText == "ABOUT")
                        {
                            Rpg.ActiveWindowSet(EnumActiveWindow.AboutWindow);
                            break;
                        }

                        if (item.ItemText == "EXIT GAME")
                        {
                            Environment.Exit(1);
                        }
                    }
                }
            }

            this.previousKeyboard = this.keyboard;
            this.previousMouse    = this.mouse;
        }