public void DoToastOne(string text, Color textColor, float duration, float delay) { ToastUIItem item = this.FindIdle(); if (item == null) { item = ResourceManager.GetInstantiate2Prefab("ToastUIItem").GetComponent <ToastUIItem>(); item.get_transform().SetParent(this.Pool); item.get_transform().set_localScale(Vector3.get_one()); item.get_transform().set_localPosition(Vector3.get_zero()); this.listPool.Add(item); } item.get_transform().set_localPosition(Vector3.get_zero()); item.Text = text; item.Unused = false; item.get_gameObject().SetActive(true); BaseTweenAlphaBaseTime component = item.GetComponent <BaseTweenAlphaBaseTime>(); component.TweenAlpha(1f, 0f, delay, duration, delegate { item.get_gameObject().SetActive(false); item.Unused = true; }); BaseTweenPostion component2 = item.GetComponent <BaseTweenPostion>(); component2.MoveTo(new Vector3(0f, 180f, 0f), 1f); }
protected override void OnEnable() { this.listQueue.Clear(); for (int i = 0; i < this.listPool.get_Count(); i++) { ToastUIItem toastUIItem = this.listPool.get_Item(i); if (!toastUIItem.Unused) { toastUIItem.Unused = true; toastUIItem.GetComponent <CanvasGroup>().set_alpha(0f); toastUIItem.get_gameObject().SetActive(false); } } }