void ReadyView() { if (SelfView == null) { SelfView = TreeRootCtrl.TempInstateOneItemView(); } SelfView.selfCtrl = this; SelfView.SetAnchoredPos(TreeRootCtrl.GetNodeViewAnchorposAtIndex(selfData.m_indexHor, selfData.m_indexVer)); InitViewClickEvents(); RefreshView(); }
//TODO 使用对象池 private UITreeNodeView TempInstateOneItemView(UITreeNodeView prefab, GameObject uiParent) { if (prefab == null) { //...ERROR NZQLA.Log.LogAtUnityEditor("预制体为空", "#ff00ffff"); return(null); } if (uiParent == null) { //...ERROR NZQLA.Log.LogAtUnityEditor("未指定元素UI的父物体", "#ff00ffff"); return(null); } UITreeNodeView tempNodeViewIns = NodeViewPool.GetOneItem(); //UITreeNodeView tempNodeViewIns = GameObject.Instantiate<UITreeNodeView>(prefab); tempNodeViewIns.transform.SetParent(uiParent.transform, false); return(tempNodeViewIns); }