Elin Decompiled Documentation EA 23.288 Nightly
Loading...
Searching...
No Matches
EInput.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.EventSystems;
5using UnityEngine.UI;
6
7public class EInput : MonoBehaviour
8{
9 [Serializable]
10 public class KeyMap
11 {
13
14 public KeyCode key;
15
16 public bool required;
17
18 public int GetGroup()
19 {
20 if (action == EAction.Examine)
21 {
22 return 1;
23 }
24 if (action == EAction.GetAll)
25 {
26 return 2;
27 }
28 return 0;
29 }
30 }
31
32 [Serializable]
33 public class KeyMapManager
34 {
35 public KeyMap cancel = new KeyMap
36 {
37 action = EAction.CancelUI
38 };
39
40 public KeyMap axisUp = new KeyMap
41 {
42 action = EAction.AxisUp
43 };
44
45 public KeyMap axisDown = new KeyMap
46 {
47 action = EAction.AxisDown
48 };
49
50 public KeyMap axisLeft = new KeyMap
51 {
52 action = EAction.AxisLeft
53 };
54
55 public KeyMap axisRight = new KeyMap
56 {
57 action = EAction.AxisRight
58 };
59
61 {
62 action = EAction.AxisUpLeft
63 };
64
66 {
67 action = EAction.AxisUpRight
68 };
69
71 {
72 action = EAction.AxisDownLeft
73 };
74
76 {
77 action = EAction.AxisDownRight
78 };
79
80 public KeyMap journal = new KeyMap
81 {
82 action = EAction.MenuJournal
83 };
84
85 public KeyMap chara = new KeyMap
86 {
87 action = EAction.MenuChara
88 };
89
90 public KeyMap inventory = new KeyMap
91 {
92 action = EAction.MenuInventory
93 };
94
95 public KeyMap ability = new KeyMap
96 {
97 action = EAction.MenuAbility
98 };
99
100 public KeyMap log = new KeyMap
101 {
102 action = EAction.Log
103 };
104
105 public KeyMap fire = new KeyMap
106 {
107 action = EAction.Fire
108 };
109
110 public KeyMap wait = new KeyMap
111 {
112 action = EAction.Wait
113 };
114
116 {
117 action = EAction.AutoCombat
118 };
119
121 {
122 action = EAction.EmptyHand
123 };
124
126 {
127 action = EAction.MouseLeft
128 };
129
131 {
132 action = EAction.MouseRight
133 };
134
136 {
137 action = EAction.MouseMiddle
138 };
139
140 public KeyMap report = new KeyMap
141 {
142 action = EAction.Report
143 };
144
146 {
147 action = EAction.QuickSave
148 };
149
151 {
152 action = EAction.QuickLoad
153 };
154
156 {
157 action = EAction.SwitchHotbar
158 };
159
160 public KeyMap examine = new KeyMap
161 {
162 action = EAction.Examine
163 };
164
165 public KeyMap getAll = new KeyMap
166 {
167 action = EAction.GetAll
168 };
169
170 public KeyMap dump = new KeyMap
171 {
172 action = EAction.Dump
173 };
174
175 public KeyMap mute = new KeyMap
176 {
177 action = EAction.Mute
178 };
179
180 public KeyMap meditate = new KeyMap
181 {
182 action = EAction.Meditate
183 };
184
185 public KeyMap search = new KeyMap
186 {
187 action = EAction.Search
188 };
189
190 public KeyMap chat = new KeyMap
191 {
192 action = EAction.Chat
193 };
194
195 public KeyMap console = new KeyMap
196 {
197 action = EAction.Console
198 };
199
200 public List<KeyMap> List()
201 {
202 return new List<KeyMap>
203 {
208 };
209 }
210 }
211
212 public class KeyboardPress
213 {
214 public float timer;
215
216 public int count;
217
218 public bool consumed;
219
220 public Func<KeyMap> func;
221
222 public EAction Action => func().action;
223
224 public bool IsRepeating => count > 1;
225
226 public bool Update(bool forcePress = false)
227 {
228 if (Input.GetKey(func().key) || forcePress)
229 {
230 if (consumed)
231 {
232 return false;
233 }
234 if (count == 1)
235 {
236 timer += delta;
237 if (timer < 0.5f)
238 {
239 return false;
240 }
241 }
242 else
243 {
244 timer = 0f;
245 }
246 count++;
247 return true;
248 }
249 consumed = false;
250 count = 0;
251 return false;
252 }
253
254 public void Consume()
255 {
256 consumed = true;
257 }
258 }
259
260 public static KeyboardPress keyFire = new KeyboardPress();
261
262 public static KeyboardPress keyWait = new KeyboardPress();
263
264 public static Func<string, string> LangGetter;
265
266 public static EInput Instance;
267
268 public static EventSystem eventSystem;
269
270 public static EAction action;
271
272 public static bool isShiftDown;
273
274 public static bool isCtrlDown;
275
276 public static bool isAltDown;
277
278 public static bool requireConfirmReset;
279
280 public static bool requireAxisReset;
281
282 public static bool hasAxisMoved;
283
284 public static bool hasShiftChanged;
285
286 public static bool haltInput;
287
288 public static bool isInputFieldActive;
289
290 public static bool firstAxisPressed;
291
292 public static bool axisReleased;
293
294 public static int hotkey;
295
296 public static int functionkey;
297
298 public static int skipFrame;
299
300 public static int wheel;
301
302 public static int missClickButton;
303
304 private static float waitInput;
305
306 private static float durationAxis;
307
308 private static float durationFirstAxis;
309
310 private static float durationAxisRelease;
311
312 private static float durationAxisDiagonal;
313
314 private static float waitReleaseKeyTimer;
315
316 private static Vector2 lastAxis;
317
318 private static Vector2 firstAxis;
319
320 private static Vector2 prevAxis;
321
322 public static bool hasMouseMoved;
323
324 public static bool axisXChanged;
325
326 public static bool axisYChanged;
327
328 public static bool waitReleaseAnyKey;
329
330 public static List<ButtonState> buttons = new List<ButtonState>();
331
332 public static float delta;
333
334 public static float antiMissClick;
335
336 public static float missClickDuration;
337
338 public static float dragHack;
339
340 public static float ignoreWheelDuration;
341
342 public static Vector2 axis;
343
344 public static Vector2 forbidAxis;
345
346 public static Vector2 axisDiagonal;
347
348 public static Vector3 mpos;
349
350 public static Vector3 mposWorld;
351
352 public static Vector3 dragStartPos;
353
354 public static Vector3 dragStartPos2;
355
356 public static Vector3 lastMousePos;
357
358 public static Vector3 dragAmount;
359
360 public static ButtonState leftMouse;
361
362 public static ButtonState rightMouse;
363
365
366 public static ButtonState mouse3;
367
368 public static ButtonState mouse4;
369
371
372 public static ButtonState buttonCtrl;
373
374 public static bool rightScroll;
375
376 public static bool disableKeyAxis;
377
378 public static KeyMapManager keys = new KeyMapManager();
379
380 public static Vector3 uiMousePosition;
381
382 public float repeatThresh = 0.3f;
383
384 public float repeatSpeed = 0.05f;
385
386 public static bool isConfirm => action == EAction.Confirm;
387
388 public static bool isCancel
389 {
390 get
391 {
392 if (action != EAction.Cancel)
393 {
394 return action == EAction.CancelUI;
395 }
396 return true;
397 }
398 }
399
400 public static bool isPrev => action == EAction.Prev;
401
402 public static bool isNext => action == EAction.Next;
403
404 public static bool IsConsumed => skipFrame > 0;
405
406 public static GameObject selectedGO => eventSystem.currentSelectedGameObject;
407
408 public static void WaitInput(float time)
409 {
410 waitInput = time;
411 }
412
413 private void Awake()
414 {
415 Instance = this;
416 Init();
417 }
418
419 public static void Init()
420 {
421 leftMouse = AddButton(0);
424 mouse3 = AddButton(3);
425 mouse4 = AddButton(4);
426 leftMouse.dragMargin = 32f;
427 middleMouse.clickDuration = 0.3f;
428 middleMouse.clickCriteria = ButtonState.ClickCriteria.ByDuration;
429 middleMouse.ignoreWheel = true;
430 middleMouse.id = "middle";
431 mouse3.clickDuration = 0.3f;
432 mouse3.clickCriteria = ButtonState.ClickCriteria.ByDuration;
433 mouse4.clickDuration = 0.3f;
434 mouse4.clickCriteria = ButtonState.ClickCriteria.ByDuration;
436 {
437 mouse = -1,
438 clickCriteria = ButtonState.ClickCriteria.ByDuration
439 };
440 buttons.Add(buttonCtrl);
442 }
443
444 public static void SetKeyMap(KeyMapManager _keys)
445 {
446 keys = _keys;
447 leftMouse.keymap = keys.mouseLeft;
448 rightMouse.keymap = keys.mouseRight;
449 middleMouse.keymap = keys.mouseMiddle;
450 buttonCtrl.keymap = keys.switchHotbar;
451 keyFire.func = () => keys.fire;
452 keyWait.func = () => keys.wait;
453 }
454
455 public static ButtonState AddButton(int mouse)
456 {
457 ButtonState buttonState = new ButtonState
458 {
459 mouse = mouse
460 };
461 buttons.Add(buttonState);
462 return buttonState;
463 }
464
465 public static void DisableIME()
466 {
467 ToggleIME(on: false);
468 }
469
470 public static void ToggleIME(bool on)
471 {
472 Input.imeCompositionMode = (on ? IMECompositionMode.On : IMECompositionMode.Off);
473 }
474
475 public static void UpdateOnlyAxis()
476 {
477 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
478 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
479 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
480 axis = Vector2.zero;
481 hasAxisMoved = (hasMouseMoved = false);
482 UpdateAxis();
483 Consume(3);
484 }
485
486 public static void Update()
487 {
490 dragHack += delta;
491 mpos = Input.mousePosition;
492 if ((bool)Camera.main)
493 {
494 mposWorld = Camera.main.ScreenToWorldPoint(mpos);
495 }
496 mposWorld.z = 0f;
497 action = EAction.None;
498 axis = Vector2.zero;
499 hasAxisMoved = (hasMouseMoved = false);
500 wheel = 0;
501 if (!Application.isFocused)
502 {
503 return;
504 }
505 GameObject gameObject = EventSystem.current?.currentSelectedGameObject;
506 if ((bool)gameObject && gameObject.activeInHierarchy)
507 {
508 isInputFieldActive = gameObject.GetComponent<InputField>();
509 }
510 else
511 {
512 isInputFieldActive = false;
513 }
514 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
515 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
516 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
518 {
519 waitReleaseKeyTimer -= Time.deltaTime;
520 if (waitReleaseKeyTimer < 0f)
521 {
522 waitReleaseAnyKey = false;
523 }
524 else
525 {
526 if (!Input.inputString.IsEmpty() || IsAnyKeyDown(includeAxis: true, _skipframe: false))
527 {
528 return;
529 }
530 waitReleaseAnyKey = false;
531 }
532 }
533 if (haltInput)
534 {
535 Consume(consumeAxis: true);
536 return;
537 }
539 {
540 if (Input.GetKey(keys.wait.key) || Input.GetKey(KeyCode.Keypad5))
541 {
542 Consume(consumeAxis: true);
543 return;
544 }
545 requireConfirmReset = false;
546 }
548 if (lastMousePos != mpos)
549 {
551 hasMouseMoved = true;
552 }
553 if (skipFrame > 0)
554 {
555 skipFrame--;
556 return;
557 }
558 if (waitInput > 0f)
559 {
560 Consume(consumeAxis: true);
561 waitInput -= Time.unscaledDeltaTime;
562 return;
563 }
564 if (Input.GetMouseButtonDown(0))
565 {
566 missClickButton = 0;
568 }
569 if (Input.GetMouseButtonDown(1))
570 {
571 if (missClickDuration > 0f && missClickButton == 0)
572 {
573 Consume();
574 rightMouse.consumed = false;
575 skipFrame = 5;
576 return;
577 }
578 missClickButton = 1;
580 }
581 foreach (ButtonState button in buttons)
582 {
583 button.Update();
584 }
585 if (ignoreWheelDuration < 0f)
586 {
587 float num = Input.GetAxis("Mouse ScrollWheel");
588 wheel = ((num < 0f) ? (-1) : ((num > 0f) ? 1 : 0));
589 if (Input.GetKeyDown(KeyCode.PageUp))
590 {
591 wheel = 1;
592 }
593 if (Input.GetKeyDown(KeyCode.PageDown))
594 {
595 wheel = -1;
596 }
597 }
599 {
600 return;
601 }
602 UpdateAxis();
604 {
605 if (axis == Vector2.zero)
606 {
607 requireAxisReset = false;
608 }
609 else
610 {
611 axis = Vector2.zero;
612 }
613 }
614 if (forbidAxis != Vector2.zero && axis == forbidAxis)
615 {
616 axis = Vector2.zero;
617 }
618 else
619 {
620 forbidAxis = Vector2.zero;
621 }
623 if (hotkey == -1 && action == EAction.None)
624 {
625 action = GetAction();
626 }
628 }
629
630 public static bool IsAnyKeyDown(bool includeAxis = true, bool _skipframe = true)
631 {
632 if (_skipframe && skipFrame > 0)
633 {
634 return false;
635 }
636 if (isConfirm || isCancel)
637 {
638 return true;
639 }
640 if (includeAxis && axis != Vector2.zero)
641 {
642 return true;
643 }
644 foreach (ButtonState button in buttons)
645 {
646 if (button.clicked)
647 {
648 return true;
649 }
650 }
651 for (int i = 97; i < 122; i++)
652 {
653 if (Input.GetKey(i.ToEnum<KeyCode>()))
654 {
655 return true;
656 }
657 }
658 return false;
659 }
660
661 public static void WaitReleaseKey()
662 {
663 waitReleaseAnyKey = true;
664 waitReleaseKeyTimer = 2.5f;
665 }
666
667 public static void Consume(int _skipFrame)
668 {
669 Consume(consumeAxis: false, _skipFrame);
670 }
671
672 public static void Consume(bool consumeAxis = false, int _skipFrame = 1)
673 {
674 wheel = 0;
675 action = EAction.None;
676 functionkey = -1;
677 hotkey = -1;
678 if (_skipFrame > skipFrame)
679 {
680 skipFrame = _skipFrame;
681 }
682 if (consumeAxis)
683 {
684 axis = (lastAxis = Vector2.zero);
685 requireAxisReset = true;
686 durationAxis = 0f;
687 }
688 foreach (ButtonState button in buttons)
689 {
690 button.Consume();
691 }
692 }
693
694 public static void ConsumeWheel()
695 {
696 wheel = 0;
697 }
698
699 public static void SetAxis(int x, int y)
700 {
701 axis.x = x;
702 axis.y = y;
703 }
704
705 public static void ModAxisX(int x)
706 {
707 axis.x += x;
708 axisXChanged = true;
709 }
710
711 public static void ModAxisY(int y)
712 {
713 axis.y += y;
714 axisYChanged = true;
715 }
716
717 private static void UpdateAxis()
718 {
720 {
721 return;
722 }
723 axisXChanged = (axisYChanged = false);
724 if (Input.GetKey(keys.axisUp.key))
725 {
726 ModAxisY(1);
727 }
728 if (Input.GetKey(keys.axisDown.key))
729 {
730 ModAxisY(-1);
731 }
732 if (Input.GetKey(keys.axisLeft.key))
733 {
734 ModAxisX(-1);
735 }
736 if (Input.GetKey(keys.axisRight.key))
737 {
738 ModAxisX(1);
739 }
740 if (axis == Vector2.zero && !disableKeyAxis)
741 {
742 if (Input.GetKey(keys.axisUp.key) || Input.GetKey(KeyCode.UpArrow))
743 {
744 ModAxisY(1);
745 }
746 if (Input.GetKey(keys.axisDown.key) || Input.GetKey(KeyCode.DownArrow))
747 {
748 ModAxisY(-1);
749 }
750 if (Input.GetKey(keys.axisLeft.key) || Input.GetKey(KeyCode.LeftArrow))
751 {
752 ModAxisX(-1);
753 }
754 if (Input.GetKey(keys.axisRight.key) || Input.GetKey(KeyCode.RightArrow))
755 {
756 ModAxisX(1);
757 }
758 }
759 if (axis == Vector2.zero)
760 {
761 if (Input.GetKey(KeyCode.Keypad8))
762 {
763 ModAxisY(1);
764 }
765 if (Input.GetKey(KeyCode.Keypad2))
766 {
767 ModAxisY(-1);
768 }
769 if (Input.GetKey(KeyCode.Keypad4))
770 {
771 ModAxisX(-1);
772 }
773 if (Input.GetKey(KeyCode.Keypad6))
774 {
775 ModAxisX(1);
776 }
777 }
778 if (Input.GetKey(keys.axisUpLeft.key))
779 {
780 SetAxis(-1, 1);
781 }
782 if (Input.GetKey(keys.axisUpRight.key))
783 {
784 SetAxis(1, 1);
785 }
786 if (Input.GetKey(keys.axisDownLeft.key))
787 {
788 SetAxis(-1, -1);
789 }
790 if (Input.GetKey(keys.axisDownRight.key))
791 {
792 SetAxis(1, -1);
793 }
794 if (Input.GetKey(KeyCode.Keypad1))
795 {
796 SetAxis(-1, -1);
797 }
798 if (Input.GetKey(KeyCode.Keypad3))
799 {
800 SetAxis(1, -1);
801 }
802 if (Input.GetKey(KeyCode.Keypad7))
803 {
804 SetAxis(-1, 1);
805 }
806 if (Input.GetKey(KeyCode.Keypad9))
807 {
808 SetAxis(1, 1);
809 }
810 if (axis.x == 0f && axisXChanged)
811 {
812 axis.x = 0f - prevAxis.x;
813 }
814 else
815 {
816 prevAxis.x = axis.x;
817 }
818 if (axis.y == 0f && axisYChanged)
819 {
820 axis.y = 0f - prevAxis.y;
821 }
822 else
823 {
824 prevAxis.y = axis.y;
825 }
826 if (Input.GetKey(KeyCode.LeftAlt) && (axis.x == 0f || axis.y == 0f))
827 {
828 axis = Vector2.zero;
829 }
830 if (axis != Vector2.zero && !firstAxisPressed)
831 {
832 firstAxisPressed = true;
833 firstAxis = axis;
834 durationFirstAxis = 0.06f;
835 }
837 {
839 if (durationFirstAxis > 0f)
840 {
841 if (!(axis == Vector2.zero))
842 {
843 axis = Vector2.zero;
844 return;
845 }
846 axis = firstAxis;
847 }
848 else if (axis == Vector2.zero)
849 {
850 firstAxisPressed = false;
851 }
852 }
853 if (axis.x != 0f && axis.y != 0f)
854 {
855 axisDiagonal.x = axis.x;
856 axisDiagonal.y = axis.y;
858 if (durationAxisDiagonal > 0f)
859 {
861 }
862 }
863 else
864 {
866 if (durationAxisDiagonal < 0f)
867 {
869 }
870 }
871 if (axis == Vector2.zero)
872 {
874 if (durationAxisRelease < 0.5f + durationAxisDiagonal * 0.1f)
875 {
876 return;
877 }
878 lastAxis = Vector2.zero;
879 }
880 else
881 {
883 }
884 if (durationAxisDiagonal > 1f)
885 {
886 if (axis != Vector2.zero)
887 {
888 axis.x = axisDiagonal.x;
889 axis.y = axisDiagonal.y;
890 }
891 lastAxis = Vector2.zero;
892 return;
893 }
895 if (axis != Vector2.zero && axis != lastAxis)
896 {
897 durationAxis = 0.25f;
898 lastAxis = axis;
899 }
900 else if (durationAxis > 0f)
901 {
902 axis = lastAxis;
903 }
904 }
905
906 public static int GetHotkeyDown()
907 {
908 int result = -1;
909 if (Input.GetKeyDown(KeyCode.Alpha1))
910 {
911 result = 0;
912 }
913 else if (Input.GetKeyDown(KeyCode.Alpha2))
914 {
915 result = 1;
916 }
917 else if (Input.GetKeyDown(KeyCode.Alpha3))
918 {
919 result = 2;
920 }
921 else if (Input.GetKeyDown(KeyCode.Alpha4))
922 {
923 result = 3;
924 }
925 else if (Input.GetKeyDown(KeyCode.Alpha5))
926 {
927 result = 4;
928 }
929 else if (Input.GetKeyDown(KeyCode.Alpha6))
930 {
931 result = 5;
932 }
933 else if (Input.GetKeyDown(KeyCode.Alpha7))
934 {
935 result = 6;
936 }
937 else if (Input.GetKeyDown(KeyCode.Alpha8))
938 {
939 result = 7;
940 }
941 else if (Input.GetKeyDown(KeyCode.Alpha9))
942 {
943 result = 8;
944 }
945 return result;
946 }
947
948 public static int GetFunctionkeyDown()
949 {
950 int result = -1;
951 if (Input.GetKeyDown(KeyCode.F1))
952 {
953 result = 0;
954 }
955 else if (Input.GetKeyDown(KeyCode.F2))
956 {
957 result = 1;
958 }
959 else if (Input.GetKeyDown(KeyCode.F3))
960 {
961 result = 2;
962 }
963 else if (Input.GetKeyDown(KeyCode.F4))
964 {
965 result = 3;
966 }
967 else if (Input.GetKeyDown(KeyCode.F5))
968 {
969 result = 4;
970 }
971 else if (Input.GetKeyDown(KeyCode.F6))
972 {
973 result = 5;
974 }
975 else if (Input.GetKeyDown(KeyCode.F7))
976 {
977 result = 6;
978 }
979 else if (Input.GetKeyDown(KeyCode.F8))
980 {
981 result = 7;
982 }
983 return result;
984 }
985
986 public static int GetHotkey()
987 {
988 int result = -1;
989 if (Input.GetKey(KeyCode.Alpha1))
990 {
991 result = 0;
992 }
993 else if (Input.GetKey(KeyCode.Alpha2))
994 {
995 result = 1;
996 }
997 else if (Input.GetKey(KeyCode.Alpha3))
998 {
999 result = 2;
1000 }
1001 else if (Input.GetKey(KeyCode.Alpha4))
1002 {
1003 result = 3;
1004 }
1005 else if (Input.GetKey(KeyCode.Alpha5))
1006 {
1007 result = 4;
1008 }
1009 else if (Input.GetKey(KeyCode.Alpha6))
1010 {
1011 result = 5;
1012 }
1013 else if (Input.GetKey(KeyCode.Alpha7))
1014 {
1015 result = 6;
1016 }
1017 else if (Input.GetKey(KeyCode.Alpha8))
1018 {
1019 result = 7;
1020 }
1021 else if (Input.GetKey(KeyCode.Alpha9))
1022 {
1023 result = 8;
1024 }
1025 return result;
1026 }
1027
1028 private static EAction GetAction()
1029 {
1030 string inputString = Input.inputString;
1031 if (Input.GetKeyDown(KeyCode.Escape))
1032 {
1033 return EAction.Cancel;
1034 }
1035 if (Input.GetKeyDown(keys.wait.key) || Input.GetKey(KeyCode.Keypad5))
1036 {
1037 return EAction.Wait;
1038 }
1039 if (Input.GetKeyDown(keys.emptyHand.key))
1040 {
1041 return EAction.EmptyHand;
1042 }
1043 if (Input.GetKeyDown(keys.autoCombat.key))
1044 {
1045 return EAction.AutoCombat;
1046 }
1047 if (Input.GetKeyDown(keys.examine.key))
1048 {
1049 return EAction.Examine;
1050 }
1051 if (Input.GetKeyDown(keys.getAll.key))
1052 {
1053 return EAction.GetAll;
1054 }
1055 if (Input.GetKeyDown(keys.dump.key))
1056 {
1057 return EAction.Dump;
1058 }
1059 if (Input.GetKeyDown(keys.mute.key))
1060 {
1061 return EAction.Mute;
1062 }
1063 if (Input.GetKeyDown(keys.meditate.key))
1064 {
1065 return EAction.Meditate;
1066 }
1067 if (Input.GetKeyDown(keys.search.key))
1068 {
1069 return EAction.Search;
1070 }
1071 if (Input.GetKeyDown(keys.chat.key))
1072 {
1073 return EAction.Chat;
1074 }
1075 if (Input.GetKeyDown(keys.console.key))
1076 {
1077 return EAction.Console;
1078 }
1079 if (keyFire.Update())
1080 {
1081 return keyFire.Action;
1082 }
1083 if (keyWait.Update())
1084 {
1085 return keyWait.Action;
1086 }
1087 if (!isShiftDown)
1088 {
1089 if (Input.GetKeyDown(keys.chara.key))
1090 {
1091 return EAction.MenuChara;
1092 }
1093 if (Input.GetKeyDown(keys.journal.key))
1094 {
1095 return EAction.MenuJournal;
1096 }
1097 if (Input.GetKeyDown(keys.inventory.key))
1098 {
1099 return EAction.MenuInventory;
1100 }
1101 if (Input.GetKeyDown(keys.ability.key))
1102 {
1103 return EAction.MenuAbility;
1104 }
1105 if (Input.GetKeyDown(keys.log.key))
1106 {
1107 return EAction.Log;
1108 }
1109 if (Input.GetKeyDown(keys.report.key))
1110 {
1111 return EAction.Report;
1112 }
1113 if (Input.GetKeyDown(keys.quickSave.key))
1114 {
1115 return EAction.QuickSave;
1116 }
1117 if (Input.GetKeyDown(keys.quickLoad.key))
1118 {
1119 return EAction.QuickLoad;
1120 }
1121 }
1122 if (!(inputString == "?"))
1123 {
1124 if (inputString == "g")
1125 {
1126 return EAction.ShowGrid;
1127 }
1128 return EAction.None;
1129 }
1130 return EAction.Help;
1131 }
1132
1133 public static void RestoreDefaultKeys()
1134 {
1135 }
1136
1137 public static void Select(GameObject go)
1138 {
1139 eventSystem.SetSelectedGameObject(null);
1140 eventSystem.SetSelectedGameObject(go);
1141 }
1142}
EAction
Definition: EAction.cs:2
void Update()
Definition: ButtonState.cs:80
bool clicked
Definition: ButtonState.cs:37
void Consume()
Definition: ButtonState.cs:184
KeyMap inventory
Definition: EInput.cs:90
KeyMap mouseMiddle
Definition: EInput.cs:135
KeyMap axisUpRight
Definition: EInput.cs:65
KeyMap axisUpLeft
Definition: EInput.cs:60
KeyMap axisDownLeft
Definition: EInput.cs:70
List< KeyMap > List()
Definition: EInput.cs:200
KeyMap axisDownRight
Definition: EInput.cs:75
KeyMap axisRight
Definition: EInput.cs:55
KeyMap switchHotbar
Definition: EInput.cs:155
KeyCode key
Definition: EInput.cs:14
bool required
Definition: EInput.cs:16
int GetGroup()
Definition: EInput.cs:18
EAction action
Definition: EInput.cs:12
Func< KeyMap > func
Definition: EInput.cs:220
bool Update(bool forcePress=false)
Definition: EInput.cs:226
Definition: EInput.cs:8
static float durationAxis
Definition: EInput.cs:306
static bool IsAnyKeyDown(bool includeAxis=true, bool _skipframe=true)
Definition: EInput.cs:630
static bool isCancel
Definition: EInput.cs:389
static Vector2 forbidAxis
Definition: EInput.cs:344
static int GetFunctionkeyDown()
Definition: EInput.cs:948
static void WaitReleaseKey()
Definition: EInput.cs:661
static GameObject selectedGO
Definition: EInput.cs:406
static Vector2 lastAxis
Definition: EInput.cs:316
static void WaitInput(float time)
Definition: EInput.cs:408
static int wheel
Definition: EInput.cs:300
static float durationAxisDiagonal
Definition: EInput.cs:312
static float antiMissClick
Definition: EInput.cs:334
static bool hasMouseMoved
Definition: EInput.cs:322
static Vector3 uiMousePosition
Definition: EInput.cs:380
static ButtonState middleMouse
Definition: EInput.cs:364
static bool hasShiftChanged
Definition: EInput.cs:284
static bool IsConsumed
Definition: EInput.cs:404
static bool isCtrlDown
Definition: EInput.cs:274
static bool axisReleased
Definition: EInput.cs:292
static bool requireAxisReset
Definition: EInput.cs:280
float repeatSpeed
Definition: EInput.cs:384
static Vector3 dragAmount
Definition: EInput.cs:358
static void Consume(int _skipFrame)
Definition: EInput.cs:667
static bool axisYChanged
Definition: EInput.cs:326
static KeyMapManager keys
Definition: EInput.cs:378
static bool disableKeyAxis
Definition: EInput.cs:376
static EInput Instance
Definition: EInput.cs:266
static void UpdateAxis()
Definition: EInput.cs:717
static bool isAltDown
Definition: EInput.cs:276
static float dragHack
Definition: EInput.cs:338
static bool requireConfirmReset
Definition: EInput.cs:278
static bool rightScroll
Definition: EInput.cs:374
static bool isInputFieldActive
Definition: EInput.cs:288
static ButtonState mouse4
Definition: EInput.cs:368
static Vector2 axis
Definition: EInput.cs:342
float repeatThresh
Definition: EInput.cs:382
static bool firstAxisPressed
Definition: EInput.cs:290
static EventSystem eventSystem
Definition: EInput.cs:268
static float ignoreWheelDuration
Definition: EInput.cs:340
static void UpdateOnlyAxis()
Definition: EInput.cs:475
static Func< string, string > LangGetter
Definition: EInput.cs:264
static bool isNext
Definition: EInput.cs:402
static ButtonState buttonCtrl
Definition: EInput.cs:372
static ButtonState leftMouse
Definition: EInput.cs:360
static float waitReleaseKeyTimer
Definition: EInput.cs:314
static void Update()
Definition: EInput.cs:486
static List< ButtonState > buttons
Definition: EInput.cs:330
static void ConsumeWheel()
Definition: EInput.cs:694
static bool isShiftDown
Definition: EInput.cs:272
static void Select(GameObject go)
Definition: EInput.cs:1137
static Vector2 prevAxis
Definition: EInput.cs:320
static void SetKeyMap(KeyMapManager _keys)
Definition: EInput.cs:444
static bool isConfirm
Definition: EInput.cs:386
static Vector3 dragStartPos
Definition: EInput.cs:352
static bool isPrev
Definition: EInput.cs:400
static Vector3 lastMousePos
Definition: EInput.cs:356
static ButtonState buttonScroll
Definition: EInput.cs:370
static ButtonState AddButton(int mouse)
Definition: EInput.cs:455
static float durationAxisRelease
Definition: EInput.cs:310
static int missClickButton
Definition: EInput.cs:302
static ButtonState rightMouse
Definition: EInput.cs:362
static int functionkey
Definition: EInput.cs:296
static float durationFirstAxis
Definition: EInput.cs:308
static void ToggleIME(bool on)
Definition: EInput.cs:470
static ButtonState mouse3
Definition: EInput.cs:366
static float waitInput
Definition: EInput.cs:304
static int skipFrame
Definition: EInput.cs:298
static bool axisXChanged
Definition: EInput.cs:324
static Vector3 mpos
Definition: EInput.cs:348
static void Consume(bool consumeAxis=false, int _skipFrame=1)
Definition: EInput.cs:672
void Awake()
Definition: EInput.cs:413
static EAction GetAction()
Definition: EInput.cs:1028
static void ModAxisX(int x)
Definition: EInput.cs:705
static Vector3 mposWorld
Definition: EInput.cs:350
static bool waitReleaseAnyKey
Definition: EInput.cs:328
static void DisableIME()
Definition: EInput.cs:465
static bool haltInput
Definition: EInput.cs:286
static float delta
Definition: EInput.cs:332
static Vector3 dragStartPos2
Definition: EInput.cs:354
static KeyboardPress keyFire
Definition: EInput.cs:260
static void SetAxis(int x, int y)
Definition: EInput.cs:699
static void Init()
Definition: EInput.cs:419
static Vector2 axisDiagonal
Definition: EInput.cs:346
static float missClickDuration
Definition: EInput.cs:336
static int GetHotkey()
Definition: EInput.cs:986
static int hotkey
Definition: EInput.cs:294
static KeyboardPress keyWait
Definition: EInput.cs:262
static bool hasAxisMoved
Definition: EInput.cs:282
static void ModAxisY(int y)
Definition: EInput.cs:711
static Vector2 firstAxis
Definition: EInput.cs:318
static int GetHotkeyDown()
Definition: EInput.cs:906
static EAction action
Definition: EInput.cs:270
static void RestoreDefaultKeys()
Definition: EInput.cs:1133