Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
EInput Class Reference
Inheritance diagram for EInput:

Classes

class  KeyboardPress
 
class  KeyMap
 
class  KeyMapManager
 

Static Public Member Functions

static void WaitInput (float time)
 
static void Init ()
 
static void SetKeyMap (KeyMapManager _keys)
 
static ButtonState AddButton (int mouse)
 
static void DisableIME ()
 
static void ToggleIME (bool on)
 
static void UpdateOnlyAxis ()
 
static void Update ()
 
static bool IsAnyKeyDown (bool includeAxis=true, bool _skipframe=true)
 
static void WaitReleaseKey ()
 
static void Consume (int _skipFrame)
 
static void Consume (bool consumeAxis=false, int _skipFrame=1)
 
static void ConsumeWheel ()
 
static void SetAxis (int x, int y)
 
static void ModAxisX (int x)
 
static void ModAxisY (int y)
 
static int GetHotkeyDown ()
 
static int GetFunctionkeyDown ()
 
static int GetHotkey ()
 
static void RestoreDefaultKeys ()
 
static void Select (GameObject go)
 

Public Attributes

float repeatThresh = 0.3f
 
float repeatSpeed = 0.05f
 

Static Public Attributes

static KeyboardPress keyFire = new KeyboardPress()
 
static KeyboardPress keyWait = new KeyboardPress()
 
static Func< string, string > LangGetter
 
static EInput Instance
 
static EventSystem eventSystem
 
static EAction action
 
static bool isShiftDown
 
static bool isCtrlDown
 
static bool isAltDown
 
static bool requireConfirmReset
 
static bool requireAxisReset
 
static bool hasAxisMoved
 
static bool hasShiftChanged
 
static bool haltInput
 
static bool isInputFieldActive
 
static bool firstAxisPressed
 
static bool axisReleased
 
static int hotkey
 
static int functionkey
 
static int skipFrame
 
static int wheel
 
static int missClickButton
 
static bool hasMouseMoved
 
static bool axisXChanged
 
static bool axisYChanged
 
static bool waitReleaseAnyKey
 
static List< ButtonStatebuttons = new List<ButtonState>()
 
static float delta
 
static float antiMissClick
 
static float missClickDuration
 
static float dragHack
 
static float ignoreWheelDuration
 
static Vector2 axis
 
static Vector2 forbidAxis
 
static Vector2 axisDiagonal
 
static Vector3 mpos
 
static Vector3 mposWorld
 
static Vector3 dragStartPos
 
static Vector3 dragStartPos2
 
static Vector3 lastMousePos
 
static Vector3 dragAmount
 
static ButtonState leftMouse
 
static ButtonState rightMouse
 
static ButtonState middleMouse
 
static ButtonState mouse3
 
static ButtonState mouse4
 
static ButtonState buttonScroll
 
static ButtonState buttonCtrl
 
static bool rightScroll
 
static bool disableKeyAxis
 
static KeyMapManager keys = new KeyMapManager()
 
static Vector3 uiMousePosition
 

Properties

static bool isConfirm [get]
 
static bool isCancel [get]
 
static bool isPrev [get]
 
static bool isNext [get]
 
static bool IsConsumed [get]
 
static GameObject selectedGO [get]
 

Private Member Functions

void Awake ()
 

Static Private Member Functions

static void UpdateAxis ()
 
static EAction GetAction ()
 

Static Private Attributes

static float waitInput
 
static float durationAxis
 
static float durationFirstAxis
 
static float durationAxisRelease
 
static float durationAxisDiagonal
 
static float waitReleaseKeyTimer
 
static Vector2 lastAxis
 
static Vector2 firstAxis
 
static Vector2 prevAxis
 

Detailed Description

Definition at line 7 of file EInput.cs.

Member Function Documentation

◆ AddButton()

static ButtonState EInput.AddButton ( int  mouse)
inlinestatic

Definition at line 444 of file EInput.cs.

445 {
446 ButtonState buttonState = new ButtonState
447 {
448 mouse = mouse
449 };
450 buttons.Add(buttonState);
451 return buttonState;
452 }
static List< ButtonState > buttons
Definition: EInput.cs:319

References buttons.

Referenced by Init().

◆ Awake()

void EInput.Awake ( )
inlineprivate

Definition at line 402 of file EInput.cs.

403 {
404 Instance = this;
405 Init();
406 }
static EInput Instance
Definition: EInput.cs:255
static void Init()
Definition: EInput.cs:408

References Init(), and Instance.

◆ Consume() [1/2]

static void EInput.Consume ( bool  consumeAxis = false,
int  _skipFrame = 1 
)
inlinestatic

Definition at line 661 of file EInput.cs.

662 {
663 wheel = 0;
664 action = EAction.None;
665 functionkey = -1;
666 hotkey = -1;
667 if (_skipFrame > skipFrame)
668 {
669 skipFrame = _skipFrame;
670 }
671 if (consumeAxis)
672 {
673 axis = (lastAxis = Vector2.zero);
674 requireAxisReset = true;
675 durationAxis = 0f;
676 }
677 foreach (ButtonState button in buttons)
678 {
679 button.Consume();
680 }
681 }
EAction
Definition: EAction.cs:2
void Consume()
Definition: ButtonState.cs:184
static float durationAxis
Definition: EInput.cs:295
static Vector2 lastAxis
Definition: EInput.cs:305
static int wheel
Definition: EInput.cs:289
static bool requireAxisReset
Definition: EInput.cs:269
static Vector2 axis
Definition: EInput.cs:331
static int functionkey
Definition: EInput.cs:285
static int skipFrame
Definition: EInput.cs:287
static int hotkey
Definition: EInput.cs:283
static EAction action
Definition: EInput.cs:259

