// Token: 0x06000089 RID: 137 RVA: 0x0000658C File Offset: 0x0000478C
    private ulong GetOverlayHandle(string overlayName, global::UnityEngine.Transform transform, float widthInMeters = 1f)
    {
        ulong num = 0UL;

        global::Valve.VR.CVROverlay overlay = global::Valve.VR.OpenVR.Overlay;
        bool  flag = overlay == null;
        ulong result;

        if (flag)
        {
            result = num;
        }
        else
        {
            string pchOverlayKey = global::SteamVR_Overlay.key + "." + overlayName;
            global::Valve.VR.EVROverlayError evroverlayError = overlay.FindOverlay(pchOverlayKey, ref num);
            bool flag2 = evroverlayError > global::Valve.VR.EVROverlayError.None;
            if (flag2)
            {
                evroverlayError = overlay.CreateOverlay(pchOverlayKey, overlayName, ref num);
            }
            bool flag3 = evroverlayError == global::Valve.VR.EVROverlayError.None;
            if (flag3)
            {
                overlay.ShowOverlay(num);
                overlay.SetOverlayAlpha(num, this.alpha);
                overlay.SetOverlayWidthInMeters(num, widthInMeters);
                bool flag4 = global::SteamVR.instance.graphicsAPI == global::Valve.VR.EGraphicsAPIConvention.API_DirectX;
                if (flag4)
                {
                    global::Valve.VR.VRTextureBounds_t vrtextureBounds_t = default(global::Valve.VR.VRTextureBounds_t);
                    vrtextureBounds_t.uMin = 0f;
                    vrtextureBounds_t.vMin = 1f;
                    vrtextureBounds_t.uMax = 1f;
                    vrtextureBounds_t.vMax = 0f;
                    overlay.SetOverlayTextureBounds(num, ref vrtextureBounds_t);
                }
                global::SteamVR_Camera steamVR_Camera = (this.loadingScreenDistance == 0f) ? global::SteamVR_Render.Top() : null;
                bool flag5 = steamVR_Camera != null && steamVR_Camera.origin != null;
                if (flag5)
                {
                    global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(steamVR_Camera.origin, transform);
                    rigidTransform.pos.x = rigidTransform.pos.x / steamVR_Camera.origin.localScale.x;
                    rigidTransform.pos.y = rigidTransform.pos.y / steamVR_Camera.origin.localScale.y;
                    rigidTransform.pos.z = rigidTransform.pos.z / steamVR_Camera.origin.localScale.z;
                    global::Valve.VR.HmdMatrix34_t hmdMatrix34_t = rigidTransform.ToHmdMatrix34();
                    overlay.SetOverlayTransformAbsolute(num, global::SteamVR_Render.instance.trackingSpace, ref hmdMatrix34_t);
                }
                else
                {
                    global::Valve.VR.HmdMatrix34_t hmdMatrix34_t2 = new global::SteamVR_Utils.RigidTransform(transform).ToHmdMatrix34();
                    overlay.SetOverlayTransformAbsolute(num, global::SteamVR_Render.instance.trackingSpace, ref hmdMatrix34_t2);
                }
            }
            result = num;
        }
        return(result);
    }
Example #2
0
        // Token: 0x06000695 RID: 1685 RVA: 0x00020414 File Offset: 0x0001E614
        public override bool Equals(object o)
        {
            bool flag = o is global::SteamVR_Utils.RigidTransform;
            bool result;

            if (flag)
            {
                global::SteamVR_Utils.RigidTransform rigidTransform = (global::SteamVR_Utils.RigidTransform)o;
                result = (this.pos == rigidTransform.pos && this.rot == rigidTransform.rot);
            }
            else
            {
                result = false;
            }
            return(result);
        }
