Esempio n. 1
0
        public void Push(GameObject obj, UIWindowInfo info)
        {
            StackData data = FindByType(info.Key);

            if (data == null)
            {
                data         = new StackData();
                data.mObject = obj;
                data.mInfo   = info;
                data.mOrder  = mListWindow.Count;
                mListWindow.Add(data);
            }

            StackChunk chunk;

            if (mChunkWindow.TryGetValue(info.WinType, out chunk))
            {
                OnPushTrigger(ref data);
                chunk.Push(data);
            }
            else
            {
                mListWindow.Remove(data);
                Debug.LogError(string.Format("Can't find chunk [{0}], Key [{1}]", info.WinType.ToString(), info.Key.ToString()));
            }
        }
Esempio n. 2
0
        private void TriggerPush(ref StackData data)
        {
            UIWindowEffect eff = data.mInfo.WinEffect;

            if ((eff & UIWindowEffect.ExclusiveView) != 0)
            {
                MonopolizeChunk(data);
            }
        }
Esempio n. 3
0
        private void TriggerPop(int index)
        {
            StackData      data = mChunkList[index];
            UIWindowEffect eff  = data.mInfo.WinEffect;

            if ((eff & UIWindowEffect.ExclusiveView) != 0)
            {
                DeMonopolizeChunk(data);
            }
        }
Esempio n. 4
0
        public int Push(StackData data)
        {
            ExistPop(ref data);
            data.mStartDepth = GetUsableDepth();
            data.mEndDepth = UITools.SetObjectDepth(data.mObject, data.mStartDepth);
            TopStack = data;
            mChunkList.Add(data);
            TriggerPush(ref data);

            return data.mEndDepth;
        }
Esempio n. 5
0
        public int Push(StackData data)
        {
            ExistPop(ref data);
            data.mStartDepth = GetUsableDepth();
            data.mEndDepth   = UITools.SetObjectDepth(data.mObject, data.mStartDepth);
            TopStack         = data;
            mChunkList.Add(data);
            TriggerPush(ref data);

            return(data.mEndDepth);
        }
Esempio n. 6
0
        public void OnPushTrigger(ref StackData data)
        {
            if ((data.mInfo.WinEffect & UIWindowEffect.CommonBack) != 0)
            {
                if (IsHaveGoback(data.mObject) == false)
                {
                    AddGobackToObject(data.mObject, UIManager.Instance.mPrefabGoback);
                }
            }

            data.mObject.SetActive(true);
        }
Esempio n. 7
0
        /// <summary>
        /// 当前窗口取消独占窗口
        /// </summary>
        /// <param name="data"></param>

        private void DeMonopolizeChunk(StackData data)
        {
            int index = mChunkList.FindIndex((StackData v) => { return(v == data); });

            if (index != -1)
            {
                DeVisibleRange(0, index);
            }
            else
            {
                Utility.Log(string.Format("DeMonopolizeChunk( ... ) Can't find StackData {0} ", data.mInfo.Key.ToString()));
            }
        }
Esempio n. 8
0
        public void Pop(StackData data)
        {
            int index = mChunkList.FindIndex((StackData d) => { return d.mObject == data.mObject; });
            if (index == -1)
                return;

            TriggerPop(index);

            Remove(index);

            if (mChunkList.Count > 0)
                TopStack = mChunkList[mChunkList.Count - 1];
            else
                TopStack = null;
        }
Esempio n. 9
0
        public StackData GetTopLevel()
        {
            StackData result   = null;
            int       maxDepth = int.MinValue;

            foreach (var iter in mChunkWindow)
            {
                if (iter.Value.TopStack != null && iter.Value.TopStack.mStartDepth > maxDepth)
                {
                    result   = iter.Value.TopStack;
                    maxDepth = iter.Value.TopStack.mStartDepth;
                }
            }

            return(result);
        }
Esempio n. 10
0
        public void SafeInsert(int insertIndex, StackData data)
        {
            int index = mChunkList.FindIndex((StackData d) => { return(d.mObject == data.mObject); });

            if (index == -1)
            {
                insertIndex = mChunkList.Count;
            }
            else
            {
                if (Remove(index) == false)
                {
                    insertIndex = mChunkList.Count;
                }
            }

            Insert(insertIndex, data);
        }
Esempio n. 11
0
        /// <summary>
        /// 插入一个指定位置
        /// </summary>
        /// <param name="index">插入索引,原索引后移</param>
        /// <param name="data"></param>

        private void Insert(int index, StackData data)
        {
            data.mStartDepth = mChunkList[index].mStartDepth;
            data.mEndDepth   = UITools.SetObjectDepth(mChunkList[index].mObject, data.mStartDepth);

            int endDepth = data.mEndDepth;

            while (index < mChunkList.Count)
            {
                ++endDepth;
                mChunkList[index].mStartDepth = endDepth;
                endDepth = UITools.SetObjectDepth(mChunkList[index].mObject, endDepth);
                mChunkList[index].mEndDepth = endDepth;
                ++index;
            }

            mChunkList.Insert(index, data);
        }
Esempio n. 12
0
        public void Pop(StackData data)
        {
            int index = mChunkList.FindIndex((StackData d) => { return(d.mObject == data.mObject); });

            if (index == -1)
            {
                return;
            }

            TriggerPop(index);

            Remove(index);

            if (mChunkList.Count > 0)
            {
                TopStack = mChunkList[mChunkList.Count - 1];
            }
            else
            {
                TopStack = null;
            }
        }
