/// <summary> /// 设置导航子窗口 /// </summary> /// <param name="go">父节点</param> /// <param name="succeedHandle">点击成功回调</param> /// <param name="checkTabEnableHandle">点击检测</param> /// <param name="checkTabShowHandle">显示检测</param> protected void SetTabRoot(GameObject go, Action <int, WindowBase> succeedHandle = null, Func <int, WindowBase, bool> checkTabEnableHandle = null, Func <int, WindowBase, bool> checkTabShowHandle = null) { if (null == go) { return; } mCheckTabEnableHandle = checkTabEnableHandle; mClickSucceedHandle = succeedHandle; mCheckTabShowHandle = checkTabShowHandle; for (int i = 0, max = go.transform.childCount; i < max; ++i) { TabItemElem tempTabItem = new TabItemElem(); Transform tempTrans = go.transform.GetChild(i); tempTabItem.rootObj = tempTrans.gameObject; tempTabItem.normalObj = Utility.GameObj.Find(tempTabItem.rootObj, NORMAL_OBJ_NAME); tempTabItem.activeObj = Utility.GameObj.Find(tempTabItem.rootObj, ACTIVE_OBJ_NAME); tempTabItem.disableObj = Utility.GameObj.Find(tempTabItem.rootObj, DISABLE_OBJ_NAME); tempTabItem.SetLock(false); mToggleList.Add(tempTabItem); OnClickTab(tempTrans.gameObject, i); } }
protected void CheckTabEnable() { if (null == mCheckTabEnableHandle) { return; } for (int i = 0, max = mKeys.Count; i < max; ++i) { int tempKey = mKeys[i]; if (tempKey < 0 || tempKey >= mToggleList.Count) { continue; } TabItemElem tempItem = mToggleList[tempKey]; tempItem.SetLock(!mCheckTabEnableHandle(tempKey, mRelationDict[tempKey])); } }