} // end OnClickUseBtn private void OnClickDiscardBtn() { if (currentGid == -1) return; // end if int count = currentPack.GetCountForGrid(currentGid); UIConfirmNumBox box = ObjectTool.InstantiateGo("ConfirmNumBoxUI", ResourcesTool.LoadPrefabUI("confirm_num_box_ui"), SceneManager.mainCanvas.rectTransform).AddComponent<UIConfirmNumBox>(); if (count > 1) { box.InitInfo("输入丢弃的数量", count); } else { box.InitInfo("确定丢弃该物品"); } // end if box.AddAction(DiscardItem); } // end OnClickDiscardBtn
} // end LoseItem private void SwitchPack(string name) { LoseItem(); packName = name; currentPack = SceneManager.mainCharacter.pack.GetItemPack(name); for (int i = 0; i < gridArray.Length; i++) { string itemID = currentPack.GetItemIDForGrid(i); IItemInfo info = Configs.itemConfig.GetItemInfo(itemID); if (null == info) { gridArray[i].HideItem(); continue; } // end int count = currentPack.GetCountForGrid(i); gridArray[i].SetUIItem(ResourcesTool.LoadSprite(info.spritepath), count); } // end for } // end SwitchPack