Esempio n. 13
0
        public void Pop(UIType type)
        {
            StackData data = FindDataByType(ref type);

            if (data != null)
            {
                StackChunk chunk;
                if (mChunkWindow.TryGetValue(data.mInfo.WinType, out chunk))
                {
                    chunk.Pop(data);
                    mListWindow.Remove(data);
                    OnPopTrigger(ref data);
                }
                else
                {
                    Debug.LogError(string.Format("Can't find chunk [{0}], Key [{1}]", data.mInfo.WinType.ToString(), data.mInfo.Key.ToString()));
                }
            }
            else
            {
                Debug.Log(string.Format("Can't find type : {0}", type.ToString()));
            }
        }
Esempio n. 14
0
        private void DeVisibleRange(int startIndex, int endIndex)
        {
            StackData data = null;

            for (int i = endIndex - 1; i >= startIndex; i--)
            {
                data = mChunkList[i];

                if (data.mState == StackState.Normal)
                {
                    break;
                }

                data.mState = StackState.Normal;
                data.SetVisible(true);

                //  之前窗口依然是独占
                if ((data.mInfo.WinEffect & UIWindowEffect.ExclusiveView) != 0)
                {
                    break;
                }
            }
        }
Esempio n. 15
0
 public void OnPopTrigger(ref StackData data)
 {
     data.mObject.SetActive(false);
 }
Esempio n. 16
0
        /// <summary>
        /// 当前窗口取消独占窗口
        /// </summary>
        /// <param name="data"></param>

        private void DeMonopolizeChunk( StackData data )
        {
            int index = mChunkList.FindIndex((StackData v) => { return v == data; });
            if (index != -1)
            {
                DeVisibleRange(0, index);
            }
            else
            {
                Utility.Log(string.Format("DeMonopolizeChunk( ... ) Can't find StackData {0} ", data.mInfo.Key.ToString()));
            }
        }
Esempio n. 17
0
        public void Push( GameObject obj, UIWindowInfo info)
        {
            StackData data = FindByType(info.Key);
            if (data == null)
            {
                data = new StackData();
                data.mObject = obj;
                data.mInfo = info;
                data.mOrder = mListWindow.Count;
                mListWindow.Add(data);
            }

            StackChunk chunk;
            if ( mChunkWindow.TryGetValue( info.WinType, out chunk))
            {
                OnPushTrigger(ref data);
                chunk.Push(data);
            }
            else
            {
                mListWindow.Remove(data);
                Debug.LogError(string.Format("Can't find chunk [{0}], Key [{1}]", info.WinType.ToString(), info.Key.ToString()));
            }
           
        }
Esempio n. 18
0
        public void OnPushTrigger( ref StackData data)
        {
            if ((data.mInfo.WinEffect & UIWindowEffect.CommonBack) != 0)
            {
                if (IsHaveGoback(data.mObject) == false)
                    AddGobackToObject(data.mObject, UIManager.Instance.mPrefabGoback);
            }

            data.mObject.SetActive(true);
        }
Esempio n. 19
0
 public void OnPopTrigger( ref StackData data)
 {
     data.mObject.SetActive(false);
 }
Esempio n. 20
0
 private void ExistPop(ref StackData data)
 {
     Pop(data);
 }
Esempio n. 21
0
        public void SafeInsert( int insertIndex, StackData data)
        {
            int index = mChunkList.FindIndex((StackData d) => { return d.mObject == data.mObject; });

            if (index == -1)
                insertIndex = mChunkList.Count;
            else
            {
                if (Remove(index) == false)
                {
                    insertIndex = mChunkList.Count;
                }
            }

            Insert(insertIndex, data);
        }
Esempio n. 22
0
        private void TriggerPush( ref StackData data)
        {
            UIWindowEffect eff = data.mInfo.WinEffect;
            if ( (eff & UIWindowEffect.ExclusiveView) != 0 )
            {
                MonopolizeChunk(data);
            }


        }
Esempio n. 23
0
 private void ExistPop(ref StackData data)
 {
     Pop(data);
 }
Esempio n. 24
0
        void _DrawStackData(ref StackData info)
        {
            CSCommonEditor.BeginContents();

            EditorGUILayout.ObjectField("Instances ", info.mObject, typeof(GameObject));
            EditorGUILayout.LabelField("Order ", info.mOrder.ToString());
            EditorGUILayout.LabelField("Start Depeth ", info.mStartDepth.ToString());
            EditorGUILayout.LabelField("End Depeth ", info.mEndDepth.ToString());
            GUILayout.Space(5f);
            EditorGUILayout.LabelField("UI Type ", info.mInfo.Key.ToString());
            EditorGUILayout.LabelField("Owner Type ", CSCommonEditor.ToString(info.mInfo.Owner));
            EditorGUILayout.LabelField("UI Wnd Type ", info.mInfo.WinType.ToString());
            EditorGUILayout.LabelField("UI Effect Type ", info.mInfo.WinEffect.ToString());
            EditorGUILayout.LabelField("UI Resources AssetName ", info.mInfo.GetResourcePath());

            CSCommonEditor.EndContents();
        }
Esempio n. 25
0
        /// <summary>
        /// 插入一个指定位置
        /// </summary>
        /// <param name="index">插入索引,原索引后移</param>
        /// <param name="data"></param>

        private void Insert(int index, StackData data)
        {
            data.mStartDepth = mChunkList[index].mStartDepth;
            data.mEndDepth = UITools.SetObjectDepth(mChunkList[index].mObject, data.mStartDepth);
            
            int endDepth = data.mEndDepth;
            while (index < mChunkList.Count)
            {
                ++endDepth;
                mChunkList[index].mStartDepth = endDepth;
                endDepth = UITools.SetObjectDepth(mChunkList[index].mObject, endDepth);
                mChunkList[index].mEndDepth = endDepth;
                ++index;
            }

            mChunkList.Insert(index, data);
        }