Elin Decompiled Documentation EA 23.285 Nightly
Loading...
Searching...
No Matches
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 455 of file EInput.cs.

456 {
457 ButtonState buttonState = new ButtonState
458 {
459 mouse = mouse
460 };
461 buttons.Add(buttonState);
462 return buttonState;
463 }
static List< ButtonState > buttons
Definition: EInput.cs:330

References buttons.

Referenced by Init().

◆ Awake()

void EInput.Awake ( )
inlineprivate

Definition at line 413 of file EInput.cs.

414 {
415 Instance = this;
416 Init();
417 }
static EInput Instance
Definition: EInput.cs:266
static void Init()
Definition: EInput.cs:419

References Init(), and Instance.

◆ Consume() [1/2]

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

Definition at line 672 of file EInput.cs.

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 }
EAction
Definition: EAction.cs:2
void Consume()
Definition: ButtonState.cs:184
static float durationAxis
Definition: EInput.cs:306
static Vector2 lastAxis
Definition: EInput.cs:316
static int wheel
Definition: EInput.cs:300
static bool requireAxisReset
Definition: EInput.cs:280
static Vector2 axis
Definition: EInput.cs:342
static int functionkey
Definition: EInput.cs:296
static int skipFrame
Definition: EInput.cs:298
static int hotkey
Definition: EInput.cs:294
static EAction action
Definition: EInput.cs:270

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 694 of file EInput.cs.

695 {
696 wheel = 0;
697 }

References wheel.

Referenced by LayerQuickMenu.OnUpdateInput().

◆ DisableIME()

static void EInput.DisableIME ( )
inlinestatic

Definition at line 465 of file EInput.cs.

466 {
467 ToggleIME(on: false);
468 }
static void ToggleIME(bool on)
Definition: EInput.cs:470

References ToggleIME().

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

◆ GetAction()

static EAction EInput.GetAction ( )
inlinestaticprivate

Definition at line 1028 of file EInput.cs.

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 }
KeyMap inventory
Definition: EInput.cs:90
KeyCode key
Definition: EInput.cs:14
bool Update(bool forcePress=false)
Definition: EInput.cs:226
static KeyMapManager keys
Definition: EInput.cs:378
static bool isShiftDown
Definition: EInput.cs:272
static KeyboardPress keyFire
Definition: EInput.cs:260
static KeyboardPress keyWait
Definition: EInput.cs:262

References EInput.KeyMapManager.ability, EInput.KeyboardPress.Action, EInput.KeyMapManager.autoCombat, EInput.KeyMapManager.chara, EInput.KeyMapManager.chat, EInput.KeyMapManager.console, 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 948 of file EInput.cs.

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 }

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

◆ GetHotkey()

static int EInput.GetHotkey ( )
inlinestatic

Definition at line 986 of file EInput.cs.

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 }

Referenced by ButtonAbility.TryUse().

◆ GetHotkeyDown()

static int EInput.GetHotkeyDown ( )
inlinestatic

Definition at line 906 of file EInput.cs.

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 }

Referenced by Update().

◆ Init()

static void EInput.Init ( )
inlinestatic

Definition at line 419 of file EInput.cs.

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 }
static ButtonState middleMouse
Definition: EInput.cs:364
static ButtonState mouse4
Definition: EInput.cs:368
static ButtonState buttonCtrl
Definition: EInput.cs:372
static ButtonState leftMouse
Definition: EInput.cs:360
static void SetKeyMap(KeyMapManager _keys)
Definition: EInput.cs:444
static ButtonState AddButton(int mouse)
Definition: EInput.cs:455
static ButtonState rightMouse
Definition: EInput.cs:362
static ButtonState mouse3
Definition: EInput.cs:366

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 630 of file EInput.cs.

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 }
bool clicked
Definition: ButtonState.cs:37
static bool isCancel
Definition: EInput.cs:389
static bool isConfirm
Definition: EInput.cs:386

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 705 of file EInput.cs.