References action, axis, buttons, ButtonState.Consume(), durationAxis, functionkey, hotkey, lastAxis, requireAxisReset, skipFrame, and wheel.

◆ Consume() [2/2]

◆ ConsumeWheel()

static void EInput.ConsumeWheel ( )
inlinestatic

Definition at line 683 of file EInput.cs.

684 {
685 wheel = 0;
686 }

References wheel.

Referenced by LayerQuickMenu.OnUpdateInput().

◆ DisableIME()

static void EInput.DisableIME ( )
inlinestatic

Definition at line 454 of file EInput.cs.

455 {
456 ToggleIME(on: false);
457 }
static void ToggleIME(bool on)
Definition: EInput.cs:459

References ToggleIME().

Referenced by UIContextMenu.Hide(), and ELayer.Kill().

◆ GetAction()

static EAction EInput.GetAction ( )
inlinestaticprivate

Definition at line 1017 of file EInput.cs.

1018 {
1019 string inputString = Input.inputString;
1020 if (Input.GetKeyDown(KeyCode.Escape))
1021 {
1022 return EAction.Cancel;
1023 }
1024 if (Input.GetKeyDown(keys.wait.key) || Input.GetKey(KeyCode.Keypad5))
1025 {
1026 return EAction.Wait;
1027 }
1028 if (Input.GetKeyDown(keys.emptyHand.key))
1029 {
1030 return EAction.EmptyHand;
1031 }
1032 if (Input.GetKeyDown(keys.autoCombat.key))
1033 {
1034 return EAction.AutoCombat;
1035 }
1036 if (Input.GetKeyDown(keys.examine.key))
1037 {
1038 return EAction.Examine;
1039 }
1040 if (Input.GetKeyDown(keys.getAll.key))
1041 {
1042 return EAction.GetAll;
1043 }
1044 if (Input.GetKeyDown(keys.dump.key))
1045 {
1046 return EAction.Dump;
1047 }
1048 if (Input.GetKeyDown(keys.mute.key))
1049 {
1050 return EAction.Mute;
1051 }
1052 if (Input.GetKeyDown(keys.meditate.key))
1053 {
1054 return EAction.Meditate;
1055 }
1056 if (Input.GetKeyDown(keys.search.key))
1057 {
1058 return EAction.Search;
1059 }
1060 if (keyFire.Update())
1061 {
1062 return keyFire.Action;
1063 }
1064 if (keyWait.Update())
1065 {
1066 return keyWait.Action;
1067 }
1068 if (!isShiftDown)
1069 {
1070 if (Input.GetKeyDown(keys.chara.key))
1071 {
1072 return EAction.MenuChara;
1073 }
1074 if (Input.GetKeyDown(keys.journal.key))
1075 {
1076 return EAction.MenuJournal;
1077 }
1078 if (Input.GetKeyDown(keys.inventory.key))
1079 {
1080 return EAction.MenuInventory;
1081 }
1082 if (Input.GetKeyDown(keys.ability.key))
1083 {
1084 return EAction.MenuAbility;
1085 }
1086 if (Input.GetKeyDown(keys.log.key))
1087 {
1088 return EAction.Log;
1089 }
1090 if (Input.GetKeyDown(keys.report.key))
1091 {
1092 return EAction.Report;
1093 }
1094 if (Input.GetKeyDown(keys.quickSave.key))
1095 {
1096 return EAction.QuickSave;
1097 }
1098 if (Input.GetKeyDown(keys.quickLoad.key))
1099 {
1100 return EAction.QuickLoad;
1101 }
1102 }
1103 if (!(inputString == "?"))
1104 {
1105 if (inputString == "g")
1106 {
1107 return EAction.ShowGrid;
1108 }
1109 return EAction.None;
1110 }
1111 return EAction.Help;
1112 }
KeyMap inventory
Definition: EInput.cs:90
KeyCode key
Definition: EInput.cs:14
bool Update(bool forcePress=false)
Definition: EInput.cs:215
static KeyMapManager keys
Definition: EInput.cs:367
static bool isShiftDown
Definition: EInput.cs:261
static KeyboardPress keyFire
Definition: EInput.cs:249
static KeyboardPress keyWait
Definition: EInput.cs:251

References EInput.KeyMapManager.ability, EInput.KeyboardPress.Action, EInput.KeyMapManager.autoCombat, EInput.KeyMapManager.chara, EInput.KeyMapManager.dump, EInput.KeyMapManager.emptyHand, EInput.KeyMapManager.examine, EInput.KeyMapManager.getAll, EInput.KeyMapManager.inventory, isShiftDown, EInput.KeyMapManager.journal, EInput.KeyMap.key, keyFire, keys, keyWait, EInput.KeyMapManager.log, EInput.KeyMapManager.meditate, EInput.KeyMapManager.mute, EInput.KeyMapManager.quickLoad, EInput.KeyMapManager.quickSave, EInput.KeyMapManager.report, EInput.KeyMapManager.search, EInput.KeyboardPress.Update(), and EInput.KeyMapManager.wait.

