コード例 #1
0
        public void BindButton(int actionId, InputEventPollingType inputEventPollingType, InputEventType inputEventType,
                               InputButtonEventDelegate handler)
        {
            InputActionEvent inputActionEvent = new InputActionEvent(actionId, inputEventPollingType, inputEventType);

            Debug.AssertFormat(!_buttonEvents.ContainsKey(inputActionEvent), $"Button binding for '{actionId}' with the same parameters already bound");
            _buttonEvents.Add(inputActionEvent, handler);
        }
コード例 #2
0
        internal void ReceiveButtonEvent(InputActionEvent inputActionEvent)
        {
            foreach (KeyValuePair <InputActionEvent, InputButtonEventDelegate> keyValuePair in _buttonEvents)
            {
                if (keyValuePair.Key != inputActionEvent)
                {
                    continue;
                }

                keyValuePair.Value.Invoke();
                break;
            }
        }