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())); } }
private void TriggerPush(ref StackData data) { UIWindowEffect eff = data.mInfo.WinEffect; if ((eff & UIWindowEffect.ExclusiveView) != 0) { MonopolizeChunk(data); } }
private void TriggerPop(int index) { StackData data = mChunkList[index]; UIWindowEffect eff = data.mInfo.WinEffect; if ((eff & UIWindowEffect.ExclusiveView) != 0) { DeMonopolizeChunk(data); } }
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; }
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); }
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); }
/// <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())); } }
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; }
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); }
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); }
/// <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); }
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; } }
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())); } }
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; } } }
public void OnPopTrigger(ref StackData data) { data.mObject.SetActive(false); }
/// <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())); } }
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())); } }
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); }
public void OnPopTrigger( ref StackData data) { data.mObject.SetActive(false); }
private void ExistPop(ref StackData data) { Pop(data); }
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); }
private void TriggerPush( ref StackData data) { UIWindowEffect eff = data.mInfo.WinEffect; if ( (eff & UIWindowEffect.ExclusiveView) != 0 ) { MonopolizeChunk(data); } }
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(); }