Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerWidget.cs
1using System;
2using System.Linq;
3
4// Token: 0x020005C9 RID: 1481
5public class LayerWidget : ELayer
6{
7 // Token: 0x06002898 RID: 10392 RVA: 0x000E5B30 File Offset: 0x000E3D30
8 public override void OnInit()
9 {
10 ELayer.ui.HideFloats();
11 WidgetManager widgets = ELayer.ui.widgets;
12 LayerWidget.Instance = this;
13 BaseList baseList = this.list;
14 BaseList baseList2 = this.list2;
15 UIList.Callback<Widget.Config, ItemWidget> callback = new UIList.Callback<Widget.Config, ItemWidget>();
16 callback.onClick = delegate(Widget.Config a, ItemWidget b)
17 {
18 };
19 callback.onInstantiate = delegate(Widget.Config a, ItemWidget b)
20 {
21 b.buttonActivate.mainText.text = Lang.Get("Widget" + a.id);
22 b.buttonActivate.subText.SetActive(a.IsSystem);
23 b.buttonActivate.onClick.AddListener(delegate()
24 {
25 if (a.IsSealed)
26 {
27 SE.Beep();
28 return;
29 }
30 Widget widget2 = widgets.Toggle(a);
31 if (widget2 != null)
32 {
33 widget2.SoundActivate();
34 }
35 this.Refresh();
36 });
37 b.buttonLock.onClick.AddListener(delegate()
38 {
39 widgets.ToggleLock(a);
40 this.Refresh();
41 });
42 b.config = a;
43 };
44 callback.onRefresh = new Action(this.Refresh);
45 UIList.ICallback callbacks = callback;
46 baseList2.callbacks = callback;
47 baseList.callbacks = callbacks;
48 foreach (Widget.Meta meta in ELayer.setting.ui.widgetMetas)
49 {
50 Widget.Config config = widgets.configs[meta.id];
51 if (config.IsInRightMode() && !meta.debugOnly)
52 {
53 if (config.id.Contains("Hotbar"))
54 {
55 this.list2.Add(config);
56 }
57 else
58 {
59 this.list.Add(config);
60 }
61 }
62 }
63 this.list.Refresh(false);
64 this.list2.Refresh(false);
65 foreach (Widget widget in widgets.list)
66 {
67 widget.OnManagerActivate();
68 }
69 this.windows[0].AddBottomSpace(20);
70 Action <>9__7;
71 this.windows[0].AddBottomButton("resetWidget", delegate
72 {
73 string langDetail = "dialogResetWidget";
74 Action actionYes;
75 if ((actionYes = <>9__7) == null)
76 {
77 actionYes = (<>9__7 = delegate()
78 {
79 this.Close();
80 ELayer.ui.widgets.Load(ELayer.player.useSubWidgetTheme, null);
81 ELayer.ui.widgets.Reset(false);
82 ELayer.ui.AddLayer<LayerWidget>();
83 });
84 }
85 Dialog.YesNo(langDetail, actionYes, null, "yes", "no");
86 }, false);
87 Action <>9__8;
88 this.windows[0].AddBottomButton("loadTheme", delegate
89 {
90 WidgetManager widgets = widgets;
91 Action onLoad;
92 if ((onLoad = <>9__8) == null)
93 {
94 onLoad = (<>9__8 = delegate()
95 {
96 this.Close();
97 ELayer.ui.AddLayer<LayerWidget>();
98 });
99 }
100 widgets.DialogLoad(onLoad);
101 }, false);
102 this.windows[0].AddBottomButton("saveTheme", delegate
103 {
104 widgets.DialogSave(delegate
105 {
106 Dialog.Ok("dialogSaveTheme");
107 });
108 }, false);
109 }
110
111 // Token: 0x06002899 RID: 10393 RVA: 0x000E5D50 File Offset: 0x000E3F50
112 public override void OnUpdateInput()
113 {
114 if (EInput.leftMouse.clicked)
115 {
116 if (EInput.leftMouse.dragging)
117 {
118 return;
119 }
120 Widget componentOf = InputModuleEX.GetComponentOf<Widget>();
121 if (componentOf)
122 {
123 componentOf.ShowContextMenu();
124 }
125 }
126 }
127
128 // Token: 0x0600289A RID: 10394 RVA: 0x000E5D8C File Offset: 0x000E3F8C
129 public void Refresh()
130 {
131 foreach (UIList.ButtonPair buttonPair in this.list.buttons.Concat(this.list2.buttons))
132 {
133 ItemWidget itemWidget = buttonPair.component as ItemWidget;
134 itemWidget.imageLock.SetActive(itemWidget.config.locked);
135 itemWidget.imageActive.SetActive(itemWidget.config.state == Widget.State.Active);
136 itemWidget.buttonLock.mainText.text = Lang.Get(itemWidget.config.locked ? "unlockWidget" : "lockWidget");
137 }
138 }
139
140 // Token: 0x0600289B RID: 10395 RVA: 0x000E5E50 File Offset: 0x000E4050
141 public override void OnKill()
142 {
143 foreach (Widget widget in ELayer.ui.widgets.list)
144 {
145 widget.OnManagerDeactivate();
146 }
147 ELayer.ui.ShowFloats();
148 }
149
150 // Token: 0x040016D7 RID: 5847
151 public static LayerWidget Instance;
152
153 // Token: 0x040016D8 RID: 5848
154 public UIList list;
155
156 // Token: 0x040016D9 RID: 5849
157 public UIList list2;
158}