private void ClearChannelMaskItem() { // 清除频道 int childCount = channelMaskButtonFrame.childCount; GameObject[] childArray = new GameObject[childCount]; for (int i = 0; i < childCount; ++i) { Transform child = channelMaskButtonFrame.GetChild(i); childArray[i] = child.gameObject; } foreach (var obj in childArray) { ChatChannelGroupItem item = obj.GetComponent <ChatChannelGroupItem>(); if (item != null) { item.Clear(); } var temp = obj; channelMaskItemPrefabRes.DestroyInstanceRes(ref temp); } }
private ChatChannelGroupItem AddChannelMaskItem(ChatChannelGroupType type) { GameObject itemObj = channelMaskItemPrefabRes.InstanceMainRes(); if (itemObj == null) { return(null); } ChatChannelGroupItem item = itemObj.GetComponent <ChatChannelGroupItem>(); if (item == null) { return(null); } item.Init(this, type); // 增加Tooltips addTooltipsForChannelGroup(ref itemObj, type); return(item); }