Referenced by Update().

◆ GetFunctionkeyDown()

static int EInput.GetFunctionkeyDown ( )
inlinestatic

Definition at line 937 of file EInput.cs.

938 {
939 int result = -1;
940 if (Input.GetKeyDown(KeyCode.F1))
941 {
942 result = 0;
943 }
944 else if (Input.GetKeyDown(KeyCode.F2))
945 {
946 result = 1;
947 }
948 else if (Input.GetKeyDown(KeyCode.F3))
949 {
950 result = 2;
951 }
952 else if (Input.GetKeyDown(KeyCode.F4))
953 {
954 result = 3;
955 }
956 else if (Input.GetKeyDown(KeyCode.F5))
957 {
958 result = 4;
959 }
960 else if (Input.GetKeyDown(KeyCode.F6))
961 {
962 result = 5;
963 }
964 else if (Input.GetKeyDown(KeyCode.F7))
965 {
966 result = 6;
967 }
968 else if (Input.GetKeyDown(KeyCode.F8))
969 {
970 result = 7;
971 }
972 return result;
973 }

Referenced by Update(), and WidgetCodex.Update().

◆ GetHotkey()

static int EInput.GetHotkey ( )
inlinestatic

Definition at line 975 of file EInput.cs.

976 {
977 int result = -1;
978 if (Input.GetKey(KeyCode.Alpha1))
979 {
980 result = 0;
981 }
982 else if (Input.GetKey(KeyCode.Alpha2))
983 {
984 result = 1;
985 }
986 else if (Input.GetKey(KeyCode.Alpha3))
987 {
988 result = 2;
989 }
990 else if (Input.GetKey(KeyCode.Alpha4))
991 {
992 result = 3;
993 }
994 else if (Input.GetKey(KeyCode.Alpha5))
995 {
996 result = 4;
997 }
998 else if (Input.GetKey(KeyCode.Alpha6))
999 {
1000 result = 5;
1001 }
1002 else if (Input.GetKey(KeyCode.Alpha7))
1003 {
1004 result = 6;
1005 }
1006 else if (Input.GetKey(KeyCode.Alpha8))
1007 {
1008 result = 7;
1009 }
1010 else if (Input.GetKey(KeyCode.Alpha9))
1011 {
1012 result = 8;
1013 }
1014 return result;
1015 }

Referenced by ButtonAbility.TryUse().

◆ GetHotkeyDown()

static int EInput.GetHotkeyDown ( )
inlinestatic

Definition at line 895 of file EInput.cs.

896 {
897 int result = -1;
898 if (Input.GetKeyDown(KeyCode.Alpha1))
899 {
900 result = 0;
901 }
902 else if (Input.GetKeyDown(KeyCode.Alpha2))
903 {
904 result = 1;
905 }
906 else if (Input.GetKeyDown(KeyCode.Alpha3))
907 {
908 result = 2;
909 }
910 else if (Input.GetKeyDown(KeyCode.Alpha4))
911 {
912 result = 3;
913 }
914 else if (Input.GetKeyDown(KeyCode.Alpha5))
915 {
916 result = 4;
917 }
918 else if (Input.GetKeyDown(KeyCode.Alpha6))
919 {
920 result = 5;
921 }
922 else if (Input.GetKeyDown(KeyCode.Alpha7))
923 {
924 result = 6;
925 }
926 else if (Input.GetKeyDown(KeyCode.Alpha8))
927 {
928 result = 7;
929 }
930 else if (Input.GetKeyDown(KeyCode.Alpha9))
931 {
932 result = 8;
933 }
934 return result;
935 }

Referenced by Update().

◆ Init()

static void EInput.Init ( )
inlinestatic

Definition at line 408 of file EInput.cs.

409 {
410 leftMouse = AddButton(0);
413 mouse3 = AddButton(3);
414 mouse4 = AddButton(4);
415 leftMouse.dragMargin = 32f;
416 middleMouse.clickDuration = 0.3f;
417 middleMouse.clickCriteria = ButtonState.ClickCriteria.ByDuration;
418 middleMouse.ignoreWheel = true;
419 middleMouse.id = "middle";
420 mouse3.clickDuration = 0.3f;
421 mouse3.clickCriteria = ButtonState.ClickCriteria.ByDuration;
422 mouse4.clickDuration = 0.3f;
423 mouse4.clickCriteria = ButtonState.ClickCriteria.ByDuration;
425 {
426 mouse = -1,
427 clickCriteria = ButtonState.ClickCriteria.ByDuration
428 };
429 buttons.Add(buttonCtrl);
431 }
static ButtonState middleMouse
Definition: EInput.cs:353
static ButtonState mouse4
Definition: EInput.cs:357
static ButtonState buttonCtrl
Definition: EInput.cs:361
static ButtonState leftMouse
Definition: EInput.cs:349
static void SetKeyMap(KeyMapManager _keys)
Definition: EInput.cs:433
static ButtonState AddButton(int mouse)
Definition: EInput.cs:444
static ButtonState rightMouse
Definition: EInput.cs:351
static ButtonState mouse3
Definition: EInput.cs:355

References AddButton(), buttonCtrl, buttons, keys, leftMouse, middleMouse, mouse3, mouse4, rightMouse, and SetKeyMap().

Referenced by Awake().

◆ IsAnyKeyDown()

static bool EInput.IsAnyKeyDown ( bool  includeAxis = true,
bool  _skipframe = true 
)
inlinestatic