Example #3
0
    // Token: 0x060000D1 RID: 209 RVA: 0x000096E4 File Offset: 0x000078E4
    public void UpdateComponents()
    {
        global::UnityEngine.Transform transform = base.transform;
        bool flag = transform.childCount == 0;

        if (!flag)
        {
            using (global::SteamVR_RenderModel.RenderModelInterfaceHolder renderModelInterfaceHolder = new global::SteamVR_RenderModel.RenderModelInterfaceHolder())
            {
                global::Valve.VR.VRControllerState_t vrcontrollerState_t = (this.index != global::SteamVR_TrackedObject.EIndex.None) ? global::SteamVR_Controller.Input((int)this.index).GetState() : default(global::Valve.VR.VRControllerState_t);
                for (int i = 0; i < transform.childCount; i++)
                {
                    global::UnityEngine.Transform    child    = transform.GetChild(i);
                    global::Valve.VR.CVRRenderModels instance = renderModelInterfaceHolder.instance;
                    bool flag2 = instance == null;
                    if (flag2)
                    {
                        break;
                    }
                    global::Valve.VR.RenderModel_ComponentState_t renderModel_ComponentState_t = default(global::Valve.VR.RenderModel_ComponentState_t);
                    bool flag3 = !instance.GetComponentState(this.renderModelName, child.name, ref vrcontrollerState_t, ref this.controllerModeState, ref renderModel_ComponentState_t);
                    if (!flag3)
                    {
                        global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(renderModel_ComponentState_t.mTrackingToComponentRenderModel);
                        child.localPosition = rigidTransform.pos;
                        child.localRotation = rigidTransform.rot;
                        global::UnityEngine.Transform transform2 = child.FindChild("attach");
                        bool flag4 = transform2 != null;
                        if (flag4)
                        {
                            global::SteamVR_Utils.RigidTransform rigidTransform2 = new global::SteamVR_Utils.RigidTransform(renderModel_ComponentState_t.mTrackingToComponentLocal);
                            transform2.position = transform.TransformPoint(rigidTransform2.pos);
                            transform2.rotation = transform.rotation * rigidTransform2.rot;
                        }
                        bool flag5 = (renderModel_ComponentState_t.uProperties & 2U) > 0U;
                        bool flag6 = flag5 != child.gameObject.activeSelf;
                        if (flag6)
                        {
                            child.gameObject.SetActive(flag5);
                        }
                    }
                }
            }
        }
    }
Example #4
0
    // Token: 0x060000EB RID: 235 RVA: 0x0000A464 File Offset: 0x00008664
    private void OnNewPoses(params object[] args)
    {
        bool flag = this.index == global::SteamVR_TrackedObject.EIndex.None;

        if (!flag)
        {
            int num = (int)this.index;
            this.isValid = false;
            global::Valve.VR.TrackedDevicePose_t[] array = (global::Valve.VR.TrackedDevicePose_t[])args[0];
            bool flag2 = array.Length <= num;
            if (!flag2)
            {
                bool flag3 = !array[num].bDeviceIsConnected;
                if (!flag3)
                {
                    bool flag4 = !array[num].bPoseIsValid;
                    if (!flag4)
                    {
                        this.isValid = true;
                        global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(array[num].mDeviceToAbsoluteTracking);
                        bool flag5 = this.origin != null;
                        if (flag5)
                        {
                            rigidTransform          = new global::SteamVR_Utils.RigidTransform(this.origin) * rigidTransform;
                            rigidTransform.pos.x    = rigidTransform.pos.x * this.origin.localScale.x;
                            rigidTransform.pos.y    = rigidTransform.pos.y * this.origin.localScale.y;
                            rigidTransform.pos.z    = rigidTransform.pos.z * this.origin.localScale.z;
                            base.transform.position = rigidTransform.pos;
                            base.transform.rotation = rigidTransform.rot;
                        }
                        else
                        {
                            base.transform.localPosition = rigidTransform.pos;
                            base.transform.localRotation = rigidTransform.rot;
                        }
                    }
                }
            }
        }
    }
    // Token: 0x06000052 RID: 82 RVA: 0x00003ACC File Offset: 0x00001CCC
    public static int GetDeviceIndex(global::SteamVR_Controller.DeviceRelation relation, global::Valve.VR.ETrackedDeviceClass deviceClass = global::Valve.VR.ETrackedDeviceClass.Controller, int relativeTo = 0)
    {
        int num = -1;

        global::SteamVR_Utils.RigidTransform t      = (relativeTo < 16) ? global::SteamVR_Controller.Input(relativeTo).transform.GetInverse() : global::SteamVR_Utils.RigidTransform.identity;
        global::Valve.VR.CVRSystem           system = global::Valve.VR.OpenVR.System;
        bool flag = system == null;
        int  result;

        if (flag)
        {
            result = num;
        }
        else
        {
            float num2 = float.MinValue;
            int   num3 = 0;
            while ((long)num3 < 16L)
            {
                bool flag2 = num3 == relativeTo || system.GetTrackedDeviceClass((uint)num3) != deviceClass;
                if (!flag2)
                {
                    global::SteamVR_Controller.Device device = global::SteamVR_Controller.Input(num3);
                    bool flag3 = !device.connected;
                    if (!flag3)
                    {
                        bool flag4 = relation == global::SteamVR_Controller.DeviceRelation.First;
                        if (flag4)
                        {
                            return(num3);
                        }
                        global::UnityEngine.Vector3 vector = t * device.transform.pos;
                        bool  flag5 = relation == global::SteamVR_Controller.DeviceRelation.FarthestRight;
                        float num4;
                        if (flag5)
                        {
                            num4 = vector.x;
                        }
                        else
                        {
                            bool flag6 = relation == global::SteamVR_Controller.DeviceRelation.FarthestLeft;
                            if (flag6)
                            {
                                num4 = -vector.x;
                            }
                            else
                            {
                                global::UnityEngine.Vector3 normalized = new global::UnityEngine.Vector3(vector.x, 0f, vector.z).normalized;
                                float num5 = global::UnityEngine.Vector3.Dot(normalized, global::UnityEngine.Vector3.forward);
                                global::UnityEngine.Vector3 vector2 = global::UnityEngine.Vector3.Cross(normalized, global::UnityEngine.Vector3.forward);
                                bool flag7 = relation == global::SteamVR_Controller.DeviceRelation.Leftmost;
                                if (flag7)
                                {
                                    num4 = ((vector2.y > 0f) ? (2f - num5) : num5);
                                }
                                else
                                {
                                    num4 = ((vector2.y < 0f) ? (2f - num5) : num5);
                                }
                            }
                        }
                        bool flag8 = num4 > num2;
                        if (flag8)
                        {
                            num  = num3;
                            num2 = num4;
                        }
                    }
                }
                num3++;
            }
            result = num;
        }
        return(result);
    }