706 {
707 axis.x += x;
708 axisXChanged = true;
709 }
static bool axisXChanged
Definition: EInput.cs:324

References axisXChanged.

Referenced by UpdateAxis().

◆ ModAxisY()

static void EInput.ModAxisY ( int  y)
inlinestatic

Definition at line 711 of file EInput.cs.

712 {
713 axis.y += y;
714 axisYChanged = true;
715 }
static bool axisYChanged
Definition: EInput.cs:326

References axisYChanged.

Referenced by UpdateAxis().

◆ RestoreDefaultKeys()

static void EInput.RestoreDefaultKeys ( )
inlinestatic

Definition at line 1133 of file EInput.cs.

1134 {
1135 }

◆ Select()

static void EInput.Select ( GameObject  go)
inlinestatic

Definition at line 1137 of file EInput.cs.

1138 {
1139 eventSystem.SetSelectedGameObject(null);
1140 eventSystem.SetSelectedGameObject(go);
1141 }
static EventSystem eventSystem
Definition: EInput.cs:268

References eventSystem.

◆ SetAxis()

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

Definition at line 699 of file EInput.cs.

700 {
701 axis.x = x;
702 axis.y = y;
703 }

Referenced by UpdateAxis().

◆ SetKeyMap()

static void EInput.SetKeyMap ( KeyMapManager  _keys)
inlinestatic

Definition at line 444 of file EInput.cs.

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 }
KeyMap mouseMiddle
Definition: EInput.cs:135
KeyMap switchHotbar
Definition: EInput.cs:155
Func< KeyMap > func
Definition: EInput.cs:220

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 470 of file EInput.cs.

471 {
472 Input.imeCompositionMode = (on ? IMECompositionMode.On : IMECompositionMode.Off);
473 }

Referenced by DisableIME().

◆ Update()

static void EInput.Update ( )
inlinestatic

Definition at line 486 of file EInput.cs.

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 }
void Update()
Definition: ButtonState.cs:80
static bool IsAnyKeyDown(bool includeAxis=true, bool _skipframe=true)
Definition: EInput.cs:630
static Vector2 forbidAxis
Definition: EInput.cs:344
static int GetFunctionkeyDown()
Definition: EInput.cs:948
static float antiMissClick
Definition: EInput.cs:334
static bool hasMouseMoved
Definition: EInput.cs:322
static bool isCtrlDown
Definition: EInput.cs:274
static Vector3 dragAmount
Definition: EInput.cs:358
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 isInputFieldActive
Definition: EInput.cs:288
static float ignoreWheelDuration
Definition: EInput.cs:340
static float waitReleaseKeyTimer
Definition: EInput.cs:314
static Vector3 lastMousePos
Definition: EInput.cs:356
static int missClickButton
Definition: EInput.cs:302
static float waitInput
Definition: EInput.cs:304
static Vector3 mpos
Definition: EInput.cs:348
static EAction GetAction()
Definition: EInput.cs:1028
static Vector3 mposWorld
Definition: EInput.cs:350
static bool waitReleaseAnyKey
Definition: EInput.cs:328
static bool haltInput
Definition: EInput.cs:286
static float delta
Definition: EInput.cs:332
static float missClickDuration
Definition: EInput.cs:336
static bool hasAxisMoved
Definition: EInput.cs:282
static int GetHotkeyDown()
Definition: EInput.cs:906

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 717 of file EInput.cs.

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 }
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:312
static bool disableKeyAxis
Definition: EInput.cs:376
static bool firstAxisPressed
Definition: EInput.cs:290
static Vector2 prevAxis
Definition: EInput.cs:320
static float durationAxisRelease
Definition: EInput.cs:310
static float durationFirstAxis
Definition: EInput.cs:308
static void ModAxisX(int x)
Definition: EInput.cs:705
static void SetAxis(int x, int y)
Definition: EInput.cs:699
static Vector2 axisDiagonal
Definition: EInput.cs:346
static void ModAxisY(int y)
Definition: EInput.cs:711
static Vector2 firstAxis
Definition: EInput.cs:318

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 475 of file EInput.cs.

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 }

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 408 of file EInput.cs.