Definition at line 619 of file EInput.cs.

620 {
621 if (_skipframe && skipFrame > 0)
622 {
623 return false;
624 }
625 if (isConfirm || isCancel)
626 {
627 return true;
628 }
629 if (includeAxis && axis != Vector2.zero)
630 {
631 return true;
632 }
633 foreach (ButtonState button in buttons)
634 {
635 if (button.clicked)
636 {
637 return true;
638 }
639 }
640 for (int i = 97; i < 122; i++)
641 {
642 if (Input.GetKey(i.ToEnum<KeyCode>()))
643 {
644 return true;
645 }
646 }
647 return false;
648 }
bool clicked
Definition: ButtonState.cs:37
static bool isCancel
Definition: EInput.cs:378
static bool isConfirm
Definition: EInput.cs:375

References axis, buttons, ButtonState.clicked, isCancel, isConfirm, and skipFrame.

Referenced by AM_Adv._OnUpdateInput(), DramaEventEndRoll.Play(), Update(), and ActionMode.UpdateInput().

◆ ModAxisX()

static void EInput.ModAxisX ( int  x)
inlinestatic

Definition at line 694 of file EInput.cs.

695 {
696 axis.x += x;
697 axisXChanged = true;
698 }
static bool axisXChanged
Definition: EInput.cs:313

References axisXChanged.

Referenced by UpdateAxis().

◆ ModAxisY()

static void EInput.ModAxisY ( int  y)
inlinestatic

Definition at line 700 of file EInput.cs.

701 {
702 axis.y += y;
703 axisYChanged = true;
704 }
static bool axisYChanged
Definition: EInput.cs:315

References axisYChanged.

Referenced by UpdateAxis().

◆ RestoreDefaultKeys()

static void EInput.RestoreDefaultKeys ( )
inlinestatic

Definition at line 1114 of file EInput.cs.

1115 {
1116 }

◆ Select()

static void EInput.Select ( GameObject  go)
inlinestatic

Definition at line 1118 of file EInput.cs.

1119 {
1120 eventSystem.SetSelectedGameObject(null);
1121 eventSystem.SetSelectedGameObject(go);
1122 }
static EventSystem eventSystem
Definition: EInput.cs:257

References eventSystem.

◆ SetAxis()

static void EInput.SetAxis ( int  x,
int  y 
)
inlinestatic

Definition at line 688 of file EInput.cs.

689 {
690 axis.x = x;
691 axis.y = y;
692 }

Referenced by UpdateAxis().

◆ SetKeyMap()

static void EInput.SetKeyMap ( KeyMapManager  _keys)
inlinestatic

Definition at line 433 of file EInput.cs.

434 {
435 keys = _keys;
436 leftMouse.keymap = keys.mouseLeft;
437 rightMouse.keymap = keys.mouseRight;
438 middleMouse.keymap = keys.mouseMiddle;
439 buttonCtrl.keymap = keys.switchHotbar;
440 keyFire.func = () => keys.fire;
441 keyWait.func = () => keys.wait;
442 }
KeyMap mouseMiddle
Definition: EInput.cs:135
KeyMap switchHotbar
Definition: EInput.cs:155
Func< KeyMap > func
Definition: EInput.cs:209

References EInput.KeyMapManager.fire, EInput.KeyboardPress.func, keys, keyWait, EInput.KeyMapManager.mouseLeft, EInput.KeyMapManager.mouseMiddle, EInput.KeyMapManager.mouseRight, EInput.KeyMapManager.switchHotbar, and EInput.KeyMapManager.wait.

Referenced by CoreConfig.Apply(), and Init().

◆ ToggleIME()

static void EInput.ToggleIME ( bool  on)
inlinestatic

Definition at line 459 of file EInput.cs.

460 {
461 Input.imeCompositionMode = (on ? IMECompositionMode.On : IMECompositionMode.Off);
462 }

Referenced by DisableIME().

◆ Update()

static void EInput.Update ( )
inlinestatic

Definition at line 475 of file EInput.cs.

