protected override void Release(bool isShutdown) { CharEntryItem displayItem = (CharEntryItem)Target; if (displayItem == null) { return; } Object.Destroy(displayItem.gameObject); }
private void Update() { for (int i = m_ActiveCharEntryItems.Count - 1; i >= 0; i--) { CharEntryItem displayItem = m_ActiveCharEntryItems[i]; if (displayItem.Refresh()) { continue; } HideCharEntry(displayItem); } }
public void ShowCharEntry(Entity entity, float fromHPRatio, float toHPRatio) { if (entity == null) { Log.Warning("Entity is invalid."); return; } CharEntryItem displayItem = GetActiveCharEntryItem(entity); if (displayItem == null) { displayItem = CreateCharEntryItem(entity); m_ActiveCharEntryItems.Add(displayItem); } displayItem.Init(entity, m_CachedCanvas, fromHPRatio, toHPRatio); }
private CharEntryItem CreateCharEntryItem(Entity entity) { CharEntryItem displayItem = null; CharEntryItemObject displayItemObject = m_CharEntryItemObjectPool.Spawn(); if (displayItemObject != null) { displayItem = (CharEntryItem)displayItemObject.Target; } else { displayItem = Instantiate(m_CharEntryItemTemplate); Transform transform = displayItem.GetComponent <Transform>(); transform.SetParent(m_CharEntryInstanceRoot); transform.localScale = Vector3.one; m_CharEntryItemObjectPool.Register(CharEntryItemObject.Create(displayItem), true); } return(displayItem); }
private void HideCharEntry(CharEntryItem displayItem) { displayItem.Reset(); m_ActiveCharEntryItems.Remove(displayItem); m_CharEntryItemObjectPool.Unspawn(displayItem); }