2using System.Collections.Generic;
34 public List<PopItem>
items =
new List<PopItem>();
38 return Util.Instantiate<T>(
"UI/Pop/" + id,
this);
41 public PopItemText PopText(
string text, Sprite sprite =
null,
string id =
"PopText",
Color c =
default(
Color), Vector3 destPos =
default(Vector3),
float duration = 0f)
44 popItemText.important =
false;
45 popItemText.
SetText(text, sprite, c);
46 Pop(popItemText, destPos, duration);
52 Text[] componentsInChildren =
item.GetComponentsInChildren<Text>();
53 for (
int i = 0; i < componentsInChildren.Length; i++)
55 componentsInChildren[i].RebuildLayout();
66 RectTransform rectTransform =
item.Rect();
69 UnityEngine.Object.Destroy(
item.GetComponent<
UIFollow>());
71 Vector2 anchoredPosition = (
startAtDestPos ? item.destPos :
new Vector2(rectTransform.rect.width *
align.x, rectTransform.rect.height *
align.y));
73 rectTransform.anchoredPosition = anchoredPosition;
74 for (
int j = 0; j <
items.Count; j++)
86 uIFollow.followPos =
true;
87 uIFollow.fixPos = destPos;
90 if ((
bool)
item.animeIn)
104 if (
items.Count == 0)
106 base.enabled =
false;
123 Vector2 zero = Vector2.zero;
124 for (
int i = 0; i <
items.Count; i++)
126 Rect rect =
items[i].Rect().rect;
127 zero.x += rect.width * dir.x +
spacing.x;
128 zero.y += rect.height * dir.y +
spacing.y;
129 items[i].destPos = zero +
new Vector2(rect.width *
align.x, rect.height *
align.y);
130 if ((
bool)
items[i].arrow)
132 items[i].arrow.enabled = i == 0;
143 TweenUtil.KillTween(ref
item.killTimer);
144 if (!instant && (
bool)
item.animeOut)
149 item.animeOut.Play(
item.transform).OnComplete(delegate
163 if (
item ==
null ||
item.gameObject ==
null)
167 DOTween.Kill(
item.Rect());
168 UnityEngine.Object.Destroy(
item.gameObject);
173 for (
int i = 0; i <
items.Count; i++)
184 ContentSizeFitter[] componentsInChildren =
item.GetComponentsInChildren<ContentSizeFitter>();
185 for (
int i = 0; i < componentsInChildren.Length; i++)
187 componentsInChildren[i].enabled =
false;
189 LayoutGroup[] componentsInChildren2 =
item.GetComponentsInChildren<LayoutGroup>();
190 for (
int i = 0; i < componentsInChildren2.Length; i++)
192 componentsInChildren2[i].enabled =
false;
194 GameObject go = UnityEngine.Object.Instantiate(
item.gameObject);
195 go.transform.SetParent(rect, worldPositionStays:
false);
196 go.transform.position =
item.transform.position;
197 Vector3 fixPos = Camera.main.ScreenToWorldPoint(go.transform.Rect().anchoredPosition *
BaseCore.
Instance.
uiScale);
199 uIFollow.followPos =
true;
200 uIFollow.fixPos = fixPos;
202 go.AddComponent<CanvasGroup>().DOFade(0f, 1.5f).SetDelay(0.5f)
207 UnityEngine.Object.Destroy(go);
219 TweenUtil.KillTween(ref
item.killTimer);
220 DOTween.Kill(
item.Rect());
221 UnityEngine.Object.Destroy(
item.gameObject);
227 for (
int num =
items.Count - 1; num >= 0; num--)
void SetText(string s, Sprite sprite=null, Color c=default(Color))
void Kill(PopItem item, bool instant=false)
void CopyAll(RectTransform rect)
PopItemText PopText(string text, Sprite sprite=null, string id="PopText", Color c=default(Color), Vector3 destPos=default(Vector3), float duration=0f)
void KillAll(bool instant=false)
PopItem Pop(PopItem item, Vector3 destPos=default(Vector3), float duration=0f)