Example #6
0
 // Token: 0x06000064 RID: 100 RVA: 0x00004460 File Offset: 0x00002660
 public void ReadConfig()
 {
     try
     {
         global::Valve.VR.HmdMatrix34_t pose = default(global::Valve.VR.HmdMatrix34_t);
         bool     flag  = false;
         object   obj   = this.config;
         string[] array = global::System.IO.File.ReadAllLines(this.configPath);
         foreach (string text in array)
         {
             string[] array3 = text.Split('=', 0);
             bool     flag2  = array3.Length == 2;
             if (flag2)
             {
                 string text2 = array3[0];
                 bool   flag3 = text2 == "m";
                 if (flag3)
                 {
                     string[] array4 = array3[1].Split(',', 0);
                     bool     flag4  = array4.Length == 12;
                     if (flag4)
                     {
                         pose.m0  = float.Parse(array4[0]);
                         pose.m1  = float.Parse(array4[1]);
                         pose.m2  = float.Parse(array4[2]);
                         pose.m3  = float.Parse(array4[3]);
                         pose.m4  = float.Parse(array4[4]);
                         pose.m5  = float.Parse(array4[5]);
                         pose.m6  = float.Parse(array4[6]);
                         pose.m7  = float.Parse(array4[7]);
                         pose.m8  = float.Parse(array4[8]);
                         pose.m9  = float.Parse(array4[9]);
                         pose.m10 = float.Parse(array4[10]);
                         pose.m11 = float.Parse(array4[11]);
                         flag     = true;
                     }
                 }
                 else
                 {
                     bool flag5 = text2 == "disableStandardAssets";
                     if (flag5)
                     {
                         global::System.Reflection.FieldInfo field = obj.GetType().GetField(text2);
                         bool flag6 = field != null;
                         if (flag6)
                         {
                             field.SetValue(obj, bool.Parse(array3[1]));
                         }
                     }
                     else
                     {
                         global::System.Reflection.FieldInfo field2 = obj.GetType().GetField(text2);
                         bool flag7 = field2 != null;
                         if (flag7)
                         {
                             field2.SetValue(obj, float.Parse(array3[1]));
                         }
                     }
                 }
             }
         }
         this.config = (global::SteamVR_ExternalCamera.Config)obj;
         bool flag8 = flag;
         if (flag8)
         {
             global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(pose);
             this.config.x = rigidTransform.pos.x;
             this.config.y = rigidTransform.pos.y;
             this.config.z = rigidTransform.pos.z;
             global::UnityEngine.Vector3 eulerAngles = rigidTransform.rot.eulerAngles;
             this.config.rx = eulerAngles.x;
             this.config.ry = eulerAngles.y;
             this.config.rz = eulerAngles.z;
         }
     }
     catch
     {
     }
 }
