// 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);
    }
Beispiel #2
0
    // Token: 0x0600009B RID: 155 RVA: 0x0000732C File Offset: 0x0000552C
    private void OnEnable()
    {
        global::Valve.VR.CVROverlay overlay = global::Valve.VR.OpenVR.Overlay;
        bool flag = overlay != null;

        if (flag)
        {
            global::Valve.VR.EVROverlayError evroverlayError = overlay.CreateOverlay(global::SteamVR_Overlay.key, base.gameObject.name, ref this.handle);
            bool flag2 = evroverlayError > global::Valve.VR.EVROverlayError.None;
            if (flag2)
            {
                global::UnityEngine.Debug.Log(overlay.GetOverlayErrorNameFromEnum(evroverlayError));
                base.enabled = false;
                return;
            }
        }
        global::SteamVR_Overlay.instance = this;
    }