Elin Modding Docs Doc
Loading...
Searching...
No Matches
UIInspector.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.UI;
5
6// Token: 0x020005D3 RID: 1491
7public class UIInspector : ELayer
8{
9 // Token: 0x17000BDE RID: 3038
10 // (get) Token: 0x0600290E RID: 10510 RVA: 0x000E8160 File Offset: 0x000E6360
11 public bool IsActive
12 {
13 get
14 {
15 return base.gameObject.activeSelf;
16 }
17 }
18
19 // Token: 0x0600290F RID: 10511 RVA: 0x000E816D File Offset: 0x000E636D
20 public void SetVisible(bool enable)
21 {
22 base.gameObject.SetActive(enable && this.group != null);
23 if (enable && this.group != null)
24 {
25 this.Refresh();
26 }
27 }
28
29 // Token: 0x06002910 RID: 10512 RVA: 0x000E819A File Offset: 0x000E639A
30 public void Hide()
31 {
32 this.group = null;
33 this.point = null;
34 base.gameObject.SetActive(false);
35 }
36
37 // Token: 0x06002911 RID: 10513 RVA: 0x000E81B8 File Offset: 0x000E63B8
38 public bool InspectUnderMouse()
39 {
40 if (!Scene.HitPoint.IsValid)
41 {
42 return false;
43 }
44 List<IInspect> list = ELayer.scene.mouseTarget.pos.ListInspectorTargets();
45 this.point = Scene.HitPoint;
46 IList<IInspect> source = list;
47 InspectGroup inspectGroup = this.group;
48 this.Inspect(source.NextItem((inspectGroup != null) ? inspectGroup.FirstTarget : null));
49 return true;
50 }
51
52 // Token: 0x06002912 RID: 10514 RVA: 0x000E8212 File Offset: 0x000E6412
53 public void Inspect(IInspect newTarget)
54 {
55 InspectGroup inspectGroup = this.group;
56 if (((inspectGroup != null) ? inspectGroup.FirstTarget : null) == newTarget)
57 {
58 return;
59 }
60 this.Inspect(InspectGroup.Create(newTarget));
61 }
62
63 // Token: 0x06002913 RID: 10515 RVA: 0x000E8238 File Offset: 0x000E6438
64 public void Inspect(InspectGroup g)
65 {
66 base.gameObject.SetActive(true);
67 if (!this.initialized)
68 {
69 this.windows.Add(this.windowChara.window);
70 this.initialized = true;
71 this.mold = this.layoutButtons.CreateMold(null);
72 IUISkin[] componentsInChildren = base.transform.GetComponentsInChildren<IUISkin>(true);
73 for (int i = 0; i < componentsInChildren.Length; i++)
74 {
75 componentsInChildren[i].ApplySkin();
76 }
77 base.InitInspector();
78 }
79 this.group = g;
80 this.soundPop.Play();
81 this.Refresh();
82 }
83
84 // Token: 0x06002914 RID: 10516 RVA: 0x000E82CC File Offset: 0x000E64CC
85 public void OnUpdate()
86 {
87 if (this.group == null || !this.IsActive)
88 {
89 return;
90 }
91 if (!this.group.CanInspect())
92 {
93 this.Hide();
94 return;
95 }
96 foreach (IInspect i in this.group.targets)
97 {
98 this.DrawHighlight(i, true);
99 }
100 }
101
102 // Token: 0x06002915 RID: 10517 RVA: 0x000E834C File Offset: 0x000E654C
103 public void Refresh()
104 {
105 if (!this.group.CanInspect())
106 {
107 this.Hide();
108 return;
109 }
110 this.group.SetActions();
111 this.layoutButtons.DestroyChildren(false, true);
112 using (List<InspectGroup.Item>.Enumerator enumerator = this.group.actions.GetEnumerator())
113 {
114 while (enumerator.MoveNext())
115 {
116 InspectGroup.Item item = enumerator.Current;
117 if (this.group.Solo || item.multi)
118 {
119 UIButton uibutton = Util.Instantiate<UIButton>(this.mold, this.layoutButtons);
120 uibutton.icon.sprite = (SpriteSheet.Get(item.idSprite.IsEmpty("icon_" + item.text)) ?? uibutton.icon.sprite);
121 uibutton.mainText.SetText((item.textFunc != null) ? item.textFunc() : item.text.lang());
122 uibutton.onClick.AddListener(delegate()
123 {
124 if (this.group.CanInspect())
125 {
126 if (item.sound)
127 {
128 this.soundPop.Play();
129 }
130 foreach (IInspect obj in this.group.targets)
131 {
132 item.action(obj);
133 }
134 }
135 if (this.group == null || !this.group.CanInspect())
136 {
137 this.Hide();
138 return;
139 }
140 this.Refresh();
141 });
142 uibutton.RebuildLayout(true);
143 }
144 }
145 }
146 Chara chara = this.group.FirstTarget as Chara;
147 bool flag = this.group.Solo && chara != null && chara.IsHomeMember();
148 Room room = null;
149 if (!flag && ELayer.core.IsGameStarted && this.point != null)
150 {
151 room = this.point.cell.room;
152 }
153 bool flag2 = room != null;
154 this.windowChara.SetActive(flag);
155 this.rectInfo.SetActive(!flag);
156 this.rectRoom.SetActive(flag2);
157 this.note.Clear();
158 if (flag)
159 {
160 this.windowChara.SetChara(chara);
161 }
162 else if (this.group.Solo)
163 {
164 this.group.FirstTarget.WriteNote(this.note, null, IInspect.NoteMode.Default, null);
165 }
166 else
167 {
168 this.note.AddHeader(this.group.GetName(), null);
169 this.note.Build();
170 }
171 if (flag2)
172 {
173 UINote uinote = this.noteRoom;
174 uinote.Clear();
175 uinote.AddHeader("Room", null);
176 uinote.AddText(room.points.Count.ToString() ?? "", FontColor.DontChange);
177 uinote.Build();
178 }
179 this.layoutButtons.RebuildLayout(true);
180 this.layoutBody.RebuildLayout(false);
181 this.group.FirstTarget.OnInspect();
182 }
183
184 // Token: 0x06002916 RID: 10518 RVA: 0x000E8620 File Offset: 0x000E6820
185 public unsafe void DrawHighlight(IInspect i, bool selected = false)
186 {
187 UIInspector.<>c__DisplayClass25_0 CS$<>8__locals1 = new UIInspector.<>c__DisplayClass25_0();
188 if (i is Area || i is EloPos)
189 {
190 return;
191 }
192 CS$<>8__locals1.v = i.InspectPosition;
193 Point inspectPoint = i.InspectPoint;
194 if (inspectPoint == null)
195 {
196 return;
197 }
198 MeshPass meshPass = (inspectPoint.HasNonWallBlock || inspectPoint.HasBlockRecipe) ? ELayer.screen.guide.passGuideBlock : ELayer.screen.guide.passGuideFloor;
199 if (i is Chara)
200 {
201 CS$<>8__locals1.v += ELayer.screen.pcOrbit.crystal.transform.position;
202 ELayer.screen.tileMap.passIcon.Add(ref CS$<>8__locals1.v, 1f, 0f);
203 return;
204 }
205 if (i is Thing)
206 {
207 Thing thing = i as Thing;
208 if (thing.IsInstalled && thing.sourceCard.multisize)
209 {
210 if (selected)
211 {
212 thing.ForeachPoint(delegate(Point pos, bool main)
213 {
214 CS$<>8__locals1.v = *pos.Position();
215 CS$<>8__locals1.v.z = CS$<>8__locals1.v.z - 0.01f;
216 ELayer.screen.guide.passGuideFloor.Add(ref CS$<>8__locals1.v, 7f, 0f);
217 });
218 }
219 return;
220 }
221 if (thing.TileType.IsBlockMount)
222 {
223 meshPass = ELayer.screen.guide.passGuideBlock;
224 }
225 }
226 else if (i is TaskBuild)
227 {
228 Recipe recipe = (i as TaskBuild).recipe;
229 if (recipe.MultiSize)
230 {
231 if (selected)
232 {
233 i.InspectPoint.ForeachMultiSize(recipe.W, recipe.H, delegate(Point pos, bool main)
234 {
235 CS$<>8__locals1.v = *pos.Position();
236 CS$<>8__locals1.v.z = CS$<>8__locals1.v.z - 0.01f;
237 ELayer.screen.guide.passGuideBlock.Add(ref CS$<>8__locals1.v, 7f, 0f);
238 });
239 }
240 return;
241 }
242 }
243 UIInspector.<>c__DisplayClass25_0 CS$<>8__locals2 = CS$<>8__locals1;
244 CS$<>8__locals2.v.z = CS$<>8__locals2.v.z - 0.01f;
245 meshPass.Add(ref CS$<>8__locals1.v, 7f, 0f);
246 }
247
248 // Token: 0x04001731 RID: 5937
249 public InspectGroup group;
250
251 // Token: 0x04001732 RID: 5938
252 public LayoutGroup layoutBody;
253
254 // Token: 0x04001733 RID: 5939
255 public LayoutGroup layoutButtons;
256
257 // Token: 0x04001734 RID: 5940
258 public UIButton mold;
259
260 // Token: 0x04001735 RID: 5941
261 public Vector3 offset;
262
263 // Token: 0x04001736 RID: 5942
264 public Vector3 modPos;
265
266 // Token: 0x04001737 RID: 5943
267 public SoundData soundPop;
268
269 // Token: 0x04001738 RID: 5944
270 public WindowChara windowChara;
271
272 // Token: 0x04001739 RID: 5945
273 public RectTransform rectInfo;
274
275 // Token: 0x0400173A RID: 5946
276 public RectTransform rectRoom;
277
278 // Token: 0x0400173B RID: 5947
279 public UINote note;
280
281 // Token: 0x0400173C RID: 5948
282 public UINote noteRoom;
283
284 // Token: 0x0400173D RID: 5949
285 public UIText textName;
286
287 // Token: 0x0400173E RID: 5950
288 public UIImage bg;
289
290 // Token: 0x0400173F RID: 5951
291 public Point point;
292
293 // Token: 0x04001740 RID: 5952
294 private bool initialized;
295}
Definition Area.cs:6
Definition Chara.cs:12
Definition Point.cs:11
Definition Room.cs:6
Definition Scene.cs:10
Definition Thing.cs:10