public T Create(Transform parent = null) { ObjectRecycler <T> .Entry entry = this._objectPool.Find((ObjectRecycler <T> .Entry x) => !x.used); if (entry != null) { if (parent) { entry.value.transform.parent = parent; } entry.value.transform.localScale = Vector3.one; PerfTools.SetVisible(entry.value.transform, true); entry.used = true; return(entry.value); } T t = (T)((object)null); if (this._getMethod != null) { t = this._getMethod(); if (t) { t.transform.parent = parent; PerfTools.SetVisible(t.transform, true); t.transform.localScale = Vector3.one; ObjectRecycler <T> .Entry item = new ObjectRecycler <T> .Entry { name = t.name, value = t, used = true }; this._objectPool.Add(item); } } return(t); }
public void On_Spawn() { this.animCount = 0; this.m_isCurVisible = true; if (this.m_debuffName) { PerfTools.SetVisible(this.m_debuffName.gameObject, false); } if (this.m_SummonerName) { this.m_SummonerName.gameObject.SetActive(true); } }
public void Release(T comp) { if (!comp) { return; } ObjectRecycler <T> .Entry entry = this._objectPool.Find((ObjectRecycler <T> .Entry x) => comp == x.value); if (entry != null) { PerfTools.SetVisible(comp.transform, false); comp.transform.SetParent(this._recycleParent); entry.used = false; } else { ClientLogger.Error("release " + comp.name); } }
public void SetDebuffIcon(bool active, string debuffName = "") { if (this.m_debuffName == null) { return; } if (active && !string.IsNullOrEmpty(debuffName)) { PerfTools.SetVisible(this.m_debuffName.gameObject, true); this.m_debuffName.text = debuffName; if (this.m_SummonerName != null) { PerfTools.SetVisible(this.m_SummonerName.gameObject, false); } this.m_debuffName.animation.enabled = true; this.m_debuffName.animation.Play(); this.animCount++; base.StopCoroutine("ShowDebuffAnim"); if (base.gameObject == null) { return; } if (base.gameObject.activeSelf) { base.StartCoroutine("ShowDebuffAnim"); } } else { this.animCount--; if (this.animCount <= 0) { PerfTools.SetVisible(this.m_debuffName.gameObject, false); this.m_debuffName.animation.Stop(); this.m_debuffName.animation.enabled = false; TweenAlpha.Begin(this.m_debuffName.gameObject, 0.1f, 0.01f); if (this.m_SummonerName != null) { PerfTools.SetVisible(this.m_SummonerName.gameObject, true); } base.StopCoroutine("ShowDebuffAnim"); } } }
private void FastSetVisible(bool visible) { PerfTools.SetVisible(base.gameObject, visible); }