476 {
479 dragHack += delta;
480 mpos = Input.mousePosition;
481 if ((bool)Camera.main)
482 {
483 mposWorld = Camera.main.ScreenToWorldPoint(mpos);
484 }
485 mposWorld.z = 0f;
486 action = EAction.None;
487 axis = Vector2.zero;
488 hasAxisMoved = (hasMouseMoved = false);
489 wheel = 0;
490 if (!Application.isFocused)
491 {
492 return;
493 }
494 GameObject gameObject = EventSystem.current?.currentSelectedGameObject;
495 if ((bool)gameObject && gameObject.activeInHierarchy)
496 {
497 isInputFieldActive = gameObject.GetComponent<InputField>();
498 }
499 else
500 {
501 isInputFieldActive = false;
502 }
503 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
504 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
505 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
507 {
508 waitReleaseKeyTimer -= Time.deltaTime;
509 if (waitReleaseKeyTimer < 0f)
510 {
511 waitReleaseAnyKey = false;
512 }
513 else
514 {
515 if (!Input.inputString.IsEmpty() || IsAnyKeyDown(includeAxis: true, _skipframe: false))
516 {
517 return;
518 }
519 waitReleaseAnyKey = false;
520 }
521 }
522 if (haltInput)
523 {
524 Consume(consumeAxis: true);
525 return;
526 }
528 {
529 if (Input.GetKey(keys.wait.key) || Input.GetKey(KeyCode.Keypad5))
530 {
531 Consume(consumeAxis: true);
532 return;
533 }
534 requireConfirmReset = false;
535 }
537 if (lastMousePos != mpos)
538 {
540 hasMouseMoved = true;
541 }
542 if (skipFrame > 0)
543 {
544 skipFrame--;
545 return;
546 }
547 if (waitInput > 0f)
548 {
549 Consume(consumeAxis: true);
550 waitInput -= Time.unscaledDeltaTime;
551 return;
552 }
553 if (Input.GetMouseButtonDown(0))
554 {
555 missClickButton = 0;
557 }
558 if (Input.GetMouseButtonDown(1))
559 {
560 if (missClickDuration > 0f && missClickButton == 0)
561 {
562 Consume();
563 rightMouse.consumed = false;
564 skipFrame = 5;
565 return;
566 }
567 missClickButton = 1;
569 }
570 foreach (ButtonState button in buttons)
571 {
572 button.Update();
573 }
574 if (ignoreWheelDuration < 0f)
575 {
576 float num = Input.GetAxis("Mouse ScrollWheel");
577 wheel = ((num < 0f) ? (-1) : ((num > 0f) ? 1 : 0));
578 if (Input.GetKeyDown(KeyCode.PageUp))
579 {
580 wheel = 1;
581 }
582 if (Input.GetKeyDown(KeyCode.PageDown))
583 {
584 wheel = -1;
585 }
586 }
588 {
589 return;
590 }
591 UpdateAxis();
593 {
594 if (axis == Vector2.zero)
595 {
596 requireAxisReset = false;
597 }
598 else
599 {
600 axis = Vector2.zero;
601 }
602 }
603 if (forbidAxis != Vector2.zero && axis == forbidAxis)
604 {
605 axis = Vector2.zero;
606 }
607 else
608 {
609 forbidAxis = Vector2.zero;
610 }
612 if (hotkey == -1 && action == EAction.None)
613 {
614 action = GetAction();
615 }
617 }
void Update()
Definition: ButtonState.cs:80
static bool IsAnyKeyDown(bool includeAxis=true, bool _skipframe=true)
Definition: EInput.cs:619
static Vector2 forbidAxis
Definition: EInput.cs:333
static int GetFunctionkeyDown()
Definition: EInput.cs:937
static float antiMissClick
Definition: EInput.cs:323
static bool hasMouseMoved
Definition: EInput.cs:311
static bool isCtrlDown
Definition: EInput.cs:263
static Vector3 dragAmount
Definition: EInput.cs:347
static void UpdateAxis()
Definition: EInput.cs:706
static bool isAltDown
Definition: EInput.cs:265
static float dragHack
Definition: EInput.cs:327
static bool requireConfirmReset
Definition: EInput.cs:267
static bool isInputFieldActive
Definition: EInput.cs:277
static float ignoreWheelDuration
Definition: EInput.cs:329
static float waitReleaseKeyTimer
Definition: EInput.cs:303
static Vector3 lastMousePos
Definition: EInput.cs:345
static int missClickButton
Definition: EInput.cs:291
static float waitInput
Definition: EInput.cs:293
static Vector3 mpos
Definition: EInput.cs:337
static EAction GetAction()
Definition: EInput.cs:1017
static Vector3 mposWorld
Definition: EInput.cs:339
static bool waitReleaseAnyKey
Definition: EInput.cs:317
static bool haltInput
Definition: EInput.cs:275
static float delta
Definition: EInput.cs:321
static float missClickDuration
Definition: EInput.cs:325
static bool hasAxisMoved
Definition: EInput.cs:271
static int GetHotkeyDown()
Definition: EInput.cs:895

References action, antiMissClick, axis, buttons, Consume(), delta, dragAmount, dragHack, forbidAxis, functionkey, GetAction(), GetFunctionkeyDown(), GetHotkeyDown(), haltInput, hasAxisMoved, hasMouseMoved, hotkey, ignoreWheelDuration, isAltDown, IsAnyKeyDown(), isCtrlDown, isInputFieldActive, isShiftDown, EInput.KeyMap.key, keys, lastMousePos, missClickButton, missClickDuration, mpos, mposWorld, requireAxisReset, requireConfirmReset, skipFrame, ButtonState.Update(), UpdateAxis(), EInput.KeyMapManager.wait, waitInput, waitReleaseAnyKey, waitReleaseKeyTimer, and wheel.

Referenced by Scene.OnUpdate().

◆ UpdateAxis()

static void EInput.UpdateAxis ( )
inlinestaticprivate

Definition at line 706 of file EInput.cs.

