/// ************************************************************************************************************************* /// EVENT CALLBACK METHODS /// Callback function on day started. We hook in and modify the fridge here. private void OnDayStarted(object sender, DayStartedEventArgs e) { this.expandedFridgeHub = new ExpandedFridgeHub(); }
public ExpandedFridgeMenu(ExpandedFridgeHub fridgeHub) : base(InventoryMenu.highlightAllItems, true, true, 0, 0) { this.fridgeHub = fridgeHub; { int i = 0; int labelX = this.xPositionOnScreen + Game1.tileSize / 2; int labelY = (int)(this.yPositionOnScreen + Game1.tileSize * 3.3F); foreach (Chest c in fridgeHub.connectedChests) { if (c == fridgeHub.selectedChest) { this.selectedTabIndex = i; this.selectedTab = new ClickableComponent(new Rectangle(labelX + Game1.tileSize * i++, labelY, Game1.tileSize, Game1.tileSize), (i).ToString(), (i).ToString()); this.selectedTabColor = c.playerChoiceColor.Value; } else { this.chestTabs.Add(new ClickableComponent(new Rectangle(labelX + Game1.tileSize * i++, labelY, Game1.tileSize, Game1.tileSize), (i).ToString(), (i).ToString())); this.chestTabsColors.Add(c.playerChoiceColor.Value); } } } this.inventory.showGrayedOutSlots = true; this.sourceItem = fridgeHub.selectedChest; { this.chestColorPicker = new DiscreteColorPicker(this.xPositionOnScreen, this.yPositionOnScreen - 64 - IClickableMenu.borderWidth * 2, 0, (Item) new Chest(true)); this.chestColorPicker.colorSelection = this.chestColorPicker.getSelectionFromColor((Color)((NetFieldBase <Color, NetColor>)fridgeHub.selectedChest.playerChoiceColor)); (this.chestColorPicker.itemToDrawColored as Chest).playerChoiceColor.Value = this.chestColorPicker.getColorFromSelection(this.chestColorPicker.colorSelection); ClickableTextureComponent textureComponent = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + 64 + 20, 64, 64), Game1.mouseCursors, new Rectangle(119, 469, 16, 16), 4f, false); textureComponent.hoverText = Game1.content.LoadString("Strings\\UI:Toggle_ColorPicker"); textureComponent.myID = 27346; textureComponent.downNeighborID = 106;//5948; textureComponent.leftNeighborID = 11; this.colorPickerToggleButton = textureComponent; } this.ItemsToGrabMenu = new InventoryMenu(this.xPositionOnScreen + 32, this.yPositionOnScreen, false, this.fridgeHub.selectedChest.items, InventoryMenu.highlightAllItems, -1, 3, 0, 0, true); if (Game1.options.SnappyMenus) { 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; } } } { ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - 64, 64, 64), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize"), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), 4f, false); textureComponent.myID = 106; textureComponent.upNeighborID = 27346; textureComponent.downNeighborID = 5948; this.organizeButton = textureComponent; } 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) { return; } this.discreteColorPickerCC = new List <ClickableComponent>(); for (int index = 0; index < this.chestColorPicker.totalColors; ++index) { this.discreteColorPickerCC.Add(new ClickableComponent(new Rectangle(this.chestColorPicker.xPositionOnScreen + IClickableMenu.borderWidth / 2 + index * 9 * 4, this.chestColorPicker.yPositionOnScreen + IClickableMenu.borderWidth / 2, 36, 28), "") { myID = index + 4343, rightNeighborID = index < this.chestColorPicker.totalColors - 1 ? index + 4343 + 1 : -1, leftNeighborID = index > 0 ? index + 4343 - 1 : -1, downNeighborID = this.ItemsToGrabMenu == null || this.ItemsToGrabMenu.inventory.Count <= 0 ? 0 : 53910 }); } 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.discreteColorPickerCC == null || this.ItemsToGrabMenu == null || this.ItemsToGrabMenu.inventory.Count > index ? (this.ItemsToGrabMenu.inventory.Count > index ? 53910 + index : 53910) : 4343); } if (this.discreteColorPickerCC != null && this.ItemsToGrabMenu != null && this.ItemsToGrabMenu.inventory.Count > index) { this.ItemsToGrabMenu.inventory[index].upNeighborID = 4343; } } 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.inventory.inventory.Count >= 12 && this.inventory.inventory[11] != null) { this.inventory.inventory[11].rightNeighborID = 5948; } if (this.trashCan != null) { this.trashCan.leftNeighborID = 11; } if (this.okButton != null) { this.okButton.leftNeighborID = 11; } this.populateClickableComponentList(); this.snapToDefaultClickableComponent(); }