예제 #1
0
        public MenuWithInventory(InventoryMenu.highlightThisItem highlighterMethod = null, bool okButton = false, bool trashCan = false, int inventoryXOffset = 0, int inventoryYOffset = 0) : base(Game1.viewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2 + Game1.tileSize, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2, false)
        {
            if (this.yPositionOnScreen < IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder)
            {
                this.yPositionOnScreen = IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder;
            }
            if (this.xPositionOnScreen < 0)
            {
                this.xPositionOnScreen = 0;
            }
            int yPosition = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 - Game1.tileSize / 4 + inventoryYOffset;

            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 + inventoryXOffset, yPosition, false, null, highlighterMethod, -1, 3, 0, 0, true);
            if (okButton)
            {
                this.okButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false)
                {
                    myID           = 4857,
                    upNeighborID   = 5948,
                    leftNeighborID = 12
                };
            }
            if (trashCan)
            {
                this.trashCan = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - Game1.tileSize / 2 - IClickableMenu.borderWidth - 104, Game1.tileSize, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom, false)
                {
                    myID           = 5948,
                    downNeighborID = 4857,
                    leftNeighborID = 12,
                    upNeighborID   = 106
                };
            }
        }
예제 #2
0
        public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
        {
            base.gameWindowSizeChanged(oldBounds, newBounds);
            if (yPositionOnScreen < IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder)
            {
                yPositionOnScreen = IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder;
            }
            if (xPositionOnScreen < 0)
            {
                xPositionOnScreen = 0;
            }
            int    yPositionForInventory = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + 192 - 16;
            string move_item_sound       = inventory.moveItemSound;

            inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2, yPositionForInventory, playerInventory: false, null, inventory.highlightMethod);
            inventory.moveItemSound = move_item_sound;
            if (okButton != null)
            {
                okButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - IClickableMenu.borderWidth, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f);
            }
            if (trashCan != null)
            {
                trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - 32 - IClickableMenu.borderWidth - 104, 64, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), 4f);
            }
        }
예제 #3
0
        public MachineInventory(Revitalize.Objects.Machines.Machine Machine, List <Item> InputInventory, List <Item> OutputInventory, int rows) : base(null, true, true, 0, 0)
        {
            machine = Machine;
            Rows    = rows;
            //Log.AsyncC(InputInventory.Capacity);
            this.inputInventory  = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, InputInventory, null, 9, 3, 0, 0, true);
            this.outputInventory = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize * 8, this.yPositionOnScreen, false, OutputInventory, null, 9, 3, 0, 0, true);
            //Log.AsyncM(this.inputInventory.actualInventory.Capacity);
            this.inputInventory.capacity  = 9;
            this.outputInventory.capacity = 9;
            this.inputInventory.actualInventory.Capacity  = 9;
            this.outputInventory.actualInventory.Capacity = 9;
            //  Log.AsyncO("MAX LOAD"+this.capacity);
            this.reverseGrab = true;

            this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false);


            TextureDataNode d;

            Dictionaries.spriteFontList.TryGetValue("leftArrow", out d);
            TextureDataNode f;

            Dictionaries.spriteFontList.TryGetValue("rightArrow", out f);
            this.LeftButton  = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 3, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), d.texture, new Rectangle(0, 0, 16, 16), 4f, false);
            this.RightButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), f.texture, new Rectangle(0, 0, 16, 16), 4f, false);
            this.inventory.showGrayedOutSlots = true;
        }
예제 #4
0
        public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
        {
            base.gameWindowSizeChanged(oldBounds, newBounds);
            geodeSpot = new ClickableComponent(new Rectangle(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 4, 560, 308), "Anvil");
            int yPositionForInventory = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + 192 - 16 + 128 + 4;

            inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 + 12, yPositionForInventory, playerInventory: false, null, inventory.highlightMethod);
        }
예제 #5
0
        public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
        {
            base.gameWindowSizeChanged(oldBounds, newBounds);
            int containerWidth = 64 * (ItemsToGrabMenu.capacity / ItemsToGrabMenu.rows);

            _ = ItemsToGrabMenu.rows;
            ItemsToGrabMenu = new InventoryMenu(Game1.uiViewport.Width / 2 - containerWidth / 2, yPositionOnScreen + 64, playerInventory: false, ItemsToGrabMenu.actualInventory, null, ItemsToGrabMenu.capacity, ItemsToGrabMenu.rows);
        }
예제 #6
0
        public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
        {
            base.gameWindowSizeChanged(oldBounds, newBounds);
            int yPositionForInventory = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + 192 - 16 + 128 + 4;

            inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 + 12, yPositionForInventory, playerInventory: false, null, inventory.highlightMethod);
            _CreateButtons();
        }
예제 #7
0
        public StorageContainer(List <Item> inventory, int capacity, int rows = 3, StorageContainer.behaviorOnItemChange itemChangeBehavior = null, StardewValley.Menus.InventoryMenu.highlightThisItem highlightMethod = null) : base(highlightMethod, true, true, 0, 0)
        {
            this.itemChangeBehavior = itemChangeBehavior;
            int num      = Game1.tileSize * (capacity / rows);
            int arg_23_0 = Game1.tileSize;
            int arg_2B_0 = Game1.tileSize / 4;

            this.ItemsToGrabMenu = new StardewValley.Menus.InventoryMenu(Game1.viewport.Width / 2 - num / 2, this.yPositionOnScreen + Game1.tileSize, false, inventory, null, capacity, rows, 0, 0, true);
        }
예제 #8
0
        public MachineInventory(Revitalize.Objects.Machines.Machine Machine, List <Item> InputInventory, List <Item> OutputInventory, int rows, bool reverseGrab, bool showReceivingMenu, InventoryMenu.highlightThisItem highlightFunction, MachineInventory.behaviorOnItemSelect behaviorOnItemSelectFunction, string message, MachineInventory.behaviorOnItemSelect behaviorOnItemGrab = null, bool snapToBottom = false, bool canBeExitedWithKey = false, bool playRightClickSound = true, bool allowRightClick = true, bool showOrganizeButton = false, int source = 0, Item sourceItem = null) : base(highlightFunction, true, true, 0, 0)
        {
            this.machine                      = Machine;
            this.source                       = source;
            this.message                      = message;
            this.reverseGrab                  = reverseGrab;
            this.showReceivingMenu            = showReceivingMenu;
            this.playRightClickSound          = playRightClickSound;
            this.allowRightClick              = allowRightClick;
            this.inventory.showGrayedOutSlots = true;
            this.sourceItem                   = sourceItem;
            this.Rows = rows;

            if (source == 1 && sourceItem != null && sourceItem is Chest)
            {
                this.chestColorPicker = new DiscreteColorPicker(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize - IClickableMenu.borderWidth * 2, 0, new Chest(true));
                this.chestColorPicker.colorSelection = this.chestColorPicker.getSelectionFromColor((sourceItem as Chest).playerChoiceColor);
                (this.chestColorPicker.itemToDrawColored as Chest).playerChoiceColor = this.chestColorPicker.getColorFromSelection(this.chestColorPicker.colorSelection);
                this.colorPickerToggleButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + Game1.tileSize + Game1.pixelZoom * 5, 16 * Game1.pixelZoom, 16 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(119, 469, 16, 16), (float)Game1.pixelZoom, false)
                {
                    hoverText = Game1.content.LoadString("Strings\\UI:Toggle_ColorPicker", new object[0])
                };
            }
            if (snapToBottom)
            {
                base.movePosition(0, Game1.viewport.Height - (this.yPositionOnScreen + this.height - IClickableMenu.spaceToClearTopBorder));
                this.snappedtoBottom = true;
            }
            this.inputInventory  = new InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, InputInventory, highlightFunction, 9, 3, 0, 0, true);
            this.outputInventory = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize * 8, this.yPositionOnScreen, false, OutputInventory, null, 9, 3, 0, 0, true);
            //Log.AsyncM(this.inputInventory.actualInventory.Capacity);
            this.inputInventory.capacity = 9;
            this.inputInventory.capacity = 9;
            this.inputInventory.actualInventory.Capacity  = 9;
            this.outputInventory.actualInventory.Capacity = 9;
            this.behaviorFunction   = behaviorOnItemSelectFunction;
            this.behaviorOnItemGrab = behaviorOnItemGrab;
            this.canExitOnKey       = canBeExitedWithKey;
            if (showOrganizeButton)
            {
                this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false);
            }
            if ((Game1.isAnyGamePadButtonBeingPressed() || !Game1.lastCursorMotionWasMouse) && this.inputInventory.actualInventory.Count > 0 && Game1.activeClickableMenu == null)
            {
                Game1.setMousePosition(this.inventory.inventory[0].bounds.Center);
            }
            TextureDataNode d;

            Dictionaries.spriteFontList.TryGetValue("leftArrow", out d);
            TextureDataNode f;

            Dictionaries.spriteFontList.TryGetValue("rightArrow", out f);
            this.LeftButton  = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 3, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), d.texture, new Rectangle(0, 0, 16, 16), 4f, false);
            this.RightButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), f.texture, new Rectangle(0, 0, 16, 16), 4f, false);
        }
