void OnFullTradeSubmit(GameObject[] data, object[] customData, Vector2Int submitType) { if (customData != null) { ItemBehavior item = (ItemBehavior)customData[0]; bool updateButtons = false; Inventory trader = (Inventory)customData[1]; Inventory tradee = (Inventory)customData[2]; // single trade if (submitType.x == FULL_TRADE_SINGLE_TRADE_ACTION) { if (item != null) { Debug.LogError("heyyyy"); if (trader.TransferItemTo(item, 1, tradee)) { updateButtons = true; } } } // take all else if (submitType.x == FULL_TRADE_TRADE_ALL_ACTION) { if (trader.TransferInventoryContentsTo(tradee)) { updateButtons = true; } } //consume on selected inventory else if (submitType.x == FULL_TRADE_CONSUME_ACTION) { if (item != null) { // if (item.OnConsume(trader, GetWorkingInventorySlot(UIType.FullTrade))) { int count = 1; if (item.OnConsume(trader, count, submitType.y)) { updateButtons = true; } } } //change working inventory // else if (submitType == 3) { // } if (updateButtons) { UpdateUIButtons(true, trader, tradee, (int)customData[3], (int)customData[4], (int)customData[5]); UpdateUIButtons(true, tradee, trader, (int)customData[3], (int)customData[5], (int)customData[4]); } } }
void OnQuickInventorySubmit(GameObject[] data, object[] customData, Vector2Int submitType) { if (customData != null) { ItemBehavior item = customData[0] as ItemBehavior; if (item) { int count = 1; // item.OnConsume((Inventory)customData[1], GetWorkingInventorySlot(UIType.QuickInventory)); item.OnConsume((Inventory)customData[1], count, submitType.y); } } CloseQuickInventoryUI(); }
void OnFullInventorySubmit(GameObject[] data, object[] customData, Vector2Int submitType) { if (customData != null) { ItemBehavior item = (ItemBehavior)customData[0]; if (item != null) { Inventory forInventory = (Inventory)customData[1]; bool updateButtons = false; if (submitType.x == FULL_INVENTORY_CONSUME_ACTION) { int count = 1; // if (item.OnConsume(forInventory, GetWorkingInventorySlot(UIType.FullInventory))) { if (item.OnConsume(forInventory, count, submitType.y)) { updateButtons = true; } } // drop else if (submitType.x == FULL_INVENTORY_DROP_ACTION) { int itemIndex; if (forInventory.CanDropItem(item, out itemIndex, out _, false)) { forInventory.DropItem(item, 1, true, itemIndex); updateButtons = true; } } // favorite // else if (submitType == FULL_INVENTORY_FAVORITE_ACTION) { // if (forInventory.FavoriteItem(item)) { // updateButtons = true; // } // } if (updateButtons) { UpdateUIButtons(true, (Inventory)customData[1], (Inventory)customData[2], (int)customData[3], (int)customData[4], (int)customData[5]); } } } }