Elin Modding Docs Doc
Loading...
Searching...
No Matches
WidgetRoster.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5using UnityEngine.UI;
6
7// Token: 0x02000632 RID: 1586
8public class WidgetRoster : Widget
9{
10 // Token: 0x06002C6D RID: 11373 RVA: 0x000F9344 File Offset: 0x000F7544
11 public override object CreateExtra()
12 {
13 return new WidgetRoster.Extra();
14 }
15
16 // Token: 0x17000CA7 RID: 3239
17 // (get) Token: 0x06002C6E RID: 11374 RVA: 0x000F934B File Offset: 0x000F754B
18 public WidgetRoster.Extra extra
19 {
20 get
21 {
22 return base.config.extra as WidgetRoster.Extra;
23 }
24 }
25
26 // Token: 0x17000CA8 RID: 3240
27 // (get) Token: 0x06002C6F RID: 11375 RVA: 0x000F935D File Offset: 0x000F755D
28 public override bool AlwaysBottom
29 {
30 get
31 {
32 return true;
33 }
34 }
35
36 // Token: 0x17000CA9 RID: 3241
37 // (get) Token: 0x06002C70 RID: 11376 RVA: 0x000F9360 File Offset: 0x000F7560
38 public override Type SetSiblingAfter
39 {
40 get
41 {
42 return typeof(WidgetBottomBar);
43 }
44 }
45
46 // Token: 0x06002C71 RID: 11377 RVA: 0x000F936C File Offset: 0x000F756C
47 public override void OnActivate()
48 {
49 if (Mathf.Abs(this.extra.margin) > 100)
50 {
51 this.extra.margin = 0;
52 this.extra.width = 40;
53 this.extra.portrait = false;
54 this.extra.onlyName = true;
55 }
56 WidgetRoster.Instance = this;
57 this.mold = this.layout.CreateMold(null);
58 this.Build();
59 }
60
61 // Token: 0x06002C72 RID: 11378 RVA: 0x000F93DC File Offset: 0x000F75DC
62 private void OnEnable()
63 {
64 base.InvokeRepeating("Refresh", 0.2f, 0.2f);
65 }
66
67 // Token: 0x06002C73 RID: 11379 RVA: 0x000F93F3 File Offset: 0x000F75F3
68 private void OnDisable()
69 {
70 base.CancelInvoke();
71 }
72
73 // Token: 0x06002C74 RID: 11380 RVA: 0x000F93FB File Offset: 0x000F75FB
74 public void OnMoveZone()
75 {
76 this.Build();
77 }
78
79 // Token: 0x06002C75 RID: 11381 RVA: 0x000F9404 File Offset: 0x000F7604
80 public void Build()
81 {
82 this.buttons.Clear();
83 this.layout.DestroyChildren(false, true);
84 this.layout.constraint = (this.extra.vertical ? GridLayoutGroup.Constraint.FixedColumnCount : GridLayoutGroup.Constraint.FixedRowCount);
85 this.layout.startCorner = (this.extra.reverse ? GridLayoutGroup.Corner.LowerRight : GridLayoutGroup.Corner.UpperLeft);
86 this.layout.cellSize = new Vector2((float)(this.extra.width * 4 / 5), (float)(this.extra.onlyName ? 32 : this.extra.width));
87 this.layout.spacing = new Vector2((float)this.extra.margin, (float)this.extra.margin);
88 foreach (Chara chara in EMono.pc.party.members)
89 {
90 if (chara != EMono.pc || this.extra.pc)
91 {
92 this.Add(chara);
93 }
94 }
95 if (this.buttons.Count == 0)
96 {
97 this.Add(EMono.pc);
98 }
99 this.layout.RebuildLayout(false);
100 this.RebuildLayout(false);
101 this.OnChangeResolution();
102 base.ClampToScreen();
103 }
104
105 // Token: 0x06002C76 RID: 11382 RVA: 0x000F9564 File Offset: 0x000F7764
106 public static void SetDirty()
107 {
108 if (WidgetRoster.Instance)
109 {
110 WidgetRoster.Instance.dirty = true;
111 }
112 }
113
114 // Token: 0x06002C77 RID: 11383 RVA: 0x000F9580 File Offset: 0x000F7780
115 public void Refresh()
116 {
117 if (this.dirty)
118 {
119 this.Build();
120 }
121 foreach (ButtonRoster buttonRoster in this.buttons.Values)
122 {
123 buttonRoster.Refresh();
124 }
125 this.dirty = false;
126 }
127
128 // Token: 0x06002C78 RID: 11384 RVA: 0x000F95EC File Offset: 0x000F77EC
129 public void Add(Chara c)
130 {
131 ButtonRoster buttonRoster = Util.Instantiate<ButtonRoster>(this.mold, this.layout);
132 buttonRoster.SetChara(c);
133 this.buttons.Add(c, buttonRoster);
134 }
135
136 // Token: 0x06002C79 RID: 11385 RVA: 0x000F961F File Offset: 0x000F781F
137 public void Remove(Chara c)
138 {
139 UnityEngine.Object.DestroyImmediate(this.buttons[c].gameObject);
140 this.buttons.Remove(c);
141 }
142
143 // Token: 0x06002C7A RID: 11386 RVA: 0x000F9644 File Offset: 0x000F7844
144 public void OnAddMember(Chara c)
145 {
146 if (this.buttons.ContainsKey(c))
147 {
148 return;
149 }
150 this.Add(c);
151 }
152
153 // Token: 0x06002C7B RID: 11387 RVA: 0x000F965C File Offset: 0x000F785C
154 public void OnRemoveMember(Chara c)
155 {
156 if (!this.buttons.ContainsKey(c))
157 {
158 return;
159 }
160 this.Remove(c);
161 }
162
163 // Token: 0x06002C7C RID: 11388 RVA: 0x000F9674 File Offset: 0x000F7874
164 public override void OnSetContextMenu(UIContextMenu m)
165 {
166 UIContextMenu uicontextMenu = m.AddChild("setting");
167 uicontextMenu.AddSlider("width", (float a) => a.ToString() ?? "", (float)this.extra.width, delegate(float a)
168 {
169 this.extra.width = (int)a;
170 this.Build();
171 }, 30f, 160f, true, true, false);
172 uicontextMenu.AddSlider("margine", (float a) => a.ToString() ?? "", (float)this.extra.margin, delegate(float a)
173 {
174 this.extra.margin = (int)a;
175 this.Build();
176 }, -50f, 50f, true, true, false);
177 uicontextMenu.AddToggle("roster_pc", this.extra.pc, delegate(bool a)
178 {
179 this.extra.pc = a;
180 this.Build();
181 });
182 uicontextMenu.AddToggle("vertical", this.extra.vertical, delegate(bool a)
183 {
184 this.extra.vertical = a;
185 this.Build();
186 });
187 uicontextMenu.AddToggle("roster_portrait", this.extra.portrait, delegate(bool a)
188 {
189 this.extra.portrait = a;
190 this.Build();
191 });
192 uicontextMenu.AddToggle("roster_onlyname", this.extra.onlyName, delegate(bool a)
193 {
194 this.extra.onlyName = a;
195 this.Build();
196 });
197 uicontextMenu.AddToggle("reverseOrder", this.extra.reverse, delegate(bool a)
198 {
199 this.extra.reverse = a;
200 this.Build();
201 });
202 m.AddChild("style").AddSlider("toggleButtonBG", (float a) => a.ToString() ?? "", (float)base.config.skin.button, delegate(float a)
203 {
204 base.config.skin.button = (int)a;
205 this.ApplySkin();
206 }, 0f, (float)(base.config.skin.Skin.buttons.Count - 1), true, true, false);
207 base.SetBaseContextMenu(m);
208 }
209
210 // Token: 0x040018E3 RID: 6371
211 public static WidgetRoster Instance;
212
213 // Token: 0x040018E4 RID: 6372
214 public GridLayoutGroup layout;
215
216 // Token: 0x040018E5 RID: 6373
217 public ButtonRoster mold;
218
219 // Token: 0x040018E6 RID: 6374
220 public RawImage imageGrid;
221
222 // Token: 0x040018E7 RID: 6375
223 public Dictionary<Chara, ButtonRoster> buttons = new Dictionary<Chara, ButtonRoster>();
224
225 // Token: 0x040018E8 RID: 6376
226 public UIButton moldDropperLeft;
227
228 // Token: 0x040018E9 RID: 6377
229 public UIButton moldDropperRight;
230
231 // Token: 0x040018EA RID: 6378
232 public bool showName;
233
234 // Token: 0x040018EB RID: 6379
235 public bool dirty;
236
237 // Token: 0x040018EC RID: 6380
238 public int maxWidth;
239
240 // Token: 0x02000B9D RID: 2973
241 public class Extra
242 {
243 // Token: 0x04002E85 RID: 11909
244 [JsonProperty]
245 public int width = 40;
246
247 // Token: 0x04002E86 RID: 11910
248 [JsonProperty]
249 public int margin;
250
251 // Token: 0x04002E87 RID: 11911
252 [JsonProperty]
253 public bool vertical;
254
255 // Token: 0x04002E88 RID: 11912
256 [JsonProperty]
257 public bool pc;
258
259 // Token: 0x04002E89 RID: 11913
260 [JsonProperty]
261 public bool portrait;
262
263 // Token: 0x04002E8A RID: 11914
264 [JsonProperty]
265 public bool reverse;
266
267 // Token: 0x04002E8B RID: 11915
268 [JsonProperty]
269 public bool onlyName;
270
271 // Token: 0x04002E8C RID: 11916
272 [JsonProperty]
273 public bool showHP;
274 }
275}
Definition Chara.cs:12
Definition EMono.cs:6