Elin Modding Docs Doc
Loading...
Searching...
No Matches
Widget.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5using UnityEngine.UI;
6
7// Token: 0x020005F4 RID: 1524
8public class Widget : EMono, IChangeResolution, ISkinRoot
9{
10 // Token: 0x060029E7 RID: 10727 RVA: 0x000EC231 File Offset: 0x000EA431
11 public void Test()
12 {
13 }
14
15 // Token: 0x17000C0C RID: 3084
16 // (get) Token: 0x060029E8 RID: 10728 RVA: 0x000EC234 File Offset: 0x000EA434
17 public string ID
18 {
19 get
20 {
21 if (this._ID == null)
22 {
23 return this._ID = base.name.Replace("Widget", "").Replace("(Clone)", "");
24 }
25 return this._ID;
26 }
27 }
28
29 // Token: 0x17000C0D RID: 3085
30 // (get) Token: 0x060029E9 RID: 10729 RVA: 0x000EC280 File Offset: 0x000EA480
31 public Widget.Config config
32 {
33 get
34 {
35 Widget.Config result;
36 if ((result = this._config) == null)
37 {
38 result = (this._config = EMono.player.widgets.dict[this.ID]);
39 }
40 return result;
41 }
42 }
43
44 // Token: 0x17000C0E RID: 3086
45 // (get) Token: 0x060029EA RID: 10730 RVA: 0x000EC2BC File Offset: 0x000EA4BC
46 public SkinRoot skinRoot
47 {
48 get
49 {
50 SkinRoot result;
51 if ((result = this._skinRoot) == null)
52 {
53 result = (this._skinRoot = base.GetComponent<SkinRoot>());
54 }
55 return result;
56 }
57 }
58
59 // Token: 0x17000C0F RID: 3087
60 // (get) Token: 0x060029EB RID: 10731 RVA: 0x000EC2E2 File Offset: 0x000EA4E2
61 public bool IsSealed
62 {
63 get
64 {
65 return this.config.meta.system && !EMono.core.config.test.unsealWidgets;
66 }
67 }
68
69 // Token: 0x17000C10 RID: 3088
70 // (get) Token: 0x060029EC RID: 10732 RVA: 0x000EC30F File Offset: 0x000EA50F
71 public virtual bool ShowStyleMenu
72 {
73 get
74 {
75 return true;
76 }
77 }
78
79 // Token: 0x17000C11 RID: 3089
80 // (get) Token: 0x060029ED RID: 10733 RVA: 0x000EC312 File Offset: 0x000EA512
81 public virtual bool AlwaysTop
82 {
83 get
84 {
85 return false;
86 }
87 }
88
89 // Token: 0x17000C12 RID: 3090
90 // (get) Token: 0x060029EE RID: 10734 RVA: 0x000EC315 File Offset: 0x000EA515
91 public virtual bool IsStaticPosition
92 {
93 get
94 {
95 return false;
96 }
97 }
98
99 // Token: 0x17000C13 RID: 3091
100 // (get) Token: 0x060029EF RID: 10735 RVA: 0x000EC318 File Offset: 0x000EA518
101 public virtual bool AlwaysBottom
102 {
103 get
104 {
105 return false;
106 }
107 }
108
109 // Token: 0x17000C14 RID: 3092
110 // (get) Token: 0x060029F0 RID: 10736 RVA: 0x000EC31B File Offset: 0x000EA51B
111 public virtual Type SetSiblingAfter
112 {
113 get
114 {
115 return null;
116 }
117 }
118
119 // Token: 0x17000C15 RID: 3093
120 // (get) Token: 0x060029F1 RID: 10737 RVA: 0x000EC31E File Offset: 0x000EA51E
121 public virtual bool ShowInBuildMode
122 {
123 get
124 {
125 return this.config.mode.HasFlag(GameMode.Build);
126 }
127 }
128
129 // Token: 0x17000C16 RID: 3094
130 // (get) Token: 0x060029F2 RID: 10738 RVA: 0x000EC33B File Offset: 0x000EA53B
131 public virtual bool RightClickToClose
132 {
133 get
134 {
135 return this.config.RC;
136 }
137 }
138
139 // Token: 0x17000C17 RID: 3095
140 // (get) Token: 0x060029F3 RID: 10739 RVA: 0x000EC348 File Offset: 0x000EA548
141 public virtual bool AllowRightClickToClose
142 {
143 get
144 {
145 return false;
146 }
147 }
148
149 // Token: 0x060029F4 RID: 10740 RVA: 0x000EC34B File Offset: 0x000EA54B
150 public bool IsInRightMode()
151 {
152 return (EMono.scene.actionMode.ShowBuildWidgets && this.ShowInBuildMode) || this.config.IsInRightMode();
153 }
154
155 // Token: 0x060029F5 RID: 10741 RVA: 0x000EC374 File Offset: 0x000EA574
156 public void Activate()
157 {
158 this._rect = this.Rect();
159 this.config.state = Widget.State.Active;
160 if (this.config.extra == null)
161 {
162 this.config.extra = this.CreateExtra();
163 }
164 if (!this.dragPanel)
165 {
166 this.dragPanel = base.GetComponentInChildren<UIDragPanel>();
167 }
168 if (this.IsStaticPosition)
169 {
170 this.dragPanel.enable = false;
171 }
172 else
173 {
174 this.dragPanel.autoAnchor = (this.config.userAnchor == RectPosition.Auto);
175 if (this.config.userAnchor != RectPosition.Auto)
176 {
177 this._rect.SetAnchor(this.config.userAnchor);
178 }
179 else
180 {
181 this._rect.SetAnchor(this.config.anchor);
182 }
183 this._rect.anchoredPosition = new Vector2(this.config.x, this.config.y);
184 this.dragPanel.onDrag = new Action(this.OnChangePosition);
185 }
186 this.SetPivot(this.config.pivot);
187 this.OnActivate();
188 if (this == null)
189 {
190 return;
191 }
192 this.flip = (this._rect.position.x > (float)Screen.width * 0.5f);
193 this.OnFlip();
194 this.OnChangePosition();
195 this.ClampToScreen();
196 foreach (SkinDeco deco in this.config.skin.decos)
197 {
198 this.InstantiateDeco(deco);
199 }
200 }
201
202 // Token: 0x060029F6 RID: 10742 RVA: 0x000EC524 File Offset: 0x000EA724
203 public virtual void OnActivate()
204 {
205 }
206
207 // Token: 0x060029F7 RID: 10743 RVA: 0x000EC526 File Offset: 0x000EA726
208 public virtual object CreateExtra()
209 {
210 return null;
211 }
212
213 // Token: 0x060029F8 RID: 10744 RVA: 0x000EC529 File Offset: 0x000EA729
214 public void Deactivate()
215 {
216 this.OnDeactivate();
217 this.config.state = Widget.State.Inactive;
218 this.UpdateConfig();
219 UnityEngine.Object.DestroyImmediate(base.gameObject);
220 }
221
222 // Token: 0x060029F9 RID: 10745 RVA: 0x000EC54E File Offset: 0x000EA74E
223 public virtual void OnDeactivate()
224 {
225 }
226
227 // Token: 0x060029FA RID: 10746 RVA: 0x000EC550 File Offset: 0x000EA750
228 public void Close()
229 {
230 EMono.ui.widgets.DeactivateWidget(this);
231 }
232
233 // Token: 0x060029FB RID: 10747 RVA: 0x000EC562 File Offset: 0x000EA762
234 public void Reactivate()
235 {
236 EMono.ui.widgets.DeactivateWidget(this);
237 EMono.ui.widgets.ActivateWidget(this.config);
238 }
239
240 // Token: 0x060029FC RID: 10748 RVA: 0x000EC58C File Offset: 0x000EA78C
241 public virtual void OnManagerActivate()
242 {
243 this.goCover = Util.Instantiate("UI/Widget/CoverWidget", base.transform).gameObject;
244 RectTransform rectTransform = this.goCover.transform.Rect();
245 RectTransform rectTransform2 = this.dragPanel.Rect();
246 rectTransform.pivot = rectTransform2.pivot;
247 rectTransform.anchorMin = rectTransform2.anchorMin;
248 rectTransform.anchorMax = rectTransform2.anchorMax;
249 rectTransform.anchoredPosition = rectTransform2.anchoredPosition;
250 rectTransform.sizeDelta = rectTransform2.sizeDelta;
251 UIDragPanel componentInChildren = this.goCover.GetComponentInChildren<UIDragPanel>();
252 componentInChildren.autoAnchor = (this.config.userAnchor == RectPosition.Auto);
253 componentInChildren.onDrag = new Action(this.OnChangePosition);
254 componentInChildren.container = this.dragPanel.container;
255 componentInChildren.target = this.dragPanel.target;
256 componentInChildren.bound = this.dragPanel.bound;
257 if (this is WidgetSideScreen)
258 {
259 componentInChildren.enable = false;
260 }
261 this.goCover.GetComponentInChildren<UIText>().SetText(("Widget" + this.ID).lang());
262 }
263
264 // Token: 0x060029FD RID: 10749 RVA: 0x000EC6A4 File Offset: 0x000EA8A4
265 public virtual void OnManagerDeactivate()
266 {
267 UnityEngine.Object.DestroyImmediate(this.goCover);
268 }
269
270 // Token: 0x060029FE RID: 10750 RVA: 0x000EC6B1 File Offset: 0x000EA8B1
271 public void SetAnchor(RectPosition p)
272 {
273 this.config.userAnchor = p;
274 this.dragPanel.autoAnchor = (p == RectPosition.Auto);
275 this._rect.SetAnchor(p);
276 }
277
278 // Token: 0x060029FF RID: 10751 RVA: 0x000EC6DC File Offset: 0x000EA8DC
279 public void SetPivot(RectPosition p)
280 {
281 this.config.pivot = p;
282 RectTransform rectTransform = this.Rect();
283 Vector3 position = base.transform.position;
284 switch (p)
285 {
286 case RectPosition.TopLEFT:
287 rectTransform.pivot = new Vector2(0f, 1f);
288 goto IL_126;
289 case RectPosition.TopCenter:
290 rectTransform.pivot = new Vector2(0.5f, 1f);
291 goto IL_126;
292 case RectPosition.TopRIGHT:
293 rectTransform.pivot = new Vector2(1f, 1f);
294 goto IL_126;
295 case RectPosition.Left:
296 rectTransform.pivot = new Vector2(0f, 0.5f);
297 goto IL_126;
298 case RectPosition.Right:
299 rectTransform.pivot = new Vector2(1f, 0.5f);
300 goto IL_126;
301 case RectPosition.BottomLEFT:
302 rectTransform.pivot = new Vector2(0f, 0f);
303 goto IL_126;
304 case RectPosition.BottomCenter:
305 rectTransform.pivot = new Vector2(0.5f, 0f);
306 goto IL_126;
307 case RectPosition.BottomRIGHT:
308 rectTransform.pivot = new Vector2(1f, 0f);
309 goto IL_126;
310 }
311 rectTransform.pivot = new Vector2(0.5f, 0.5f);
312 IL_126:
313 base.transform.position = position;
314 this.OnChangePivot();
315 this.ClampToScreen();
316 }
317
318 // Token: 0x06002A00 RID: 10752 RVA: 0x000EC827 File Offset: 0x000EAA27
319 public virtual void OnChangePivot()
320 {
321 }
322
323 // Token: 0x06002A01 RID: 10753 RVA: 0x000EC82C File Offset: 0x000EAA2C
324 public void UpdateConfig()
325 {
326 this.config.anchor = this._rect.GetAnchor();
327 this.config.x = this._rect.anchoredPosition.x;
328 this.config.y = this._rect.anchoredPosition.y;
329 this.OnUpdateConfig();
330 }
331
332 // Token: 0x06002A02 RID: 10754 RVA: 0x000EC88B File Offset: 0x000EAA8B
333 public virtual void OnUpdateConfig()
334 {
335 }
336
337 // Token: 0x06002A03 RID: 10755 RVA: 0x000EC890 File Offset: 0x000EAA90
338 protected void ClampToScreenEnsured(Component c, Vector2 anchoredPos)
339 {
340 RectTransform rectTransform = c.Rect();
341 rectTransform.anchoredPosition = anchoredPos;
342 rectTransform.RebuildLayout(false);
343 rectTransform.ForceUpdateRectTransforms();
344 this.ClampToScreen(rectTransform, 10f);
345 rectTransform.anchoredPosition = anchoredPos;
346 rectTransform.RebuildLayout(false);
347 rectTransform.ForceUpdateRectTransforms();
348 this.ClampToScreen(rectTransform, 10f);
349 }
350
351 // Token: 0x06002A04 RID: 10756 RVA: 0x000EC8E4 File Offset: 0x000EAAE4
352 public void ClampToScreen()
353 {
354 this.ClampToScreen(this.Rect(), 10f);
355 }
356
357 // Token: 0x06002A05 RID: 10757 RVA: 0x000EC8F8 File Offset: 0x000EAAF8
358 protected void ClampToScreen(RectTransform rect, float margin = 10f)
359 {
360 if (this.IsStaticPosition || this.config.userAnchor != RectPosition.Auto)
361 {
362 return;
363 }
364 Vector3 position = rect.position;
365 Vector2 a = new Vector2(margin, margin);
366 Vector2 a2 = new Vector2((float)Screen.width - margin, (float)Screen.height - margin);
367 Vector3 vector = a - rect.rect.min;
368 Vector3 vector2 = a2 - rect.rect.max;
369 position.x = (float)((int)Mathf.Clamp(position.x, vector.x - 20f, vector2.x + 20f));
370 position.y = (float)((int)Mathf.Clamp(position.y, vector.y - 20f, vector2.y + 20f));
371 rect.position = position;
372 }
373
374 // Token: 0x06002A06 RID: 10758 RVA: 0x000EC9D4 File Offset: 0x000EABD4
375 public virtual void OnChangeResolution()
376 {
377 this.ClampToScreen(this.Rect(), 10f);
378 }
379
380 // Token: 0x06002A07 RID: 10759 RVA: 0x000EC9E8 File Offset: 0x000EABE8
381 public void OnChangePosition()
382 {
383 bool flag = this.Rect().position.x > (float)Screen.width * 0.5f;
384 if (this.flip != flag)
385 {
386 this.flip = flag;
387 this.OnFlip();
388 }
389 this.RefreshTipPivotPosition();
390 }
391
392 // Token: 0x06002A08 RID: 10760 RVA: 0x000ECA30 File Offset: 0x000EAC30
393 public virtual void OnChangeActionMode()
394 {
395 this.SetActive(this.IsInRightMode());
396 }
397
398 // Token: 0x06002A09 RID: 10761 RVA: 0x000ECA3E File Offset: 0x000EAC3E
399 public virtual void OnFlip()
400 {
401 }
402
403 // Token: 0x06002A0A RID: 10762 RVA: 0x000ECA40 File Offset: 0x000EAC40
404 public bool IsAlignTop()
405 {
406 RectPosition anchor = this.Rect().GetAnchor();
407 return anchor == RectPosition.TopCenter || anchor == RectPosition.TopLEFT || anchor == RectPosition.TopRIGHT;
408 }
409
410 // Token: 0x06002A0B RID: 10763 RVA: 0x000ECA68 File Offset: 0x000EAC68
411 public Layer AddLayer(Layer l, Transform trans)
412 {
413 l.OnBeforeAddLayer();
414 l.gameObject.SetActive(true);
415 l.transform.SetParent(trans, false);
416 l.Init();
417 l.OnAfterAddLayer();
418 Window window = l.windows[0];
419 RectTransform rectTransform = l.Rect();
420 RectTransform rectTransform2 = window.Rect();
421 rectTransform.sizeDelta = window.Rect().sizeDelta;
422 rectTransform.SetPivot(0.5f, 0.5f);
423 rectTransform.SetAnchor(0.5f, 0.5f, 0.5f, 0.5f);
424 rectTransform2.SetPivot(0.5f, 0.5f);
425 rectTransform2.SetAnchor(0.5f, 0.5f, 0.5f, 0.5f);
426 rectTransform2.anchoredPosition = Vector2.zero;
427 window.setting.allowMove = (window.setting.allowResize = false);
428 window.setting.saveWindow = false;
429 window.bgCollider.SetActive(false);
430 return l;
431 }
432
433 // Token: 0x06002A0C RID: 10764 RVA: 0x000ECB5C File Offset: 0x000EAD5C
434 public void RefreshTipPivotPosition()
435 {
436 bool flag = (float)(Screen.width / 2 - 40) > base.transform.position.x;
437 if (this.tipPivotLeft)
438 {
439 this.tipPivotLeft.SetActive(!flag || !this.tipPivotRight);
440 }
441 if (this.tipPivotRight)
442 {
443 this.tipPivotRight.SetActive(flag || !this.tipPivotLeft);
444 }
445 }
446
447 // Token: 0x06002A0D RID: 10765 RVA: 0x000ECBDF File Offset: 0x000EADDF
448 public SkinSet GetSkin()
449 {
450 return SkinManager.Instance.skinSets[this.config.skin.id];
451 }
452
453 // Token: 0x06002A0E RID: 10766 RVA: 0x000ECC00 File Offset: 0x000EAE00
454 public SkinConfig GetSkinConfig()
455 {
456 return this.config.skin;
457 }
458
459 // Token: 0x06002A0F RID: 10767 RVA: 0x000ECC10 File Offset: 0x000EAE10
460 public void SetSkin(int id, int v = 0)
461 {
462 SkinConfig skin = this.config.skin;
463 if (skin.id != id)
464 {
465 skin.SetID(id);
466 }
467 skin.id = id;
468 skin.bg = v;
469 skin.bgColor = skin.BG.color;
470 this.ApplySkin();
471 }
472
473 // Token: 0x06002A10 RID: 10768 RVA: 0x000ECC5E File Offset: 0x000EAE5E
474 public void TestSkin()
475 {
476 this.config.skin.SetID();
477 this.ApplySkin();
478 }
479
480 // Token: 0x06002A11 RID: 10769 RVA: 0x000ECC78 File Offset: 0x000EAE78
481 public virtual void ApplySkin()
482 {
483 SkinRoot component = base.GetComponent<SkinRoot>();
484 if (!component)
485 {
486 return;
487 }
488 component.Reset();
489 IUISkin[] componentsInChildren = base.GetComponentsInChildren<IUISkin>(true);
490 for (int i = 0; i < componentsInChildren.Length; i++)
491 {
492 componentsInChildren[i].ApplySkin();
493 }
494 this.OnApplySkin();
495 }
496
497 // Token: 0x06002A12 RID: 10770 RVA: 0x000ECCBF File Offset: 0x000EAEBF
498 public virtual void OnApplySkin()
499 {
500 }
501
502 // Token: 0x06002A13 RID: 10771 RVA: 0x000ECCC4 File Offset: 0x000EAEC4
503 public void InstantiateDeco(SkinDeco deco)
504 {
505 SkinDecoActor skinDecoActor = Util.Instantiate<SkinDecoActor>("UI/Widget/SkinDecoActor", base.transform);
506 deco.actor = skinDecoActor;
507 skinDecoActor.owner = deco;
508 skinDecoActor.image.sprite = ResourceCache.Load<Sprite>("Media/Graphics/Deco/deco" + deco.id.ToString());
509 skinDecoActor.Rect().anchoredPosition = new Vector2((float)deco.x, (float)deco.y);
510 skinDecoActor.Refresh();
511 }
512
513 // Token: 0x06002A14 RID: 10772 RVA: 0x000ECD3C File Offset: 0x000EAF3C
514 public void AddDeco(SkinDeco deco)
515 {
516 this.config.skin.decos.Add(deco);
517 this.InstantiateDeco(deco);
518 }
519
520 // Token: 0x06002A15 RID: 10773 RVA: 0x000ECD5B File Offset: 0x000EAF5B
521 public void RemoveDeco(SkinDeco deco)
522 {
523 this.config.skin.decos.Remove(deco);
524 UnityEngine.Object.DestroyImmediate(deco.actor.gameObject);
525 }
526
527 // Token: 0x06002A16 RID: 10774 RVA: 0x000ECD84 File Offset: 0x000EAF84
528 public virtual bool CanShowContextMenu()
529 {
530 return true;
531 }
532
533 // Token: 0x06002A17 RID: 10775 RVA: 0x000ECD88 File Offset: 0x000EAF88
534 public void ShowContextMenu()
535 {
536 UIContextMenu uicontextMenu = EMono.ui.CreateContextMenu("ContextMenu");
537 this.OnSetContextMenu(uicontextMenu);
538 uicontextMenu.Show();
539 }
540
541 // Token: 0x06002A18 RID: 10776 RVA: 0x000ECDB4 File Offset: 0x000EAFB4
542 public void SetBaseContextMenu(UIContextMenu m)
543 {
544 UIContextMenu uicontextMenu = m.AddChild("anchor");
545 SkinConfig cfg = this.config.skin;
546 using (List<RectPosition>.Enumerator enumerator = Util.EnumToList<RectPosition>().GetEnumerator())
547 {
548 while (enumerator.MoveNext())
549 {
550 RectPosition p = enumerator.Current;
551 uicontextMenu.AddButton(((this.config.userAnchor == p) ? "★ " : "") + p.ToString().lang(), delegate()
552 {
553 this.SetAnchor(p);
554 SE.ClickGeneral();
555 m.Hide();
556 }, true);
557 }
558 }
559 uicontextMenu = m.AddChild("pivot");
560 using (List<RectPosition>.Enumerator enumerator = Util.EnumToList<RectPosition>().GetEnumerator())
561 {
562 while (enumerator.MoveNext())
563 {
564 RectPosition p = enumerator.Current;
565 uicontextMenu.AddButton(((this.config.pivot == p) ? "★ " : "") + p.ToString().lang(), delegate()
566 {
567 this.SetPivot(p);
568 SE.ClickGeneral();
569 m.Hide();
570 }, true);
571 }
572 }
573 UIContextMenuItem sliderB = null;
574 Action Refresh = delegate()
575 {
576 int num = EMono.ui.skins.skinSets[cfg.id].bgs.Count - 1;
577 sliderB.slider.maxValue = (float)num;
578 sliderB.slider.value = (float)cfg.bg;
579 sliderB.textSlider.text = cfg.bg.ToString() + "/" + (EMono.ui.skins.skinSets[cfg.id].bgs.Count - 1).ToString();
580 };
581 if (this.ShowStyleMenu)
582 {
583 UIContextMenu uicontextMenu2 = m.AddOrGetChild("style");
584 sliderB = uicontextMenu2.AddSlider("changeBG", (float n) => n.ToString() + "/" + (EMono.ui.skins.skinSets[cfg.id].bgs.Count - 1).ToString(), (float)cfg.bg, delegate(float a)
585 {
586 this.SetSkin(cfg.id, (int)a);
587 Refresh();
588 }, 0f, (float)(EMono.ui.skins.skinSets[cfg.id].bgs.Count - 1), true, true, false);
589 uicontextMenu2.AddSlider("bgSize", (float n) => n.ToString() ?? "", (float)cfg.bgSize, delegate(float a)
590 {
591 cfg.bgSize = (int)a;
592 this.ApplySkin();
593 }, -50f, 50f, true, true, false);
594 Action<PickerState, Color> <>9__13;
595 uicontextMenu2.AddButton("colorBG", delegate()
596 {
597 if (EMono.ui.skins.skinSets[cfg.id].bgs[cfg.bg].redirect != SkinAssetRedirect.None)
598 {
599 SE.Beep();
600 return;
601 }
602 LayerColorPicker layerColorPicker = EMono.ui.AddLayer<LayerColorPicker>();
603 Color bgColor = cfg.bgColor;
604 Color color = EMono.ui.skins.skinSets[cfg.id].bgs[cfg.bg].color;
605 Action<PickerState, Color> onChangeColor;
606 if ((onChangeColor = <>9__13) == null)
607 {
608 onChangeColor = (<>9__13 = delegate(PickerState state, Color _c)
609 {
610 cfg.bgColor = _c;
611 this.ApplySkin();
612 });
613 }
614 layerColorPicker.SetColor(bgColor, color, onChangeColor);
615 }, true);
616 uicontextMenu2.AddButton("editDeco", delegate()
617 {
618 EMono.ui.AddLayer<LayerSkinDeco>().SetWidget(this);
619 }, true);
620 }
621 if (this.AllowRightClickToClose)
622 {
623 m.AddToggle("RC_widget", this.config.RC, delegate(bool a)
624 {
625 this.config.RC = a;
626 });
627 }
628 m.AddButton(() => (this.config.locked ? "unlockWidget" : "lockWidget").lang(), delegate()
629 {
630 EMono.ui.widgets.ToggleLock(this.config);
631 SE.ClickGeneral();
632 m.Hide();
633 LayerWidget layer = EMono.ui.GetLayer<LayerWidget>(false);
634 if (layer == null)
635 {
636 return;
637 }
638 layer.Refresh();
639 });
640 if (!this.IsSealed)
641 {
642 m.AddButton("closeWidget", delegate()
643 {
644 EMono.ui.widgets.DeactivateWidget(this);
645 LayerWidget layer = EMono.ui.GetLayer<LayerWidget>(false);
646 if (layer == null)
647 {
648 return;
649 }
650 layer.Refresh();
651 }, true);
652 }
653 }
654
655 // Token: 0x06002A19 RID: 10777 RVA: 0x000ED0E4 File Offset: 0x000EB2E4
656 public virtual void OnSetContextMenu(UIContextMenu m)
657 {
658 this.SetBaseContextMenu(m);
659 }
660
661 // Token: 0x06002A1A RID: 10778 RVA: 0x000ED0F0 File Offset: 0x000EB2F0
662 public void SetGridContextMenu(UIContextMenu m)
663 {
664 SkinConfig cfg = this.config.skin;
665 m.AddSlider("skinGrid", (float n) => n.ToString() ?? "", (float)cfg.grid, delegate(float a)
666 {
667 cfg.grid = (int)a;
668 cfg.gridColor = cfg.Grid.color;
669 this.ApplySkin();
670 }, 0f, (float)(cfg.Skin.bgGrid.Count - 1), true, true, false);
671 Action<PickerState, Color> <>9__3;
672 m.AddButton("colorGrid", delegate()
673 {
674 LayerColorPicker layerColorPicker = EMono.ui.AddLayer<LayerColorPicker>();
675 Color gridColor = cfg.gridColor;
676 Color color = cfg.Grid.color;
677 Action<PickerState, Color> onChangeColor;
678 if ((onChangeColor = <>9__3) == null)
679 {
680 onChangeColor = (<>9__3 = delegate(PickerState state, Color _c)
681 {
682 cfg.gridColor = _c;
683 this.ApplySkin();
684 });
685 }
686 layerColorPicker.SetColor(gridColor, color, onChangeColor);
687 }, true);
688 }
689
690 // Token: 0x06002A1B RID: 10779 RVA: 0x000ED197 File Offset: 0x000EB397
691 public void SoundActivate()
692 {
693 EMono.Sound.Play(this.soundActivate);
694 }
695
696 // Token: 0x040017B4 RID: 6068
697 private string _ID;
698
699 // Token: 0x040017B5 RID: 6069
700 private Widget.Config _config;
701
702 // Token: 0x040017B6 RID: 6070
703 public Image imageBG;
704
705 // Token: 0x040017B7 RID: 6071
706 public SoundData soundActivate;
707
708 // Token: 0x040017B8 RID: 6072
709 public UIDragPanel dragPanel;
710
711 // Token: 0x040017B9 RID: 6073
712 private RectTransform _rect;
713
714 // Token: 0x040017BA RID: 6074
715 public RectTransform tipPivotLeft;
716
717 // Token: 0x040017BB RID: 6075
718 public RectTransform tipPivotRight;
719
720 // Token: 0x040017BC RID: 6076
721 private SkinRoot _skinRoot;
722
723 // Token: 0x040017BD RID: 6077
724 protected bool flip;
725
726 // Token: 0x040017BE RID: 6078
727 private GameObject goCover;
728
729 // Token: 0x02000B59 RID: 2905
730 [Serializable]
731 public class Meta
732 {
733 // Token: 0x060043CF RID: 17359 RVA: 0x0015AB19 File Offset: 0x00158D19
734 public override string ToString()
735 {
736 return this.id;
737 }
738
739 // Token: 0x04002D92 RID: 11666
740 public string id;
741
742 // Token: 0x04002D93 RID: 11667
743 public bool enabled;
744
745 // Token: 0x04002D94 RID: 11668
746 public bool locked;
747
748 // Token: 0x04002D95 RID: 11669
749 public bool debugOnly;
750
751 // Token: 0x04002D96 RID: 11670
752 public bool system;
753
754 // Token: 0x04002D97 RID: 11671
755 public Widget.WidgetType type;
756
757 // Token: 0x04002D98 RID: 11672
758 public GameMode mode;
759 }
760
761 // Token: 0x02000B5A RID: 2906
762 public enum WidgetType
763 {
764 // Token: 0x04002D9A RID: 11674
765 Default,
766 // Token: 0x04002D9B RID: 11675
767 ZoomMenu
768 }
769
770 // Token: 0x02000B5B RID: 2907
771 public class Config
772 {
773 // Token: 0x170011EE RID: 4590
774 // (get) Token: 0x060043D1 RID: 17361 RVA: 0x0015AB29 File Offset: 0x00158D29
775 [JsonIgnore]
776 public GameMode mode
777 {
778 get
779 {
780 return this.meta.mode;
781 }
782 }
783
784 // Token: 0x170011EF RID: 4591
785 // (get) Token: 0x060043D2 RID: 17362 RVA: 0x0015AB36 File Offset: 0x00158D36
786 [JsonIgnore]
787 public bool IsSealed
788 {
789 get
790 {
791 return this.IsSystem && !EMono.core.config.test.unsealWidgets;
792 }
793 }
794
795 // Token: 0x170011F0 RID: 4592
796 // (get) Token: 0x060043D3 RID: 17363 RVA: 0x0015AB59 File Offset: 0x00158D59
797 [JsonIgnore]
798 public bool IsSystem
799 {
800 get
801 {
802 return this.meta.system || this.annoyPlayer;
803 }
804 }
805
806 // Token: 0x060043D4 RID: 17364 RVA: 0x0015AB70 File Offset: 0x00158D70
807 public bool IsInRightMode()
808 {
809 ActionMode actionMode = EMono.scene.actionMode;
810 if (actionMode.ShowBuildWidgets)
811 {
812 return this.mode.HasFlag(GameMode.Build);
813 }
814 if (actionMode == ActionMode.NoMap || actionMode == ActionMode.NewZone || actionMode == ActionMode.ViewMap)
815 {
816 return this.mode.HasFlag(GameMode.NoMap);
817 }
818 if (actionMode == ActionMode.Bird)
819 {
820 return this.mode.HasFlag(GameMode.Bird);
821 }
822 if (ActionMode.DefaultMode == ActionMode.Sim)
823 {
824 return this.mode.HasFlag(GameMode.Sim);
825 }
826 if (ActionMode.DefaultMode == ActionMode.EloMap)
827 {
828 return this.mode.HasFlag(GameMode.EloMap);
829 }
830 return (ActionMode.IsAdv || ActionMode.DefaultMode == ActionMode.View) && (actionMode != ActionMode.Region || this.mode.HasFlag(GameMode.EloMap)) && (ActionMode.Adv.zoomOut || this.meta.type != Widget.WidgetType.ZoomMenu) && this.mode.HasFlag(GameMode.Adv);
831 }
832
833 // Token: 0x04002D9C RID: 11676
834 public Widget.State state;
835
836 // Token: 0x04002D9D RID: 11677
837 public RectPosition anchor;
838
839 // Token: 0x04002D9E RID: 11678
840 public RectPosition userAnchor;
841
842 // Token: 0x04002D9F RID: 11679
843 public RectPosition pivot = RectPosition.Center;
844
845 // Token: 0x04002DA0 RID: 11680
846 public string id;
847
848 // Token: 0x04002DA1 RID: 11681
849 public string titleLang;
850
851 // Token: 0x04002DA2 RID: 11682
852 public float x;
853
854 // Token: 0x04002DA3 RID: 11683
855 public float y;
856
857 // Token: 0x04002DA4 RID: 11684
858 public bool locked;
859
860 // Token: 0x04002DA5 RID: 11685
861 public bool RC;
862
863 // Token: 0x04002DA6 RID: 11686
864 public object extra;
865
866 // Token: 0x04002DA7 RID: 11687
867 public SkinConfig skin = new SkinConfig();
868
869 // Token: 0x04002DA8 RID: 11688
870 [JsonIgnore]
871 public bool valid;
872
873 // Token: 0x04002DA9 RID: 11689
874 [JsonIgnore]
875 public bool annoyPlayer;
876
877 // Token: 0x04002DAA RID: 11690
878 [JsonIgnore]
879 public Widget.Meta meta;
880 }
881
882 // Token: 0x02000B5C RID: 2908
883 public enum State
884 {
885 // Token: 0x04002DAC RID: 11692
886 Active,
887 // Token: 0x04002DAD RID: 11693
888 Inactive
889 }
890}
Definition EMono.cs:6