Beispiel #1
0
    public static KeyPortData SetDevice(string _deviceName, bool _testing)
    {
        IsTesting = _testing;
        Debug.Log("打开测试: " + IsTesting);

        DeviceName = _deviceName;

        var config = KeyInputConfig.GetInstance();

        KeyPortData = config.GetKeyportData(DeviceName);

        if (KeyPortData == null)
        {
            Debug.LogWarning(string.Format("{0}不存在于keyInputConfig.json", _deviceName));
            return(null);
        }

        Debug.Log("设备类型:" + KeyPortData.type);

        return(KeyPortData);
    }
    public override IEnumerator SetupRoutine()
    {
        touchCtrl = GetComponent <LMTouchCtrl>();

        keyInputConfig = TGUtility.ParseConfigFile(configFileName);

        DeviceName = m_controller.gameConfig.GetValue("训练器材", string.Empty);

        KeyportData = keyInputConfig.GetKeyportData(DeviceName);

        if (KeyportData == null)
        {
            m_controller.ErrorQuit("训练器材 " + DeviceName + "不存在!");
            yield break;
        }

        touchCtrl.enabled = KeyportData.type == "touch";

        if (!touchCtrl.enabled)
        {
            // FIXME: Temperory
            if (KeyportData.type == "m7b" && m_gameConfig.evalData.isFullAxis)
            {
                KeyportData.type += "2D";
            }

            portInput = GetProperInput();

            if (!portInput.OnStart(KeyportData))
            {
                m_controller.DebugText(portInput.ErrorTxt);
                touchCtrl.enabled = true;
            }
        }

        m_controller.SetHeatmapEnable(KeyportData.heatmap);
        Debug.Log("Input Setup Success");

        yield return(1);
    }