Elin Decompiled Documentation EA 23.321 Nightly Patch 1
Loading...
Searching...
No Matches
HotItemContext.cs
Go to the documentation of this file.
1using Newtonsoft.Json;
2using UnityEngine;
3using UnityEngine.UI;
4
5public class HotItemContext : HotItem
6{
7 [JsonProperty]
8 public string id;
9
10 [JsonProperty]
11 public bool autoExpand;
12
13 public override string Name => ("m_" + id).lang();
14
15 public override string TextTip => id.lang();
16
17 public override string pathSprite
18 {
19 get
20 {
21 if (!(id == "system"))
22 {
23 return "icon_" + id;
24 }
25 return "icon_m_system";
26 }
27 }
28
29 public override Selectable.Transition Transition
30 {
31 get
32 {
33 if (!AutoExpand)
34 {
35 return base.Transition;
36 }
37 return Selectable.Transition.None;
38 }
39 }
40
41 public bool AutoExpand => autoExpand;
42
43 public override void OnHover(UIButton b)
44 {
45 if (AutoExpand && !EClass.ui.BlockInput)
46 {
47 OnClick(null, null);
48 }
49 }
50
51 public override void OnClick(UIButton b)
52 {
53 if (!EClass.ui.contextMenu.isActive)
54 {
56 }
57 }
58
59 public override void OnShowContextMenu(UIContextMenu m)
60 {
61 m.AddToggle("autoExpand", autoExpand, delegate(bool on)
62 {
63 autoExpand = on;
64 });
65 }
66
67 public static void Show(string id, Vector3 pos)
68 {
69 string menuName = ((id == "system") ? "ContextSystem" : "ContextMenu");
70 UIContextMenu i = EClass.ui.contextMenu.Create(menuName);
73 bool isRegion = EClass._zone.IsRegion;
74 if (!(id == "mapTool"))
75 {
76 if (id == "system")
77 {
78 UIContextMenu uIContextMenu = i.AddChild("etc");
79 uIContextMenu.AddButton("LayerFeedback".lang() + "(" + EInput.keys.report.key.ToString() + ")", delegate
80 {
81 EClass.ui.ToggleFeedback();
82 });
83 uIContextMenu.AddButton("LayerConsole", delegate
84 {
85 EClass.ui.AddLayer<LayerConsole>();
86 });
87 uIContextMenu.AddButton("LayerCredit", delegate
88 {
89 EClass.ui.AddLayer<LayerCredit>();
90 });
91 uIContextMenu.AddButton("announce", delegate
92 {
93 EClass.ui.AddLayer("LayerAnnounce");
94 });
95 uIContextMenu.AddButton("about", delegate
96 {
97 EClass.ui.AddLayer("LayerAbout");
98 });
99 uIContextMenu.AddButton("hideUI", delegate
100 {
101 SE.ClickGeneral();
102 EClass.ui.ToggleCanvas();
103 });
104 UIContextMenu uIContextMenu2 = i.AddChild("tool");
105 uIContextMenu2.AddButton("LayerMod", delegate
106 {
107 EClass.ui.AddLayer<LayerMod>();
108 });
109 uIContextMenu2.AddButton("LayerTextureViewer", delegate
110 {
111 EClass.ui.AddLayer<LayerTextureViewer>();
112 });
113 uIContextMenu2.AddButton("OpenCustomFolder", delegate
114 {
115 Util.ShowExplorer(CorePath.custom + "Portrait");
116 });
117 if (ModUtil.contextMenuProxies.Count > 0)
118 {
119 UIContextMenu parent2 = i.AddChild("mod");
120 foreach (ContextMenuProxy contextMenuProxy in ModUtil.contextMenuProxies)
121 {
122 PopulateMenu(parent2, contextMenuProxy);
123 }
124 }
125 i.AddSeparator();
126 i.AddButton("help", delegate
127 {
128 LayerHelp.Toggle("general", "1");
129 });
130 i.AddButton("widget", delegate
131 {
132 EClass.ui.AddLayer<LayerWidget>();
133 });
134 i.AddButton("config", delegate
135 {
136 EClass.ui.AddLayer<LayerConfig>();
137 });
138 i.AddButton("worldSetting", delegate
139 {
140 EClass.ui.AddLayer<LayerWorldSetting>();
141 });
142 i.AddSeparator();
143 i.AddButton("LayerHoard", delegate
144 {
145 EClass.ui.AddLayer<LayerHoard>();
146 });
147 i.AddSeparator();
149 {
150 i.AddButton("save", delegate
151 {
152 EClass.game.Save();
153 });
154 i.AddButton("load", delegate
155 {
156 EClass.ui.AddLayer<LayerLoadGame>().Init(_backup: false);
157 });
158 }
159 i.AddSeparator();
160 i.AddButton("title", delegate
161 {
163 });
164 i.AddButton("quit", EClass.game.Quit);
165 i.GetComponent<Image>().SetAlpha(1f);
166 }
167 }
169 {
170 if (EClass.debug.enable)
171 {
172 i.AddButton("Reset Map", delegate
173 {
174 Zone.forceRegenerate = true;
176 });
177 i.AddChild("Map Subset");
178 i.AddSeparator();
179 AddSliderMonth();
180 AddSliderHour();
181 AddSliderWeather();
182 }
183 }
184 else
185 {
186 if (!isRegion && EClass.scene.flock.gameObject.activeSelf)
187 {
188 i.AddButton("birdView", delegate
189 {
191 });
192 }
193 AddTilt();
194 i.AddToggle("highlightArea", conf.highlightArea, delegate
195 {
196 EClass.scene.ToggleHighlightArea();
197 });
198 i.AddToggle("noRoof", conf.noRoof, delegate
199 {
200 EClass.scene.ToggleRoof();
201 });
203 {
204 i.AddSlider("zoomRegion", (float a) => a * (float)CoreConfig.ZoomStep + "%", conf.regionZoom / CoreConfig.ZoomStep, delegate(float b)
205 {
206 conf.regionZoom = (int)b * CoreConfig.ZoomStep;
207 }, 100 / CoreConfig.ZoomStep, 200 / CoreConfig.ZoomStep, isInt: true, hideOther: false);
208 }
209 else if (ActionMode.Adv.zoomOut2)
210 {
211 i.AddSlider("zoomAlt", (float a) => a * (float)CoreConfig.ZoomStep + "%", conf.zoomedZoom / CoreConfig.ZoomStep, delegate(float b)
212 {
213 conf.zoomedZoom = (int)b * CoreConfig.ZoomStep;
214 }, 50 / CoreConfig.ZoomStep, 200 / CoreConfig.ZoomStep, isInt: true, hideOther: false);
215 }
216 else
217 {
218 i.AddSlider("zoom", (float a) => a * (float)CoreConfig.ZoomStep + "%", conf.defaultZoom / CoreConfig.ZoomStep, delegate(float b)
219 {
220 conf.defaultZoom = (int)b * CoreConfig.ZoomStep;
221 }, 50 / CoreConfig.ZoomStep, 200 / CoreConfig.ZoomStep, isInt: true, hideOther: false);
222 }
223 i.AddSlider("backDrawAlpha", (float a) => a + "%", EClass.game.config.backDrawAlpha, delegate(float b)
224 {
225 EClass.game.config.backDrawAlpha = (int)b;
226 }, 0f, 50f, isInt: true, hideOther: false);
227 if (EClass.debug.enable)
228 {
229 i.AddSeparator();
230 AddSliderMonth();
231 i.AddSlider("sliderDay", (float a) => a.ToString() ?? "", EClass.world.date.day, delegate(float b)
232 {
233 if ((int)b != EClass.world.date.day)
234 {
235 EClass.world.date.day = (int)b - 1;
236 EClass.world.date.AdvanceDay();
237 }
240 }, 1f, 30f, isInt: true, hideOther: false);
241 AddSliderHour();
242 AddSliderWeather();
243 i.AddSlider("sliderAnimeSpeed", (float a) => EClass.game.config.animeSpeed + "%", EClass.game.config.animeSpeed, delegate(float b)
244 {
245 EClass.game.config.animeSpeed = (int)b;
246 }, 0f, 100f, isInt: true, hideOther: false);
247 UIContextMenu uIContextMenu3 = i.AddChild("debug");
248 uIContextMenu3.AddToggle("reveal_map", EClass.debug.revealMap, delegate
249 {
251 });
252 uIContextMenu3.AddToggle("test_los", EClass.debug.testLOS, delegate
253 {
254 Toggle(ref EClass.debug.testLOS);
255 });
256 uIContextMenu3.AddToggle("test_los2", EClass.debug.testLOS2, delegate
257 {
258 Toggle(ref EClass.debug.testLOS2);
259 });
260 uIContextMenu3.AddToggle("godBuild", EClass.debug.godBuild, delegate
261 {
262 Toggle(ref EClass.debug._godBuild);
263 });
264 uIContextMenu3.AddToggle("godMode", EClass.debug.godMode, delegate
265 {
266 Toggle(ref EClass.debug.godMode);
267 });
268 uIContextMenu3.AddToggle("autoAdvanceQuest", EClass.debug.autoAdvanceQuest, delegate
269 {
270 Toggle(ref EClass.debug.autoAdvanceQuest);
271 });
272 uIContextMenu3.AddSlider("slopeMod", (float a) => a.ToString() ?? "", conf.slopeMod, delegate(float b)
273 {
274 EClass.game.config.slopeMod = (int)b;
275 (EClass.pc.renderer as CharaRenderer).first = true;
276 }, 0f, 500f, isInt: true, hideOther: false);
277 }
278 }
279 i.Show(pos);
280 if (id == "system")
281 {
282 i.hideOnMouseLeave = false;
283 }
284 void AddSliderHour()
285 {
286 i.AddSlider("sliderTime", (float a) => a.ToString() ?? "", d.hour, delegate(float b)
287 {
289 if (d.hour != (int)b)
290 {
291 d.hour = (int)b - 1;
292 d.AdvanceHour();
293 EClass.world.weather.SetCondition(currentCondition);
294 }
296 EClass._map.RefreshFOV(EClass.pc.pos.x, EClass.pc.pos.z, 20, recalculate: true);
298 }, 0f, 23f, isInt: true, hideOther: false);
299 }
300 void AddSliderMonth()
301 {
302 i.AddSlider("sliderMonth", (float a) => a.ToString() ?? "", EClass.world.date.month, delegate(float b)
303 {
304 if (d.month != (int)b)
305 {
306 d.month = (int)b - 1;
307 d.AdvanceMonth();
308 }
312 EClass.pc.c_daysWithGod += 30;
314 }, 1f, 12f, isInt: true, hideOther: false);
315 }
316 void AddSliderWeather()
317 {
318 i.AddSlider("sliderWeather", (float a) => EClass.world.weather.GetName(((int)a).ToEnum<Weather.Condition>()) ?? "", (float)EClass.world.weather._currentCondition, delegate(float b)
319 {
320 EClass.world.weather.SetCondition(((int)b).ToEnum<Weather.Condition>());
321 }, 0f, 7f, isInt: true, hideOther: false);
322 }
323 void AddTilt()
324 {
325 i.AddToggle("alwaysTilt".lang() + (isRegion ? "(Region)" : ""), isRegion ? conf.tiltRegion : conf.tilt, delegate
326 {
327 EClass.scene.ToggleTilt();
328 });
329 i.AddSlider("tiltPower", (float a) => a.ToString() ?? "", isRegion ? conf.tiltPowerRegion : conf.tiltPower, delegate(float b)
330 {
331 if (isRegion)
332 {
333 conf.tiltPowerRegion = (int)b;
334 }
335 else
336 {
337 conf.tiltPower = (int)b;
338 }
339 EClass.scene.camSupport.tiltShift.blurArea = 0.1f * b;
340 }, 0f, 150f, isInt: true, hideOther: false);
341 }
342 static void PopulateMenu(UIContextMenu parent, ContextMenuProxy proxy)
343 {
344 if (proxy.isMenu)
345 {
346 UIContextMenu parent3 = parent.AddChild(proxy.DisplayName);
347 {
348 foreach (ContextMenuProxy child in proxy.children)
349 {
350 PopulateMenu(parent3, child);
351 }
352 return;
353 }
354 }
355 parent.AddButton(proxy.DisplayName, proxy.onClick);
356 }
357 static void Toggle(ref bool flag)
358 {
359 flag = !flag;
362 SE.ClickGeneral();
363 }
364 }
365}
bool zoomOut2
Definition: AM_Adv.cs:106
virtual bool IsBuildMode
Definition: ActionMode.cs:181
static AM_Adv Adv
Definition: ActionMode.cs:15
int c_daysWithGod
Definition: Card.cs:1513
Point pos
Definition: Card.cs:60
void RefreshFaithElement()
Definition: Chara.cs:10658
Religion faith
Definition: Chara.cs:443
readonly List< ContextMenuProxy > children
static int ZoomStep
Definition: CoreConfig.cs:647
bool godMode
Definition: CoreDebug.cs:188
void ToggleRevealMap()
Definition: CoreDebug.cs:2491
bool _godBuild
Definition: CoreDebug.cs:194
bool revealMap
Definition: CoreDebug.cs:169
bool enable
Definition: CoreDebug.cs:301
bool testLOS2
Definition: CoreDebug.cs:165
bool godBuild
Definition: CoreDebug.cs:319
bool autoAdvanceQuest
Definition: CoreDebug.cs:226
bool testLOS
Definition: CoreDebug.cs:163
static string custom
Definition: CorePath.cs:159
Game game
Definition: Core.cs:72
int month
Definition: Date.cs:50
int day
Definition: Date.cs:62
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Scene scene
Definition: EClass.cs:31
static Core core
Definition: EClass.cs:7
static Zone _zone
Definition: EClass.cs:21
static World world
Definition: EClass.cs:41
static Map _map
Definition: EClass.cs:19
static BaseGameScreen screen
Definition: EClass.cs:33
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static UI ui
Definition: EClass.cs:17
KeyCode key
Definition: EInput.cs:14
Definition: EInput.cs:8
static KeyMapManager keys
Definition: EInput.cs:378
bool disableManualSave
int animeSpeed
Definition: Game.cs:85
int regionZoom
Definition: Game.cs:70
bool noRoof
Definition: Game.cs:28
int defaultZoom
Definition: Game.cs:64
bool highlightArea
Definition: Game.cs:40
int zoomedZoom
Definition: Game.cs:67
int backDrawAlpha
Definition: Game.cs:82
GamePrincipal principal
Definition: Game.cs:225
void GotoTitle(bool showDialog=true)
Definition: Game.cs:1011
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:1040
new World world
Definition: Game.cs:177
Config config
Definition: Game.cs:219
void Quit()
Definition: Game.cs:1029
override string Name
override void OnHover(UIButton b)
static void Show(string id, Vector3 pos)
override string TextTip
override Selectable.Transition Transition
override string pathSprite
override void OnClick(UIButton b)
override void OnShowContextMenu(UIContextMenu m)
void ResetHotbar(int id)
Definition: HotbarManager.cs:8
static void Toggle(string idFile, string idTopic=null)
Definition: LayerHelp.cs:32
void RefreshFOV(int x, int z, int radius=6, bool recalculate=false)
Definition: Map.cs:942
void RefreshAllTiles()
Definition: Map.cs:2153
int holyWell
Definition: Player.cs:984
HotbarManager hotbars
Definition: Player.cs:1152
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
virtual void OnChangeHour()
Definition: Religion.cs:509
void ToggleBirdView(bool sound=true)
Definition: Scene.cs:961
ActionMode actionMode
Definition: Scene.cs:79
FlockController flock
Definition: Scene.cs:69
virtual bool IsRegion
Definition: Spatial.cs:515
static Vector2 buttonPos
Definition: UIButton.cs:98
void AddSeparator(int index=0)
UIContextMenuItem AddToggle(string idLang="", bool isOn=false, UnityAction< bool > action=null)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
void AddButton(Func< string > funcText, UnityAction action=null)
UIContextMenu AddChild(string idLang, TextAnchor anchor)
string GetName()
Definition: Weather.cs:158
void SetCondition(Condition condition, int _duration=20, bool silent=false)
Definition: Weather.cs:308
Condition _currentCondition
Definition: Weather.cs:67
Condition
Definition: Weather.cs:16
static void OnChangeMode()
GameDate date
Definition: World.cs:6
Weather weather
Definition: World.cs:12
void Activate()
Definition: Zone.cs:632