Example #1
0
        void OnClickTab(GameObject go, int index)
        {
            if (go == null)
            {
                return;
            }

            UGUIEventListener.Get(go).onClick = delegate(PointerEventData eventData)
            {
                if (index == mCurrentTabIndex || !mRelationDict.ContainsKey(index))
                {
                    return;
                }

                WindowBase  tempWindow  = mRelationDict[index];
                TabItemElem tempTabItem = mToggleList[index];

                if (mCheckTabEnableHandle != null)
                {
                    if (!mCheckTabEnableHandle(index, tempWindow))
                    {
                        return;
                    }
                }

                for (int i = 0; i < mToggleList.Count; i++)
                {
                    mToggleList[i].SetActive(i == index);
                }

                mCurrentTabIndex = index;
                TabSucceed(tempWindow);
            };
        }
Example #2
0
        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]));
            }
        }