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; }
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); }