Elin Decompiled Documentation EA 23.130 Nightly
Loading...
Searching...
No Matches
DamageTextRenderer.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
6
8
10
11 public int sum;
12
13 public int num;
14
15 public void Add(Card target, Card attacker, int dmg, Element e = null)
16 {
17 if (e == null)
18 {
19 e = Element.Void;
20 }
21 if (lastTarget != target || lastAttacker != attacker || lastElement.id != e.id)
22 {
23 Flush();
24 lastTarget = target;
25 lastAttacker = attacker;
26 lastElement = e;
27 }
28 sum += dmg;
29 num++;
31 {
32 Flush();
33 }
34 }
35
36 public void Flush()
37 {
38 if (this.num != 0)
39 {
41 Card card2 = lastAttacker;
42 Element element = lastElement;
43 Popper popper = EClass.scene.popper.Pop(card.renderer.PositionCenter(), "DamageNum");
45 if (card2 != null)
46 {
47 c = (card2.IsPC ? EClass.Colors.textColors.damagePC : (card2.IsPCFaction ? EClass.Colors.textColors.damagePCParty : EClass.Colors.textColors.damage));
48 }
49 if (element != Element.Void)
50 {
51 c = EClass.Colors.elementColors.TryGetValue(element.source.alias);
52 float num = (c.r + c.g + c.b) / 3f;
53 num = ((num > 0.5f) ? 0f : (0.6f - num));
54 c = new Color(c.r + num, c.g + num, c.b + num, 1f);
55 }
56 popper.SetText((this.num == 1) ? (sum.ToString() ?? "") : (sum + "<size=18> (x" + this.num + ")</size>"), c);
57 sum = (this.num = 0);
58 }
59 }
60}
Definition: Card.cs:11
UD_String_Color elementColors
TextColors textColors
CoreConfig config
Definition: Core.cs:70
void Add(Card target, Card attacker, int dmg, Element e=null)
Definition: EClass.cs:5
static Scene scene
Definition: EClass.cs:30
static ColorProfile Colors
Definition: EClass.cs:38
static Core core
Definition: EClass.cs:6
int id
Definition: ELEMENT.cs:246
SourceElement.Row source
Definition: ELEMENT.cs:269
static Element Void
Definition: ELEMENT.cs:234
Popper Pop(Vector3 pos, string id, Sprite sprite)
Definition: Popper.cs:6
Popper SetText(string s, Color c=default(Color))
Definition: Popper.cs:28
PopperManager popper
Definition: Scene.cs:95
bool TryGetValue(TKey key, out TValue value)
Definition: UDictionary.cs:178