Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LayerInspect.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3using UnityEngine.Events;
4
5public class LayerInspect : ELayer
6{
7 public class MenuItem
8 {
9 public string id;
10
11 public string text;
12
13 public UnityAction action;
14
15 public Card card;
16
18 }
19
20 public bool inspectMap;
21
22 public UIList list;
23
24 public List<MenuItem> items = new List<MenuItem>();
25
26 public void SetItems(List<Thing> things)
27 {
28 foreach (Thing thing in things)
29 {
30 items.Add(GetItem(thing));
31 }
32 Refresh();
33 }
34
35 public void SetItemsOnHitPoint()
36 {
37 inspectMap = true;
39 Refresh();
40 }
41
42 public override void OnUpdateInput()
43 {
44 if (!inspectMap)
45 {
46 return;
47 }
48 if (Input.GetMouseButtonDown(0))
49 {
50 if (!ELayer.ui.isPointerOverUI && Scene.HitPoint.IsValid)
51 {
53 }
54 }
55 else
56 {
57 _ = Input.anyKeyDown;
58 }
59 }
60
61 public void Refresh()
62 {
63 list.Clear();
64 list.callbacks = new UIList.Callback<MenuItem, ButtonGeneral>
65 {
66 onClick = delegate(MenuItem a, ButtonGeneral b)
67 {
68 if (a.action != null)
69 {
70 a.action();
71 }
72 },
73 onInstantiate = delegate(MenuItem a, ButtonGeneral b)
74 {
75 if (a.card != null)
76 {
77 b.SetCard(a.card);
78 }
79 else
80 {
81 b.mainText.text = a.text;
82 if (a.renderRow != null)
83 {
85 }
86 }
87 }
88 };
90 list.Refresh();
91 }
92
93 public static MenuItem GetItem(Card t)
94 {
95 return new MenuItem
96 {
97 card = t,
98 text = t.Name,
99 action = delegate
100 {
101 if (t.isChara)
102 {
103 ELayer.ui.AddLayer<LayerChara>().SetChara(t.Chara);
104 }
105 else
106 {
107 ELayer.ui.AddLayer<LayerInfo>().Set(t);
108 }
109 }
110 };
111 }
112
113 public static List<MenuItem> GetMenuItems()
114 {
115 List<MenuItem> list = new List<MenuItem>();
116 Point point = Scene.HitPoint.Copy();
117 if (!point.IsValid)
118 {
119 return list;
120 }
121 foreach (Card item in point.ListCards())
122 {
123 if (item.isSynced)
124 {
126 }
127 }
128 if (point.area != null)
129 {
130 list.Add(new MenuItem
131 {
132 text = point.area.Name,
133 action = delegate
134 {
135 }
136 });
137 }
138 if (point.cell.HasLiquid)
139 {
140 list.Add(new MenuItem
141 {
142 text = point.cell.GetLiquidName(),
143 action = delegate
144 {
145 ELayer.ui.AddLayer<LayerInfo>().SetLiquid(point.cell);
146 },
147 renderRow = point.cell.sourceEffect
148 });
149 }
150 if (point.matBlock.id != 0)
151 {
152 list.Add(new MenuItem
153 {
154 text = point.cell.GetBlockName(),
155 action = delegate
156 {
157 ELayer.ui.AddLayer<LayerInfo>().SetBlock(point.cell);
158 },
159 renderRow = point.cell.sourceBlock
160 });
161 }
162 if (point.matFloor.id != 0)
163 {
164 list.Add(new MenuItem
165 {
166 text = point.cell.GetFloorName(),
167 action = delegate
168 {
169 ELayer.ui.AddLayer<LayerInfo>().SetFloor(point.cell);
170 },
171 renderRow = point.cell.sourceFloor
172 });
173 }
174 if (point.cell.obj != 0)
175 {
176 list.Add(new MenuItem
177 {
178 text = point.sourceObj.GetName(),
179 action = delegate
180 {
181 ELayer.ui.AddLayer<LayerInfo>().SetObj(point.cell);
182 },
183 renderRow = point.cell.sourceObj
184 });
185 }
186 return list;
187 }
188}
void SetCard(Card c, FontColor color=FontColor.Ignore)
Definition: ButtonGeneral.cs:9
Definition: Card.cs:11
virtual Chara Chara
Definition: Card.cs:1946
string Name
Definition: Card.cs:2013
virtual bool isChara
Definition: Card.cs:1959
Definition: ELayer.cs:4
static UI ui
Definition: ELayer.cs:21
void SetItemsOnHitPoint()
Definition: LayerInspect.cs:35
List< MenuItem > items
Definition: LayerInspect.cs:24
static List< MenuItem > GetMenuItems()
override void OnUpdateInput()
Definition: LayerInspect.cs:42
static MenuItem GetItem(Card t)
Definition: LayerInspect.cs:93
void SetItems(List< Thing > things)
Definition: LayerInspect.cs:26
void Refresh()
Definition: LayerInspect.cs:61
Definition: Point.cs:9
Point Copy()
Definition: Point.cs:467
bool IsValid
Definition: Point.cs:88
void SetImage(Image image, Sprite sprite=null, int matCol=0, bool setNativeSize=true, int dir=0, int idSkin=0)
Definition: RenderRow.cs:346
Definition: Scene.cs:8
static Point HitPoint
Definition: Scene.cs:21
Definition: Thing.cs:8
Image icon
Definition: UIButton.cs:110
Definition: UIList.cs:9
override void Clear()
Definition: UIList.cs:349
override void Add(object item)
Definition: UIList.cs:302
void AddCollection(ICollection collection)
Definition: UIList.cs:294
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:424