private void LoadAssetFailureCallback(string ItemAssetName, LoadResourceStatus status, string errorMessage, object userData) { ShowItemInfo showItemInfo = (ShowItemInfo)userData; if (showItemInfo == null) { throw new GameFrameworkException("Show Item info is invalid."); } if (m_ItemsToReleaseOnLoad.Contains(showItemInfo.SerialId)) { m_ItemsToReleaseOnLoad.Remove(showItemInfo.SerialId); return; } m_ItemsBeingLoaded.Remove(showItemInfo.ItemId); string appendErrorMessage = Utility.Text.Format("Load Item failure, asset name '{0}', status '{1}', error message '{2}'.", ItemAssetName, status.ToString(), errorMessage); if (m_ShowItemFailureEventHandler != null) { ShowItemFailureEventArgs showItemFailureEventArgs = ShowItemFailureEventArgs.Create(showItemInfo.ItemId, ItemAssetName, showItemInfo.ItemGroup.Name, appendErrorMessage, showItemInfo.UserData); m_ShowItemFailureEventHandler(this, showItemFailureEventArgs); ReferencePool.Release(showItemFailureEventArgs); return; } throw new GameFrameworkException(appendErrorMessage); }
/// <summary> /// 界面显示 /// </summary> protected override void OnShow(INotification notification) { ShowItemInfo showItemInfo = (notification.Body as List <object>)[0] as ShowItemInfo; shopItemInfo = (notification.Body as List <object>)[1] as ShopItemInfo; buyItem = showItemInfo.buyItem; panel.changeNum.text = "1"; if (shopItemInfo.moneyType == 3) { itemID = shopItemInfo.itemID; panel.buyPrcie.text = shopItemInfo.itemPrice.ToString(); } else { panel.buyPrcie.text = (shopItemInfo.itemPrice * (shopItemInfo.disCount * 1.0f / 100)).ToString(); itemID = shopItemInfo.itemID.Substring(0, shopItemInfo.itemID.Length - 1); } UtilTools.SetMoneySprite(shopItemInfo.moneyType, panel.moneyType); ItemInfo info = ItemManager.GetItemInfo(itemID); LoadSprite.LoaderItem(panel.itemIcon, itemID, false); panel.itemcolor.spriteName = UtilTools.StringBuilder("color", info.color); panel.itemName.text = TextManager.GetItemString(itemID); panel.itemdesc.text = TextManager.GetPropsString("description_" + itemID); }
private void LoadAssetSuccessCallback(string ItemAssetName, object ItemAsset, float duration, object userData) { ShowItemInfo showItemInfo = (ShowItemInfo)userData; if (showItemInfo == null) { throw new GameFrameworkException("Show Item info is invalid."); } if (m_ItemsToReleaseOnLoad.Contains(showItemInfo.SerialId)) { m_ItemsToReleaseOnLoad.Remove(showItemInfo.SerialId); ReferencePool.Release(showItemInfo); m_ItemHelper.ReleaseItem(ItemAsset, null); return; } m_ItemsBeingLoaded.Remove(showItemInfo.ItemId); ItemInstanceObject itemInstanceObject = ItemInstanceObject.Create(ItemAssetName, ItemAsset, m_ItemHelper.InstantiateItem(ItemAsset), m_ItemHelper); showItemInfo.ItemGroup.RegisterItemInstanceObject(itemInstanceObject, true); InternalShowItem(showItemInfo.ItemId, ItemAssetName, showItemInfo.ItemGroup, itemInstanceObject.Target, true, duration, showItemInfo.UserData); ReferencePool.Release(showItemInfo); }
/// <summary> /// 添加item /// </summary> /// <param name="item"></param> /// <param name="isLeft"></param> private void AddItem(ShowItemInfo item, bool isLeft) { int targetIndex = item.DefIndex; if (isLeft) { targetIndex -= 1; if (targetIndex < 0) { targetIndex = targetIndex % _DefList.Length; targetIndex = _DefList.Length + targetIndex; } } else { targetIndex += 1; if (targetIndex >= _DefList.Length) { targetIndex = targetIndex % _DefList.Length; } } ShowItemInfo showItemInfo = new ShowItemInfo(); for (int i = 0; i < _hideItems.Count; i++) { if (_hideItems[i].DefIndex == targetIndex) { showItemInfo = _hideItems[i]; _hideItems.RemoveAt(i); break; } } //重新生成一个 if (showItemInfo.ShowItem == null) { showItemInfo.DefIndex = targetIndex; showItemInfo.ShowItem = Instantiate(_DefList[targetIndex], transform); ShowItemInfoAddListener(ref showItemInfo); showItemInfo.NameBG = showItemInfo.ShowItem.transform.Find("NameBG").gameObject; } Vector3 targetPos = item.ShowItem.transform.localPosition; if (isLeft) { targetPos.x -= (_itemWidth + _itemSpacing); } else { targetPos.x += (_itemWidth + _itemSpacing); } _showItems.Add(showItemInfo); showItemInfo.ShowItem.transform.localPosition = targetPos; showItemInfo.ShowItem.SetActive(true); }
public static ShowItemInfo Create(int serialId, int itemId, ItemGroup itemGroup, object userData) { ShowItemInfo showItemInfo = ReferencePool.Acquire <ShowItemInfo>(); showItemInfo.m_SerialId = serialId; showItemInfo.m_ItemId = itemId; showItemInfo.m_ItemGroup = itemGroup; showItemInfo.m_UserData = userData; return(showItemInfo); }
/// <summary> /// 查看道具信息 不是背包里查看的uuid不填 /// </summary> public static void ShowItemInfoPanel(PanelType type, string itemID, string uuid = "", ItemMediator.SellItem SellItem = null, ItemMediator.UseItem UseItem = null) { ShowItemInfo showItemInfo = new ShowItemInfo(); ItemMediator.panelType = type; showItemInfo.sellItem = SellItem; showItemInfo.useItem = UseItem; List <object> list = new List <object>(); list.Add(showItemInfo); list.Add(itemID); list.Add(uuid); Facade.Instance.SendNotification(NotificationID.ItemInfo_Show, list); }
private void LoadAssetDependencyAssetCallback(string ItemAssetName, string dependencyAssetName, int loadedCount, int totalCount, object userData) { ShowItemInfo showItemInfo = (ShowItemInfo)userData; if (showItemInfo == null) { throw new GameFrameworkException("Show Item info is invalid."); } if (m_ShowItemDependencyAssetEventHandler != null) { ShowItemDependencyAssetEventArgs showItemDependencyAssetEventArgs = ShowItemDependencyAssetEventArgs.Create(showItemInfo.ItemId, ItemAssetName, showItemInfo.ItemGroup.Name, dependencyAssetName, loadedCount, totalCount, showItemInfo.UserData); m_ShowItemDependencyAssetEventHandler(this, showItemDependencyAssetEventArgs); ReferencePool.Release(showItemDependencyAssetEventArgs); } }
private void LoadAssetUpdateCallback(string ItemAssetName, float progress, object userData) { ShowItemInfo showItemInfo = (ShowItemInfo)userData; if (showItemInfo == null) { throw new GameFrameworkException("Show Item info is invalid."); } if (m_ShowItemUpdateEventHandler != null) { ShowItemUpdateEventArgs showItemUpdateEventArgs = ShowItemUpdateEventArgs.Create(showItemInfo.ItemId, ItemAssetName, showItemInfo.ItemGroup.Name, progress, showItemInfo.UserData); m_ShowItemUpdateEventHandler(this, showItemUpdateEventArgs); ReferencePool.Release(showItemUpdateEventArgs); } }
/// <summary> /// 使用 /// </summary> void UseItem(Item info) { SeverInfo = info; ShowItemInfo showItemInfo = new ShowItemInfo(); ItemMediator.panelType = PanelType.Use; showItemInfo.useOne = UseOneItem; List <object> list = new List <object>(); list.Add(showItemInfo); list.Add(info); if (info == null) { return; } Facade.SendNotification(NotificationID.ItemInfo_Show, list); }
void OnClickItem(UIGridItem item) { if (item == null || item.mScripts == null || item.oData == null) { return; } UISprite islimit = item.mScripts[9] as UISprite; if (islimit.gameObject.activeSelf) { GUIManager.SetJumpText(TextManager.GetSystemString("ui_system_shop_1")); return; } currentInfo = item.oData as ShopItemInfo; if (currentInfo.moneyType == 0 && PlayerMediator.playerInfo.diamond < currentInfo.itemPrice) { GameShopProxy.Instance.onShopInfoCallBack(2); return; } if (currentInfo.moneyType == 1 && PlayerMediator.playerInfo.euro < currentInfo.itemPrice) { GameShopProxy.Instance.onShopInfoCallBack(1); return; } if (currentInfo.moneyType == 2 && PlayerMediator.playerInfo.blackMoney < currentInfo.itemPrice) { GameShopProxy.Instance.onShopInfoCallBack(3); return; } if (currentInfo.moneyType == 3 && PlayerMediator.playerInfo.guildDonate < currentInfo.itemPrice) { GameShopProxy.Instance.onShopInfoCallBack(5); return; } ShowItemInfo showItemInfo = new ShowItemInfo(); showItemInfo.buyItem = BuyItem; List <object> list = new List <object>(); list.Add(showItemInfo); list.Add(currentInfo); Facade.SendNotification(NotificationID.BuyItem_Show, list); }
/// <summary> /// 出售 /// </summary> void SellItem(Item info) { SeverInfo = info; if (info.amount == 1) { SellOneItemOK(info.amount); Facade.SendNotification(NotificationID.ItemInfo_Hide); return; } ShowItemInfo showItemInfo = new ShowItemInfo(); ItemMediator.panelType = PanelType.Sell; showItemInfo.sellOne = SellOneItemOK; List <object> list = new List <object>(); list.Add(showItemInfo); list.Add(info); if (info == null) { return; } Facade.SendNotification(NotificationID.ItemInfo_Show, list); }
/// <summary> /// GridItem点击事件 /// </summary> void OnClickItem(UIGridItem item) { if (item == null || item.mScripts == null || item.oData == null) { return; } RewardInfo rewardInfo = item.oData as RewardInfo; if (rewardInfo.itemType != 7) { ShowItemInfo showItemInfo = new ShowItemInfo(); ItemMediator.panelType = PanelType.Info; showItemInfo.sellItem = null; showItemInfo.useItem = null; List <object> list = new List <object>(); list.Add(showItemInfo); list.Add(rewardInfo); Facade.SendNotification(NotificationID.ItemInfo_Show, list); } else if (rewardInfo.itemType == 7) { Facade.SendNotification(NotificationID.Team_Show, rewardInfo.itemID); } }
/// <summary> /// 界面显示时调用 /// </summary> protected override void OnShow(INotification notification) { if (panelType == PanelType.Info || panelType == PanelType.Sell || panelType == PanelType.Use) { m_Panel.CloseBtn.transform.localPosition = new Vector3(323, 244, 0); m_Panel.itemInfo.gameObject.SetActive(true); itemIcon = m_Panel.transform.FindChild("itemInfo/itemIcon").GetComponent <UITexture>(); itemcolor = m_Panel.transform.FindChild("itemInfo/itemcolor").GetComponent <UISprite>(); itemName = m_Panel.transform.FindChild("itemInfo/itemName").GetComponent <UILabel>(); ShowItemInfo showItemInfo = (notification.Body as List <object>)[0] as ShowItemInfo; itemID = (notification.Body as List <object>)[1] as string; string uuid = (notification.Body as List <object>)[2] as string; item = ItemManager.GetItemInfo(itemID); EquipItemInfo equip = EquipConfig.GetEquipDataByUUID(uuid); if (equip != null) { itemcolor.spriteName = UtilTools.StringBuilder("color", equip.star); } else { itemcolor.spriteName = UtilTools.StringBuilder("color", item.color); } itemName.text = TextManager.GetItemString(item.itemID); LoadSprite.LoaderItem(itemIcon, itemID, false); if (panelType == PanelType.Info) { m_Panel.SellOne.gameObject.SetActive(false); m_Panel.Info.gameObject.SetActive(true); sellBtn = m_Panel.transform.FindChild("itemInfo/Info/sellBtn").GetComponent <UIButton>(); useItemBtn = m_Panel.transform.FindChild("itemInfo/Info/useItemBtn").GetComponent <UIButton>(); itemDesc = m_Panel.transform.FindChild("itemInfo/Info/itemDesc").GetComponent <UILabel>(); itemPrice = m_Panel.transform.FindChild("itemInfo/Info/itemPrice").GetComponent <UILabel>(); itemNum = m_Panel.transform.FindChild("itemInfo/Info/itemNum").GetComponent <UILabel>(); UIEventListener.Get(sellBtn.gameObject).onClick = OnClick; UIEventListener.Get(useItemBtn.gameObject).onClick = OnClick; if (item == null) { return; } itemDesc.text = TextManager.GetPropsString("description_" + item.itemID); itemPrice.text = item.itemPrice.ToString(); itemNum.text = ItemManager.GetBagItemCount(itemID.ToString()).ToString(); sellItem = showItemInfo.sellItem; useItem = showItemInfo.useItem; if (sellItem == null && useItem == null) { sellBtn.gameObject.SetActive(false); useItemBtn.gameObject.SetActive(false); } else { sellBtn.gameObject.SetActive(true); useItemBtn.gameObject.SetActive(true); sellItem = showItemInfo.sellItem; useItem = showItemInfo.useItem; } } else if (panelType == PanelType.Sell) { m_Panel.Info.gameObject.SetActive(false); m_Panel.SellOne.gameObject.SetActive(true); minBtn = m_Panel.transform.FindChild("itemInfo/SellOne/minBtn").GetComponent <UIButton>(); maxBtn = m_Panel.transform.FindChild("itemInfo/SellOne/maxBtn").GetComponent <UIButton>(); addBtn = m_Panel.transform.FindChild("itemInfo/SellOne/addBtn").GetComponent <UIButton>(); subtractBtn = m_Panel.transform.FindChild("itemInfo/SellOne/subtractBtn").GetComponent <UIButton>(); cancelOneSellBtn = m_Panel.transform.FindChild("itemInfo/SellOne/cancelOneSellBtn").GetComponent <UIButton>(); okOneSellBtn = m_Panel.transform.FindChild("itemInfo/SellOne/okOneSellBtn").GetComponent <UIButton>(); haveNum = m_Panel.transform.FindChild("itemInfo/SellOne/haveNum").GetComponent <UILabel>(); changeNum = m_Panel.transform.FindChild("itemInfo/SellOne/changeNum").GetComponent <UILabel>(); sellPrcie = m_Panel.transform.FindChild("itemInfo/SellOne/sellPrcie").GetComponent <UILabel>(); UIEventListener.Get(cancelOneSellBtn.gameObject).onClick = OnClick; LongClickEvent.Get(subtractBtn.gameObject).onPress = OnPress; LongClickEvent.Get(subtractBtn.gameObject).duration = 3; LongClickEvent.Get(addBtn.gameObject).onPress = OnPress; LongClickEvent.Get(addBtn.gameObject).duration = 3; UIEventListener.Get(minBtn.gameObject).onClick = OnClick; UIEventListener.Get(maxBtn.gameObject).onClick = OnClick; UIEventListener.Get(okOneSellBtn.gameObject).onClick = OnClick; subtractBtn.gameObject.SetActive(info.amount > 1); addBtn.gameObject.SetActive(info.amount > 1); maxBtn.gameObject.SetActive(info.amount > 1); minBtn.gameObject.SetActive(info.amount > 1); changeNum.gameObject.SetActive(info.amount > 1); changeNum.text = "1"; sellPrcie.text = item.itemPrice.ToString(); haveNum.text = info.amount.ToString(); SellOne = showItemInfo.sellOne; } else if (panelType == PanelType.Use) { sellBtn = m_Panel.transform.FindChild("itemInfo/Info/sellBtn").GetComponent <UIButton>(); useItemBtn = m_Panel.transform.FindChild("itemInfo/Info/useItemBtn").GetComponent <UIButton>(); itemDesc = m_Panel.transform.FindChild("itemInfo/Info/itemDesc").GetComponent <UILabel>(); itemPrice = m_Panel.transform.FindChild("itemInfo/Info/itemPrice").GetComponent <UILabel>(); itemNum = m_Panel.transform.FindChild("itemInfo/Info/itemNum").GetComponent <UILabel>(); sellBtn.gameObject.SetActive(false); useItemBtn.gameObject.SetActive(false); m_Panel.Info.gameObject.SetActive(true); m_Panel.use.gameObject.SetActive(true); if (item == null) { return; } itemDesc.text = TextManager.GetPropsString("description_" + item.itemID); itemPrice.text = item.itemPrice.ToString(); itemNum.text = info.amount.ToString(); okuse = m_Panel.transform.FindChild("itemInfo/use/okuse").GetComponent <UIButton>(); cancelUse = m_Panel.transform.FindChild("itemInfo/use/cancelUse").GetComponent <UIButton>(); UIEventListener.Get(okuse.gameObject).onClick = OnClick; UIEventListener.Get(cancelUse.gameObject).onClick = OnClick; UseOne = showItemInfo.useOne; } } else if (panelType == PanelType.Reward) { rewardIndex = 0; m_Panel.Mask.GetComponent <BoxCollider>().enabled = false; UIEventListener.Get(m_Panel.Mask.gameObject).onClick = OnClick; m_Panel.CloseBtn.gameObject.SetActive(false); GameObject cell = m_Panel.RewardItem.gameObject; PoolManager.CreatePrefabPools(PoolManager.PoolKey.Prefab_RewardItem, cell, false); m_Panel.getReward.gameObject.SetActive(true); rewardList = notification.Body as List <object>; TimerManager.Destroy("rewardIndex"); TimerManager.AddTimer("rewardIndex", 0.02f, CreateRewardItem); //getRewardBtn = m_Panel.transform.FindChild("getReward/getRewardBtn").GetComponent<UIButton>(); //UIEventListener.Get(getRewardBtn.gameObject).onClick = OnClick; } else if (panelType == PanelType.ChooseFriend) { if (FriendMediator.friendList.Count < 1) { GUIManager.SetPromptInfo(TextManager.GetUIString("UI2048"), null); ClosePanel(null); return; } m_Panel.CloseBtn.transform.localPosition = new Vector3(374, 229, 0); m_Panel.chooseFriend.gameObject.SetActive(true); FriendGrid = UtilTools.GetChild <UIGrid>(m_Panel.transform, "chooseFriend/ScrollView/FriendGrid"); FriendGrid.enabled = true; FriendGrid.BindCustomCallBack(UpdateFriendGrid); FriendGrid.StartCustom(); } else if (panelType == PanelType.UpMentality) { m_Panel.CloseBtn.transform.localPosition = new Vector3(316, 277, 0); UPMentality = UtilTools.GetChilds <UIToggle>(m_Panel.transform, "ballerUpMentality/group"); mentalityDesc = UtilTools.GetChilds <UILabel>(m_Panel.transform, "ballerUpMentality/group"); UPMentalityBtn = m_Panel.transform.FindChild("ballerUpMentality/UPMentalityBtn").GetComponent <UISprite>(); UIEventListener.Get(UPMentalityBtn.gameObject).onClick = OnClick; m_Panel.ballerUpMentality.gameObject.SetActive(true); } else if (panelType == PanelType.SwitchInherit) { m_Panel.CloseBtn.transform.localPosition = new Vector3(378, 243, 0); m_Panel.switchballer.gameObject.SetActive(true); List <object> list = notification.Body as List <object>; ChooseGrid = UtilTools.GetChild <UIGrid>(m_Panel.transform, "switchballer/ScrollView/ChooseGrid"); ChooseGrid.enabled = true; ChooseGrid.BindCustomCallBack(UpdateInheriter); ChooseGrid.StartCustom(); ChooseGrid.AddCustomDataList(list); } }
/// <summary> /// 显示物品。 /// </summary> /// <param name="itemId">物品编号。</param> /// <param name="itemAssetName">物品资源名称。</param> /// <param name="itemGroupName">物品组名称。</param> /// <param name="priority">加载物品资源的优先级。</param> /// <param name="userData">用户自定义数据。</param> public void ShowItem(int itemId, string itemAssetName, string itemGroupName, int priority, object userData) { if (m_ResourceManager == null) { throw new GameFrameworkException("You must set resource manager first."); } if (m_ItemHelper == null) { throw new GameFrameworkException("You must set item helper first."); } if (string.IsNullOrEmpty(itemAssetName)) { throw new GameFrameworkException("Item asset name is invalid."); } if (string.IsNullOrEmpty(itemGroupName)) { throw new GameFrameworkException("Item group name is invalid."); } if (HasItem(itemId)) { throw new GameFrameworkException(Utility.Text.Format("Item id '{0}' is already exist.", itemId.ToString())); } if (IsLoadingItem(itemId)) { throw new GameFrameworkException(Utility.Text.Format("Item '{0}' is already being loaded.", itemId.ToString())); } ItemGroup itemGroup = (ItemGroup)GetItemGroup(itemGroupName); if (itemGroup == null) { throw new GameFrameworkException(Utility.Text.Format("Item group '{0}' is not exist.", itemGroupName)); } ItemInstanceObject itemInstanceObject = itemGroup.SpawnItemInstanceObject(itemAssetName); if (itemInstanceObject == null) { int serialId = ++m_Serial; m_ItemsBeingLoaded.Add(itemId, serialId); m_ResourceManager.LoadAsset(itemAssetName, priority, m_LoadAssetCallbacks, ShowItemInfo.Create(serialId, itemId, itemGroup, userData)); return; } InternalShowItem(itemId, itemAssetName, itemGroup, itemInstanceObject.Target, false, 0f, userData); }
private void Init() { _showMaxX = (transform as RectTransform).sizeDelta.x / 2f; _showMinX = _showMaxX * -1; _itemWidth = (_DefList[0].transform as RectTransform).sizeDelta.x; _itemSpacing = Mathf.Abs(_DefList[0].transform.localPosition.x - _DefList[1].transform.localPosition.x) - _itemWidth; //中心点向外扩散显示item float showItemMinX = 0; float showItemMaxX = 0; int index = _DefList.Length / 2; int addIndex = 1; //中心点 _DefList[index].transform.localPosition = Vector3.zero; _DefList[index].gameObject.SetActive(true); ShowItemInfo curShowItem = new ShowItemInfo(); curShowItem.DefIndex = index; curShowItem.ShowItem = _DefList[index]; ShowItemInfoAddListener(ref curShowItem); curShowItem.NameBG = curShowItem.ShowItem.transform.Find("NameBG").gameObject; _showItems.Add(curShowItem); showItemMaxX = _itemWidth / 2f; showItemMinX = showItemMaxX * -1; while (showItemMinX > _showMinX || showItemMaxX < _showMaxX) { GameObject objLeft = null; List <ShowItemInfo> showItems = new List <ShowItemInfo>(); //左 index = _DefList.Length / 2 - addIndex; if (index >= 0) { objLeft = _DefList[index]; } else { index = index % _DefList.Length; index = _DefList.Length + index; objLeft = Instantiate(_DefList[index], transform); } Vector3 targetPos = Vector3.zero; targetPos.x = (_itemWidth + _itemSpacing) * addIndex * -1; objLeft.transform.localPosition = targetPos; objLeft.transform.localScale = Vector2.one * UnCenterScale; objLeft.SetActive(true); ShowItemInfo curShowItemLeft = new ShowItemInfo(); curShowItemLeft.DefIndex = index; curShowItemLeft.ShowItem = _DefList[index]; ShowItemInfoAddListener(ref curShowItemLeft); curShowItemLeft.NameBG = curShowItemLeft.ShowItem.transform.Find("NameBG").gameObject; _showItems.Add(curShowItemLeft); showItemMinX = objLeft.transform.localPosition.x - _itemWidth / 2f;; //右 GameObject objRight = null; index = _DefList.Length / 2 + addIndex; if (index < _DefList.Length) { objRight = _DefList[index]; } else { index = index % _DefList.Length; objRight = Instantiate(_DefList[index], transform); } targetPos.x = (_itemWidth + _itemSpacing) * addIndex; objRight.transform.localPosition = targetPos; showItemMaxX = objRight.transform.localPosition.x + _itemWidth / 2f; objRight.transform.localScale = Vector2.one * UnCenterScale; objRight.SetActive(true); ShowItemInfo curShowItemRight = new ShowItemInfo(); curShowItemRight.DefIndex = index; curShowItemRight.ShowItem = _DefList[index]; ShowItemInfoAddListener(ref curShowItemRight); curShowItemRight.NameBG = curShowItemRight.ShowItem.transform.Find("NameBG").gameObject; _showItems.Add(curShowItemRight); addIndex += 1; } int curCenterChildIndex = -1; float curCenterChildPos = 0; FindClosestChildPos(out curCenterChildIndex, out curCenterChildPos); SetCellScale(curCenterChildIndex); }
/// <summary> /// /// </summary> /// <param name="curShowItem"></param> private void ShowItemInfoAddListener(ref ShowItemInfo curShowItem) { curShowItem.ClickBut = curShowItem.ShowItem.transform.Find("ButBG").gameObject; curShowItem.ClickBut.GetComponent <Button>().onClick.RemoveAllListeners(); curShowItem.ClickBut.GetComponent <Button>().onClick.AddListener(OnClickThrow); }