예제 #9
0
        public QuestContainerMenu(IList <Item> inventory, int rows = 3, InventoryMenu.highlightThisItem highlight_method = null, Func <Item, int> stack_capacity_check = null, Action on_item_changed = null, Action on_confirm = null)
            : base(highlight_method, okButton: true)
        {
            onItemChanged = (Action)Delegate.Combine(onItemChanged, on_item_changed);
            onConfirm     = (Action)Delegate.Combine(onConfirm, on_confirm);
            int capacity       = inventory.Count;
            int containerWidth = 64 * (capacity / rows);

            ItemsToGrabMenu    = new InventoryMenu(Game1.uiViewport.Width / 2 - containerWidth / 2, yPositionOnScreen + 64, playerInventory: false, inventory, null, capacity, rows);
            stackCapacityCheck = stack_capacity_check;
            for (int j = 0; j < ItemsToGrabMenu.actualInventory.Count; j++)
            {
                if (j >= ItemsToGrabMenu.actualInventory.Count - ItemsToGrabMenu.capacity / ItemsToGrabMenu.rows)
                {
                    ItemsToGrabMenu.inventory[j].downNeighborID = j + 53910;
                }
            }
            for (int i = 0; i < base.inventory.inventory.Count; i++)
            {
                base.inventory.inventory[i].myID = i + 53910;
                if (base.inventory.inventory[i].downNeighborID != -1)
                {
                    base.inventory.inventory[i].downNeighborID += 53910;
                }
                if (base.inventory.inventory[i].rightNeighborID != -1)
                {
                    base.inventory.inventory[i].rightNeighborID += 53910;
                }
                if (base.inventory.inventory[i].leftNeighborID != -1)
                {
                    base.inventory.inventory[i].leftNeighborID += 53910;
                }
                if (base.inventory.inventory[i].upNeighborID != -1)
                {
                    base.inventory.inventory[i].upNeighborID += 53910;
                }
                if (i < 12)
                {
                    base.inventory.inventory[i].upNeighborID = ItemsToGrabMenu.actualInventory.Count - ItemsToGrabMenu.capacity / ItemsToGrabMenu.rows;
                }
                foreach (ClickableComponent item in base.inventory.GetBorder(InventoryMenu.BorderSide.Right))
                {
                    item.rightNeighborID = okButton.myID;
                }
            }
            dropItemInvisibleButton.myID = -500;
            ItemsToGrabMenu.dropItemInvisibleButton.myID = -500;
            populateClickableComponentList();
            if (Game1.options.SnappyMenus)
            {
                setCurrentlySnappedComponentTo(53910);
                snapCursorToCurrentSnappedComponent();
            }
        }
예제 #10
0
        public ItemGrabMenu(List <Item> inventory, int rows) : base(null, true, true, 0, 0)
        {
            Rows = rows;
            this.ItemsToGrabMenu = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, null, inventory.Capacity, Rows, 0, 0, true);
            capacity             = inventory.Capacity;
            //  Log.AsyncO("MAX LOAD"+this.capacity);
            this.reverseGrab = true;

            this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false);

            this.inventory.showGrayedOutSlots = true;
        }
예제 #11
0
 public ItemGrabMenu(List <Item> inventory)
     : base((InventoryMenu.highlightThisItem)null, true, true, 0, 0)
 {
     this.ItemsToGrabMenu = new InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, (InventoryMenu.highlightThisItem)null, -1, 3, 0, 0, true);
     this.trashCan.myID   = 106;
     this.ItemsToGrabMenu.populateClickableComponentList();
     for (int index = 0; index < this.ItemsToGrabMenu.inventory.Count; ++index)
     {
         if (this.ItemsToGrabMenu.inventory[index] != null)
         {
             this.ItemsToGrabMenu.inventory[index].myID            += 53910;
             this.ItemsToGrabMenu.inventory[index].upNeighborID    += 53910;
             this.ItemsToGrabMenu.inventory[index].rightNeighborID += 53910;
             this.ItemsToGrabMenu.inventory[index].downNeighborID   = -7777;
             this.ItemsToGrabMenu.inventory[index].leftNeighborID  += 53910;
             this.ItemsToGrabMenu.inventory[index].fullyImmutable   = true;
         }
     }
     if (Game1.options.SnappyMenus)
     {
         for (int index = 0; index < 12; ++index)
         {
             if (this.inventory != null && this.inventory.inventory != null && this.inventory.inventory.Count >= 12)
             {
                 this.inventory.inventory[index].upNeighborID = this.shippingBin ? 12598 : -7777;
             }
         }
         if (!this.shippingBin)
         {
             for (int index = 0; index < 36; ++index)
             {
                 if (this.inventory != null && this.inventory.inventory != null && this.inventory.inventory.Count > index)
                 {
                     this.inventory.inventory[index].upNeighborID        = -7777;
                     this.inventory.inventory[index].upNeighborImmutable = true;
                 }
             }
         }
         if (this.trashCan != null)
         {
             this.trashCan.leftNeighborID = 11;
         }
         if (this.okButton != null)
         {
             this.okButton.leftNeighborID = 11;
         }
         this.populateClickableComponentList();
         this.snapToDefaultClickableComponent();
     }
     this.inventory.showGrayedOutSlots = true;
 }
        public CustomCraftingMenu(int x, int y, int width, int height,
                                  List <Chest> material_containers,
                                  List <string> craftingRecipes, List <string> cookingRecipes)
            : base(x, y, width, height)
        {
            inventory = new InventoryMenu(xPositionOnScreen + spaceToClearSideBorder + borderWidth, yPositionOnScreen + spaceToClearTopBorder + borderWidth + 320 - 16, playerInventory: false);
            inventory.showGrayedOutSlots   = true;
            currentPageClickableComponents = new List <ClickableComponent>();
            foreach (ClickableComponent item in inventory.GetBorder(InventoryMenu.BorderSide.Top))
            {
                item.upNeighborID = -99998;
            }
            _materialContainers = material_containers;
            _ = _materialContainers;
            initializeUpperRightCloseButton();
            trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - 32 - borderWidth - 104, 64, 104), Game1.mouseCursors, new Rectangle(564 + Game1.player.trashCanLevel * 18, 102, 18, 26), 4f)
            {
                myID = 106
            };
            dropItemInvisibleButton = new ClickableComponent(new Rectangle(xPositionOnScreen - borderWidth - spaceToClearSideBorder - 64, trashCan.bounds.Y, 64, 64), "")
            {
                myID            = 107,
                rightNeighborID = 0
            };
            List <string> playerRecipes = new List <string>();

            Game1.playSound("bigSelect");
            layoutRecipes(craftingRecipes, cookingRecipes);
            if (pagesOfCraftingRecipes.Count > 1)
            {
                upButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 768 + 32, craftingPageY(), 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 12), 0.8f)
                {
                    myID            = 88,
                    downNeighborID  = 89,
                    rightNeighborID = 106,
                    leftNeighborID  = -99998
                };
                downButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 768 + 32, craftingPageY() + 192 + 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 11), 0.8f)
                {
                    myID            = 89,
                    upNeighborID    = 88,
                    rightNeighborID = 106,
                    leftNeighborID  = -99998
                };
            }
            _UpdateCurrentPageButtons();
            if (Game1.options.SnappyMenus)
            {
                snapToDefaultClickableComponent();
            }
        }