409 {
410 waitInput = time;
411 }

References waitInput.

◆ WaitReleaseKey()

static void EInput.WaitReleaseKey ( )
inlinestatic

Member Data Documentation

◆ action

◆ antiMissClick

float EInput.antiMissClick
static

Definition at line 334 of file EInput.cs.

Referenced by Update().

◆ axis

◆ axisDiagonal

Vector2 EInput.axisDiagonal
static

Definition at line 346 of file EInput.cs.

Referenced by UpdateAxis().

◆ axisReleased

bool EInput.axisReleased
static

Definition at line 292 of file EInput.cs.

◆ axisXChanged

bool EInput.axisXChanged
static

Definition at line 324 of file EInput.cs.

Referenced by ModAxisX(), and UpdateAxis().

◆ axisYChanged

bool EInput.axisYChanged
static

Definition at line 326 of file EInput.cs.

Referenced by ModAxisY(), and UpdateAxis().

◆ buttonCtrl

ButtonState EInput.buttonCtrl
static

Definition at line 372 of file EInput.cs.

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

◆ buttons

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

Definition at line 330 of file EInput.cs.

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

◆ buttonScroll

ButtonState EInput.buttonScroll
static

Definition at line 370 of file EInput.cs.

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

◆ delta

float EInput.delta
static

Definition at line 332 of file EInput.cs.

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

◆ disableKeyAxis

bool EInput.disableKeyAxis
static

Definition at line 376 of file EInput.cs.

Referenced by UpdateAxis().

◆ dragAmount

Vector3 EInput.dragAmount
static

Definition at line 358 of file EInput.cs.

Referenced by Update().

◆ dragHack

float EInput.dragHack
static

Definition at line 338 of file EInput.cs.

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

◆ dragStartPos

Vector3 EInput.dragStartPos
static

Definition at line 352 of file EInput.cs.

Referenced by ButtonState.Update().

◆ dragStartPos2

Vector3 EInput.dragStartPos2
static

Definition at line 354 of file EInput.cs.

Referenced by ButtonState.Update().

◆ durationAxis

float EInput.durationAxis
staticprivate

Definition at line 306 of file EInput.cs.

Referenced by Consume(), and UpdateAxis().

◆ durationAxisDiagonal

float EInput.durationAxisDiagonal
staticprivate

Definition at line 312 of file EInput.cs.

Referenced by UpdateAxis().

◆ durationAxisRelease

float EInput.durationAxisRelease
staticprivate

Definition at line 310 of file EInput.cs.

Referenced by UpdateAxis().

◆ durationFirstAxis

float EInput.durationFirstAxis
staticprivate

Definition at line 308 of file EInput.cs.

Referenced by UpdateAxis().

◆ eventSystem

EventSystem EInput.eventSystem
static

Definition at line 268 of file EInput.cs.

Referenced by Select().

◆ firstAxis

Vector2 EInput.firstAxis
staticprivate

Definition at line 318 of file EInput.cs.

Referenced by UpdateAxis().

◆ firstAxisPressed

bool EInput.firstAxisPressed
static

Definition at line 290 of file EInput.cs.

Referenced by UpdateAxis().

◆ forbidAxis

Vector2 EInput.forbidAxis
static

Definition at line 344 of file EInput.cs.

Referenced by Update().

◆ functionkey

int EInput.functionkey
static

Definition at line 296 of file EInput.cs.

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

◆ haltInput

bool EInput.haltInput
static

Definition at line 286 of file EInput.cs.

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

◆ hasAxisMoved

bool EInput.hasAxisMoved
static

Definition at line 282 of file EInput.cs.

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

◆ hasMouseMoved

bool EInput.hasMouseMoved
static

Definition at line 322 of file EInput.cs.

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

◆ hasShiftChanged

