Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
PopfabItem Class Reference
Inheritance diagram for PopfabItem:
PopfabText elona.MsgPlain

Public Member Functions

void Set (string text)
 
void Set (BalloonData data)
 
void Init (Transform parent=null)
 
void Intro ()
 
void ForceOutro ()
 
void Outro ()
 
void Kill ()
 
void SetDuration (float duration)
 

Public Attributes

Transform animeTarget
 
CanvasGroup animeGroup
 
Anime intro
 
Anime outro
 
Anime outroForce
 
Anime loop
 
float duration = 6f
 
bool pooling
 
Vector3 fixPos = Vector3.zero
 
bool startTransparent
 
bool clamp
 
Text uiText
 
bool screenSpace = true
 
ContentSizeFitter fitter
 
Image icon
 
bool stopFollow
 
float destX
 
float destY
 
RectTransform rect
 
Popfab reciever
 
float destTime
 
bool isOutro
 
Transform followTarget
 
bool isUseDuration = true
 
bool hasRect
 

Private Member Functions

void Awake ()
 
void LateUpdate ()
 
void ClampToScreen ()
 

Private Attributes

bool isKilled
 
Vector3? lastPosition
 

Detailed Description

Definition at line 6 of file PopfabItem.cs.

Member Function Documentation

◆ Awake()

void PopfabItem.Awake ( )
inlineprivate

Definition at line 73 of file PopfabItem.cs.

74 {
75 rect = base.transform as RectTransform;
76 hasRect = rect;
77 if (animeTarget == null)
78 {
80 }
81 }
bool hasRect
Definition: PopfabItem.cs:71
Transform animeTarget
Definition: PopfabItem.cs:8
RectTransform rect
Definition: PopfabItem.cs:50

References animeTarget, hasRect, and rect.

◆ ClampToScreen()

void PopfabItem.ClampToScreen ( )
inlineprivate

Definition at line 180 of file PopfabItem.cs.

181 {
182 if (hasRect)
183 {
184 Vector3 zero = Vector3.zero;
185 Vector3 vector = (base.transform.parent as RectTransform).rect.min - rect.rect.min;
186 Vector3 vector2 = (base.transform.parent as RectTransform).rect.max - rect.rect.max;
187 zero.x = Mathf.Clamp(rect.localPosition.x, vector.x, vector2.x);
188 zero.y = Mathf.Clamp(rect.localPosition.y, vector.y, vector2.y);
189 rect.localPosition = zero;
190 }
191 else
192 {
193 Vector3 position = Camera.main.WorldToViewportPoint(base.transform.position);
194 position.x = Mathf.Clamp(position.x, 0.1f, 0.9f);
195 position.y = Mathf.Clamp(position.y, 0.1f, 0.9f);
196 base.transform.position = Camera.main.ViewportToWorldPoint(position);
197 }
198 }

References hasRect, and rect.

Referenced by LateUpdate().

◆ ForceOutro()

void PopfabItem.ForceOutro ( )
inline

Definition at line 200 of file PopfabItem.cs.

201 {
202 if (!isOutro)
203 {
204 isOutro = true;
205 if ((bool)outroForce)
206 {
208 }
209 else
210 {
211 Kill();
212 }
213 }
214 }
virtual Tween Play(Transform trans, UnityAction onComplete=null, float duration=-1f, float delay=0f)
Definition: Anime.cs:7
Anime outroForce
Definition: PopfabItem.cs:16
bool isOutro
Definition: PopfabItem.cs:59
void Kill()
Definition: PopfabItem.cs:230

References animeTarget, isOutro, Kill(), outroForce, and Anime.Play().

◆ Init()

void PopfabItem.Init ( Transform  parent = null)
inline

Definition at line 104 of file PopfabItem.cs.

105 {
106 if ((bool)parent)
107 {
108 base.transform.SetParent(parent, worldPositionStays: false);
109 }
110 animeTarget.localScale = Vector3.one;
111 animeTarget.localEulerAngles = Vector3.zero;
112 animeTarget.localPosition = new Vector3(0f, 0f, animeTarget.localPosition.z);
113 if (stopFollow && (bool)followTarget)
114 {
115 lastPosition = followTarget.position;
116 }
117 if (fitter != null)
118 {
119 fitter.SetLayoutHorizontal();
120 fitter.SetLayoutVertical();
121 }
123 {
124 if ((bool)animeGroup)
125 {
126 animeGroup.alpha = 0f;
127 }
128 else if ((bool)uiText)
129 {
130 Color color = uiText.color;
131 color.a = 0f;
132 uiText.color = color;
133 }
134 }
135 }
bool stopFollow
Definition: PopfabItem.cs:41
ContentSizeFitter fitter
Definition: PopfabItem.cs:37
Vector3? lastPosition
Definition: PopfabItem.cs:65
CanvasGroup animeGroup
Definition: PopfabItem.cs:10
bool startTransparent
Definition: PopfabItem.cs:28
Text uiText
Definition: PopfabItem.cs:33
Transform followTarget
Definition: PopfabItem.cs:62

