コード例 #1
0
    public void ErrorQuit(string _error)
    {
        // Write down error
        TGDebug.ErrorBox(_error, 0, i => Quit(), "确定");

        Debug.LogWarning(_error);

        StopCoroutine(m_routine);
    }
コード例 #2
0
    private IEnumerator ConnectDeviceRoutine()
    {
        if (TGData.IsTesting)
        {
            Debug.Log("开启测试模式");
        }

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

        PortInput = GetProperInput();

        if (TGData.IsTesting)
        {
            yield break;
        }

        while (!PortInput.IsPortActive)
        {
            yield return(StartCoroutine(PortInput.OnStart()));

            if (!PortInput.IsPortActive)
            {
                int result = -1;

                TGDebug.ErrorBox(PortInput.ErrorTxt, 1, i => result = i, "取消", "确定");
                yield return(new WaitUntil(() => result >= 0));

                if (result == 0)
                {
                    m_controller.Quit();
                    yield break;
                }

                TGDebug.MessageBox("重连中...");

                yield return(new WaitForSecondsRealtime(0.1f));
            }
        }

        TGDebug.ClearMessageBox();
    }