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; }
void LateUpdate() { if (mRefresh) { flowLayout.Reposition(); panelAnchor.Reposition(); mRefresh = false; } }
public void RefreshStats(bool refreshHP) { if (refreshHP) { if (mStats.maxHP != mHPs.Count) { Clear(); for (int i = 0; i < mStats.maxHP; i++) { Transform hpTrans; if (cacheContainer.GetChildCount() > 0) { hpTrans = cacheContainer.GetChild(0); } else { hpTrans = (Transform)Object.Instantiate(hitpointTemplate); } hpTrans.parent = container; hpTrans.localPosition = Vector3.zero; hpTrans.localRotation = Quaternion.identity; hpTrans.localScale = Vector3.one; hpTrans.gameObject.SetActiveRecursively(true); mHPs.Add(hpTrans.GetComponent <HUDHitPoint>()); } if (containerLayout != null) { containerLayout.Reposition(); } mHPs.Sort(delegate(HUDHitPoint h1, HUDHitPoint h2) { Vector3 p1 = h1.transform.localPosition; Vector3 p2 = h2.transform.localPosition; return(isHPFlipped ? Mathf.RoundToInt(p2.x - p1.x) : Mathf.RoundToInt(p1.x - p2.x)); }); if (containerFrameLayout != null) { containerFrameLayout.Reposition(); } } int curHPInd = 0; for (; curHPInd < mStats.curHP; curHPInd++) { mHPs[curHPInd].SetOn(true); } for (; curHPInd < mStats.maxHP; curHPInd++) { mHPs[curHPInd].SetOn(false); } mCurHP = mStats.curHP; } mCurPanelFeedbackDelay = hurtPanelFeedbackDelay; if (nameWidget != null) { nameWidget.text = mStats.displayName; } if (portraitWidget != null) { if (!string.IsNullOrEmpty(mStats.portrait)) { portraitWidget.gameObject.SetActiveRecursively(true); portraitWidget.spriteName = mStats.portrait; portraitWidget.MakePixelPerfect(); } else { portraitWidget.gameObject.SetActiveRecursively(false); } } }