References animeGroup, animeTarget, Color, fitter, followTarget, lastPosition, startTransparent, stopFollow, and uiText.

◆ Intro()

void PopfabItem.Intro ( )
inline

Definition at line 137 of file PopfabItem.cs.

138 {
139 destTime = Time.realtimeSinceStartup + duration;
140 LateUpdate();
141 this.RebuildLayout();
142 if (!(intro == null))
143 {
145 }
146 }
void LateUpdate()
Definition: PopfabItem.cs:148
Anime intro
Definition: PopfabItem.cs:12
float duration
Definition: PopfabItem.cs:20
float destTime
Definition: PopfabItem.cs:56

References animeTarget, destTime, duration, intro, LateUpdate(), and Anime.Play().

◆ Kill()

void PopfabItem.Kill ( )
inline

Definition at line 230 of file PopfabItem.cs.

231 {
232 if (!isKilled)
233 {
234 base.transform.DOKill();
235 if ((bool)reciever)
236 {
237 reciever.Remove(this);
238 }
239 if (pooling)
240 {
241 stopFollow = false;
242 isOutro = false;
243 isKilled = false;
244 isUseDuration = true;
245 lastPosition = null;
246 destY = 0f;
247 }
248 else
249 {
250 UnityEngine.Object.Destroy(base.gameObject);
251 }
252 isKilled = true;
253 }
254 }
bool isKilled
Definition: PopfabItem.cs:26
Popfab reciever
Definition: PopfabItem.cs:53
bool pooling
Definition: PopfabItem.cs:22
bool isUseDuration
Definition: PopfabItem.cs:68
float destY
Definition: PopfabItem.cs:47
void Remove(PopfabItem item)
Definition: Popfab.cs:70

References destY, isKilled, isOutro, isUseDuration, lastPosition, pooling, reciever, Popfab.Remove(), and stopFollow.

Referenced by ForceOutro(), LateUpdate(), and Outro().

◆ LateUpdate()

void PopfabItem.LateUpdate ( )
inlineprivate

Definition at line 148 of file PopfabItem.cs.

149 {
150 if (!isOutro && isUseDuration && Time.realtimeSinceStartup > destTime)
151 {
152 Outro();
153 }
154 if ((bool)followTarget)
155 {
156 if (!followTarget.gameObject.activeInHierarchy && !lastPosition.HasValue)
157 {
158 Kill();
159 return;
160 }
161 if (!stopFollow && followTarget.gameObject.activeInHierarchy)
162 {
163 lastPosition = followTarget.position;
164 }
165 if (hasRect)
166 {
167 rect.position = Camera.main.WorldToScreenPoint(lastPosition ?? followTarget.position) + fixPos;
168 }
169 else
170 {
171 base.transform.position = (lastPosition ?? followTarget.position) + fixPos;
172 }
173 }
174 if (clamp)
175 {
177 }
178 }
void Outro()
Definition: PopfabItem.cs:216
Vector3 fixPos
Definition: PopfabItem.cs:24
bool clamp
Definition: PopfabItem.cs:30
void ClampToScreen()
Definition: PopfabItem.cs:180

References clamp, ClampToScreen(), destTime, fixPos, followTarget, hasRect, isOutro, isUseDuration, Kill(), lastPosition, Outro(), and stopFollow.

Referenced by Intro().

◆ Outro()

void PopfabItem.Outro ( )
inline

Definition at line 216 of file PopfabItem.cs.

217 {
218 isOutro = true;
219 if (outro == null)
220 {
221 destY += 80f;
222 animeTarget.DOLocalMoveY(destY, 1.6f).SetEase(Ease.OutQuart).OnComplete(Kill);
223 }
224 else
225 {
227 }
228 }
Anime outro
Definition: PopfabItem.cs:14

References animeTarget, destY, isOutro, Kill(), outro, and Anime.Play().

Referenced by LateUpdate().

◆ Set() [1/2]

void PopfabItem.Set ( BalloonData  data)
inline

Definition at line 91 of file PopfabItem.cs.

92 {
93 Set(data.text);
94 if (data.font != null && (bool)uiText)
95 {
96 uiText.font = data.font;
97 }
98 if (data.fontSize != 0 && (bool)uiText)
99 {
100 uiText.fontSize = data.fontSize;
101 }
102 }
string text
Definition: BalloonData.cs:5
void Set(string text)
Definition: PopfabItem.cs:83