707 {
709 {
710 return;
711 }
712 axisXChanged = (axisYChanged = false);
713 if (Input.GetKey(keys.axisUp.key))
714 {
715 ModAxisY(1);
716 }
717 if (Input.GetKey(keys.axisDown.key))
718 {
719 ModAxisY(-1);
720 }
721 if (Input.GetKey(keys.axisLeft.key))
722 {
723 ModAxisX(-1);
724 }
725 if (Input.GetKey(keys.axisRight.key))
726 {
727 ModAxisX(1);
728 }
729 if (axis == Vector2.zero && !disableKeyAxis)
730 {
731 if (Input.GetKey(keys.axisUp.key) || Input.GetKey(KeyCode.UpArrow))
732 {
733 ModAxisY(1);
734 }
735 if (Input.GetKey(keys.axisDown.key) || Input.GetKey(KeyCode.DownArrow))
736 {
737 ModAxisY(-1);
738 }
739 if (Input.GetKey(keys.axisLeft.key) || Input.GetKey(KeyCode.LeftArrow))
740 {
741 ModAxisX(-1);
742 }
743 if (Input.GetKey(keys.axisRight.key) || Input.GetKey(KeyCode.RightArrow))
744 {
745 ModAxisX(1);
746 }
747 }
748 if (axis == Vector2.zero)
749 {
750 if (Input.GetKey(KeyCode.Keypad8))
751 {
752 ModAxisY(1);
753 }
754 if (Input.GetKey(KeyCode.Keypad2))
755 {
756 ModAxisY(-1);
757 }
758 if (Input.GetKey(KeyCode.Keypad4))
759 {
760 ModAxisX(-1);
761 }
762 if (Input.GetKey(KeyCode.Keypad6))
763 {
764 ModAxisX(1);
765 }
766 }
767 if (Input.GetKey(keys.axisUpLeft.key))
768 {
769 SetAxis(-1, 1);
770 }
771 if (Input.GetKey(keys.axisUpRight.key))
772 {
773 SetAxis(1, 1);
774 }
775 if (Input.GetKey(keys.axisDownLeft.key))
776 {
777 SetAxis(-1, -1);
778 }
779 if (Input.GetKey(keys.axisDownRight.key))
780 {
781 SetAxis(1, -1);
782 }
783 if (Input.GetKey(KeyCode.Keypad1))
784 {
785 SetAxis(-1, -1);
786 }
787 if (Input.GetKey(KeyCode.Keypad3))
788 {
789 SetAxis(1, -1);
790 }
791 if (Input.GetKey(KeyCode.Keypad7))
792 {
793 SetAxis(-1, 1);
794 }
795 if (Input.GetKey(KeyCode.Keypad9))
796 {
797 SetAxis(1, 1);
798 }
799 if (axis.x == 0f && axisXChanged)
800 {
801 axis.x = 0f - prevAxis.x;
802 }
803 else
804 {
805 prevAxis.x = axis.x;
806 }
807 if (axis.y == 0f && axisYChanged)
808 {
809 axis.y = 0f - prevAxis.y;
810 }
811 else
812 {
813 prevAxis.y = axis.y;
814 }
815 if (Input.GetKey(KeyCode.LeftAlt) && (axis.x == 0f || axis.y == 0f))
816 {
817 axis = Vector2.zero;
818 }
819 if (axis != Vector2.zero && !firstAxisPressed)
820 {
821 firstAxisPressed = true;
822 firstAxis = axis;
823 durationFirstAxis = 0.06f;
824 }
826 {
828 if (durationFirstAxis > 0f)
829 {
830 if (!(axis == Vector2.zero))
831 {
832 axis = Vector2.zero;
833 return;
834 }
835 axis = firstAxis;
836 }
837 else if (axis == Vector2.zero)
838 {
839 firstAxisPressed = false;
840 }
841 }
842 if (axis.x != 0f && axis.y != 0f)
843 {
844 axisDiagonal.x = axis.x;
845 axisDiagonal.y = axis.y;
847 if (durationAxisDiagonal > 0f)
848 {
850 }
851 }
852 else
853 {
855 if (durationAxisDiagonal < 0f)
856 {
858 }
859 }
860 if (axis == Vector2.zero)
861 {
863 if (durationAxisRelease < 0.5f + durationAxisDiagonal * 0.1f)
864 {
865 return;
866 }
867 lastAxis = Vector2.zero;
868 }
869 else
870 {
872 }
873 if (durationAxisDiagonal > 1f)
874 {
875 if (axis != Vector2.zero)
876 {
877 axis.x = axisDiagonal.x;
878 axis.y = axisDiagonal.y;
879 }
880 lastAxis = Vector2.zero;
881 return;
882 }
884 if (axis != Vector2.zero && axis != lastAxis)
885 {
886 durationAxis = 0.25f;
887 lastAxis = axis;
888 }
889 else if (durationAxis > 0f)
890 {
891 axis = lastAxis;
892 }
893 }
KeyMap axisUpRight
Definition: EInput.cs:65
KeyMap axisUpLeft
Definition: EInput.cs:60
KeyMap axisDownLeft
Definition: EInput.cs:70
KeyMap axisDownRight
Definition: EInput.cs:75
KeyMap axisRight
Definition: EInput.cs:55
static float durationAxisDiagonal
Definition: EInput.cs:301
static bool disableKeyAxis
Definition: EInput.cs:365
static bool firstAxisPressed
Definition: EInput.cs:279
static Vector2 prevAxis
Definition: EInput.cs:309
static float durationAxisRelease
Definition: EInput.cs:299
static float durationFirstAxis
Definition: EInput.cs:297
static void ModAxisX(int x)
Definition: EInput.cs:694
static void SetAxis(int x, int y)
Definition: EInput.cs:688
static Vector2 axisDiagonal
Definition: EInput.cs:335
static void ModAxisY(int y)
Definition: EInput.cs:700
static Vector2 firstAxis
Definition: EInput.cs:307

References axis, axisDiagonal, EInput.KeyMapManager.axisDown, EInput.KeyMapManager.axisDownLeft, EInput.KeyMapManager.axisDownRight, EInput.KeyMapManager.axisLeft, EInput.KeyMapManager.axisRight, EInput.KeyMapManager.axisUp, EInput.KeyMapManager.axisUpLeft, EInput.KeyMapManager.axisUpRight, axisXChanged, axisYChanged, delta, disableKeyAxis, durationAxis, durationAxisDiagonal, durationAxisRelease, durationFirstAxis, firstAxis, firstAxisPressed, EInput.KeyMap.key, keys, lastAxis, ModAxisX(), ModAxisY(), prevAxis, SetAxis(), and waitReleaseAnyKey.

Referenced by Update(), and UpdateOnlyAxis().

◆ UpdateOnlyAxis()

static void EInput.UpdateOnlyAxis ( )
inlinestatic

Definition at line 464 of file EInput.cs.

465 {
466 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
467 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
468 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
469 axis = Vector2.zero;
470 hasAxisMoved = (hasMouseMoved = false);
471 UpdateAxis();
472 Consume(3);
473 }

References axis, Consume(), hasAxisMoved, hasMouseMoved, isAltDown, isCtrlDown, isShiftDown, and UpdateAxis().

Referenced by Scene.OnUpdate().

◆ WaitInput()

static void EInput.WaitInput ( float  time)
inlinestatic

Definition at line 397 of file EInput.cs.

398 {
399 waitInput = time;
400 }

References waitInput.

◆ WaitReleaseKey()

static void EInput.WaitReleaseKey ( )
inlinestatic

Member Data Documentation

◆ action

◆ antiMissClick

float EInput.antiMissClick
static

Definition at line 323 of file EInput.cs.

Referenced by Update().

◆ axis

◆ axisDiagonal

Vector2 EInput.axisDiagonal
static

Definition at line 335 of file EInput.cs.

Referenced by UpdateAxis().

◆ axisReleased

bool EInput.axisReleased
static

Definition at line 281 of file EInput.cs.

◆ axisXChanged

bool EInput.axisXChanged
static

Definition at line 313 of file EInput.cs.

Referenced by ModAxisX(), and UpdateAxis().

◆ axisYChanged

bool EInput.axisYChanged
static

Definition at line 315 of file EInput.cs.

Referenced by ModAxisY(), and UpdateAxis().

◆ buttonCtrl

ButtonState EInput.buttonCtrl
static

Definition at line 361 of file EInput.cs.

Referenced by Init(), and ActionMode.UpdateInput().

◆ buttons

List<ButtonState> EInput.buttons = new List<ButtonState>()
static

Definition at line 319 of file EInput.cs.

Referenced by AddButton(), Consume(), Init(), IsAnyKeyDown(), and Update().

◆ buttonScroll

ButtonState EInput.buttonScroll
static

Definition at line 359 of file EInput.cs.

Referenced by ActionMode.InputMovement(), and BaseGameScreen.ModTargetZoomIndex().

◆ delta

float EInput.delta
static

Definition at line 321 of file EInput.cs.

Referenced by Update(), EInput.KeyboardPress.Update(), and UpdateAxis().

◆ disableKeyAxis

bool EInput.disableKeyAxis
static

Definition at line 365 of file EInput.cs.

Referenced by UpdateAxis().

◆ dragAmount

Vector3 EInput.dragAmount
static

Definition at line 347 of file EInput.cs.

Referenced by Update().

◆ dragHack

float EInput.dragHack
static

Definition at line 327 of file EInput.cs.

Referenced by Window.OnPointerDown(), and Update().

◆ dragStartPos

Vector3 EInput.dragStartPos
static

Definition at line 341 of file EInput.cs.

Referenced by ButtonState.Update().

◆ dragStartPos2

Vector3 EInput.dragStartPos2
static

Definition at line 343 of file EInput.cs.

Referenced by ButtonState.Update().

◆ durationAxis

float EInput.durationAxis
staticprivate

Definition at line 295 of file EInput.cs.

Referenced by Consume(), and UpdateAxis().

◆ durationAxisDiagonal

float EInput.durationAxisDiagonal
staticprivate

Definition at line 301 of file EInput.cs.

Referenced by UpdateAxis().

◆ durationAxisRelease

float EInput.durationAxisRelease
staticprivate

Definition at line 299 of file EInput.cs.

Referenced by UpdateAxis().

◆ durationFirstAxis

float EInput.durationFirstAxis
staticprivate

Definition at line 297 of file EInput.cs.

Referenced by UpdateAxis().

◆ eventSystem

EventSystem EInput.eventSystem
static

Definition at line 257 of file EInput.cs.

Referenced by Select().

◆ firstAxis

Vector2 EInput.firstAxis
staticprivate

Definition at line 307 of file EInput.cs.

Referenced by UpdateAxis().

◆ firstAxisPressed

bool EInput.firstAxisPressed
static

Definition at line 279 of file EInput.cs.

Referenced by UpdateAxis().

◆ forbidAxis

Vector2 EInput.forbidAxis
static

Definition at line 333 of file EInput.cs.

Referenced by Update().

◆ functionkey

int EInput.functionkey
static

Definition at line 285 of file EInput.cs.

Referenced by Consume(), Update(), and ActionMode.UpdateInput().

◆ haltInput

bool EInput.haltInput
static

Definition at line 275 of file EInput.cs.

