public void UpdateLogic(int inDelta) { if (this.m_spawnGroupCounter.Count > 0) { for (int i = this.m_spawnGroupCounter.Count - 1; i >= 0; i--) { SpawnGroupCounter counter = this.m_spawnGroupCounter[i]; counter.timer -= inDelta; if ((counter.bAlertPreroll && !counter.bDidAlert) && (counter.timer <= counter.AlertTime)) { counter.bDidAlert = true; } if (counter.timer <= 0) { if ((this.m_spawnGroupCounterContainer != null) && (counter.TextObj != null)) { this.m_spawnGroupCounterContainer.RecycleElement(counter.TextObj); } counter.TextObj = null; counter.timerText = null; this.m_spawnGroupCounter.RemoveAt(i); } } } this.Draw(); }
private void Draw() { ListView <SpawnGroupCounter> .Enumerator enumerator = this.m_spawnGroupCounter.GetEnumerator(); while (enumerator.MoveNext()) { SpawnGroupCounter current = enumerator.Current; if ((current != null) && (current.timerText != null)) { int num = current.timer / 0x3e8; int num2 = num / 60; int num3 = num - (num2 * 60); current.timerText.text = string.Format("{0:D2}:{1:D2}", num2, num3); } } }
private void AddSpawnGroupCounter(int inCountdown, int inAlertPreroll, Vector3 inInitPos, SpawnerWrapper.ESpawnObjectType inObjType) { this.m_spawnGroupCounterContainer = this.GetSpawnGroupTextContainer(); if (this.m_spawnGroupCounterContainer != null) { int element = this.m_spawnGroupCounterContainer.GetElement(); if (element >= 0) { SpawnGroupCounter counter; counter = new SpawnGroupCounter { CountdownTime = inCountdown, timer = counter.CountdownTime, AlertTime = counter.timer - inAlertPreroll, bAlertPreroll = inAlertPreroll > 0, bDidAlert = false }; RectTransform mapPointerRectTransform = null; GameObject p = this.m_spawnGroupCounterContainer.GetElement(element); if (p != null) { mapPointerRectTransform = p.transform as RectTransform; counter.TextObj = p; counter.timerText = Utility.FindChild(p, "TimerText").GetComponent <Text>(); } if (mapPointerRectTransform != null) { mapPointerRectTransform.SetAsFirstSibling(); } SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext(); if ((curLvelContext != null) && curLvelContext.isPVPMode) { this.UpdateUIMap(mapPointerRectTransform, inInitPos, (float)curLvelContext.mapWidth, (float)curLvelContext.mapHeight); } this.m_spawnGroupCounter.Add(counter); } } }