示例#1
0
    // Token: 0x06000D82 RID: 3458 RVA: 0x00054D60 File Offset: 0x00052F60
    public static void View(Color newColor, float duration)
    {
        CVRCompositor compositor = OpenVR.Compositor;

        if (compositor != null)
        {
            compositor.FadeToColor(duration, newColor.r, newColor.g, newColor.b, newColor.a, false);
        }
    }
示例#2
0
 public static void FadeToColor(float sec, Color color)
 {
     m_vrCompositor.FadeToColor(sec, color.R, color.G, color.B, color.A, false);
 }
示例#3
0
    // Token: 0x06005F2C RID: 24364 RVA: 0x00215578 File Offset: 0x00213978
    private IEnumerator LoadLevel()
    {
        if (this.loadingScreen != null && this.loadingScreenDistance > 0f)
        {
            SteamVR_Controller.Device hmd = SteamVR_Controller.Input(0);
            while (!hmd.hasTracking)
            {
                yield return(null);
            }
            SteamVR_Utils.RigidTransform tloading = hmd.transform;
            tloading.rot  = Quaternion.Euler(0f, tloading.rot.eulerAngles.y, 0f);
            tloading.pos += tloading.rot * new Vector3(0f, 0f, this.loadingScreenDistance);
            Transform t = (!(this.loadingScreenTransform != null)) ? base.transform : this.loadingScreenTransform;
            t.position = tloading.pos;
            t.rotation = tloading.rot;
        }
        SteamVR_LoadLevel._active = this;
        SteamVR_Events.Loading.Send(true);
        if (this.loadingScreenFadeInTime > 0f)
        {
            this.fadeRate = 1f / this.loadingScreenFadeInTime;
        }
        else
        {
            this.alpha = 1f;
        }
        CVROverlay overlay = OpenVR.Overlay;

        if (this.loadingScreen != null && overlay != null)
        {
            this.loadingScreenOverlayHandle = this.GetOverlayHandle("loadingScreen", (!(this.loadingScreenTransform != null)) ? base.transform : this.loadingScreenTransform, this.loadingScreenWidthInMeters);
            if (this.loadingScreenOverlayHandle != 0UL)
            {
                Texture_t texture_t = default(Texture_t);
                texture_t.handle      = this.loadingScreen.GetNativeTexturePtr();
                texture_t.eType       = SteamVR.instance.textureType;
                texture_t.eColorSpace = EColorSpace.Auto;
                overlay.SetOverlayTexture(this.loadingScreenOverlayHandle, ref texture_t);
            }
        }
        bool fadedForeground = false;

        SteamVR_Events.LoadingFadeOut.Send(this.fadeOutTime);
        CVRCompositor compositor = OpenVR.Compositor;

        if (compositor != null)
        {
            if (this.front != null)
            {
                SteamVR_Skybox.SetOverride(this.front, this.back, this.left, this.right, this.top, this.bottom);
                compositor.FadeGrid(this.fadeOutTime, true);
                yield return(new WaitForSeconds(this.fadeOutTime));
            }
            else if (this.backgroundColor != Color.clear)
            {
                if (this.showGrid)
                {
                    compositor.FadeToColor(0f, this.backgroundColor.r, this.backgroundColor.g, this.backgroundColor.b, this.backgroundColor.a, true);
                    compositor.FadeGrid(this.fadeOutTime, true);
                    yield return(new WaitForSeconds(this.fadeOutTime));
                }
                else
                {
                    compositor.FadeToColor(this.fadeOutTime, this.backgroundColor.r, this.backgroundColor.g, this.backgroundColor.b, this.backgroundColor.a, false);
                    yield return(new WaitForSeconds(this.fadeOutTime + 0.1f));

                    compositor.FadeGrid(0f, true);
                    fadedForeground = true;
                }
            }
        }
        SteamVR_Render.pauseRendering = true;
        while (this.alpha < 1f)
        {
            yield return(null);
        }
        base.transform.parent = null;
        UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
        if (!string.IsNullOrEmpty(this.internalProcessPath))
        {
            UnityEngine.Debug.Log("Launching external application...");
            CVRApplications applications = OpenVR.Applications;
            if (applications == null)
            {
                UnityEngine.Debug.Log("Failed to get OpenVR.Applications interface!");
            }
            else
            {
                string currentDirectory = Directory.GetCurrentDirectory();
                string text             = Path.Combine(currentDirectory, this.internalProcessPath);
                UnityEngine.Debug.Log("LaunchingInternalProcess");
                UnityEngine.Debug.Log("ExternalAppPath = " + this.internalProcessPath);
                UnityEngine.Debug.Log("FullPath = " + text);
                UnityEngine.Debug.Log("ExternalAppArgs = " + this.internalProcessArgs);
                UnityEngine.Debug.Log("WorkingDirectory = " + currentDirectory);
                EVRApplicationError evrapplicationError = applications.LaunchInternalProcess(text, this.internalProcessArgs, currentDirectory);
                UnityEngine.Debug.Log("LaunchInternalProcessError: " + evrapplicationError);
                Process.GetCurrentProcess().Kill();
            }
        }
        else
        {
            LoadSceneMode mode = (!this.loadAdditive) ? LoadSceneMode.Single : LoadSceneMode.Additive;
            if (this.loadAsync)
            {
                Application.backgroundLoadingPriority = ThreadPriority.Low;
                this.async = SceneManager.LoadSceneAsync(this.levelName, mode);
                while (!this.async.isDone)
                {
                    yield return(null);
                }
            }
            else
            {
                SceneManager.LoadScene(this.levelName, mode);
            }
        }
        yield return(null);

        GC.Collect();
        yield return(null);

        Shader.WarmupAllShaders();
        yield return(new WaitForSeconds(this.postLoadSettleTime));

        SteamVR_Render.pauseRendering = false;
        if (this.loadingScreenFadeOutTime > 0f)
        {
            this.fadeRate = -1f / this.loadingScreenFadeOutTime;
        }
        else
        {
            this.alpha = 0f;
        }
        SteamVR_Events.LoadingFadeIn.Send(this.fadeInTime);
        if (compositor != null)
        {
            if (fadedForeground)
            {
                compositor.FadeGrid(0f, false);
                compositor.FadeToColor(this.fadeInTime, 0f, 0f, 0f, 0f, false);
                yield return(new WaitForSeconds(this.fadeInTime));
            }
            else
            {
                compositor.FadeGrid(this.fadeInTime, false);
                yield return(new WaitForSeconds(this.fadeInTime));

                if (this.front != null)
                {
                    SteamVR_Skybox.ClearOverride();
                }
            }
        }
        while (this.alpha > 0f)
        {
            yield return(null);
        }
        if (overlay != null)
        {
            if (this.progressBarOverlayHandle != 0UL)
            {
                overlay.HideOverlay(this.progressBarOverlayHandle);
            }
            if (this.loadingScreenOverlayHandle != 0UL)
            {
                overlay.HideOverlay(this.loadingScreenOverlayHandle);
            }
        }
        UnityEngine.Object.Destroy(base.gameObject);
        SteamVR_LoadLevel._active = null;
        SteamVR_Events.Loading.Send(false);
        yield break;
    }