Example #7
0
    // Token: 0x0600009D RID: 157 RVA: 0x000073DC File Offset: 0x000055DC
    public void UpdateOverlay()
    {
        global::Valve.VR.CVROverlay overlay = global::Valve.VR.OpenVR.Overlay;
        bool flag = overlay == null;

        if (!flag)
        {
            bool flag2 = this.texture != null;
            if (flag2)
            {
                global::Valve.VR.EVROverlayError evroverlayError = overlay.ShowOverlay(this.handle);
                bool flag3 = evroverlayError == global::Valve.VR.EVROverlayError.InvalidHandle || evroverlayError == global::Valve.VR.EVROverlayError.UnknownOverlay;
                if (flag3)
                {
                    bool flag4 = overlay.FindOverlay(global::SteamVR_Overlay.key, ref this.handle) > global::Valve.VR.EVROverlayError.None;
                    if (flag4)
                    {
                        return;
                    }
                }
                global::Valve.VR.Texture_t texture_t = default(global::Valve.VR.Texture_t);
                texture_t.handle      = this.texture.GetNativeTexturePtr();
                texture_t.eType       = global::SteamVR.instance.graphicsAPI;
                texture_t.eColorSpace = global::Valve.VR.EColorSpace.Auto;
                overlay.SetOverlayTexture(this.handle, ref texture_t);
                overlay.SetOverlayAlpha(this.handle, this.alpha);
                overlay.SetOverlayWidthInMeters(this.handle, this.scale);
                overlay.SetOverlayAutoCurveDistanceRangeInMeters(this.handle, this.curvedRange.x, this.curvedRange.y);
                global::Valve.VR.VRTextureBounds_t vrtextureBounds_t = default(global::Valve.VR.VRTextureBounds_t);
                vrtextureBounds_t.uMin = (0f + this.uvOffset.x) * this.uvOffset.z;
                vrtextureBounds_t.vMin = (1f + this.uvOffset.y) * this.uvOffset.w;
                vrtextureBounds_t.uMax = (1f + this.uvOffset.x) * this.uvOffset.z;
                vrtextureBounds_t.vMax = (0f + this.uvOffset.y) * this.uvOffset.w;
                overlay.SetOverlayTextureBounds(this.handle, ref vrtextureBounds_t);
                global::Valve.VR.HmdVector2_t hmdVector2_t = default(global::Valve.VR.HmdVector2_t);
                hmdVector2_t.v0 = this.mouseScale.x;
                hmdVector2_t.v1 = this.mouseScale.y;
                overlay.SetOverlayMouseScale(this.handle, ref hmdVector2_t);
                global::SteamVR_Camera steamVR_Camera = global::SteamVR_Render.Top();
                bool flag5 = steamVR_Camera != null && steamVR_Camera.origin != null;
                if (flag5)
                {
                    global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(steamVR_Camera.origin, base.transform);
                    rigidTransform.pos.x = rigidTransform.pos.x / steamVR_Camera.origin.localScale.x;
                    rigidTransform.pos.y = rigidTransform.pos.y / steamVR_Camera.origin.localScale.y;
                    rigidTransform.pos.z = rigidTransform.pos.z / steamVR_Camera.origin.localScale.z;
                    rigidTransform.pos.z = rigidTransform.pos.z + this.distance;
                    global::Valve.VR.HmdMatrix34_t hmdMatrix34_t = rigidTransform.ToHmdMatrix34();
                    overlay.SetOverlayTransformAbsolute(this.handle, global::SteamVR_Render.instance.trackingSpace, ref hmdMatrix34_t);
                }
                overlay.SetOverlayInputMethod(this.handle, this.inputMethod);
                bool flag6 = this.curved || this.antialias;
                if (flag6)
                {
                    this.highquality = true;
                }
                bool flag7 = this.highquality;
                if (flag7)
                {
                    overlay.SetHighQualityOverlay(this.handle);
                    overlay.SetOverlayFlag(this.handle, global::Valve.VR.VROverlayFlags.Curved, this.curved);
                    overlay.SetOverlayFlag(this.handle, global::Valve.VR.VROverlayFlags.RGSS4X, this.antialias);
                }
                else
                {
                    bool flag8 = overlay.GetHighQualityOverlay() == this.handle;
                    if (flag8)
                    {
                        overlay.SetHighQualityOverlay(0UL);
                    }
                }
            }
            else
            {
                overlay.HideOverlay(this.handle);
            }
        }
    }
 // Token: 0x060000E9 RID: 233 RVA: 0x0000A130 File Offset: 0x00008330
 private void Update()
 {
     foreach (int num in this.controllerIndices)
     {
         global::SteamVR_Overlay instance = global::SteamVR_Overlay.instance;
         bool flag = instance && this.point && this.pointer;
         if (flag)
         {
             global::SteamVR_Utils.RigidTransform transform = global::SteamVR_Controller.Input(num).transform;
             this.pointer.transform.localPosition = transform.pos;
             this.pointer.transform.localRotation = transform.rot;
             global::SteamVR_Overlay.IntersectionResults intersectionResults = default(global::SteamVR_Overlay.IntersectionResults);
             bool flag2 = instance.ComputeIntersection(transform.pos, transform.rot * global::UnityEngine.Vector3.forward, ref intersectionResults);
             bool flag3 = flag2;
             if (flag3)
             {
                 this.point.transform.localPosition = intersectionResults.point;
                 this.point.transform.localRotation = global::UnityEngine.Quaternion.LookRotation(intersectionResults.normal);
             }
         }
         else
         {
             foreach (global::Valve.VR.EVRButtonId evrbuttonId in this.buttonIds)
             {
                 bool pressDown = global::SteamVR_Controller.Input(num).GetPressDown(evrbuttonId);
                 if (pressDown)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId.ToString() + " press down");
                 }
                 bool pressUp = global::SteamVR_Controller.Input(num).GetPressUp(evrbuttonId);
                 if (pressUp)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId.ToString() + " press up");
                     bool flag4 = evrbuttonId == global::Valve.VR.EVRButtonId.k_EButton_Axis1;
                     if (flag4)
                     {
                         global::SteamVR_Controller.Input(num).TriggerHapticPulse(500, global::Valve.VR.EVRButtonId.k_EButton_Axis0);
                         this.PrintControllerStatus(num);
                     }
                 }
                 bool press = global::SteamVR_Controller.Input(num).GetPress(evrbuttonId);
                 if (press)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId);
                 }
             }
             foreach (global::Valve.VR.EVRButtonId buttonId in this.axisIds)
             {
                 bool touchDown = global::SteamVR_Controller.Input(num).GetTouchDown(buttonId);
                 if (touchDown)
                 {
                     global::UnityEngine.Debug.Log(buttonId.ToString() + " touch down");
                 }
                 bool touchUp = global::SteamVR_Controller.Input(num).GetTouchUp(buttonId);
                 if (touchUp)
                 {
                     global::UnityEngine.Debug.Log(buttonId.ToString() + " touch up");
                 }
                 bool touch = global::SteamVR_Controller.Input(num).GetTouch(buttonId);
                 if (touch)
                 {
                     global::UnityEngine.Vector2 axis = global::SteamVR_Controller.Input(num).GetAxis(buttonId);
                     string text = "axis: ";
                     global::UnityEngine.Vector2 vector = axis;
                     global::UnityEngine.Debug.Log(text + vector.ToString());
                 }
             }
         }
     }
 }
