Elin Modding Docs Doc
Loading...
Searching...
No Matches
WidgetMinimap.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.EventSystems;
5
6// Token: 0x02000624 RID: 1572
7public class WidgetMinimap : Widget, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler, IChangeResolution, IInitializePotentialDragHandler
8{
9 // Token: 0x06002BFF RID: 11263 RVA: 0x000F7589 File Offset: 0x000F5789
10 public override object CreateExtra()
11 {
12 return new WidgetMinimap.Extra();
13 }
14
15 // Token: 0x17000C95 RID: 3221
16 // (get) Token: 0x06002C00 RID: 11264 RVA: 0x000F7590 File Offset: 0x000F5790
17 public override Type SetSiblingAfter
18 {
19 get
20 {
21 return typeof(WidgetBottomBar);
22 }
23 }
24
25 // Token: 0x17000C96 RID: 3222
26 // (get) Token: 0x06002C01 RID: 11265 RVA: 0x000F759C File Offset: 0x000F579C
27 public WidgetMinimap.Extra extra
28 {
29 get
30 {
31 return base.config.extra as WidgetMinimap.Extra;
32 }
33 }
34
35 // Token: 0x17000C97 RID: 3223
36 // (get) Token: 0x06002C02 RID: 11266 RVA: 0x000F75AE File Offset: 0x000F57AE
37 public int Size
38 {
39 get
40 {
41 return this.preview.Size;
42 }
43 }
44
45 // Token: 0x17000C98 RID: 3224
46 // (get) Token: 0x06002C03 RID: 11267 RVA: 0x000F75BB File Offset: 0x000F57BB
47 public override bool AlwaysBottom
48 {
49 get
50 {
51 return true;
52 }
53 }
54
55 // Token: 0x06002C04 RID: 11268 RVA: 0x000F75C0 File Offset: 0x000F57C0
56 public override void OnActivate()
57 {
58 WidgetMinimap.Instance = this;
59 this.preview.limitBounds = this.extra.limitBounds;
60 this.preview.monoColor = this.extra.monoColor;
61 this.preview.SetMap(EMono._map);
62 base.InvokeRepeating("RefreshMarkers", 0f, this.interval);
63 this.RefreshStyle();
64 this.buttonMaptool.SetItem(new HotItemContext
65 {
66 id = "mapTool"
67 });
68 }
69
70 // Token: 0x06002C05 RID: 11269 RVA: 0x000F7646 File Offset: 0x000F5846
71 public static void UpdateMap(List<Cell> newPoints)
72 {
73 if (WidgetMinimap.Instance && WidgetMinimap.Instance.preview.map.zone.IsActiveZone)
74 {
75 WidgetMinimap.Instance.preview.UpdateMap(newPoints);
76 }
77 newPoints.Clear();
78 }
79
80 // Token: 0x06002C06 RID: 11270 RVA: 0x000F7685 File Offset: 0x000F5885
81 public static void UpdateMap(int x, int z)
82 {
83 if (WidgetMinimap.Instance && WidgetMinimap.Instance.preview.map.zone.IsActiveZone)
84 {
85 WidgetMinimap.Instance.preview.UpdateMap(x, z);
86 }
87 }
88
89 // Token: 0x06002C07 RID: 11271 RVA: 0x000F76BF File Offset: 0x000F58BF
90 public static void UpdateMap()
91 {
92 if (WidgetMinimap.Instance && WidgetMinimap.Instance.preview.map.zone.IsActiveZone)
93 {
94 WidgetMinimap.Instance.preview.SetMap(EMono._map);
95 }
96 }
97
98 // Token: 0x06002C08 RID: 11272 RVA: 0x000F76FC File Offset: 0x000F58FC
99 public void OnMoveZone()
100 {
101 this.preview.SetMap(EMono._map);
102 this.RefreshStyle();
103 }
104
105 // Token: 0x06002C09 RID: 11273 RVA: 0x000F7714 File Offset: 0x000F5914
106 public void Reload()
107 {
108 this.preview.SetMap(this.preview.map);
109 }
110
111 // Token: 0x06002C0A RID: 11274 RVA: 0x000F772C File Offset: 0x000F592C
112 public void OnPointerDown(PointerEventData e)
113 {
114 if (!EMono.pc.HasNoGoal || EMono.game.activeZone.IsRegion || EMono.ui.IsActive)
115 {
116 SE.BeepSmall();
117 return;
118 }
119 Vector2 size = this.rectMap.rect.size;
120 Vector2 vector;
121 RectTransformUtility.ScreenPointToLocalPointInRectangle(this.rectMap, e.position, e.pressEventCamera, out vector);
122 if (vector.x < 0f)
123 {
124 vector.x = 0f;
125 }
126 else if (vector.x >= size.x)
127 {
128 vector.x = size.x;
129 }
130 if (vector.y < 0f)
131 {
132 vector.y = 0f;
133 }
134 else if (vector.y >= size.y)
135 {
136 vector.y = size.y;
137 }
138 this.pos.Set((int)((float)this.Size * vector.x / size.x), (int)((float)this.Size * vector.y / size.y));
139 this.pos.Clamp(false);
140 if (this.preview.limitBounds)
141 {
142 this.pos.x += EMono._map.bounds.x - this.preview.offsetX;
143 this.pos.z += EMono._map.bounds.z - this.preview.offsetZ;
144 }
145 if (this.pos.cell.outOfBounds || !this.pos.cell.isSeen)
146 {
147 SE.BeepSmall();
148 return;
149 }
150 EMono.pc.SetAIImmediate(new AI_Goto(this.pos, 0, false, false));
151 }
152
153 // Token: 0x06002C0B RID: 11275 RVA: 0x000F78F0 File Offset: 0x000F5AF0
154 public void OnPointerUp(PointerEventData e)
155 {
156 }
157
158 // Token: 0x06002C0C RID: 11276 RVA: 0x000F78F2 File Offset: 0x000F5AF2
159 public void OnInitializePotentialDrag(PointerEventData ped)
160 {
161 ped.useDragThreshold = false;
162 }
163
164 // Token: 0x06002C0D RID: 11277 RVA: 0x000F78FC File Offset: 0x000F5AFC
165 public void OnDrag(PointerEventData e)
166 {
167 }
168
169 // Token: 0x06002C0E RID: 11278 RVA: 0x000F790C File Offset: 0x000F5B0C
170 public override void OnSetContextMenu(UIContextMenu m)
171 {
172 UIContextMenu uicontextMenu = m.AddChild("setting");
173 uicontextMenu.AddSlider("size", (float a) => this.extra.scale.ToString() ?? "", (float)this.extra.scale, delegate(float a)
174 {
175 this.extra.scale = (int)a;
176 this.RefreshStyle();
177 }, 5f, 20f, true, true, false);
178 uicontextMenu.AddSlider("width", (float a) => (100 + this.extra.width).ToString() + "%", (float)this.extra.width, delegate(float a)
179 {
180 this.extra.width = (int)a;
181 this.RefreshStyle();
182 }, -25f, 25f, true, true, false);
183 uicontextMenu.AddSlider("alpha", (float a) => this.extra.alpha.ToString() ?? "", (float)this.extra.alpha, delegate(float a)
184 {
185 this.extra.alpha = (int)a;
186 this.RefreshStyle();
187 }, 0f, 255f, true, true, false);
188 uicontextMenu.AddToggle("rotation", this.extra.rotate, delegate(bool a)
189 {
190 this.extra.rotate = a;
191 this.RefreshStyle();
192 });
193 uicontextMenu.AddToggle("monoColor", this.extra.monoColor, delegate(bool a)
194 {
195 WidgetMinimap.Extra extra = this.extra;
196 this.preview.monoColor = a;
197 extra.monoColor = a;
198 this.preview.SetMap(EMono._map);
199 this.RefreshStyle();
200 });
201 base.SetBaseContextMenu(m);
202 }
203
204 // Token: 0x06002C0F RID: 11279 RVA: 0x000F7A28 File Offset: 0x000F5C28
205 public void RefreshStyle()
206 {
207 this.rectAll.localEulerAngles = ((this.extra.rotate && !EMono._zone.IsRegion) ? new Vector3(60f, 0f, -45f) : Vector3.zero);
208 this.preview.matMap.SetColor("_Color", new Color(1f, 1f, 1f, (float)this.extra.alpha / 255f));
209 this.Rect().sizeDelta = new Vector2(0.1f * this.baseSize.x * (float)(10 + this.extra.scale) * (float)(100 + this.extra.width) * 0.01f, 0.1f * this.baseSize.y * (float)(10 + this.extra.scale));
210 }
211
212 // Token: 0x06002C10 RID: 11280 RVA: 0x000F7B18 File Offset: 0x000F5D18
213 public void OnUpdate()
214 {
215 this.point.Set(EMono.screen.position);
216 if (this.preview.limitBounds)
217 {
218 this.point.x -= EMono._map.bounds.x - this.preview.offsetX;
219 this.point.z -= EMono._map.bounds.z - this.preview.offsetZ;
220 }
221 float x = (float)(this.point.x / this.Size) - 0.5f;
222 float y = (float)(this.point.z / this.Size) - 0.5f;
223 this.transBound.localScale = new Vector3(Mathf.Min((float)EMono.screen.width / (float)this.Size * 1.5f, 1f), Mathf.Min((float)EMono.screen.height / (float)this.Size / 2f, 1f), 1f);
224 this.transBound.localPosition = new Vector3(x, y, 50f);
225 this.transCam.localScale = new Vector3(1f / EMono.core.uiScale, 1f / EMono.core.uiScale, 1f);
226 }
227
228 // Token: 0x06002C11 RID: 11281 RVA: 0x000F7C80 File Offset: 0x000F5E80
229 public void RefreshMarkers()
230 {
231 if (!base.gameObject.activeInHierarchy)
232 {
233 return;
234 }
235 this.EmitParticle(EMono.pc, this.psAlly, this.colorAlly);
236 }
237
238 // Token: 0x06002C12 RID: 11282 RVA: 0x000F7CB4 File Offset: 0x000F5EB4
239 public void EmitParticle(Card c, ParticleSystem ps, Color col)
240 {
241 int num = c.pos.x;
242 int num2 = c.pos.z;
243 if (this.preview.limitBounds)
244 {
245 num -= EMono._map.bounds.x - this.preview.offsetX;
246 num2 -= EMono._map.bounds.z - this.preview.offsetZ;
247 }
248 float x = (float)num / (float)this.Size - 0.5f;
249 float y = (float)num2 / (float)this.Size - 0.5f;
250 this.count++;
251 ParticleSystem.EmitParams emitParams = new ParticleSystem.EmitParams
252 {
253 position = new Vector3(x, y, 10f),
254 startSize = this.psSize,
255 startLifetime = this.intervalPS,
256 startColor = col
257 };
258 this.psAlly.Emit(emitParams, 1);
259 }
260
261 // Token: 0x040018A0 RID: 6304
262 public static WidgetMinimap Instance;
263
264 // Token: 0x040018A1 RID: 6305
265 public float interval;
266
267 // Token: 0x040018A2 RID: 6306
268 public float intervalPS;
269
270 // Token: 0x040018A3 RID: 6307
271 public float psSize;
272
273 // Token: 0x040018A4 RID: 6308
274 public RectTransform rectAll;
275
276 // Token: 0x040018A5 RID: 6309
277 public RectTransform rectMap;
278
279 // Token: 0x040018A6 RID: 6310
280 public Vector2 baseSize;
281
282 // Token: 0x040018A7 RID: 6311
283 private Point pos = new Point();
284
285 // Token: 0x040018A8 RID: 6312
286 public UIButton buttonMaptool;
287
288 // Token: 0x040018A9 RID: 6313
289 public UIMapPreview preview;
290
291 // Token: 0x040018AA RID: 6314
292 public Color colorAlly;
293
294 // Token: 0x040018AB RID: 6315
295 public Color colorEnemy;
296
297 // Token: 0x040018AC RID: 6316
298 public Color colorGuest;
299
300 // Token: 0x040018AD RID: 6317
301 public ParticleSystem psAlly;
302
303 // Token: 0x040018AE RID: 6318
304 public Transform transBound;
305
306 // Token: 0x040018AF RID: 6319
307 public Vector2 posPs;
308
309 // Token: 0x040018B0 RID: 6320
310 public Transform transCam;
311
312 // Token: 0x040018B1 RID: 6321
313 private Point point = new Point();
314
315 // Token: 0x040018B2 RID: 6322
316 private int count;
317
318 // Token: 0x02000B97 RID: 2967
319 public class Extra
320 {
321 // Token: 0x04002E77 RID: 11895
322 public bool rotate;
323
324 // Token: 0x04002E78 RID: 11896
325 public bool monoColor;
326
327 // Token: 0x04002E79 RID: 11897
328 public bool limitBounds;
329
330 // Token: 0x04002E7A RID: 11898
331 public int alpha;
332
333 // Token: 0x04002E7B RID: 11899
334 public int scale;
335
336 // Token: 0x04002E7C RID: 11900
337 public int width;
338 }
339}
Definition Card.cs:13
Definition EMono.cs:6
Definition Point.cs:11