Referenced by InvOwnerDraglet.OnProcess(), and Update().

◆ hasAxisMoved

bool EInput.hasAxisMoved
static

Definition at line 271 of file EInput.cs.

Referenced by ActionMode.InputMovement(), Update(), and UpdateOnlyAxis().

◆ hasMouseMoved

bool EInput.hasMouseMoved
static

Definition at line 311 of file EInput.cs.

Referenced by ActionMode.InputMovement(), Update(), and UpdateOnlyAxis().

◆ hasShiftChanged

bool EInput.hasShiftChanged
static

Definition at line 273 of file EInput.cs.

Referenced by AM_Adv._OnUpdateInput().

◆ hotkey

int EInput.hotkey
static

Definition at line 283 of file EInput.cs.

Referenced by Consume(), AM_MoveInstalled.HitTest(), Update(), and ActionMode.UpdateInput().

◆ ignoreWheelDuration

float EInput.ignoreWheelDuration
static

Definition at line 329 of file EInput.cs.

Referenced by Update().

◆ Instance

EInput EInput.Instance
static

Definition at line 255 of file EInput.cs.

Referenced by Awake().

◆ isAltDown

◆ isCtrlDown

◆ isInputFieldActive

bool EInput.isInputFieldActive
static

Definition at line 277 of file EInput.cs.

Referenced by ButtonState.Update(), Update(), and CoreDebug.UpdateInput().

◆ isShiftDown

◆ keyFire

KeyboardPress EInput.keyFire = new KeyboardPress()
static

Definition at line 249 of file EInput.cs.

Referenced by AM_Adv._OnUpdateInput(), ActionMode.DoFunc(), and GetAction().

◆ keys

◆ keyWait

KeyboardPress EInput.keyWait = new KeyboardPress()
static

Definition at line 251 of file EInput.cs.

Referenced by GetAction(), Scene.Init(), and SetKeyMap().

◆ LangGetter

Func<string, string> EInput.LangGetter
static

Definition at line 253 of file EInput.cs.

◆ lastAxis

Vector2 EInput.lastAxis
staticprivate

Definition at line 305 of file EInput.cs.

Referenced by Consume(), and UpdateAxis().

◆ lastMousePos

Vector3 EInput.lastMousePos
static

Definition at line 345 of file EInput.cs.

Referenced by Update().

◆ leftMouse

◆ middleMouse

◆ missClickButton

int EInput.missClickButton
static

Definition at line 291 of file EInput.cs.

Referenced by Update().

◆ missClickDuration

float EInput.missClickDuration
static

Definition at line 325 of file EInput.cs.

Referenced by Update().

◆ mouse3

ButtonState EInput.mouse3
static

◆ mouse4

ButtonState EInput.mouse4
static

◆ mpos

Vector3 EInput.mpos
static

Definition at line 337 of file EInput.cs.

Referenced by LayerQuickMenu.OnUpdateInput(), ButtonState.Update(), and Update().

◆ mposWorld

Vector3 EInput.mposWorld
static

◆ prevAxis

Vector2 EInput.prevAxis
staticprivate

Definition at line 309 of file EInput.cs.

Referenced by UpdateAxis().

◆ repeatSpeed

float EInput.repeatSpeed = 0.05f

Definition at line 373 of file EInput.cs.

◆ repeatThresh

float EInput.repeatThresh = 0.3f

Definition at line 371 of file EInput.cs.

◆ requireAxisReset

bool EInput.requireAxisReset
static

Definition at line 269 of file EInput.cs.

Referenced by Consume(), and Update().

◆ requireConfirmReset

bool EInput.requireConfirmReset
static

Definition at line 267 of file EInput.cs.

Referenced by Update().

◆ rightMouse

◆ rightScroll

bool EInput.rightScroll
static

Definition at line 363 of file EInput.cs.

Referenced by BaseTileSelector.OnUpdate().

◆ skipFrame

◆ uiMousePosition

◆ waitInput

float EInput.waitInput
staticprivate

Definition at line 293 of file EInput.cs.

Referenced by Update(), and WaitInput().

◆ waitReleaseAnyKey

bool EInput.waitReleaseAnyKey
static

◆ waitReleaseKeyTimer

float EInput.waitReleaseKeyTimer
staticprivate

Definition at line 303 of file EInput.cs.

Referenced by Update(), and WaitReleaseKey().

◆ wheel

Property Documentation

◆ isCancel

bool EInput.isCancel
staticget

Definition at line 377 of file EInput.cs.

378 {
379 get
380 {
381 if (action != EAction.Cancel)
382 {
383 return action == EAction.CancelUI;
384 }
385 return true;
386 }
387 }

Referenced by IsAnyKeyDown(), Scene.OnUpdate(), and ActionMode.UpdateInput().

◆ isConfirm

bool EInput.isConfirm
staticget

Definition at line 375 of file EInput.cs.

Referenced by IsAnyKeyDown().

◆ IsConsumed

bool EInput.IsConsumed
staticget

Definition at line 393 of file EInput.cs.

Referenced by UIButton.OnPointerDown().

◆ isNext

bool EInput.isNext
staticget

Definition at line 391 of file EInput.cs.

◆ isPrev

bool EInput.isPrev
staticget

Definition at line 389 of file EInput.cs.

◆ selectedGO

GameObject EInput.selectedGO
staticget

Definition at line 395 of file EInput.cs.


The documentation for this class was generated from the following file: