void NewActive(string imageRef, string title) { int ind = mInactives.Count - 1; UIAchievementPopUpItem itm = mInactives[ind]; mInactives.RemoveAt(ind); itm.name = mPopUpCounter.ToString(); mPopUpCounter++; if (!string.IsNullOrEmpty(imageRef)) { itm.image.spriteName = imageRef; } itm.text.text = title; mActives.Add(itm); itm.gameObject.SetActive(true); mLayout.Reposition(); mLastInactiveCheckTime = Time.realtimeSinceStartup; }
// Update is called once per frame void Update() { if (mActives.Count > 0 && Time.realtimeSinceStartup - mLastInactiveCheckTime > popUpInactiveCheckDelay) { for (int i = 0; i < mActives.Count; i++) { UIAchievementPopUpItem item = mActives[i]; if (!item.animDat.isPlaying) { item.gameObject.SetActive(false); mInactives.Add(item); mActives.RemoveAt(i); i--; } } if (mActives.Count == 0) { mPopUpCounter = 0; } } if (mPopUpQueue.Count > 0 && mInactives.Count > 0) { Data d = mPopUpQueue.Dequeue(); NewActive(d.imageRef, d.text); } if (test) { NewActive(null, mPopUpCounter.ToString()); test = false; } }