예제 #13
0
        public StorageContainer(IList <Item> inventory, int capacity, int rows = 3, behaviorOnItemChange itemChangeBehavior = null, InventoryMenu.highlightThisItem highlightMethod = null)
            : base(highlightMethod, okButton: true, trashCan: true)
        {
            this.itemChangeBehavior = itemChangeBehavior;
            int containerWidth = 64 * (capacity / rows);

            ItemsToGrabMenu = new InventoryMenu(Game1.uiViewport.Width / 2 - containerWidth / 2, yPositionOnScreen + 64, playerInventory: false, inventory, null, capacity, rows);
            for (int j = 0; j < ItemsToGrabMenu.actualInventory.Count; j++)
            {
                if (j >= ItemsToGrabMenu.actualInventory.Count - ItemsToGrabMenu.capacity / ItemsToGrabMenu.rows)
                {
                    ItemsToGrabMenu.inventory[j].downNeighborID = j + 53910;
                }
            }
            for (int i = 0; i < base.inventory.inventory.Count; i++)
            {
                base.inventory.inventory[i].myID = i + 53910;
                if (base.inventory.inventory[i].downNeighborID != -1)
                {
                    base.inventory.inventory[i].downNeighborID += 53910;
                }
                if (base.inventory.inventory[i].rightNeighborID != -1)
                {
                    base.inventory.inventory[i].rightNeighborID += 53910;
                }
                if (base.inventory.inventory[i].leftNeighborID != -1)
                {
                    base.inventory.inventory[i].leftNeighborID += 53910;
                }
                if (base.inventory.inventory[i].upNeighborID != -1)
                {
                    base.inventory.inventory[i].upNeighborID += 53910;
                }
                if (i < 12)
                {
                    base.inventory.inventory[i].upNeighborID = ItemsToGrabMenu.actualInventory.Count - ItemsToGrabMenu.capacity / ItemsToGrabMenu.rows;
                }
            }
            dropItemInvisibleButton.myID = -500;
            ItemsToGrabMenu.dropItemInvisibleButton.myID = -500;
            if (Game1.options.SnappyMenus)
            {
                populateClickableComponentList();
                setCurrentlySnappedComponentTo(53910);
                snapCursorToCurrentSnappedComponent();
            }
        }
예제 #14
0
 public InventoryPage(int x, int y, int width, int height) : base(x, y, width, height, false)
 {
     this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth, true, null, null, -1, 3, 0, 0, true);
     this.equipmentIcons.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Hat")
     {
         myID                = 101,
         downNeighborID      = 102,
         upNeighborID        = Game1.player.MaxItems - 12,
         rightNeighborID     = 105,
         upNeighborImmutable = true
     });
     this.equipmentIcons.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 5 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Left Ring")
     {
         myID            = 102,
         downNeighborID  = 103,
         rightNeighborID = 105
     });
     this.equipmentIcons.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 6 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Right Ring")
     {
         myID            = 103,
         downNeighborID  = 104,
         rightNeighborID = 105
     });
     this.equipmentIcons.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 7 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Boots")
     {
         myID            = 104,
         rightNeighborID = 105
     });
     this.portrait = new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 - Game1.tileSize + Game1.tileSize / 2, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - 8 + Game1.tileSize, Game1.tileSize, Game1.tileSize * 3 / 2), "32");
     this.trashCan = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width / 3 + Game1.tileSize * 9 + Game1.tileSize / 2, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 3 * Game1.tileSize + Game1.tileSize, Game1.tileSize, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom, false)
     {
         myID           = 105,
         upNeighborID   = 106,
         leftNeighborID = 101
     };
     this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + width, this.yPositionOnScreen + height / 3 - Game1.tileSize + Game1.pixelZoom * 2, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false)
     {
         myID           = 106,
         downNeighborID = 105,
         leftNeighborID = 11,
         upNeighborID   = 898
     };
     if (Utility.findHorse() != null)
     {
         this.horseName = Utility.findHorse().displayName;
     }
 }
예제 #15
0
        public StorageContainer(List <Item> inventory, int capacity, int rows = 3, StorageContainer.behaviorOnItemChange itemChangeBehavior = null, InventoryMenu.highlightThisItem highlightMethod = null)
            : base(highlightMethod, true, true, 0, 0)
        {
            this.itemChangeBehavior = itemChangeBehavior;
            int num1     = Game1.tileSize * (capacity / rows);
            int tileSize = Game1.tileSize;
            int num2     = Game1.tileSize / 4;

            this.ItemsToGrabMenu = new InventoryMenu(Game1.viewport.Width / 2 - num1 / 2, this.yPositionOnScreen + Game1.tileSize, false, inventory, (InventoryMenu.highlightThisItem)null, capacity, rows, 0, 0, true);
            for (int index = 0; index < this.ItemsToGrabMenu.actualInventory.Count; ++index)
            {
                if (index >= this.ItemsToGrabMenu.actualInventory.Count - this.ItemsToGrabMenu.capacity / this.ItemsToGrabMenu.rows)
                {
                    this.ItemsToGrabMenu.inventory[index].downNeighborID = index + 53910;
                }
            }
            for (int index = 0; index < this.inventory.inventory.Count; ++index)
            {
                this.inventory.inventory[index].myID = index + 53910;
                if (this.inventory.inventory[index].downNeighborID != -1)
                {
                    this.inventory.inventory[index].downNeighborID += 53910;
                }
                if (this.inventory.inventory[index].rightNeighborID != -1)
                {
                    this.inventory.inventory[index].rightNeighborID += 53910;
                }
                if (this.inventory.inventory[index].leftNeighborID != -1)
                {
                    this.inventory.inventory[index].leftNeighborID += 53910;
                }
                if (this.inventory.inventory[index].upNeighborID != -1)
                {
                    this.inventory.inventory[index].upNeighborID += 53910;
                }
                if (index < 12)
                {
                    this.inventory.inventory[index].upNeighborID = this.ItemsToGrabMenu.actualInventory.Count - this.ItemsToGrabMenu.capacity / this.ItemsToGrabMenu.rows;
                }
            }
        }
예제 #16
0
        public MenuWithInventory(InventoryMenu.highlightThisItem highlighterMethod = null, bool okButton = false, bool trashCan = false, int inventoryXOffset = 0, int inventoryYOffset = 0, int menuOffsetHack = 0)
            : base(Game1.uiViewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.uiViewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2 + menuOffsetHack, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2)
        {
            if (yPositionOnScreen < IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder)
            {
                yPositionOnScreen = IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder;
            }
            if (xPositionOnScreen < 0)
            {
                xPositionOnScreen = 0;
            }
            int yPositionForInventory = yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + 192 - 16 + inventoryYOffset;

            inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 + inventoryXOffset, yPositionForInventory, playerInventory: false, null, highlighterMethod);
            if (okButton)
            {
                this.okButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - IClickableMenu.borderWidth, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
                {
                    myID           = 4857,
                    upNeighborID   = 5948,
                    leftNeighborID = 12
                };
            }
            if (trashCan)
            {
                this.trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - 32 - IClickableMenu.borderWidth - 104, 64, 104), Game1.mouseCursors, new Rectangle(564 + Game1.player.trashCanLevel * 18, 102, 18, 26), 4f)
                {
                    myID           = 5948,
                    downNeighborID = 4857,
                    leftNeighborID = 12,
                    upNeighborID   = 106
                };
            }
            dropItemInvisibleButton = new ClickableComponent(new Rectangle(xPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 128, yPositionForInventory - 12, 64, 64), "")
            {
                myID            = 107,
                rightNeighborID = 0
            };
        }
예제 #17
0
        public CataloguePage(int x, int y, int width, int height, GameMenu parent)
            : base(x, y, width, height)
        {
            this.parent            = parent;
            buildingPlacementTiles = Game1.content.Load <Texture2D>("LooseSprites\\buildingPlacementTiles");
            widthToMoveActiveTab   = 8;
            blueprintButtonMargin  = 32;
            inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + 320 - 16, playerInventory: false);
            sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen - 48 + widthToMoveActiveTab, yPositionOnScreen + 128, 64, 64), "", "Buildings", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 4), 1f));
            sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen - 48, yPositionOnScreen + 192, 64, 64), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10138"), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 5), 1f));
            sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen - 48, yPositionOnScreen + 256, 64, 64), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10139"), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 8), 1f));
            sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen - 48, yPositionOnScreen + 320, 64, 64), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10140"), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 6), 1f));
            for (int j = 0; j < 4; j++)
            {
                blueprintButtons.Add(new Dictionary <ClickableComponent, BluePrint>());
            }
            int widthOfBlueprintSpace = 512;

            int[] rowWidthTally = new int[4];
            for (int i = 0; i < Game1.player.blueprints.Count; i++)
            {
                BluePrint print = new BluePrint(Game1.player.blueprints[i]);
                if (canPlaceThisBuildingOnTheCurrentMap(print, Game1.currentLocation))
                {
                    print.canBuildOnCurrentMap = true;
                }
                int tabNumber = getTabNumberFromName(print.blueprintType);
                if (print.blueprintType != null)
                {
                    int printWidth = (int)((float)Math.Max(print.tilesWidth, 4) / 4f * 64f) + blueprintButtonMargin;
                    if (rowWidthTally[tabNumber] % (widthOfBlueprintSpace - IClickableMenu.borderWidth * 2) + printWidth > widthOfBlueprintSpace - IClickableMenu.borderWidth * 2)
                    {
                        rowWidthTally[tabNumber] += widthOfBlueprintSpace - IClickableMenu.borderWidth * 2 - rowWidthTally[tabNumber] % (widthOfBlueprintSpace - IClickableMenu.borderWidth * 2);
                    }
                    blueprintButtons[Math.Min(3, tabNumber)].Add(new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(x + IClickableMenu.borderWidth + rowWidthTally[tabNumber] % (widthOfBlueprintSpace - IClickableMenu.borderWidth * 2), y + IClickableMenu.borderWidth + rowWidthTally[tabNumber] / (widthOfBlueprintSpace - IClickableMenu.borderWidth * 2) * 64 * 2 + 64, printWidth, 128), print.name), print);
                    rowWidthTally[tabNumber] += printWidth;
                }
            }
        }
