public void ClearHandPoker() { for (int i = m_HandList.Count; i > 0; --i) { m_HandList[i - 1].transform.SetParent(null); UIItemHandPoker_PaiJiu UIHandPoker = m_HandList[i - 1]; m_HandList.Remove(UIHandPoker); Destroy(UIHandPoker.gameObject); } }
/// <summary> /// 创建Poker /// </summary> /// <param name="majiang"></param> /// <param name="isInit"></param> /// <param name="onComplete"></param> private void CreatePoker(MaJiangCtrl_PaiJiu majiang, bool isInit, Action <UIItemHandPoker_PaiJiu> onComplete) { UIViewManager.Instance.LoadItemAsync("UIItemHandPoker_PaiJiu", (GameObject prefab) => { GameObject go = Instantiate(prefab); majiang.gameObject.SetLayer(LayerMask.NameToLayer("UI")); UIItemHandPoker_PaiJiu uiPoker = go.GetComponent <UIItemHandPoker_PaiJiu>(); uiPoker.SetUI(majiang); m_HandList.Add(uiPoker); uiPoker.gameObject.SetParent(m_HandConatiner.transform); m_HandConatiner.Sort(); if (onComplete != null) { onComplete(uiPoker); } }); }