Пример #1
0
        private void ControlEvents_ControllerButtonPressed(object sender, EventArgsControllerButtonPressed e)
        {
            if (e.ButtonPressed.ToString().Equals(CJBCheatsMenu.config.openMenuKey))
            {
                if (Game1.hasLoadedGame && Game1.activeClickableMenu == null && Game1.player.CanMove && !Game1.dialogueUp && !Game1.eventUp)
                {
                    CheatsMenu.Open();
                }
                return;
            }

            if (e.ButtonPressed.ToString().Equals(CJBCheatsMenu.config.freezeTimeKey))
            {
                if (Game1.hasLoadedGame && Game1.activeClickableMenu == null)
                {
                    CJBCheatsMenu.config.freezeTime = !CJBCheatsMenu.config.freezeTime;
                }
                return;
            }

            if (Game1.activeClickableMenu is GameMenu)
            {
                GameMenu menu = (GameMenu)Game1.activeClickableMenu;
                List <IClickableMenu> pages = (List <IClickableMenu>) typeof(GameMenu).GetField("pages", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(menu);

                if (pages[menu.currentTab] is CheatsMenu)
                {
                    pages[menu.currentTab].receiveGamePadButton(e.ButtonPressed);
                }
            }
        }
Пример #2
0
        private void ControlEvents_ControllerButtonPressed(object sender, EventArgsControllerButtonPressed e)
        {
            if (!CJBCheatsMenu.IsLoaded)
            {
                return;
            }

            if (e.ButtonPressed.ToString() == CJBCheatsMenu.Config.OpenMenuKey)
            {
                if (Game1.activeClickableMenu == null && Game1.player.CanMove && !Game1.dialogueUp && !Game1.eventUp)
                {
                    CheatsMenu.Open(0);
                }
                return;
            }

            if (e.ButtonPressed.ToString() == CJBCheatsMenu.Config.FreezeTimeKey)
            {
                if (Game1.activeClickableMenu == null)
                {
                    CJBCheatsMenu.Config.FreezeTime = !CJBCheatsMenu.Config.FreezeTime;
                }
                return;
            }

            if (Game1.activeClickableMenu is GameMenu menu)
            {
                IClickableMenu page = CJBCheatsMenu.Helper.Reflection.GetPrivateValue <List <IClickableMenu> >(menu, "pages")[menu.currentTab];
                if (page is CheatsMenu)
                {
                    page.receiveGamePadButton(e.ButtonPressed);
                }
            }
        }
Пример #3
0
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            if (GameMenu.forcePreventClose)
            {
                return;
            }
            if (this.DownArrow.containsPoint(x, y) && this.CurrentItemIndex < Math.Max(0, this.Options.Count - CheatsMenu.ItemsPerPage))
            {
                this.DownArrowPressed();
                Game1.soundBank.PlayCue("shwip");
            }
            else if (this.UpArrow.containsPoint(x, y) && this.CurrentItemIndex > 0)
            {
                this.UpArrowPressed();
                Game1.soundBank.PlayCue("shwip");
            }
            else if (this.Scrollbar.containsPoint(x, y))
            {
                this.IsScrolling = true;
            }
            else if (!this.DownArrow.containsPoint(x, y) && x > this.xPositionOnScreen + this.width && (x < this.xPositionOnScreen + this.width + Game1.tileSize * 2 && y > this.yPositionOnScreen) && y < this.yPositionOnScreen + this.height)
            {
                this.IsScrolling = true;
                this.leftClickHeld(x, y);
                this.releaseLeftClick(x, y);
            }
            this.CurrentItemIndex = Math.Max(0, Math.Min(this.Options.Count - CheatsMenu.ItemsPerPage, this.CurrentItemIndex));
            for (int index = 0; index < this.OptionSlots.Count; ++index)
            {
                if (this.OptionSlots[index].bounds.Contains(x, y) && this.CurrentItemIndex + index < this.Options.Count && this.Options[this.CurrentItemIndex + index].bounds.Contains(x - this.OptionSlots[index].bounds.X, y - this.OptionSlots[index].bounds.Y - 5))
                {
                    this.Options[this.CurrentItemIndex + index].receiveLeftClick(x - this.OptionSlots[index].bounds.X, y - this.OptionSlots[index].bounds.Y + 5);
                    this.OptionsSlotHeld = index;
                    break;
                }
            }

            for (int i = 0; i < this.Tabs.Count; i++)
            {
                ClickableComponent tab = this.Tabs[i];
                if (tab.bounds.Contains(x, y))
                {
                    this.TabIndex = i;
                    Game1.exitActiveMenu();
                    this.CurrentItemIndex = 0;
                    CheatsMenu.Open(this.TabIndex);
                    break;
                }
            }
        }
Пример #4
0
        public static void onKeyPress(Microsoft.Xna.Framework.Input.Keys key)
        {
            if (key.ToString().Equals(CJBCheatsMenu.config.openMenuKey))
            {
                if (Game1.hasLoadedGame && Game1.activeClickableMenu == null)
                {
                    CheatsMenu.Open();
                }
                return;
            }

            if (key.ToString().Equals(CJBCheatsMenu.config.freezeTimeKey))
            {
                if (Game1.hasLoadedGame && Game1.activeClickableMenu == null)
                {
                    CJBCheatsMenu.config.freezeTime = !CJBCheatsMenu.config.freezeTime;
                }
                return;
            }

            if (key.ToString().Equals(CJBCheatsMenu.config.growTreeKey))
            {
                if (Game1.hasLoadedGame && Game1.activeClickableMenu == null)
                {
                    GrowTree();
                }
                return;
            }

            if (key.ToString().Equals(CJBCheatsMenu.config.growCropsKey))
            {
                if (Game1.hasLoadedGame && Game1.activeClickableMenu == null)
                {
                    GrowCrops();
                }
                return;
            }
        }
Пример #5
0
 public override void receiveGamePadButton(Buttons key)
 {
     if (key == Buttons.LeftShoulder || key == Buttons.RightShoulder)
     {
         if (key == Buttons.LeftShoulder)
         {
             this.TabIndex--;
         }
         if (key == Buttons.RightShoulder)
         {
             this.TabIndex++;
         }
         if (this.TabIndex > 7)
         {
             this.TabIndex = 0;
         }
         if (this.TabIndex < 0)
         {
             this.TabIndex = 7;
         }
         CheatsMenu.Open(this.TabIndex);
     }
 }