Elin Decompiled Documentation EA 23.102 Nightly
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 i.AddSeparator();
118 i.AddButton("help", delegate
119 {
120 LayerHelp.Toggle("general", "1");
121 });
122 i.AddButton("widget", delegate
123 {
124 EClass.ui.AddLayer<LayerWidget>();
125 });
126 i.AddButton("config", delegate
127 {
128 EClass.ui.AddLayer<LayerConfig>();
129 });
130 i.AddButton("worldSetting", delegate
131 {
132 EClass.ui.AddLayer<LayerWorldSetting>();
133 });
134 i.AddSeparator();
135 i.AddButton("LayerHoard", delegate
136 {
137 EClass.ui.AddLayer<LayerHoard>();
138 });
139 i.AddSeparator();
141 {
142 i.AddButton("save", delegate
143 {
144 EClass.game.Save();
145 });
146 i.AddButton("load", delegate
147 {
148 EClass.ui.AddLayer<LayerLoadGame>().Init(_backup: false);
149 });
150 }
151 i.AddSeparator();
152 i.AddButton("title", delegate
153 {
155 });
156 i.AddButton("quit", EClass.game.Quit);
157 i.GetComponent<Image>().SetAlpha(1f);
158 }
159 }
161 {
162 if (EClass.debug.enable)
163 {
164 i.AddButton("Reset Map", delegate
165 {
166 Zone.forceRegenerate = true;
168 });
169 i.AddChild("Map Subset");
170 i.AddSeparator();
171 AddSliderMonth();
172 AddSliderHour();
173 AddSliderWeather();
174 }
175 }
176 else
177 {
178 if (!isRegion && EClass.scene.flock.gameObject.activeSelf)
179 {
180 i.AddButton("birdView", delegate
181 {
183 });
184 }
185 AddTilt();
186 i.AddToggle("highlightArea", conf.highlightArea, delegate
187 {
188 EClass.scene.ToggleHighlightArea();
189 });
190 i.AddToggle("noRoof", conf.noRoof, delegate
191 {
192 EClass.scene.ToggleRoof();
193 });
195 {
196 i.AddSlider("zoomRegion", (float a) => a * (float)CoreConfig.ZoomStep + "%", conf.regionZoom / CoreConfig.ZoomStep, delegate(float b)
197 {
198 conf.regionZoom = (int)b * CoreConfig.ZoomStep;
199 }, 100 / CoreConfig.ZoomStep, 200 / CoreConfig.ZoomStep, isInt: true, hideOther: false);
200 }
201 else if (ActionMode.Adv.zoomOut2)
202 {
203 i.AddSlider("zoomAlt", (float a) => a * (float)CoreConfig.ZoomStep + "%", conf.zoomedZoom / CoreConfig.ZoomStep, delegate(float b)
204 {
205 conf.zoomedZoom = (int)b * CoreConfig.ZoomStep;
206 }, 50 / CoreConfig.ZoomStep, 200 / CoreConfig.ZoomStep, isInt: true, hideOther: false);
207 }
208 else
209 {
210 i.AddSlider("zoom", (float a) => a * (float)CoreConfig.ZoomStep + "%", conf.defaultZoom / CoreConfig.ZoomStep, delegate(float b)
211 {
212 conf.defaultZoom = (int)b * CoreConfig.ZoomStep;
213 }, 50 / CoreConfig.ZoomStep, 200 / CoreConfig.ZoomStep, isInt: true, hideOther: false);
214 }
215 i.AddSlider("backDrawAlpha", (float a) => a + "%", EClass.game.config.backDrawAlpha, delegate(float b)
216 {
217 EClass.game.config.backDrawAlpha = (int)b;
218 }, 0f, 50f, isInt: true, hideOther: false);
219 if (EClass.debug.enable)
220 {
221 i.AddSeparator();
222 AddSliderMonth();
223 i.AddSlider("sliderDay", (float a) => a.ToString() ?? "", EClass.world.date.day, delegate(float b)
224 {
225 if ((int)b != EClass.world.date.day)
226 {
227 EClass.world.date.day = (int)b - 1;
228 EClass.world.date.AdvanceDay();
229 }
232 }, 1f, 30f, isInt: true, hideOther: false);
233 AddSliderHour();
234 AddSliderWeather();
235 i.AddSlider("sliderAnimeSpeed", (float a) => EClass.game.config.animeSpeed + "%", EClass.game.config.animeSpeed, delegate(float b)
236 {
237 EClass.game.config.animeSpeed = (int)b;
238 }, 0f, 100f, isInt: true, hideOther: false);
239 UIContextMenu uIContextMenu3 = i.AddChild("debug");
240 uIContextMenu3.AddToggle("reveal_map", EClass.debug.revealMap, delegate
241 {
243 });
244 uIContextMenu3.AddToggle("test_los", EClass.debug.testLOS, delegate
245 {
246 Toggle(ref EClass.debug.testLOS);
247 });
248 uIContextMenu3.AddToggle("test_los2", EClass.debug.testLOS2, delegate
249 {
250 Toggle(ref EClass.debug.testLOS2);
251 });
252 uIContextMenu3.AddToggle("godBuild", EClass.debug.godBuild, delegate
253 {
254 Toggle(ref EClass.debug._godBuild);
255 });
256 uIContextMenu3.AddToggle("godMode", EClass.debug.godMode, delegate
257 {
258 Toggle(ref EClass.debug.godMode);
259 });
260 uIContextMenu3.AddToggle("autoAdvanceQuest", EClass.debug.autoAdvanceQuest, delegate
261 {
262 Toggle(ref EClass.debug.autoAdvanceQuest);
263 });
264 uIContextMenu3.AddSlider("slopeMod", (float a) => a.ToString() ?? "", conf.slopeMod, delegate(float b)
265 {
266 EClass.game.config.slopeMod = (int)b;
267 (EClass.pc.renderer as CharaRenderer).first = true;
268 }, 0f, 500f, isInt: true, hideOther: false);
269 }
270 }
271 i.Show(pos);
272 if (id == "system")
273 {
274 i.hideOnMouseLeave = false;
275 }
276 void AddSliderHour()
277 {
278 i.AddSlider("sliderTime", (float a) => a.ToString() ?? "", d.hour, delegate(float b)
279 {
281 if (d.hour != (int)b)
282 {
283 d.hour = (int)b - 1;
284 d.AdvanceHour();
285 EClass.world.weather.SetCondition(currentCondition);
286 }
288 EClass._map.RefreshFOV(EClass.pc.pos.x, EClass.pc.pos.z, 20, recalculate: true);
290 }, 0f, 23f, isInt: true, hideOther: false);
291 }
292 void AddSliderMonth()
293 {
294 i.AddSlider("sliderMonth", (float a) => a.ToString() ?? "", EClass.world.date.month, delegate(float b)
295 {
296 if (d.month != (int)b)
297 {
298 d.month = (int)b - 1;
299 d.AdvanceMonth();
300 }
304 EClass.pc.c_daysWithGod += 30;
306 }, 1f, 12f, isInt: true, hideOther: false);
307 }
308 void AddSliderWeather()
309 {
310 i.AddSlider("sliderWeather", (float a) => EClass.world.weather.GetName(((int)a).ToEnum<Weather.Condition>()) ?? "", (float)EClass.world.weather._currentCondition, delegate(float b)
311 {
312 EClass.world.weather.SetCondition(((int)b).ToEnum<Weather.Condition>());
313 }, 0f, 7f, isInt: true, hideOther: false);
314 }
315 void AddTilt()
316 {
317 i.AddToggle("alwaysTilt".lang() + (isRegion ? "(Region)" : ""), isRegion ? conf.tiltRegion : conf.tilt, delegate
318 {
319 EClass.scene.ToggleTilt();
320 });
321 i.AddSlider("tiltPower", (float a) => a.ToString() ?? "", isRegion ? conf.tiltPowerRegion : conf.tiltPower, delegate(float b)
322 {
323 if (isRegion)
324 {
325 conf.tiltPowerRegion = (int)b;
326 }
327 else
328 {
329 conf.tiltPower = (int)b;
330 }
331 EClass.scene.camSupport.tiltShift.blurArea = 0.1f * b;
332 }, 0f, 150f, isInt: true, hideOther: false);
333 }
334 static void Toggle(ref bool flag)
335 {
336 flag = !flag;
339 SE.ClickGeneral();
340 }
341 }
342}
bool zoomOut2
Definition: AM_Adv.cs:105
virtual bool IsBuildMode
Definition: ActionMode.cs:181
static AM_Adv Adv
Definition: ActionMode.cs:15
int c_daysWithGod
Definition: Card.cs:1397
Point pos
Definition: Card.cs:55
void RefreshFaithElement()
Definition: Chara.cs:9166
Religion faith
Definition: Chara.cs:424
static int ZoomStep
Definition: CoreConfig.cs:626
bool godMode
Definition: CoreDebug.cs:172
void ToggleRevealMap()
Definition: CoreDebug.cs:2260
bool _godBuild
Definition: CoreDebug.cs:178
bool revealMap
Definition: CoreDebug.cs:153
bool enable
Definition: CoreDebug.cs:285
bool testLOS2
Definition: CoreDebug.cs:149
bool godBuild
Definition: CoreDebug.cs:303
bool autoAdvanceQuest
Definition: CoreDebug.cs:210
bool testLOS
Definition: CoreDebug.cs:147
static string custom
Definition: CorePath.cs:163
Game game
Definition: Core.cs:72
int month
Definition: Date.cs:50
int day
Definition: Date.cs:62
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static Scene scene
Definition: EClass.cs:30
static Core core
Definition: EClass.cs:6
static Zone _zone
Definition: EClass.cs:20
static World world
Definition: EClass.cs:40
static Map _map
Definition: EClass.cs:18
static BaseGameScreen screen
Definition: EClass.cs:32
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static UI ui
Definition: EClass.cs:16
KeyCode key
Definition: EInput.cs:14
Definition: EInput.cs:8
static KeyMapManager keys
Definition: EInput.cs:367
bool disableManualSave
int animeSpeed
Definition: Game.cs:84
int regionZoom
Definition: Game.cs:69
bool noRoof
Definition: Game.cs:27
int defaultZoom
Definition: Game.cs:63
bool highlightArea
Definition: Game.cs:39
int zoomedZoom
Definition: Game.cs:66
int backDrawAlpha
Definition: Game.cs:81
GamePrincipal principal
Definition: Game.cs:221
void GotoTitle(bool showDialog=true)
Definition: Game.cs:931
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:960
new World world
Definition: Game.cs:173
Config config
Definition: Game.cs:215
void Quit()
Definition: Game.cs:949
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:923
void RefreshAllTiles()
Definition: Map.cs:2086
int holyWell
Definition: Player.cs:724
HotbarManager hotbars
Definition: Player.cs:886
int x
Definition: Point.cs:36
int z
Definition: Point.cs:39
void OnChangeHour()
Definition: Religion.cs:537
void ToggleBirdView(bool sound=true)
Definition: Scene.cs:942
ActionMode actionMode
Definition: Scene.cs:77
FlockController flock
Definition: Scene.cs:67
virtual bool IsRegion
Definition: Spatial.cs:501
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:577