Example #9
0
 // Token: 0x060006A1 RID: 1697 RVA: 0x000206BF File Offset: 0x0001E8BF
 public void Interpolate(global::SteamVR_Utils.RigidTransform to, float t)
 {
     this.pos = global::SteamVR_Utils.Lerp(this.pos, to.pos, t);
     this.rot = global::SteamVR_Utils.Slerp(this.rot, to.rot, t);
 }
Example #10
0
 // Token: 0x060006A0 RID: 1696 RVA: 0x00020684 File Offset: 0x0001E884
 public static global::SteamVR_Utils.RigidTransform Interpolate(global::SteamVR_Utils.RigidTransform a, global::SteamVR_Utils.RigidTransform b, float t)
 {
     return(new global::SteamVR_Utils.RigidTransform(global::UnityEngine.Vector3.Lerp(a.pos, b.pos, t), global::UnityEngine.Quaternion.Slerp(a.rot, b.rot, t)));
 }
Example #11
0
 // Token: 0x0600069C RID: 1692 RVA: 0x000205CE File Offset: 0x0001E7CE
 public void Multiply(global::SteamVR_Utils.RigidTransform a, global::SteamVR_Utils.RigidTransform b)
 {
     this.rot = a.rot * b.rot;
     this.pos = a.pos + a.rot * b.pos;
 }
