Example #1
0
 public void setSourceItem(Item item)
 {
     this.sourceItem              = item;
     this.chestColorPicker        = null;
     this.colorPickerToggleButton = null;
     if (this.source == 1 && this.sourceItem != null && this.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((this.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])
         };
     }
 }
Example #2
0
 public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
 {
     if (this.snappedtoBottom)
     {
         base.movePosition((newBounds.Width - oldBounds.Width) / 2, Game1.viewport.Height - (this.yPositionOnScreen + this.height - IClickableMenu.spaceToClearTopBorder));
     }
     if (this.ItemsToGrabMenu != null)
     {
         this.ItemsToGrabMenu.gameWindowSizeChanged(oldBounds, newBounds);
     }
     if (this.organizeButton != null)
     {
         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 (this.source == 1 && this.sourceItem != null && this.sourceItem is Chest)
     {
         this.chestColorPicker = new DiscreteColorPicker(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize - IClickableMenu.borderWidth * 2, 0, null);
         this.chestColorPicker.colorSelection = this.chestColorPicker.getSelectionFromColor((this.sourceItem as Chest).playerChoiceColor);
     }
 }
Example #3
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();
     }
 }