示例#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()));
            }
        }
示例#2
0
        private void TriggerPush(ref StackData data)
        {
            UIWindowEffect eff = data.mInfo.WinEffect;

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

            if ((eff & UIWindowEffect.ExclusiveView) != 0)
            {
                DeMonopolizeChunk(data);
            }
        }
示例#4
0
文件: UIStack.cs 项目: tsuixl/Frame
        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;
        }
示例#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);
        }
示例#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);
        }
示例#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()));
            }
        }
示例#8
0
文件: UIStack.cs 项目: tsuixl/Frame
        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;
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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;
            }
        }
示例#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()));
            }
        }
示例#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;
                }
            }
        }
示例#15
0
 public void OnPopTrigger(ref StackData data)
 {
     data.mObject.SetActive(false);
 }
示例#16
0
文件: UIStack.cs 项目: tsuixl/Frame
        /// <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()));
            }
        }
示例#17
0
文件: UIStack.cs 项目: tsuixl/Frame
        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()));
            }
           
        }
示例#18
0
文件: UIStack.cs 项目: tsuixl/Frame
        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);
        }
示例#19
0
文件: UIStack.cs 项目: tsuixl/Frame
 public void OnPopTrigger( ref StackData data)
 {
     data.mObject.SetActive(false);
 }
示例#20
0
文件: UIStack.cs 项目: tsuixl/Frame
 private void ExistPop(ref StackData data)
 {
     Pop(data);
 }
示例#21
0
文件: UIStack.cs 项目: tsuixl/Frame
        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);
        }
示例#22
0
文件: UIStack.cs 项目: tsuixl/Frame
        private void TriggerPush( ref StackData data)
        {
            UIWindowEffect eff = data.mInfo.WinEffect;
            if ( (eff & UIWindowEffect.ExclusiveView) != 0 )
            {
                MonopolizeChunk(data);
            }


        }
示例#23
0
 private void ExistPop(ref StackData data)
 {
     Pop(data);
 }
示例#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();
        }
示例#25
0
文件: UIStack.cs 项目: tsuixl/Frame
        /// <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);
        }