override public void Play(object val, Color color) { if (itemPool == null) { itemPool = War.textEffect.damageItemPool; } TextEffectDamageItem item = (TextEffectDamageItem)itemPool.Get(); item.transform.SetParent(transform, false); RectTransform itemRectTransform = (RectTransform)item.transform; itemRectTransform.anchoredPosition = offset; itemRectTransform.SetAsLastSibling(); int count = actives.Count; for (int i = 0; i < count; i++) { (actives[i].transform as RectTransform).anchoredPosition = offset + gapOffset * (count - i + 1); } item.gameObject.name = "TextEffect-Damage-" + actives.Count; item.container = this; item.Play(val); actives.Add(item); }
#pragma warning restore 0649 private void Awake() { if (Instance == null) { Instance = this; PoolSetup(); } else { Destroy(gameObject); } }
private void Awake() { if (instance == null) { instance = this; PoolReset(); } else { Destroy(gameObject); } }
public AbstractTextEffect Play(TextEffectType type, object val, Color color, Vector3 worldPosition, System.Object uid) { TextEffectPool pool = poolDict[type]; AbstractTextEffect textEffect = null; if (type == TextEffectType.Damage) { if (uidTextEffectDict.ContainsKey(uid)) { textEffect = uidTextEffectDict[uid]; } } if (textEffect == null) { textEffect = pool.Get(); textEffect.transform.SetParent(transform, false); // textEffect.transform.localScale = Vector3.one; textEffect.pool = pool; if (type == TextEffectType.Damage) { uidTextEffectDict.Add(uid, textEffect); } } Vector3 pt = mainCamera.WorldToScreenPoint(worldPosition).SetZ(0); (textEffect.transform as RectTransform).anchoredPosition = pt * rate; textEffect.gameObject.SetActive(true); textEffect.Play(val, color); // Debug.Log("textEffect.Play txt=" + val + " color=" + color ); return(textEffect); }