예제 #18
0
        public ExpandableItemGrabMenu(Revitalize.Objects.Generic.ExpandableInventoryObject ExpandableObject, List <Item> inventory, int rows) : base(null, true, true, 0, 0)
        {
            expandableObject     = ExpandableObject;
            Rows                 = rows;
            this.ItemsToGrabMenu = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, null, inventory.Capacity, Rows, 0, 0, true);
            capacity             = inventory.Capacity;
            //  Log.AsyncO("MAX LOAD"+this.capacity);
            this.reverseGrab = true;

            this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false);


            TextureDataNode d;

            Dictionaries.spriteFontList.TryGetValue("leftArrow", out d);
            TextureDataNode f;

            Dictionaries.spriteFontList.TryGetValue("rightArrow", out f);
            this.LeftButton  = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 3, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), d.texture, new Rectangle(0, 0, 16, 16), 4f, false);
            this.RightButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), f.texture, new Rectangle(0, 0, 16, 16), 4f, false);
            this.inventory.showGrayedOutSlots = true;
        }
예제 #19
0
        public CataloguePage(int x, int y, int width, int height, GameMenu parent)
            : base(x, y, width, height, false)
        {
            this.parent = parent;
            this.buildingPlacementTiles         = Game1.content.Load <Texture2D>("LooseSprites\\buildingPlacementTiles");
            CataloguePage.widthToMoveActiveTab  = Game1.tileSize / 8;
            CataloguePage.blueprintButtonMargin = Game1.tileSize / 2;
            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 5 - Game1.tileSize / 4, false, (List <Item>)null, (InventoryMenu.highlightThisItem)null, -1, 3, 0, 0, true);
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4 + CataloguePage.widthToMoveActiveTab, this.yPositionOnScreen + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), "", "Buildings", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 4, -1, -1), 1f, false));
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 3, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10138"), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 5, -1, -1), 1f, false));
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 4, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10139"), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 8, -1, -1), 1f, false));
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 5, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10140"), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 6, -1, -1), 1f, false));
            for (int index = 0; index < 4; ++index)
            {
                this.blueprintButtons.Add(new Dictionary <ClickableComponent, BluePrint>());
            }
            int num = Game1.tileSize * 8;

            int[] numArray = new int[4];
            for (int index = 0; index < Game1.player.blueprints.Count; ++index)
            {
                BluePrint structureToPlace = new BluePrint(Game1.player.blueprints[index]);
                if (CataloguePage.canPlaceThisBuildingOnTheCurrentMap(structureToPlace, Game1.currentLocation))
                {
                    structureToPlace.canBuildOnCurrentMap = true;
                }
                int tabNumberFromName = this.getTabNumberFromName(structureToPlace.blueprintType);
                if (structureToPlace.blueprintType != null)
                {
                    int width1 = (int)((double)Math.Max(structureToPlace.tilesWidth, 4) / 4.0 * (double)Game1.tileSize) + CataloguePage.blueprintButtonMargin;
                    if (numArray[tabNumberFromName] % (num - IClickableMenu.borderWidth * 2) + width1 > num - IClickableMenu.borderWidth * 2)
                    {
                        numArray[tabNumberFromName] += num - IClickableMenu.borderWidth * 2 - numArray[tabNumberFromName] % (num - IClickableMenu.borderWidth * 2);
                    }
                    this.blueprintButtons[Math.Min(3, tabNumberFromName)].Add(new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(x + IClickableMenu.borderWidth + numArray[tabNumberFromName] % (num - IClickableMenu.borderWidth * 2), y + IClickableMenu.borderWidth + numArray[tabNumberFromName] / (num - IClickableMenu.borderWidth * 2) * Game1.tileSize * 2 + Game1.tileSize, width1, Game1.tileSize * 2), structureToPlace.name), structureToPlace);
                    numArray[tabNumberFromName] += width1;
                }
            }
        }
예제 #20
0
 public ItemGrabMenu(List <Item> inventory, int rows, bool reverseGrab, bool showReceivingMenu, InventoryMenu.highlightThisItem highlightFunction, ItemGrabMenu.behaviorOnItemSelect behaviorOnItemSelectFunction, string message, ItemGrabMenu.behaviorOnItemSelect behaviorOnItemGrab = null, bool snapToBottom = false, bool canBeExitedWithKey = false, bool playRightClickSound = true, bool allowRightClick = true, bool showOrganizeButton = false, int source = 0, Item sourceItem = null) : base(highlightFunction, true, true, 0, 0)
 {
     this.source                       = source;
     this.message                      = message;
     this.reverseGrab                  = reverseGrab;
     this.showReceivingMenu            = showReceivingMenu;
     this.playRightClickSound          = playRightClickSound;
     this.allowRightClick              = allowRightClick;
     this.inventory.showGrayedOutSlots = true;
     this.sourceItem                   = sourceItem;
     this.Rows = rows;
     if (source == 1 && sourceItem != null && sourceItem is Chest)
     {
         this.chestColorPicker = new DiscreteColorPicker(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize - IClickableMenu.borderWidth * 2, 0, new Chest(true));
         this.chestColorPicker.colorSelection = this.chestColorPicker.getSelectionFromColor((sourceItem as Chest).playerChoiceColor);
         (this.chestColorPicker.itemToDrawColored as Chest).playerChoiceColor = this.chestColorPicker.getColorFromSelection(this.chestColorPicker.colorSelection);
         this.colorPickerToggleButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + Game1.tileSize + Game1.pixelZoom * 5, 16 * Game1.pixelZoom, 16 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(119, 469, 16, 16), (float)Game1.pixelZoom, false)
         {
             hoverText = Game1.content.LoadString("Strings\\UI:Toggle_ColorPicker", new object[0])
         };
     }
     if (snapToBottom)
     {
         base.movePosition(0, Game1.viewport.Height - (this.yPositionOnScreen + this.height - IClickableMenu.spaceToClearTopBorder));
         this.snappedtoBottom = true;
     }
     this.ItemsToGrabMenu    = new InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, highlightFunction, inventory.Capacity, Rows, 0, 0, true);
     this.behaviorFunction   = behaviorOnItemSelectFunction;
     this.behaviorOnItemGrab = behaviorOnItemGrab;
     this.canExitOnKey       = canBeExitedWithKey;
     if (showOrganizeButton)
     {
         this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false);
     }
     if ((Game1.isAnyGamePadButtonBeingPressed() || !Game1.lastCursorMotionWasMouse) && this.ItemsToGrabMenu.actualInventory.Count > 0 && Game1.activeClickableMenu == null)
     {
         Game1.setMousePosition(this.inventory.inventory[0].bounds.Center);
     }
 }
예제 #21
0
        public CataloguePage(int x, int y, int width, int height, GameMenu parent) : base(x, y, width, height, false)
        {
            this.parent = parent;
            this.buildingPlacementTiles         = Game1.content.Load <Texture2D>("LooseSprites\\buildingPlacementTiles");
            CataloguePage.widthToMoveActiveTab  = Game1.tileSize / 8;
            CataloguePage.blueprintButtonMargin = Game1.tileSize / 2;
            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 5 - Game1.tileSize / 4, false, null, null, -1, 3, 0, 0, true);
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4 + CataloguePage.widthToMoveActiveTab, this.yPositionOnScreen + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), "", "Buildings", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 4, -1, -1), 1f, false));
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 3, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10138", new object[0]), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 5, -1, -1), 1f, false));
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 4, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10139", new object[0]), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 8, -1, -1), 1f, false));
            this.sideTabs.Add(new ClickableTextureComponent("", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 5, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10140", new object[0]), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 6, -1, -1), 1f, false));
            for (int i = 0; i < 4; i++)
            {
                this.blueprintButtons.Add(new Dictionary <ClickableComponent, BluePrint>());
            }
            int num = Game1.tileSize * 8;

            int[] array = new int[4];
            for (int j = 0; j < Game1.player.blueprints.Count; j++)
            {
                BluePrint bluePrint = new BluePrint(Game1.player.blueprints[j]);
                if (CataloguePage.canPlaceThisBuildingOnTheCurrentMap(bluePrint, Game1.currentLocation))
                {
                    bluePrint.canBuildOnCurrentMap = true;
                }
                int tabNumberFromName = this.getTabNumberFromName(bluePrint.blueprintType);
                if (bluePrint.blueprintType != null)
                {
                    int num2 = (int)((float)Math.Max(bluePrint.tilesWidth, 4) / 4f * (float)Game1.tileSize) + CataloguePage.blueprintButtonMargin;
                    if (array[tabNumberFromName] % (num - IClickableMenu.borderWidth * 2) + num2 > num - IClickableMenu.borderWidth * 2)
                    {
                        array[tabNumberFromName] += num - IClickableMenu.borderWidth * 2 - array[tabNumberFromName] % (num - IClickableMenu.borderWidth * 2);
                    }
                    this.blueprintButtons[Math.Min(3, tabNumberFromName)].Add(new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(x + IClickableMenu.borderWidth + array[tabNumberFromName] % (num - IClickableMenu.borderWidth * 2), y + IClickableMenu.borderWidth + array[tabNumberFromName] / (num - IClickableMenu.borderWidth * 2) * Game1.tileSize * 2 + Game1.tileSize, num2, Game1.tileSize * 2), bluePrint.name), bluePrint);
                    array[tabNumberFromName] += num2;
                }
            }
        }
예제 #22
0
        public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
        {
            base.gameWindowSizeChanged(oldBounds, newBounds);
            if (this.yPositionOnScreen < IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder)
            {
                this.yPositionOnScreen = IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder;
            }
            if (this.xPositionOnScreen < 0)
            {
                this.xPositionOnScreen = 0;
            }
            int yPosition = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 - Game1.tileSize / 4;

            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2, yPosition, false, null, this.inventory.highlightMethod, -1, 3, 0, 0, true);
            if (this.okButton != null)
            {
                this.okButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            }
            if (this.trashCan != null)
            {
                this.trashCan = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize * 3 - Game1.tileSize / 2 - IClickableMenu.borderWidth - 104, Game1.tileSize, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom, false);
            }
        }
예제 #23
0
 public AddNewItemMenu() : base(Game1.viewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (300 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 300 + IClickableMenu.borderWidth * 2, false)
 {
     this.playerInventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder, true, null, null, -1, 3, 0, 0, true);
     this.garbage         = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width + IClickableMenu.spaceToClearSideBorder, this.yPositionOnScreen + this.height - Game1.tileSize, Game1.tileSize, Game1.tileSize), "Garbage");
 }
예제 #24
0
 public ItemGrabMenu(List <Item> inventory, bool reverseGrab, bool showReceivingMenu, InventoryMenu.highlightThisItem highlightFunction, ItemGrabMenu.behaviorOnItemSelect behaviorOnItemSelectFunction, string message, ItemGrabMenu.behaviorOnItemSelect behaviorOnItemGrab = null, bool snapToBottom = false, bool canBeExitedWithKey = false, bool playRightClickSound = true, bool allowRightClick = true, bool showOrganizeButton = false, int source = 0, Item sourceItem = null, int whichSpecialButton = -1, object specialObject = null) : base(highlightFunction, true, true, 0, 0)
 {
     this.source                       = source;
     this.message                      = message;
     this.reverseGrab                  = reverseGrab;
     this.showReceivingMenu            = showReceivingMenu;
     this.playRightClickSound          = playRightClickSound;
     this.allowRightClick              = allowRightClick;
     this.inventory.showGrayedOutSlots = true;
     this.sourceItem                   = sourceItem;
     if (source == 1 && sourceItem != null && sourceItem is Chest)
     {
         this.chestColorPicker = new DiscreteColorPicker(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize - IClickableMenu.borderWidth * 2, 0, new Chest(true));
         this.chestColorPicker.colorSelection = this.chestColorPicker.getSelectionFromColor((sourceItem as Chest).playerChoiceColor);
         (this.chestColorPicker.itemToDrawColored as Chest).playerChoiceColor = this.chestColorPicker.getColorFromSelection(this.chestColorPicker.colorSelection);
         this.colorPickerToggleButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + Game1.tileSize + Game1.pixelZoom * 5, 16 * Game1.pixelZoom, 16 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(119, 469, 16, 16), (float)Game1.pixelZoom, false)
         {
             hoverText      = Game1.content.LoadString("Strings\\UI:Toggle_ColorPicker", new object[0]),
             myID           = 27346,
             downNeighborID = (showOrganizeButton ? 106 : 5948),
             leftNeighborID = 11
         };
     }
     this.whichSpecialButton = whichSpecialButton;
     this.specialObject      = specialObject;
     if (whichSpecialButton == 1)
     {
         this.specialButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + Game1.tileSize + Game1.pixelZoom * 5, 16 * Game1.pixelZoom, 16 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(108, 491, 16, 16), (float)Game1.pixelZoom, false)
         {
             myID           = 12485,
             downNeighborID = (showOrganizeButton ? 106 : 5948)
         };
         if (specialObject != null && specialObject is JunimoHut)
         {
             this.specialButton.sourceRect.X = ((specialObject as JunimoHut).noHarvest ? 124 : 108);
         }
     }
     if (snapToBottom)
     {
         base.movePosition(0, Game1.viewport.Height - (this.yPositionOnScreen + this.height - IClickableMenu.spaceToClearTopBorder));
         this.snappedtoBottom = true;
     }
     this.ItemsToGrabMenu = new InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, highlightFunction, -1, 3, 0, 0, true);
     if (Game1.options.SnappyMenus)
     {
         this.ItemsToGrabMenu.populateClickableComponentList();
         for (int i = 0; i < this.ItemsToGrabMenu.inventory.Count; i++)
         {
             if (this.ItemsToGrabMenu.inventory[i] != null)
             {
                 this.ItemsToGrabMenu.inventory[i].myID            += 53910;
                 this.ItemsToGrabMenu.inventory[i].upNeighborID    += 53910;
                 this.ItemsToGrabMenu.inventory[i].rightNeighborID += 53910;
                 this.ItemsToGrabMenu.inventory[i].downNeighborID   = -7777;
                 this.ItemsToGrabMenu.inventory[i].leftNeighborID  += 53910;
                 this.ItemsToGrabMenu.inventory[i].fullyImmutable   = true;
             }
         }
     }
     this.behaviorFunction   = behaviorOnItemSelectFunction;
     this.behaviorOnItemGrab = behaviorOnItemGrab;
     this.canExitOnKey       = canBeExitedWithKey;
     if (showOrganizeButton)
     {
         this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false)
         {
             myID           = 106,
             upNeighborID   = ((this.colorPickerToggleButton != null) ? 27346 : ((this.specialButton != null) ? 12485 : -500)),
             downNeighborID = 5948
         };
     }
     if ((Game1.isAnyGamePadButtonBeingPressed() || !Game1.lastCursorMotionWasMouse) && this.ItemsToGrabMenu.actualInventory.Count > 0 && Game1.activeClickableMenu == null)
     {
         Game1.setMousePosition(this.inventory.inventory[0].bounds.Center);
     }
     if (Game1.options.snappyMenus && Game1.options.gamepadControls)
     {
         if (this.chestColorPicker != null)
         {
             this.discreteColorPickerCC = new List <ClickableComponent>();
             for (int j = 0; j < this.chestColorPicker.totalColors; j++)
             {
                 this.discreteColorPickerCC.Add(new ClickableComponent(new Rectangle(this.chestColorPicker.xPositionOnScreen + IClickableMenu.borderWidth / 2 + j * 9 * Game1.pixelZoom, this.chestColorPicker.yPositionOnScreen + IClickableMenu.borderWidth / 2, 9 * Game1.pixelZoom, 7 * Game1.pixelZoom), "")
                 {
                     myID            = j + 4343,
                     rightNeighborID = ((j < this.chestColorPicker.totalColors - 1) ? (j + 4343 + 1) : -1),
                     leftNeighborID  = ((j > 0) ? (j + 4343 - 1) : -1),
                     downNeighborID  = ((this.ItemsToGrabMenu != null && this.ItemsToGrabMenu.inventory.Count > 0) ? 53910 : 0)
                 });
             }
         }
         for (int k = 0; k < 12; k++)
         {
             if (this.inventory != null && this.inventory.inventory != null && this.inventory.inventory.Count >= 12)
             {
                 this.inventory.inventory[k].upNeighborID = (this.shippingBin ? 12598 : ((this.discreteColorPickerCC != null && this.ItemsToGrabMenu != null && this.ItemsToGrabMenu.inventory.Count <= k) ? 4343 : ((this.ItemsToGrabMenu.inventory.Count > k) ? (53910 + k) : 53910)));
             }
             if (this.discreteColorPickerCC != null && this.ItemsToGrabMenu != null && this.ItemsToGrabMenu.inventory.Count > k)
             {
                 this.ItemsToGrabMenu.inventory[k].upNeighborID = 4343;
             }
         }
         if (!this.shippingBin)
         {
             for (int l = 0; l < 36; l++)
             {
                 if (this.inventory != null && this.inventory.inventory != null && this.inventory.inventory.Count > l)
                 {
                     this.inventory.inventory[l].upNeighborID        = -7777;
                     this.inventory.inventory[l].upNeighborImmutable = true;
                 }
             }
         }
         if (this.trashCan != null)
         {
             this.trashCan.leftNeighborID = 11;
         }
         if (this.okButton != null)
         {
             this.okButton.leftNeighborID = 11;
         }
         base.populateClickableComponentList();
         this.snapToDefaultClickableComponent();
     }
 }