References BalloonData.font, BalloonData.fontSize, Set(), BalloonData.text, and uiText.

◆ Set() [2/2]

void PopfabItem.Set ( string  text)
inline

Definition at line 83 of file PopfabItem.cs.

84 {
85 if ((bool)uiText)
86 {
87 uiText.text = text;
88 }
89 }

References uiText.

Referenced by Popfab.Pop(), and Set().

◆ SetDuration()

void PopfabItem.SetDuration ( float  duration)
inline

Definition at line 256 of file PopfabItem.cs.

257 {
258 this.duration = duration;
259 destTime = Time.realtimeSinceStartup + duration;
260 }

References destTime, and duration.

Member Data Documentation

◆ animeGroup

CanvasGroup PopfabItem.animeGroup

Definition at line 10 of file PopfabItem.cs.

Referenced by Init().

◆ animeTarget

Transform PopfabItem.animeTarget

Definition at line 8 of file PopfabItem.cs.

Referenced by Awake(), ForceOutro(), Init(), Intro(), and Outro().

◆ clamp

bool PopfabItem.clamp

Definition at line 30 of file PopfabItem.cs.

Referenced by LateUpdate().

◆ destTime

float PopfabItem.destTime

Definition at line 56 of file PopfabItem.cs.

Referenced by Intro(), LateUpdate(), and SetDuration().

◆ destX

float PopfabItem.destX

Definition at line 44 of file PopfabItem.cs.

◆ destY

float PopfabItem.destY

Definition at line 47 of file PopfabItem.cs.

Referenced by Kill(), and Outro().

◆ duration

float PopfabItem.duration = 6f

Definition at line 20 of file PopfabItem.cs.

Referenced by Intro(), and SetDuration().

◆ fitter

ContentSizeFitter PopfabItem.fitter

Definition at line 37 of file PopfabItem.cs.

Referenced by Init().

◆ fixPos

Vector3 PopfabItem.fixPos = Vector3.zero

Definition at line 24 of file PopfabItem.cs.

Referenced by LateUpdate().

◆ followTarget

Transform PopfabItem.followTarget

Definition at line 62 of file PopfabItem.cs.

Referenced by Init(), and LateUpdate().

◆ hasRect

bool PopfabItem.hasRect

Definition at line 71 of file PopfabItem.cs.

Referenced by Awake(), ClampToScreen(), and LateUpdate().

◆ icon

Image PopfabItem.icon

Definition at line 39 of file PopfabItem.cs.

◆ intro

Anime PopfabItem.intro

Definition at line 12 of file PopfabItem.cs.

Referenced by Intro().

◆ isKilled

bool PopfabItem.isKilled
private

Definition at line 26 of file PopfabItem.cs.

Referenced by Kill().

◆ isOutro

bool PopfabItem.isOutro

Definition at line 59 of file PopfabItem.cs.

Referenced by ForceOutro(), Kill(), LateUpdate(), and Outro().

◆ isUseDuration

bool PopfabItem.isUseDuration = true

Definition at line 68 of file PopfabItem.cs.

Referenced by Kill(), and LateUpdate().

◆ lastPosition

Vector3? PopfabItem.lastPosition
private

Definition at line 65 of file PopfabItem.cs.

Referenced by Init(), Kill(), and LateUpdate().

◆ loop

Anime PopfabItem.loop

Definition at line 18 of file PopfabItem.cs.

◆ outro

Anime PopfabItem.outro

Definition at line 14 of file PopfabItem.cs.

Referenced by Outro().

◆ outroForce

Anime PopfabItem.outroForce

Definition at line 16 of file PopfabItem.cs.

Referenced by ForceOutro().

◆ pooling

bool PopfabItem.pooling

Definition at line 22 of file PopfabItem.cs.

Referenced by Kill().

◆ reciever

Popfab PopfabItem.reciever

Definition at line 53 of file PopfabItem.cs.

Referenced by Kill().

◆ rect

RectTransform PopfabItem.rect

Definition at line 50 of file PopfabItem.cs.

Referenced by Awake(), and ClampToScreen().

◆ screenSpace

bool PopfabItem.screenSpace = true

Definition at line 35 of file PopfabItem.cs.

◆ startTransparent

bool PopfabItem.startTransparent

Definition at line 28 of file PopfabItem.cs.

Referenced by Init().

◆ stopFollow

bool PopfabItem.stopFollow

Definition at line 41 of file PopfabItem.cs.

Referenced by Init(), Kill(), and LateUpdate().

◆ uiText

Text PopfabItem.uiText

Definition at line 33 of file PopfabItem.cs.

Referenced by Init(), and Set().


The documentation for this class was generated from the following file: