예제 #1
0
    private LMBasePortInput GetProperInput()
    {
        //FIXME: Temperory
        if (KeyportData.type == "CASMB")
        {
            var retval = new LMGrindTable();
            retval.Init(m_controller,
                        KeyportData,
                        TGGameConfig.GetValue("端口", -1));
            return(retval);
        }

        int udp = TGGameConfig.GetValue("UDP", -1);

        if (udp >= 0)
        {
            var retval = new LMInput_UDP();
            retval.Init(m_controller, KeyportData, udp);
            Debug.Log("准备衔接UDP设备");
            return(retval);
        }
        else
        {
            var retval = new LMInput_Port();
            retval.Init(m_controller,
                        KeyportData,
                        TGGameConfig.GetValue("端口", -1));
            Debug.Log("准备衔接端口设备");
            return(retval);
        }
    }
예제 #2
0
    public override void Init(TGController _controller)
    {
        Instance = this;

        QualitySettings.SetQualityLevel(QualitySettings.names.Length - 1);
        Screen.SetResolution(1920, 1080, true, 60);

        base.Init(_controller);
    }
예제 #3
0
    public override void Init()
    {
        base.Init();

        InitUI();

        Duration     = TGGameConfig.GetValue("训练时长", -1) * 60;
        DifficultyLv = TGGameConfig.GetValue("难度等级", -1);
    }
예제 #4
0
    public override void Init(LMBasePortInput _portInput)
    {
        base.Init(_portInput);

        inputTotalGap = _portInput.KeyportData.inputTotalGap;

        string txt = TGGameConfig.GetValue("校准", string.Empty);

        if (!string.IsNullOrEmpty(txt))
        {
            SetBiases(txt);
        }
    }
예제 #5
0
    private void LoadInputConfig()
    {
        bool   testing    = false;
        string deviceName = string.Empty;

        var scn = GameObject.FindObjectOfType <TGBaseScene>();

        deviceName = string.Empty;

        testing    = TGGameConfig.GetValue("测试", 0) == 1;
        deviceName = TGGameConfig.GetValue("训练器材", string.Empty);

        TGData.SetDevice(deviceName, testing);
    }
예제 #6
0
    public static float GetValueFromINI(string key)
    {
        if (string.IsNullOrEmpty(key))
        {
            return(0f);
        }
        else
        {
            if (key.IndexOf('(') >= 0)
            {
                var solver = new TGExpressionParser();

                int start = key.IndexOf('(') + 1;
                int end   = key.IndexOf(')');

                var sliced = key.Substring(start, end - start).Split(',');

                for (int i = 0; i < sliced.Length; i++)
                {
                    string cutkey = sliced[i];
                    Debug.Log("Cut Key: " + cutkey);

                    key = key.Replace(cutkey, TGGameConfig.GetValue(cutkey, 0f).ToString());
                }
                Debug.Log("String Converted: " + key);

                return(( float )solver.EvaluateExpression(key).Value);
            }
            else
            {
                float retval = 0f;
                if (float.TryParse(key, out retval))
                {
                    return(retval);
                }
                else
                {
                    return(TGGameConfig.GetValue(key, 0));
                }
            }
        }
    }