예제 #25
0
        public CraftingPage(int x, int y, int width, int height, bool cooking = false, bool standalone_menu = false, List <Chest> material_containers = null)
            : base(x, y, width, height)
        {
            _standaloneMenu = standalone_menu;
            this.cooking    = cooking;
            inventory       = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + 320 - 16, playerInventory: false);
            inventory.showGrayedOutSlots   = true;
            currentPageClickableComponents = new List <ClickableComponent>();
            foreach (ClickableComponent item in inventory.GetBorder(InventoryMenu.BorderSide.Top))
            {
                item.upNeighborID = -99998;
            }
            _materialContainers = material_containers;
            _ = _materialContainers;
            if (_standaloneMenu)
            {
                initializeUpperRightCloseButton();
            }
            trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - 32 - IClickableMenu.borderWidth - 104, 64, 104), Game1.mouseCursors, new Rectangle(564 + Game1.player.trashCanLevel * 18, 102, 18, 26), 4f)
            {
                myID = 106
            };
            dropItemInvisibleButton = new ClickableComponent(new Rectangle(xPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 64, trashCan.bounds.Y, 64, 64), "")
            {
                myID            = 107,
                rightNeighborID = 0
            };
            List <string> playerRecipes = new List <string>();

            if (_standaloneMenu)
            {
                Game1.playSound("bigSelect");
            }
            if (!cooking)
            {
                foreach (string s2 in CraftingRecipe.craftingRecipes.Keys)
                {
                    if (Game1.player.craftingRecipes.ContainsKey(s2))
                    {
                        playerRecipes.Add(s2);
                    }
                }
            }
            else
            {
                foreach (string s in CraftingRecipe.cookingRecipes.Keys)
                {
                    playerRecipes.Add(s);
                }
                playerRecipes.Sort(delegate(string a, string b)
                {
                    int num   = -1;
                    int value = -1;
                    if (a != null && CraftingRecipe.cookingRecipes.ContainsKey(a))
                    {
                        string[] array = CraftingRecipe.cookingRecipes[a].Split('/');
                        if (array.Length > 2 && int.TryParse(array[2], out int result))
                        {
                            num = result;
                        }
                    }
                    if (b != null && CraftingRecipe.cookingRecipes.ContainsKey(b))
                    {
                        string[] array2 = CraftingRecipe.cookingRecipes[b].Split('/');
                        if (array2.Length > 2 && int.TryParse(array2[2], out int result2))
                        {
                            value = result2;
                        }
                    }
                    return(num.CompareTo(value));
                });
            }
            layoutRecipes(playerRecipes);
            if (pagesOfCraftingRecipes.Count > 1)
            {
                upButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 768 + 32, craftingPageY(), 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 12), 0.8f)
                {
                    myID            = 88,
                    downNeighborID  = 89,
                    rightNeighborID = 106,
                    leftNeighborID  = -99998
                };
                downButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 768 + 32, craftingPageY() + 192 + 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 11), 0.8f)
                {
                    myID            = 89,
                    upNeighborID    = 88,
                    rightNeighborID = 106,
                    leftNeighborID  = -99998
                };
            }
            _UpdateCurrentPageButtons();
            if (Game1.options.SnappyMenus)
            {
                snapToDefaultClickableComponent();
            }
        }
예제 #26
0
        public CraftingPage(int x, int y, int width, int height, bool cooking = false) : base(x, y, width, height, false)
        {
            this.cooking   = cooking;
            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 5 - Game1.tileSize / 4, false, null, null, -1, 3, 0, 0, true);
            this.inventory.showGrayedOutSlots = true;
            int num      = this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth - Game1.tileSize / 4;
            int num2     = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.tileSize / 4;
            int arg_CE_0 = Game1.tileSize;
            int num3     = 8;
            int num4     = 10;
            int num5     = -1;

            if (cooking)
            {
                base.initializeUpperRightCloseButton();
            }
            SerializableDictionary <string, int> serializableDictionary = new SerializableDictionary <string, int>();

            foreach (string current in CraftingRecipe.craftingRecipes.Keys)
            {
                if (Game1.player.craftingRecipes.ContainsKey(current))
                {
                    serializableDictionary.Add(current, Game1.player.craftingRecipes[current]);
                }
            }
            Game1.player.craftingRecipes = serializableDictionary;
            this.trashCan = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width + 4, this.yPositionOnScreen + height - Game1.tileSize * 3 - Game1.tileSize / 2 - IClickableMenu.borderWidth - 104, Game1.tileSize, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom, false)
            {
                myID = 106
            };
            List <string> list = new List <string>();

            if (!cooking)
            {
                using (Dictionary <string, int> .KeyCollection.Enumerator enumerator2 = Game1.player.craftingRecipes.Keys.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        string current2 = enumerator2.Current;
                        list.Add(new string(current2.ToCharArray()));
                    }
                    goto IL_26A;
                }
            }
            Game1.playSound("bigSelect");
            foreach (string current3 in CraftingRecipe.cookingRecipes.Keys)
            {
                list.Add(new string(current3.ToCharArray()));
            }