Example #12
0
 // Token: 0x0600069B RID: 1691 RVA: 0x000205A0 File Offset: 0x0001E7A0
 public global::SteamVR_Utils.RigidTransform GetInverse()
 {
     global::SteamVR_Utils.RigidTransform result = new global::SteamVR_Utils.RigidTransform(this.pos, this.rot);
     result.Inverse();
     return(result);
 }
    // Token: 0x06000088 RID: 136 RVA: 0x0000657D File Offset: 0x0000477D
    private global::System.Collections.IEnumerator LoadLevel()
    {
        bool flag = this.loadingScreen != null && this.loadingScreenDistance > 0f;

        if (flag)
        {
            global::SteamVR_Controller.Device hmd = global::SteamVR_Controller.Input(0);
            while (!hmd.hasTracking)
            {
                yield return(null);
            }
            global::SteamVR_Utils.RigidTransform tloading = hmd.transform;
            tloading.rot  = global::UnityEngine.Quaternion.Euler(0f, tloading.rot.eulerAngles.y, 0f);
            tloading.pos += tloading.rot * new global::UnityEngine.Vector3(0f, 0f, this.loadingScreenDistance);
            global::UnityEngine.Transform t = (this.loadingScreenTransform != null) ? this.loadingScreenTransform : base.transform;
            t.position = tloading.pos;
            t.rotation = tloading.rot;
            hmd        = null;
            tloading   = default(global::SteamVR_Utils.RigidTransform);
            t          = null;
        }
        global::SteamVR_LoadLevel._active = this;
        global::SteamVR_Utils.Event.Send("loading", new object[]
        {
            true
        });
        bool flag2 = this.loadingScreenFadeInTime > 0f;

        if (flag2)
        {
            this.fadeRate = 1f / this.loadingScreenFadeInTime;
        }
        else
        {
            this.alpha = 1f;
        }
        global::Valve.VR.CVROverlay overlay = global::Valve.VR.OpenVR.Overlay;
        bool flag3 = this.loadingScreen != null && overlay != null;

        if (flag3)
        {
            this.loadingScreenOverlayHandle = this.GetOverlayHandle("loadingScreen", (this.loadingScreenTransform != null) ? this.loadingScreenTransform : base.transform, this.loadingScreenWidthInMeters);
            bool flag4 = this.loadingScreenOverlayHandle > 0UL;
            if (flag4)
            {
                global::Valve.VR.Texture_t texture = default(global::Valve.VR.Texture_t);
                texture.handle      = this.loadingScreen.GetNativeTexturePtr();
                texture.eType       = global::SteamVR.instance.graphicsAPI;
                texture.eColorSpace = global::Valve.VR.EColorSpace.Auto;
                overlay.SetOverlayTexture(this.loadingScreenOverlayHandle, ref texture);
            }
        }
        bool fadedForeground = false;

        global::SteamVR_Utils.Event.Send("loading_fade_out", new object[]
        {
            this.fadeOutTime
        });
        global::Valve.VR.CVRCompositor compositor = global::Valve.VR.OpenVR.Compositor;
        bool flag5 = compositor != null;

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

                        compositor.FadeGrid(0f, true);
                        fadedForeground = true;
                    }
                }
            }
        }
        global::SteamVR_Render.pauseRendering = true;
        while (this.alpha < 1f)
        {
            yield return(null);
        }
        base.transform.parent = null;
        global::UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
        bool flag9 = this.loadExternalApp;

        if (flag9)
        {
            global::UnityEngine.Debug.Log("Launching external application...");
            global::Valve.VR.CVRApplications applications = global::Valve.VR.OpenVR.Applications;
            bool flag10 = applications == null;
            if (flag10)
            {
                global::UnityEngine.Debug.Log("Failed to get OpenVR.Applications interface!");
            }
            else
            {
                string workingDirectory = global::System.IO.Directory.GetCurrentDirectory();
                string fullPath         = global::System.IO.Path.Combine(workingDirectory, this.externalAppPath);
                global::UnityEngine.Debug.Log("LaunchingInternalProcess");
                global::UnityEngine.Debug.Log("ExternalAppPath = " + this.externalAppPath);
                global::UnityEngine.Debug.Log("FullPath = " + fullPath);
                global::UnityEngine.Debug.Log("ExternalAppArgs = " + this.externalAppArgs);
                global::UnityEngine.Debug.Log("WorkingDirectory = " + workingDirectory);
                global::UnityEngine.Debug.Log("LaunchInternalProcessError: " + applications.LaunchInternalProcess(fullPath, this.externalAppArgs, workingDirectory).ToString());
                global::System.Diagnostics.Process.GetCurrentProcess().Kill();
                workingDirectory = null;
                fullPath         = null;
            }
            applications = null;
        }
        else
        {
            global::UnityEngine.SceneManagement.LoadSceneMode mode = this.loadAdditive ? 1 : 0;
            bool flag11 = this.loadAsync;
            if (flag11)
            {
                global::UnityEngine.Application.backgroundLoadingPriority = 0;
                this.async = global::UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(this.levelName, mode);
                while (!this.async.isDone)
                {
                    yield return(null);
                }
            }
            else
            {
                global::UnityEngine.SceneManagement.SceneManager.LoadScene(this.levelName, mode);
            }
        }
        yield return(null);

        global::System.GC.Collect();
        yield return(null);

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

        global::SteamVR_Render.pauseRendering = false;
        bool flag12 = this.loadingScreenFadeOutTime > 0f;

        if (flag12)
        {
            this.fadeRate = -1f / this.loadingScreenFadeOutTime;
        }
        else
        {
            this.alpha = 0f;
        }
        global::SteamVR_Utils.Event.Send("loading_fade_in", new object[]
        {
            this.fadeInTime
        });
        bool flag13 = compositor != null;

        if (flag13)
        {
            bool flag14 = fadedForeground;
            if (flag14)
            {
                compositor.FadeGrid(0f, false);
                compositor.FadeToColor(this.fadeInTime, 0f, 0f, 0f, 0f, false);
                yield return(new global::UnityEngine.WaitForSeconds(this.fadeInTime));
            }
            else
            {
                compositor.FadeGrid(this.fadeInTime, false);
                yield return(new global::UnityEngine.WaitForSeconds(this.fadeInTime));

                bool flag15 = this.front != null;
                if (flag15)
                {
                    global::SteamVR_Skybox.ClearOverride();
                }
            }
        }
        while (this.alpha > 0f)
        {
            yield return(null);
        }
        bool flag16 = overlay != null;

        if (flag16)
        {
            bool flag17 = this.progressBarOverlayHandle > 0UL;
            if (flag17)
            {
                overlay.HideOverlay(this.progressBarOverlayHandle);
            }
            bool flag18 = this.loadingScreenOverlayHandle > 0UL;
            if (flag18)
            {
                overlay.HideOverlay(this.loadingScreenOverlayHandle);
            }
        }
        global::UnityEngine.Object.Destroy(base.gameObject);
        global::SteamVR_LoadLevel._active = null;
        global::SteamVR_Utils.Event.Send("loading", new object[]
        {
            false
        });
        yield break;
    }