bool EInput.hasShiftChanged
static

Definition at line 284 of file EInput.cs.

Referenced by AM_Adv._OnUpdateInput().

◆ hotkey

int EInput.hotkey
static

Definition at line 294 of file EInput.cs.

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

◆ ignoreWheelDuration

float EInput.ignoreWheelDuration
static

Definition at line 340 of file EInput.cs.

Referenced by Update().

◆ Instance

EInput EInput.Instance
static

Definition at line 266 of file EInput.cs.

Referenced by Awake().

◆ isAltDown

bool EInput.isAltDown
static

◆ isCtrlDown

◆ isInputFieldActive

bool EInput.isInputFieldActive
static

Definition at line 288 of file EInput.cs.

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

◆ isShiftDown

◆ keyFire

KeyboardPress EInput.keyFire = new KeyboardPress()
static

Definition at line 260 of file EInput.cs.

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

◆ keys

◆ keyWait

KeyboardPress EInput.keyWait = new KeyboardPress()
static

Definition at line 262 of file EInput.cs.

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

◆ LangGetter

Func<string, string> EInput.LangGetter
static

Definition at line 264 of file EInput.cs.

◆ lastAxis

Vector2 EInput.lastAxis
staticprivate

Definition at line 316 of file EInput.cs.

Referenced by Consume(), and UpdateAxis().

◆ lastMousePos

Vector3 EInput.lastMousePos
static

Definition at line 356 of file EInput.cs.

Referenced by Update().

◆ leftMouse

◆ middleMouse

◆ missClickButton

int EInput.missClickButton
static

Definition at line 302 of file EInput.cs.

Referenced by Update().

◆ missClickDuration

float EInput.missClickDuration
static

Definition at line 336 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 348 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 320 of file EInput.cs.

Referenced by UpdateAxis().

◆ repeatSpeed

float EInput.repeatSpeed = 0.05f

Definition at line 384 of file EInput.cs.

◆ repeatThresh

float EInput.repeatThresh = 0.3f

Definition at line 382 of file EInput.cs.

◆ requireAxisReset

bool EInput.requireAxisReset
static

Definition at line 280 of file EInput.cs.

Referenced by Consume(), and Update().

◆ requireConfirmReset

bool EInput.requireConfirmReset
static

Definition at line 278 of file EInput.cs.

Referenced by Update().

◆ rightMouse

◆ rightScroll

bool EInput.rightScroll
static

Definition at line 374 of file EInput.cs.

Referenced by BaseTileSelector.OnUpdate().

◆ skipFrame

◆ uiMousePosition

◆ waitInput

float EInput.waitInput
staticprivate

Definition at line 304 of file EInput.cs.

Referenced by Update(), and WaitInput().

◆ waitReleaseAnyKey

bool EInput.waitReleaseAnyKey
static

◆ waitReleaseKeyTimer

float EInput.waitReleaseKeyTimer
staticprivate

Definition at line 314 of file EInput.cs.

Referenced by Update(), and WaitReleaseKey().

◆ wheel

Property Documentation

◆ isCancel

bool EInput.isCancel
staticget

Definition at line 388 of file EInput.cs.

389 {
390 get
391 {
392 if (action != EAction.Cancel)
393 {
394 return action == EAction.CancelUI;
395 }
396 return true;
397 }
398 }

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

◆ isConfirm

bool EInput.isConfirm
staticget

Definition at line 386 of file EInput.cs.

Referenced by IsAnyKeyDown().

◆ IsConsumed

bool EInput.IsConsumed
staticget

Definition at line 404 of file EInput.cs.

Referenced by UIButton.OnPointerDown().

◆ isNext

bool EInput.isNext
staticget

Definition at line 402 of file EInput.cs.

◆ isPrev

bool EInput.isPrev
staticget

Definition at line 400 of file EInput.cs.

◆ selectedGO

GameObject EInput.selectedGO
staticget

Definition at line 406 of file EInput.cs.


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