예제 #1
0
        IEnumerator Install()
        {
            SetInstallButtonActive(false);

            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                Log("Attempting install...");
                yield return(ARSession.Install());

                if (ARSession.state == ARSessionState.NeedsInstall)
                {
                    Log("The software update failed, or you declined the update.");
                    SetInstallButtonActive(true);
                }
                else if (ARSession.state == ARSessionState.Ready)
                {
                    Log("Success! Starting AR session...");
                    m_Session.enabled = true;
                }
            }
            else
            {
                Log("Error: ARSession does not require install.");
            }
        }
    IEnumerator CheckSupport()
    {
        yield return(ARSession.CheckAvailability());

        if (ARSession.state == ARSessionState.NeedsInstall)
        {
            yield return(ARSession.Install());
        }

        if (ARSession.state == ARSessionState.Ready)
        {
            m_Session.enabled = true;
        }
        else
        {
            switch (ARSession.state)
            {
            case ARSessionState.Unsupported:
                Debug.Log("Your device does not support AR.");
                GameManager.Instance.SetErrorMessage(ErrorMessageType.ARError, "AR wird leider nicht unterstützt");
                CameraController.Instance.ShowDefaultCamera();
                IsMobile = false;
                break;

            case ARSessionState.NeedsInstall:
                Debug.Log("The software update failed, or you declined the update.");
                GameManager.Instance.SetErrorMessage(ErrorMessageType.ARError, "AR Software Update muss installiert werden");
                CameraController.Instance.ShowDefaultCamera();
                break;
            }
        }
    }
예제 #3
0
        IEnumerator Start()
        {
            arSession.enabled = false;

            if (ARSession.state == ARSessionState.None || ARSession.state == ARSessionState.CheckingAvailability)
            {
                yield return(ARSession.CheckAvailability());
            }
            else if (ARSession.state == ARSessionState.Unsupported)
            {
                this.OnFailARSession?.Invoke();
                yield break;
            }

            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                this.OnRequestARLibInstall?.Invoke();
                yield return(ARSession.Install());
            }

            if (ARSession.state == ARSessionState.Ready)
            {
                this.OnReadyAR?.Invoke();
                arSession.enabled = true;
            }

            yield return(null);
        }
예제 #4
0
        static IEnumerator CheckSupport(Action <bool> checkCall)
        {
            yield return(ARSession.CheckAvailability());

            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                yield return(ARSession.Install());
            }
            if (ARSession.state == ARSessionState.Ready)
            {
                checkCall(true);
            }
            else
            {
                switch (ARSession.state)
                {
                case ARSessionState.Unsupported:
                    AFLogger.d("Your device does not support AR.");
                    checkCall(false);
                    break;

                case ARSessionState.NeedsInstall:
                    AFLogger.d("软件更新失败,或者您拒绝了更新。变为本地放置模型");
                    checkCall(false);
                    break;
                }
            }
        }
    /// <summary>
    /// Check for support, and if some software needs installing
    /// </summary>
    /// <returns></returns>
    private IEnumerator CheckSupport()
    {
        #if UNITY_EDITOR
        yield return(new WaitForSeconds(2f));

        SendSupportCheckDoneEvent(true);
        #endif

        SetExitButtonActive(false);
        SetInstallButtonActive(false);

        ChangeStatusText(checkingForARSupportText);

        yield return(ARSession.CheckAvailability());

        ChangeStatusText(ARSession.state.ToString());


        if (ARSession.state == ARSessionState.NeedsInstall)
        {
            ChangeStatusText(needsInstallingText);
            yield return(ARSession.Install());
        }

        if (ARSession.state == ARSessionState.Ready)
        {
            // To start the ARSession, we just need to enable it.
            SetARSessionEnabled(true);
            SendSupportCheckDoneEvent(true);
        }
        else
        {
            switch (ARSession.state)
            {
            case ARSessionState.Unsupported:
                ChangeStatusText(deviceNotSupportedText);
                break;

            case ARSessionState.NeedsInstall:
                ChangeStatusText(updateFailedOrCancelledText);

                // In this case, we enable a button which allows the user
                // to try again in the event they decline the update the first time.
                SetInstallButtonActive(true);
                break;

            default:
                SendSupportCheckDoneEvent(true);
                break;
            }

            //Show user the exit button
            SetExitButtonActive(true);
        }
    }
