コード例 #1
0
        private void CheckKeyCodeEvent(KeyCodeEventData eventData)
        {
            bool    _modIsDown = false;
            KeyCode _validMod  = KeyCode.None;

            // Loop through all the aliases for
            KeyCodeAliasManager.PerformOnAliases(eventData.m_modifierKeyCode, (KeyCode alias) =>
            {
                _modIsDown = KeyCodeEventData.IsModDown(alias);
                _validMod  = alias;

                return(_modIsDown);
            }, true);

            if (_modIsDown == false)
            {
                return;
            }

            bool _primIsDown = false;

            KeyCodeAliasManager.PerformOnAliases(eventData.m_primaryKeyCode, (KeyCode alias) =>
            {
                _primIsDown = KeyCodeEventData.IsStateActive(_validMod, alias, eventData.m_keyState);

                return(_primIsDown);
            }, true);

            if (_primIsDown == false)
            {
                return;
            }

            eventData.ActivateEvents();
        }
コード例 #2
0
        private void OnEnable()
        {
            if (s_instance.IsNotNull() && this.Equals(s_instance) == false)
            {
                Debug.LogWarning("There can only be one KeyCodeAliasManager asset in the project at a time");

                DestroyImmediate(this, true);
                return;
            }

            s_instance = this;
        }