IL_26A:
            int arg_271_0 = list.Count;
            int num6 = 0;

            while (list.Count > 0)
            {
                CraftingRecipe            craftingRecipe;
                int                       num9;
                ClickableTextureComponent clickableTextureComponent;
                bool                      flag;
                do
                {
                    num5++;
                    if (num5 % 40 == 0)
                    {
                        this.pagesOfCraftingRecipes.Add(new Dictionary <ClickableTextureComponent, CraftingRecipe>());
                    }
                    int num7 = num5 / num4 % (40 / num4);
                    craftingRecipe = new CraftingRecipe(list[num6], cooking);
                    int num8 = list.Count;
                    while (craftingRecipe.bigCraftable && num7 == 40 / num4 - 1 && num8 > 0)
                    {
                        num6 = (num6 + 1) % list.Count;
                        num8--;
                        craftingRecipe = new CraftingRecipe(list[num6], false);
                        if (num8 == 0)
                        {
                            num5 += 40 - num5 % 40;
                            num7  = num5 / num4 % (40 / num4);
                            this.pagesOfCraftingRecipes.Add(new Dictionary <ClickableTextureComponent, CraftingRecipe>());
                        }
                    }
                    num9 = num5 / 40;
                    clickableTextureComponent = new ClickableTextureComponent("", new Rectangle(num + num5 % num4 * (Game1.tileSize + num3), num2 + num7 * (Game1.tileSize + 8), Game1.tileSize, craftingRecipe.bigCraftable ? (Game1.tileSize * 2) : Game1.tileSize), null, (cooking && !Game1.player.cookingRecipes.ContainsKey(craftingRecipe.name)) ? "ghosted" : "", craftingRecipe.bigCraftable ? Game1.bigCraftableSpriteSheet : Game1.objectSpriteSheet, craftingRecipe.bigCraftable ? Game1.getArbitrarySourceRect(Game1.bigCraftableSpriteSheet, 16, 32, craftingRecipe.getIndexOfMenuView()) : Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, craftingRecipe.getIndexOfMenuView(), 16, 16), (float)Game1.pixelZoom, false)
                    {
                        myID            = 200 + num5,
                        myAlternateID   = (craftingRecipe.bigCraftable ? (200 + num5 + num4) : -500),
                        rightNeighborID = ((num5 % num4 < num4 - 1) ? (200 + num5 + 1) : ((num7 < 2 && num9 > 0) ? 88 : 89)),
                        leftNeighborID  = ((num5 % num4 > 0) ? (200 + num5 - 1) : -1),
                        upNeighborID    = ((num7 == 0) ? 12344 : (200 + num5 - num4)),
                        downNeighborID  = ((num7 == 40 / num4 - 1 || (num7 == 40 / num4 - 2 && craftingRecipe.bigCraftable) || list.Count <= 10) ? (num5 % num4) : (200 + num5 + (craftingRecipe.bigCraftable ? (num4 * 2) : num4))),
                        fullyImmutable  = true,
                        region          = 8000
                    };
                    flag = false;
                    using (Dictionary <ClickableTextureComponent, CraftingRecipe> .KeyCollection.Enumerator enumerator3 = this.pagesOfCraftingRecipes[num9].Keys.GetEnumerator())
                    {
                        while (enumerator3.MoveNext())
                        {
                            if (enumerator3.Current.bounds.Intersects(clickableTextureComponent.bounds))
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                }while (flag);
                this.pagesOfCraftingRecipes[num9].Add(clickableTextureComponent, craftingRecipe);
                list.RemoveAt(num6);
                num6 = 0;
            }
            if (this.pagesOfCraftingRecipes.Count > 1)
            {
                this.upButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 12 + Game1.tileSize / 2, num2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 12, -1, -1), 0.8f, false)
                {
                    myID            = 88,
                    downNeighborID  = 89,
                    rightNeighborID = 106
                };
                this.downButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 12 + Game1.tileSize / 2, num2 + Game1.tileSize * 3 + Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 11, -1, -1), 0.8f, false)
                {
                    myID            = 89,
                    upNeighborID    = 88,
                    rightNeighborID = 106
                };
            }
        }
예제 #27
0
        public InventoryPage(int x, int y, int width, int height)
            : base(x, y, width, height, false)
        {
            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth, true, (List <Item>)null, (InventoryMenu.highlightThisItem)null, -1, 3, 0, 0, true);
            List <ClickableComponent> equipmentIcons     = this.equipmentIcons;
            ClickableComponent        clickableComponent = new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Hat");

            clickableComponent.myID           = 101;
            clickableComponent.downNeighborID = 102;
            int num1 = Game1.player.MaxItems - 12;

            clickableComponent.upNeighborID = num1;
            int num2 = 105;

            clickableComponent.rightNeighborID = num2;
            int num3 = 1;

            clickableComponent.upNeighborImmutable = num3 != 0;
            equipmentIcons.Add(clickableComponent);
            this.equipmentIcons.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 5 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Left Ring")
            {
                myID            = 102,
                downNeighborID  = 103,
                rightNeighborID = 105
            });
            this.equipmentIcons.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 6 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Right Ring")
            {
                myID            = 103,
                downNeighborID  = 104,
                rightNeighborID = 105
            });
            this.equipmentIcons.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 7 * Game1.tileSize - 12, Game1.tileSize, Game1.tileSize), "Boots")
            {
                myID            = 104,
                rightNeighborID = 105
            });
            this.portrait = new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 - Game1.tileSize + Game1.tileSize / 2, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - 8 + Game1.tileSize, Game1.tileSize, Game1.tileSize * 3 / 2), "32");
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width / 3 + Game1.tileSize * 9 + Game1.tileSize / 2, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 3 * Game1.tileSize + Game1.tileSize, Game1.tileSize, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom, false);
            int num4 = 105;

            textureComponent1.myID = num4;
            int num5 = 106;

            textureComponent1.upNeighborID = num5;
            int num6 = 101;

            textureComponent1.leftNeighborID = num6;
            this.trashCan = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + width, this.yPositionOnScreen + height / 3 - Game1.tileSize + Game1.pixelZoom * 2, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize"), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false);
            int num7 = 106;

            textureComponent2.myID = num7;
            int num8 = 105;

            textureComponent2.downNeighborID = num8;
            int num9 = 11;

            textureComponent2.leftNeighborID = num9;
            int num10 = 898;

            textureComponent2.upNeighborID = num10;
            this.organizeButton            = textureComponent2;
            if (Utility.findHorse() == null)
            {
                return;
            }
            this.horseName = Utility.findHorse().displayName;
        }
예제 #28
0
        public CraftingPage(int x, int y, int width, int height, bool cooking = false)
            : base(x, y, width, height, false)
        {
            this.cooking   = cooking;
            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 5 - Game1.tileSize / 4, false, (List <Item>)null, (InventoryMenu.highlightThisItem)null, -1, 3, 0, 0, true);
            this.inventory.showGrayedOutSlots = true;
            int num1     = this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth - Game1.tileSize / 4;
            int y1       = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.tileSize / 4;
            int tileSize = Game1.tileSize;
            int num2     = 8;
            int num3     = 10;
            int num4     = -1;

            if (cooking)
            {
                this.initializeUpperRightCloseButton();
            }
            SerializableDictionary <string, int> serializableDictionary = new SerializableDictionary <string, int>();

            foreach (string key in CraftingRecipe.craftingRecipes.Keys)
            {
                if (Game1.player.craftingRecipes.ContainsKey(key))
                {
                    serializableDictionary.Add(key, Game1.player.craftingRecipes[key]);
                }
            }
            Game1.player.craftingRecipes = serializableDictionary;
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width + 4, this.yPositionOnScreen + height - Game1.tileSize * 3 - Game1.tileSize / 2 - IClickableMenu.borderWidth - 104, Game1.tileSize, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom, false);
            int num5 = 106;

            textureComponent1.myID = num5;
            this.trashCan          = textureComponent1;
            List <string> stringList = new List <string>();

            if (!cooking)
            {
                foreach (string key in Game1.player.craftingRecipes.Keys)
                {
                    stringList.Add(new string(key.ToCharArray()));
                }
            }
            else
            {
                Game1.playSound("bigSelect");
                foreach (string key in CraftingRecipe.cookingRecipes.Keys)
                {
                    stringList.Add(new string(key.ToCharArray()));
                }
            }
            int count1 = stringList.Count;
            int index1 = 0;

            while (stringList.Count > 0)
            {
                CraftingRecipe            craftingRecipe;
                int                       index2;
                ClickableTextureComponent key1;
                bool                      flag;
                do
                {
                    ++num4;
                    if (num4 % 40 == 0)
                    {
                        this.pagesOfCraftingRecipes.Add(new Dictionary <ClickableTextureComponent, CraftingRecipe>());
                    }
                    int num6 = num4 / num3 % (40 / num3);
                    craftingRecipe = new CraftingRecipe(stringList[index1], cooking);
                    int count2 = stringList.Count;
                    while (craftingRecipe.bigCraftable && num6 == 40 / num3 - 1 && count2 > 0)
                    {
                        index1 = (index1 + 1) % stringList.Count;
                        --count2;
                        craftingRecipe = new CraftingRecipe(stringList[index1], false);
                        if (count2 == 0)
                        {
                            num4 += 40 - num4 % 40;
                            num6  = num4 / num3 % (40 / num3);
                            this.pagesOfCraftingRecipes.Add(new Dictionary <ClickableTextureComponent, CraftingRecipe>());
                        }
                    }
                    index2 = num4 / 40;
                    ClickableTextureComponent textureComponent2 = new ClickableTextureComponent("", new Rectangle(num1 + num4 % num3 * (Game1.tileSize + num2), y1 + num6 * (Game1.tileSize + 8), Game1.tileSize, craftingRecipe.bigCraftable ? Game1.tileSize * 2 : Game1.tileSize), (string)null, !cooking || Game1.player.cookingRecipes.ContainsKey(craftingRecipe.name) ? "" : "ghosted", craftingRecipe.bigCraftable ? Game1.bigCraftableSpriteSheet : Game1.objectSpriteSheet, craftingRecipe.bigCraftable ? Game1.getArbitrarySourceRect(Game1.bigCraftableSpriteSheet, 16, 32, craftingRecipe.getIndexOfMenuView()) : Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, craftingRecipe.getIndexOfMenuView(), 16, 16), (float)Game1.pixelZoom, false);
                    int num7 = 200 + num4;
                    textureComponent2.myID = num7;
                    int num8 = craftingRecipe.bigCraftable ? 200 + num4 + num3 : -500;
                    textureComponent2.myAlternateID = num8;
                    int num9 = num4 % num3 < num3 - 1 ? 200 + num4 + 1 : (num6 >= 2 || index2 <= 0 ? 89 : 88);
                    textureComponent2.rightNeighborID = num9;
                    int num10 = num4 % num3 > 0 ? 200 + num4 - 1 : -1;
                    textureComponent2.leftNeighborID = num10;
                    int num11 = num6 == 0 ? 12344 : 200 + num4 - num3;
                    textureComponent2.upNeighborID = num11;
                    int num12 = num6 == 40 / num3 - 1 || num6 == 40 / num3 - 2 && craftingRecipe.bigCraftable || stringList.Count <= 10 ? num4 % num3 : 200 + num4 + (craftingRecipe.bigCraftable ? num3 * 2 : num3);
                    textureComponent2.downNeighborID = num12;
                    int num13 = 1;
                    textureComponent2.fullyImmutable = num13 != 0;
                    int num14 = 8000;
                    textureComponent2.region = num14;
                    key1 = textureComponent2;
                    flag = false;
                    foreach (ClickableComponent key2 in this.pagesOfCraftingRecipes[index2].Keys)
                    {
                        if (key2.bounds.Intersects(key1.bounds))
                        {
                            flag = true;
                            break;
                        }
                    }
                }while (flag);
                this.pagesOfCraftingRecipes[index2].Add(key1, craftingRecipe);
                stringList.RemoveAt(index1);
                index1 = 0;
            }
            if (this.pagesOfCraftingRecipes.Count <= 1)
            {
                return;
            }
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 12 + Game1.tileSize / 2, y1, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 12, -1, -1), 0.8f, false);
            int num15 = 88;

            textureComponent3.myID = num15;
            int num16 = 89;

            textureComponent3.downNeighborID = num16;
            int num17 = 106;

            textureComponent3.rightNeighborID = num17;
            this.upButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 12 + Game1.tileSize / 2, y1 + Game1.tileSize * 3 + Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 11, -1, -1), 0.8f, false);
            int num18 = 89;

            textureComponent4.myID = num18;
            int num19 = 88;

            textureComponent4.upNeighborID = num19;
            int num20 = 106;

            textureComponent4.rightNeighborID = num20;
            this.downButton = textureComponent4;
        }
