コード例 #1
0
        private void Event_MenuChanged(object send, EventArgsClickableMenuChanged e)
        {
            Microsoft.Xna.Framework.Vector2 lastGrabbedTile = Game1.player.lastGrabTile;
            //Log.Debug("M007_ExtendedFridge Event_MenuChanged HIT", new object[0]);

            if (Game1.currentLocation is FarmHouse)
            {
                this.Monitor.Log(String.Format("M007_ExtendedFridge lastGrabTileX:{0} lastGrabTileY:{1}", (int)Game1.player.lastGrabTile.X, (int)Game1.player.lastGrabTile.Y));
            }

            if (ClickedOnFridge())
            {
                IsInFridgeMenu = true;
                if (e.NewMenu is ItemGrabMenu)
                {
                    ItemGrabMenu ptrMenu = (ItemGrabMenu)e.NewMenu;

                    if (_fridge == null)
                    {
                        _fridge = new FridgeChest(config.autoSwitchPageOnGrab);
                        StardewValley.Locations.FarmHouse h = (StardewValley.Locations.FarmHouse)Game1.currentLocation;
                        _fridge.items.AddRange(h.fridge.items);
                    }
                    _fridge.ShowCurrentPage();
                    this.Monitor.Log("M007_ExtendedFridge Fridge HOOKED");
                }
            }
        }
コード例 #2
0
        private void Event_MenuChanged(object send, EventArgsClickableMenuChanged e)
        {
            //Log.Debug("M007_ExtendedFridge Event_MenuChanged HIT", new object[0]);

            /*
             * if (Game1.currentLocation is FarmHouse)
             * {
             *  this.Monitor.Log(String.Format("M007_ExtendedFridge lastGrabTileX:{0} lastGrabTileY:{1}", (int)Game1.player.lastGrabTile.X, (int)Game1.player.lastGrabTile.Y));
             * }*/

            if (ClickedOnFridge())
            {
                //_isInFridgeMenu = true;
                if (e.NewMenu is ItemGrabMenu)
                {
                    if (_fridge == null || _fridge.Items.Count == 0)
                    {
                        _fridge = new FridgeChest(_config.autoSwitchPageOnGrab);
                        FarmHouse h = (FarmHouse)Game1.currentLocation;
                        _fridge.Items.AddRange(h.fridge.Value.items);
                    }
                    _fridge.ShowCurrentPage();
                    // this.Monitor.Log("M007_ExtendedFridge Fridge HOOKED");
                }
            }
            if (e.NewMenu is CraftingPage && Game1.currentLocation is FarmHouse fh)
            {
                if (_fridge != null)
                {
                    fh.fridge.Value.items.Clear();
                    fh.fridge.Value.items.AddRange(_fridge.Items);
                    _fridge.Items.Clear();
                }
            }
        }