public void RemoveAndSort(PromptNode node) { if (mShowList.Count > 0) { mShowList.Remove(node); } for (int i = 0; i < mShowList.Count; ++i) { PromptNode _node = mShowList[i] as PromptNode; _node.SetPos(new Vector2(mSrcPos.x, mSrcPos.y - (i * _node.GetHeight()))); } }
public void AddNewPrompt(string txt) { if (string.IsNullOrEmpty(txt)) { return; } if (mShowList.Count > 0) { PromptNode tmp = mShowList[mShowList.Count - 1] as PromptNode; if (tmp != null && txt.Equals(tmp.GetText())) { tmp.Start(txt); return; } } if (mShowList.Count >= MAX_SHOW) { mShowList[0].End(); } PromptNode node = null; if (mCacheQueue.Count > 0) { node = mCacheQueue.Dequeue() as PromptNode; } else { //等待新机制修改 GameObject clone = WindowManager.Instance.CloneCommonUI("PromptUI"); GameObject.DontDestroyOnLoad(clone); WindowManager.Instance.SetDepth(clone, 1000, true); node = new PromptNode(clone); } float y = mSrcPos.y; for (int i = 0; i < mShowList.Count; ++i) { PromptNode _node = mShowList[i] as PromptNode; y -= _node.GetHeight(); } node.SetPos(new Vector2(mSrcPos.x, y)); node.Start(txt); mShowList.Add(node); }