예제 #29
0
 public InventoryPage(int x, int y, int width, int height)
     : base(x, y, width, height)
 {
     inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth, playerInventory: true);
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 256 - 12, 64, 64), "Left Ring")
     {
         myID            = 102,
         downNeighborID  = 103,
         upNeighborID    = Game1.player.MaxItems - 12,
         rightNeighborID = 101,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 320 - 12, 64, 64), "Right Ring")
     {
         myID            = 103,
         upNeighborID    = 102,
         downNeighborID  = 104,
         rightNeighborID = 108,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 384 - 12, 64, 64), "Boots")
     {
         myID            = 104,
         upNeighborID    = 103,
         rightNeighborID = 109,
         fullyImmutable  = true
     });
     portrait = new ClickableComponent(new Rectangle(xPositionOnScreen + 192 - 8 - 64 + 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 8 + 64, 64, 96), "32");
     trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width / 3 + 576 + 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 192 + 64, 64, 104), Game1.mouseCursors, new Rectangle(564 + Game1.player.trashCanLevel * 18, 102, 18, 26), 4f)
     {
         myID           = 105,
         upNeighborID   = 106,
         leftNeighborID = 101
     };
     organizeButton = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width, yPositionOnScreen + height / 3 - 64 + 8, 64, 64), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize"), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), 4f)
     {
         myID           = 106,
         downNeighborID = 105,
         leftNeighborID = 11,
         upNeighborID   = 898
     };
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 256 - 12, 64, 64), "Hat")
     {
         myID            = 101,
         leftNeighborID  = 102,
         downNeighborID  = 108,
         upNeighborID    = Game1.player.MaxItems - 12,
         rightNeighborID = 105,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 320 - 12, 64, 64), "Shirt")
     {
         myID            = 108,
         upNeighborID    = 101,
         downNeighborID  = 109,
         rightNeighborID = 105,
         leftNeighborID  = 103,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 384 - 12, 64, 64), "Pants")
     {
         myID            = 109,
         upNeighborID    = 108,
         rightNeighborID = 105,
         leftNeighborID  = 104,
         fullyImmutable  = true
     });
     if (ShouldShowJunimoNoteIcon())
     {
         junimoNoteIcon = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width, yPositionOnScreen + 96, 64, 64), "", Game1.content.LoadString("Strings\\UI:GameMenu_JunimoNote_Hover"), Game1.mouseCursors, new Rectangle(331, 374, 15, 14), 4f)
         {
             myID           = 898,
             leftNeighborID = 11,
             downNeighborID = 106
         };
     }
 }
예제 #30
0
 public InventoryPage(int x, int y, int width, int height)
     : base(x, y, width, height)
 {
     inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth, playerInventory: true);
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 256 - 12, 64, 64), "Left Ring")
     {
         myID            = 102,
         downNeighborID  = 103,
         upNeighborID    = Game1.player.MaxItems - 12,
         rightNeighborID = 101,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 320 - 12, 64, 64), "Right Ring")
     {
         myID            = 103,
         upNeighborID    = 102,
         downNeighborID  = 104,
         rightNeighborID = 108,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 384 - 12, 64, 64), "Boots")
     {
         myID            = 104,
         upNeighborID    = 103,
         rightNeighborID = 109,
         fullyImmutable  = true
     });
     portrait = new ClickableComponent(new Rectangle(xPositionOnScreen + 192 - 8 - 64 + 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 8 + 64, 64, 96), "32");
     trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width / 3 + 576 + 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 192 + 64, 64, 104), Game1.mouseCursors, new Rectangle(564 + Game1.player.trashCanLevel * 18, 102, 18, 26), 4f)
     {
         myID           = 105,
         upNeighborID   = 106,
         leftNeighborID = 101
     };
     organizeButton = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width, yPositionOnScreen + height / 3 - 64 + 8, 64, 64), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize"), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), 4f)
     {
         myID           = 106,
         downNeighborID = 105,
         leftNeighborID = 11,
         upNeighborID   = 898
     };
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 256 - 12, 64, 64), "Hat")
     {
         myID            = 101,
         leftNeighborID  = 102,
         downNeighborID  = 108,
         upNeighborID    = Game1.player.MaxItems - 12,
         rightNeighborID = 105,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 320 - 12, 64, 64), "Shirt")
     {
         myID            = 108,
         upNeighborID    = 101,
         downNeighborID  = 109,
         rightNeighborID = 105,
         leftNeighborID  = 103,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 384 - 12, 64, 64), "Pants")
     {
         myID            = 109,
         upNeighborID    = 108,
         rightNeighborID = 105,
         leftNeighborID  = 104,
         fullyImmutable  = true
     });
     if (Game1.player.hasOrWillReceiveMail("canReadJunimoText") && !Game1.player.hasOrWillReceiveMail("JojaMember") && (!Game1.MasterPlayer.hasCompletedCommunityCenter() || (Utility.doesMasterPlayerHaveMailReceivedButNotMailForTomorrow("hasSeenAbandonedJunimoNote") && !Game1.MasterPlayer.hasOrWillReceiveMail("ccMovieTheater"))))
     {
         junimoNoteIcon = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width, yPositionOnScreen + 96, 64, 64), "", Game1.content.LoadString("Strings\\UI:GameMenu_JunimoNote_Hover"), Game1.mouseCursors, new Rectangle(331, 374, 15, 14), 4f)
         {
             myID           = 898,
             leftNeighborID = 11,
             downNeighborID = 106
         };
     }
 }