Пример #1
0
    private void AfterReceiveInput()
    {
        // 执行注册的输入回调
        _thisFrameMappedInputList = _inputMapper.GetMappedInputInThisFrame();
        for (int i = 0; i < _thisFrameMappedInputList.Count; i++)
        {
            InputInfo tInfo = _thisFrameMappedInputList[i];
            if (!IsKeyAccessable(tInfo.virtualKey))
            {
                Debug.Log($"{tInfo.virtualKey} 当前被禁用!");
                continue;
            }
            switch (tInfo.inputType)
            {
            case EInputType.Action:
                if (actionInputEventDic.ContainsKey(tInfo.virtualKey))
                {
                    actionInputEventDic[tInfo.virtualKey]?.Invoke(tInfo);
                }
                break;

            case EInputType.State:
                if (stateInputEventDic.ContainsKey(tInfo.virtualKey))
                {
                    stateInputEventDic[tInfo.virtualKey]?.Invoke(tInfo);
                }
                break;
            }
            //--For debug
            if (showDebugInfo)
            {
                Debug.Log(tInfo.ToString());
            }
        }
    }