예제 #6
0
        IEnumerator CheckSupport()
        {
            SetInstallButtonActive(false);

            Log("Checking for AR support...");

            yield return(ARSession.CheckAvailability());

            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                Log("Your device supports AR, but requires a software update.");
                Log("Attempting install...");
                yield return(ARSession.Install());
            }

            if (ARSession.state == ARSessionState.Ready)
            {
                Log("Your device supports AR!");
                Log("Starting AR session...");

                // To start the ARSession, we just need to enable it.
                m_Session.enabled = true;
                //m_arInput.enabled = true;
            }
            else
            {
                switch (ARSession.state)
                {
                case ARSessionState.Unsupported:
                    Log("Your device does not support AR.");
                    break;

                case ARSessionState.NeedsInstall:
                    Log("The software update failed, or you declined the update.");

                    // In this case, we enable a button which allows the user
                    // to try again in the event they decline the update the first time.
                    SetInstallButtonActive(true);
                    break;
                }

                Log("\n[Start non-AR experience instead]");

                //
                // Start a non-AR fallback experience here...
                m_ARInteraction.SetActive(false);
                //
            }
        }
예제 #7
0
    IEnumerator CheckSupport()
    {
        SetInstallButtonActive(false);

        Log("Checking for AR support...");

        yield return(ARSession.CheckAvailability());

        if (ARSession.state == ARSessionState.NeedsInstall)
        {
            Log("Your device supports AR, but requires a software update.");
            Log("Attempting install...");
            yield return(ARSession.Install());
        }

        if (ARSession.state == ARSessionState.Ready)
        {
            Log("Your device supports AR!");

            // To start the ARSession, we just need to enable it.
            m_Session.enabled = true;
            //this.gameObject.SetActive(false);
            ArRetarget.StateMachine.Instance.SetState(ArRetarget.StateMachine.State.Tutorial);
        }
        else
        {
            switch (ARSession.state)
            {
            case ARSessionState.Unsupported:
                Log("Your device does not support AR.");
                break;

            case ARSessionState.NeedsInstall:
                Log("The software update failed, or you declined the update.");

                // In this case, we enable a button which allows the user
                // to try again in the event they decline the update the first time.
                SetInstallButtonActive(true);
                break;
            }

            Log("\n[Software update failed. Please install ArCore via the AppStore. Retargeter requieres ArCore.]");
        }
    }
    /// <summary>
    /// Try to install the necessary software for AR to work
    /// </summary>
    /// <returns></returns>
    private IEnumerator Install()
    {
        SetInstallButtonActive(false);

        if (ARSession.state == ARSessionState.NeedsInstall)
        {
            ChangeStatusText(attemptingInstallText);
            yield return(ARSession.Install());

            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                ChangeStatusText(updateFailedOrCancelledText);
                SetInstallButtonActive(true);
            }
            else if (ARSession.state == ARSessionState.Ready)
            {
                SendSupportCheckDoneEvent(true);
                SetARSessionEnabled(true);
            }
        }
    }
예제 #9
0
    /// <summary>检查设备是否支持AR支持</summary>
    private IEnumerator CheckSupport()
    {
        yield return(ARSession.CheckAvailability());

        //当前设备不支持AR功能
        if (ARSession.state == ARSessionState.Unsupported)
        {
            OnUnsupported();
        }
        else
        {
            //设备支持 AR,但需要安装相应软件(这里指手机端的 ARCore 或者 ARKit)
            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                yield return(ARSession.Install());
            }

            isSupportAR = true;
            OnInitARFinish();
        }
    }
        IEnumerator Start()
        {
            arSession.enabled = false;

            if (ARSession.state == ARSessionState.None || ARSession.state == ARSessionState.CheckingAvailability)
            {
                yield return(ARSession.CheckAvailability());
            }
            else if (ARSession.state == ARSessionState.Unsupported)
            {
                Debug.Log("ARSessionStartHelper :: ar unsupported");

                this.OnFailARSession?.Invoke();
                yield break;
            }

            if (ARSession.state == ARSessionState.NeedsInstall)
            {
                Debug.Log("ARSessionStartHelper :: ar library need install");

                this.OnRequestARLibInstall?.Invoke();
                yield return(ARSession.Install());

                Debug.Log("ARSessionStartHelper :: ar library installed");
            }

            if (ARSession.state == ARSessionState.Ready)
            {
                Debug.Log("ARSessionStartHelper :: ar ready");

                this.OnReadyAR?.Invoke();
                arSession.enabled = true;
            }

            yield return(null);
        }
예제 #11
0
    private IEnumerator InstallARCoreApp()
    {
        yield return(ARSession.Install());

        NextStep(true);
    }
예제 #12
0
 public void InstallARSoftware()
 {
     CoroutineRunner.Run(ARSession.Install());
 }