Elin Modding Docs Doc
Loading...
Searching...
No Matches
WidgetMouseover.cs
1using System;
2using DG.Tweening;
3using DG.Tweening.Core;
4using DG.Tweening.Plugins.Options;
5using UnityEngine;
6using UnityEngine.UI;
7
8// Token: 0x02000625 RID: 1573
9public class WidgetMouseover : Widget
10{
11 // Token: 0x06002C1C RID: 11292 RVA: 0x000F7EB9 File Offset: 0x000F60B9
12 public override void OnActivate()
13 {
14 WidgetMouseover.Instance = this;
15 this.Hide(true);
16 }
17
18 // Token: 0x06002C1D RID: 11293 RVA: 0x000F7EC8 File Offset: 0x000F60C8
19 public void Refresh()
20 {
21 this.timer += Core.delta;
22 PointTarget mouseTarget = EMono.scene.mouseTarget;
23 if (!mouseTarget.hasTargetChanged && this.timer < 0.1f)
24 {
25 return;
26 }
27 this.timer = 0f;
28 bool flag = EInput.isShiftDown && mouseTarget.pos.Equals(EMono.pc.pos) && (EMono.pc.ride != null || EMono.pc.parasite != null);
29 if ((!flag && mouseTarget.target == null) || (ActionMode.IsAdv && Input.GetMouseButton(0)))
30 {
31 this.Hide(false);
32 return;
33 }
34 string text = "";
35 Card card = mouseTarget.card;
36 if (flag)
37 {
38 if (EMono.pc.ride != null)
39 {
40 text += EMono.pc.ride.GetHoverText();
41 text += EMono.pc.ride.GetHoverText2();
42 }
43 if (EMono.pc.parasite != null)
44 {
45 if (EMono.pc.ride != null)
46 {
47 text += Environment.NewLine;
48 }
49 text += EMono.pc.parasite.GetHoverText();
50 text += EMono.pc.parasite.GetHoverText2();
51 }
52 }
53 else if (card != null)
54 {
55 text = card.GetHoverText();
56 int count = EMono.scene.mouseTarget.cards.Count;
57 if (count > 1)
58 {
59 text += "otherCards".lang((count - 1).ToString() ?? "", null, null, null, null);
60 }
61 text += card.GetHoverText2();
62 if (mouseTarget.target != card)
63 {
64 text = text + Environment.NewLine + mouseTarget.target.InspectName;
65 }
66 }
67 else
68 {
69 text = mouseTarget.target.InspectName;
70 }
71 this.Show(text);
72 }
73
74 // Token: 0x06002C1E RID: 11294 RVA: 0x000F80A8 File Offset: 0x000F62A8
75 public void Show(string s)
76 {
77 this.layout.SetActive(true);
78 this.cg.alpha = 1f;
79 TweenUtil.KillTween(ref this.tween, false);
80 this.textName.text = s;
81 RectPosition anchor = this.Rect().GetAnchor();
82 if (anchor <= RectPosition.TopRIGHT)
83 {
84 if (anchor != RectPosition.TopLEFT)
85 {
86 if (anchor != RectPosition.TopRIGHT)
87 {
88 goto IL_76;
89 }
90 goto IL_68;
91 }
92 }
93 else if (anchor != RectPosition.BottomLEFT)
94 {
95 if (anchor != RectPosition.BottomRIGHT)
96 {
97 goto IL_76;
98 }
99 goto IL_68;
100 }
101 this.layout.childAlignment = TextAnchor.MiddleLeft;
102 goto IL_82;
103 IL_68:
104 this.layout.childAlignment = TextAnchor.MiddleRight;
105 goto IL_82;
106 IL_76:
107 this.layout.childAlignment = TextAnchor.MiddleCenter;
108 IL_82:
109 this.layout.RebuildLayout(false);
110 }
111
112 // Token: 0x06002C1F RID: 11295 RVA: 0x000F8144 File Offset: 0x000F6344
113 public void Hide(bool immediate = false)
114 {
115 this.imageBG.raycastTarget = false;
116 if (immediate)
117 {
118 this.layout.SetActive(false);
119 return;
120 }
121 TweenUtil.KillTween(ref this.tween, false);
122 this.tween = this.cg.DOFade(0f, 0.3f).OnComplete(delegate
123 {
124 if (this.layout)
125 {
126 this.layout.SetActive(false);
127 }
128 }).SetEase(Ease.InQuad);
129 }
130
131 // Token: 0x06002C20 RID: 11296 RVA: 0x000F81AC File Offset: 0x000F63AC
132 public override void OnManagerActivate()
133 {
134 base.OnManagerActivate();
135 this.imageBG.raycastTarget = true;
136 this.Show("[" + Lang.Get("WidgetMouseover") + "]");
137 }
138
139 // Token: 0x06002C21 RID: 11297 RVA: 0x000F81DF File Offset: 0x000F63DF
140 public override void OnManagerDeactivate()
141 {
142 base.OnManagerDeactivate();
143 this.Hide(true);
144 }
145
146 // Token: 0x040018B3 RID: 6323
147 public static WidgetMouseover Instance;
148
149 // Token: 0x040018B4 RID: 6324
150 public UIText textName;
151
152 // Token: 0x040018B5 RID: 6325
153 public LayoutGroup layout;
154
155 // Token: 0x040018B6 RID: 6326
156 public CanvasGroup cg;
157
158 // Token: 0x040018B7 RID: 6327
159 public Tween tween;
160
161 // Token: 0x040018B8 RID: 6328
162 private float timer;
163}
Definition Card.cs:13
Definition EMono.cs:6