// Token: 0x060000E5 RID: 229 RVA: 0x00009EB0 File Offset: 0x000080B0
    private void OnDeviceConnected(params object[] args)
    {
        int num = (int)args[0];

        global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
        bool flag = system == null || system.GetTrackedDeviceClass((uint)num) != global::Valve.VR.ETrackedDeviceClass.Controller;

        if (!flag)
        {
            bool flag2 = (bool)args[1];
            bool flag3 = flag2;
            if (flag3)
            {
                global::UnityEngine.Debug.Log(string.Format("Controller {0} connected.", num));
                this.PrintControllerStatus(num);
                this.controllerIndices.Add(num);
            }
            else
            {
                global::UnityEngine.Debug.Log(string.Format("Controller {0} disconnected.", num));
                this.PrintControllerStatus(num);
                this.controllerIndices.Remove(num);
            }
        }
    }
    // Token: 0x0600005C RID: 92 RVA: 0x000040C0 File Offset: 0x000022C0
    private void OnDeviceConnected(params object[] args)
    {
        uint num  = (uint)((int)args[0]);
        bool flag = this.connected[(int)num];

        this.connected[(int)num] = false;
        bool flag2 = (bool)args[1];
        bool flag3 = flag2;

        if (flag3)
        {
            global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
            bool flag4 = system != null && system.GetTrackedDeviceClass(num) == global::Valve.VR.ETrackedDeviceClass.Controller;
            if (flag4)
            {
                this.connected[(int)num] = true;
                flag = !flag;
            }
        }
        bool flag5 = flag;

        if (flag5)
        {
            this.Refresh();
        }
    }
Пример #3
0
    // Token: 0x060000C6 RID: 198 RVA: 0x00008B3C File Offset: 0x00006D3C
    public void UpdateModel()
    {
        global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
        bool flag = system == null;

        if (!flag)
        {
            global::Valve.VR.ETrackedPropertyError etrackedPropertyError = global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
            uint stringTrackedDeviceProperty = system.GetStringTrackedDeviceProperty((uint)this.index, global::Valve.VR.ETrackedDeviceProperty.Prop_RenderModelName_String, null, 0U, ref etrackedPropertyError);
            bool flag2 = stringTrackedDeviceProperty <= 1U;
            if (flag2)
            {
                global::UnityEngine.Debug.LogError("Failed to get render model name for tracked object " + this.index.ToString());
            }
            else
            {
                global::System.Text.StringBuilder stringBuilder = new global::System.Text.StringBuilder((int)stringTrackedDeviceProperty);
                system.GetStringTrackedDeviceProperty((uint)this.index, global::Valve.VR.ETrackedDeviceProperty.Prop_RenderModelName_String, stringBuilder, stringTrackedDeviceProperty, ref etrackedPropertyError);
                string text  = stringBuilder.ToString();
                bool   flag3 = this.renderModelName != text;
                if (flag3)
                {
                    this.renderModelName = text;
                    base.StartCoroutine(this.SetModelAsync(text));
                }
            }
        }
    }
Пример #4
0
    // Token: 0x06000076 RID: 118 RVA: 0x00005728 File Offset: 0x00003928
    private void OnDeviceConnected(params object[] args)
    {
        int  num  = (int)args[0];
        bool flag = num != (int)this.index;

        if (!flag)
        {
            base.GetComponent <global::UnityEngine.MeshFilter>().mesh = null;
            bool flag2 = (bool)args[1];
            bool flag3 = flag2;
            if (flag3)
            {
                global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
                bool flag4 = system != null && system.GetTrackedDeviceClass((uint)num) == global::Valve.VR.ETrackedDeviceClass.TrackingReference;
                if (flag4)
                {
                    global::Valve.VR.ETrackedPropertyError etrackedPropertyError = global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
                    float floatTrackedDeviceProperty = system.GetFloatTrackedDeviceProperty((uint)num, global::Valve.VR.ETrackedDeviceProperty.Prop_FieldOfViewLeftDegrees_Float, ref etrackedPropertyError);
                    bool  flag5 = etrackedPropertyError == global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
                    if (flag5)
                    {
                        this.fovLeft = floatTrackedDeviceProperty;
                    }
                    floatTrackedDeviceProperty = system.GetFloatTrackedDeviceProperty((uint)num, global::Valve.VR.ETrackedDeviceProperty.Prop_FieldOfViewRightDegrees_Float, ref etrackedPropertyError);
                    bool flag6 = etrackedPropertyError == global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
                    if (flag6)
                    {
                        this.fovRight = floatTrackedDeviceProperty;
                    }
                    floatTrackedDeviceProperty = system.GetFloatTrackedDeviceProperty((uint)num, global::Valve.VR.ETrackedDeviceProperty.Prop_FieldOfViewTopDegrees_Float, ref etrackedPropertyError);
                    bool flag7 = etrackedPropertyError == global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
                    if (flag7)
                    {
                        this.fovTop = floatTrackedDeviceProperty;
                    }
                    floatTrackedDeviceProperty = system.GetFloatTrackedDeviceProperty((uint)num, global::Valve.VR.ETrackedDeviceProperty.Prop_FieldOfViewBottomDegrees_Float, ref etrackedPropertyError);
                    bool flag8 = etrackedPropertyError == global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
                    if (flag8)
                    {
                        this.fovBottom = floatTrackedDeviceProperty;
                    }
                    floatTrackedDeviceProperty = system.GetFloatTrackedDeviceProperty((uint)num, global::Valve.VR.ETrackedDeviceProperty.Prop_TrackingRangeMinimumMeters_Float, ref etrackedPropertyError);
                    bool flag9 = etrackedPropertyError == global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
                    if (flag9)
                    {
                        this.nearZ = floatTrackedDeviceProperty;
                    }
                    floatTrackedDeviceProperty = system.GetFloatTrackedDeviceProperty((uint)num, global::Valve.VR.ETrackedDeviceProperty.Prop_TrackingRangeMaximumMeters_Float, ref etrackedPropertyError);
                    bool flag10 = etrackedPropertyError == global::Valve.VR.ETrackedPropertyError.TrackedProp_Success;
                    if (flag10)
                    {
                        this.farZ = floatTrackedDeviceProperty;
                    }
                    this.UpdateModel();
                }
            }
        }
    }
Пример #5
0
        // Token: 0x0600065B RID: 1627 RVA: 0x0001E6F8 File Offset: 0x0001C8F8
        public void TriggerHapticPulse(ushort durationMicroSec = 500, global::Valve.VR.EVRButtonId buttonId = global::Valve.VR.EVRButtonId.k_EButton_Axis0)
        {
            global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
            bool flag = system != null;

            if (flag)
            {
                uint unAxisId = (uint)(buttonId - global::Valve.VR.EVRButtonId.k_EButton_Axis0);
                system.TriggerHapticPulse(this.index, unAxisId, (char)durationMicroSec);
            }
        }
Пример #6
0
        // Token: 0x0600064D RID: 1613 RVA: 0x0001E360 File Offset: 0x0001C560
        public void Update()
        {
            bool flag = global::UnityEngine.Time.frameCount != this.prevFrameCount;

            if (flag)
            {
                this.prevFrameCount = global::UnityEngine.Time.frameCount;
                this.prevState      = this.state;
                global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
                bool flag2 = system != null;
                if (flag2)
                {
                    this.valid = system.GetControllerStateWithPose(global::SteamVR_Render.instance.trackingSpace, this.index, ref this.state, ref this.pose);
                    this.UpdateHairTrigger();
                }
            }
        }
Пример #7
0
    // Token: 0x06000103 RID: 259 RVA: 0x0000B054 File Offset: 0x00009254
    public static object CallSystemFn(global::SteamVR_Utils.SystemFn fn, params object[] args)
    {
        bool flag  = !global::SteamVR.active && !global::SteamVR.usingNativeSupport;
        bool flag2 = flag;

        if (flag2)
        {
            global::Valve.VR.EVRInitError evrinitError = global::Valve.VR.EVRInitError.None;
            global::Valve.VR.OpenVR.Init(ref evrinitError, global::Valve.VR.EVRApplicationType.VRApplication_Other);
        }
        global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
        object result = (system != null) ? fn(system, args) : null;
        bool   flag3  = flag;

        if (flag3)
        {
            global::Valve.VR.OpenVR.Shutdown();
        }
        return(result);
    }
Пример #8
0
    // Token: 0x060000CE RID: 206 RVA: 0x000095D0 File Offset: 0x000077D0
    private void OnEnable()
    {
        bool flag = !string.IsNullOrEmpty(this.modelOverride);

        if (flag)
        {
            global::UnityEngine.Debug.Log("Model override is really only meant to be used in the scene view for lining things up; using it at runtime is discouraged.  Use tracked device index instead to ensure the correct model is displayed for all users.");
            base.enabled = false;
        }
        else
        {
            global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
            bool flag2 = system != null && system.IsTrackedDeviceConnected((uint)this.index);
            if (flag2)
            {
                this.UpdateModel();
            }
            global::SteamVR_Utils.Event.Listen("device_connected", new global::SteamVR_Utils.Event.Handler(this.OnDeviceConnected));
            global::SteamVR_Utils.Event.Listen("hide_render_models", new global::SteamVR_Utils.Event.Handler(this.OnHideRenderModels));
            global::SteamVR_Utils.Event.Listen("ModelSkinSettingsHaveChanged", new global::SteamVR_Utils.Event.Handler(this.OnModelSkinSettingsHaveChanged));
        }
    }
    // Token: 0x0600005D RID: 93 RVA: 0x00004138 File Offset: 0x00002338
    public void Refresh()
    {
        int i = 0;

        global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
        bool flag = system != null;

        if (flag)
        {
            this.leftIndex  = system.GetTrackedDeviceIndexForControllerRole(global::Valve.VR.ETrackedControllerRole.LeftHand);
            this.rightIndex = system.GetTrackedDeviceIndexForControllerRole(global::Valve.VR.ETrackedControllerRole.RightHand);
        }
        bool flag2 = this.leftIndex == uint.MaxValue && this.rightIndex == uint.MaxValue;

        if (flag2)
        {
            uint num = 0U;
            while ((ulong)num < (ulong)((long)this.connected.Length))
            {
                bool flag3 = this.connected[(int)num];
                if (flag3)
                {
                    this.SetTrackedDeviceIndex(i++, num);
                    break;
                }
                num += 1U;
            }
        }
        else
        {
            this.SetTrackedDeviceIndex(i++, ((ulong)this.rightIndex < (ulong)((long)this.connected.Length) && this.connected[(int)this.rightIndex]) ? this.rightIndex : uint.MaxValue);
            this.SetTrackedDeviceIndex(i++, ((ulong)this.leftIndex < (ulong)((long)this.connected.Length) && this.connected[(int)this.leftIndex]) ? this.leftIndex : uint.MaxValue);
            bool flag4 = this.leftIndex != uint.MaxValue && this.rightIndex != uint.MaxValue;
            if (flag4)
            {
                uint num2 = 0U;
                while ((ulong)num2 < (ulong)((long)this.connected.Length))
                {
                    bool flag5 = i >= this.objects.Length;
                    if (flag5)
                    {
                        break;
                    }
                    bool flag6 = !this.connected[(int)num2];
                    if (!flag6)
                    {
                        bool flag7 = num2 != this.leftIndex && num2 != this.rightIndex;
                        if (flag7)
                        {
                            this.SetTrackedDeviceIndex(i++, num2);
                        }
                    }
                    num2 += 1U;
                }
            }
        }
        while (i < this.objects.Length)
        {
            this.SetTrackedDeviceIndex(i++, uint.MaxValue);
        }
    }
Пример #10
0
    // 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);
    }
Пример #11
0
    // Token: 0x06000090 RID: 144 RVA: 0x000068FC File Offset: 0x00004AFC
    private void OnGUI()
    {
        bool flag = this.overlay == null;

        if (!flag)
        {
            global::UnityEngine.RenderTexture renderTexture = this.overlay.texture as global::UnityEngine.RenderTexture;
            global::UnityEngine.RenderTexture active        = global::UnityEngine.RenderTexture.active;
            global::UnityEngine.RenderTexture.active = renderTexture;
            bool flag2 = global::UnityEngine.Event.current.type == 7;
            if (flag2)
            {
                global::UnityEngine.GL.Clear(false, true, global::UnityEngine.Color.clear);
            }
            global::UnityEngine.Rect rect;
            rect..ctor(0f, 0f, (float)renderTexture.width, (float)renderTexture.height);
            bool flag3 = global::UnityEngine.Screen.width < renderTexture.width;
            if (flag3)
            {
                rect.width = (float)global::UnityEngine.Screen.width;
                this.overlay.uvOffset.x = -(float)(renderTexture.width - global::UnityEngine.Screen.width) / (float)(2 * renderTexture.width);
            }
            bool flag4 = global::UnityEngine.Screen.height < renderTexture.height;
            if (flag4)
            {
                rect.height             = (float)global::UnityEngine.Screen.height;
                this.overlay.uvOffset.y = (float)(renderTexture.height - global::UnityEngine.Screen.height) / (float)(2 * renderTexture.height);
            }
            global::UnityEngine.GUILayout.BeginArea(rect);
            bool flag5 = this.background != null;
            if (flag5)
            {
                global::UnityEngine.GUI.DrawTexture(new global::UnityEngine.Rect((rect.width - (float)this.background.width) / 2f, (rect.height - (float)this.background.height) / 2f, (float)this.background.width, (float)this.background.height), this.background);
            }
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.FlexibleSpace();
            global::UnityEngine.GUILayout.BeginVertical(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool flag6 = this.logo != null;
            if (flag6)
            {
                global::UnityEngine.GUILayout.Space(rect.height / 2f - this.logoHeight);
                global::UnityEngine.GUILayout.Box(this.logo, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            }
            global::UnityEngine.GUILayout.Space(this.menuOffset);
            bool flag7 = global::UnityEngine.GUILayout.Button("[Esc] - Close menu", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.Label(string.Format("Scale: {0:N4}", this.scale), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            float num   = global::UnityEngine.GUILayout.HorizontalSlider(this.scale, this.scaleLimits.x, this.scaleLimits.y, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool  flag8 = num != this.scale;
            if (flag8)
            {
                this.SetScale(num);
            }
            global::UnityEngine.GUILayout.EndHorizontal();
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.Label(string.Format("Scale limits:", global::System.Array.Empty <object>()), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            string text  = global::UnityEngine.GUILayout.TextField(this.scaleLimitX, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool   flag9 = text != this.scaleLimitX;
            if (flag9)
            {
                bool flag10 = float.TryParse(text, ref this.scaleLimits.x);
                if (flag10)
                {
                    this.scaleLimitX = text;
                }
            }
            string text2  = global::UnityEngine.GUILayout.TextField(this.scaleLimitY, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool   flag11 = text2 != this.scaleLimitY;
            if (flag11)
            {
                bool flag12 = float.TryParse(text2, ref this.scaleLimits.y);
                if (flag12)
                {
                    this.scaleLimitY = text2;
                }
            }
            global::UnityEngine.GUILayout.EndHorizontal();
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.Label(string.Format("Scale rate:", global::System.Array.Empty <object>()), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            string text3  = global::UnityEngine.GUILayout.TextField(this.scaleRateText, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool   flag13 = text3 != this.scaleRateText;
            if (flag13)
            {
                bool flag14 = float.TryParse(text3, ref this.scaleRate);
                if (flag14)
                {
                    this.scaleRateText = text3;
                }
            }
            global::UnityEngine.GUILayout.EndHorizontal();
            bool active2 = global::SteamVR.active;
            if (active2)
            {
                global::SteamVR instance = global::SteamVR.instance;
                global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                float sceneResolutionScale = global::SteamVR_Camera.sceneResolutionScale;
                int   num2 = (int)(instance.sceneWidth * sceneResolutionScale);
                int   num3 = (int)(instance.sceneHeight * sceneResolutionScale);
                int   num4 = (int)(100f * sceneResolutionScale);
                global::UnityEngine.GUILayout.Label(string.Format("Scene quality: {0}x{1} ({2}%)", num2, num3, num4), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                int  num5   = global::UnityEngine.Mathf.RoundToInt(global::UnityEngine.GUILayout.HorizontalSlider((float)num4, 50f, 200f, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>()));
                bool flag15 = num5 != num4;
                if (flag15)
                {
                    global::SteamVR_Camera.sceneResolutionScale = (float)num5 / 100f;
                }
                global::UnityEngine.GUILayout.EndHorizontal();
            }
            this.overlay.highquality = global::UnityEngine.GUILayout.Toggle(this.overlay.highquality, "High quality", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool highquality = this.overlay.highquality;
            if (highquality)
            {
                this.overlay.curved    = global::UnityEngine.GUILayout.Toggle(this.overlay.curved, "Curved overlay", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                this.overlay.antialias = global::UnityEngine.GUILayout.Toggle(this.overlay.antialias, "Overlay RGSS(2x2)", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            }
            else
            {
                this.overlay.curved    = false;
                this.overlay.antialias = false;
            }
            global::SteamVR_Camera steamVR_Camera = global::SteamVR_Render.Top();
            bool flag16 = steamVR_Camera != null;
            if (flag16)
            {
                steamVR_Camera.wireframe = global::UnityEngine.GUILayout.Toggle(steamVR_Camera.wireframe, "Wireframe", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                global::SteamVR_Render instance2 = global::SteamVR_Render.instance;
                bool flag17 = instance2.trackingSpace == global::Valve.VR.ETrackingUniverseOrigin.TrackingUniverseSeated;
                if (flag17)
                {
                    bool flag18 = global::UnityEngine.GUILayout.Button("Switch to Standing", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                    if (flag18)
                    {
                        instance2.trackingSpace = global::Valve.VR.ETrackingUniverseOrigin.TrackingUniverseStanding;
                    }
                    bool flag19 = global::UnityEngine.GUILayout.Button("Center View", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                    if (flag19)
                    {
                        global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
                        bool flag20 = system != null;
                        if (flag20)
                        {
                            system.ResetSeatedZeroPose();
                        }
                    }
                }
                else
                {
                    bool flag21 = global::UnityEngine.GUILayout.Button("Switch to Seated", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                    if (flag21)
                    {
                        instance2.trackingSpace = global::Valve.VR.ETrackingUniverseOrigin.TrackingUniverseSeated;
                    }
                }
            }
            bool flag22 = global::UnityEngine.GUILayout.Button("Exit", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            if (flag22)
            {
                global::UnityEngine.Application.Quit();
            }
            global::UnityEngine.GUILayout.Space(this.menuOffset);
            string environmentVariable = global::System.Environment.GetEnvironmentVariable("VR_OVERRIDE");
            bool   flag23 = environmentVariable != null;
            if (flag23)
            {
                global::UnityEngine.GUILayout.Label("VR_OVERRIDE=" + environmentVariable, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            }
            global::UnityEngine.GUILayout.Label("Graphics device: " + global::UnityEngine.SystemInfo.graphicsDeviceVersion, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.EndVertical();
            global::UnityEngine.GUILayout.FlexibleSpace();
            global::UnityEngine.GUILayout.EndHorizontal();
            global::UnityEngine.GUILayout.EndArea();
            bool flag24 = this.cursor != null;
            if (flag24)
            {
                float x    = global::UnityEngine.Input.mousePosition.x;
                float num6 = (float)global::UnityEngine.Screen.height - global::UnityEngine.Input.mousePosition.y;
                float num7 = (float)this.cursor.width;
                float num8 = (float)this.cursor.height;
                global::UnityEngine.GUI.DrawTexture(new global::UnityEngine.Rect(x, num6, num7, num8), this.cursor);
            }
            global::UnityEngine.RenderTexture.active = active;
            bool flag25 = flag7;
            if (flag25)
            {
                this.HideMenu();
            }
        }
    }
Пример #12
0
    // Token: 0x060000BF RID: 191 RVA: 0x00008760 File Offset: 0x00006960
    private void Update()
    {
        bool flag = this.cameras.Length == 0;

        if (flag)
        {
            base.enabled = false;
        }
        else
        {
            global::SteamVR_Utils.QueueEventOnRenderThread(201510024);
            global::SteamVR_Controller.Update();
            global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
            bool flag2 = system != null;
            if (flag2)
            {
                global::Valve.VR.VREvent_t vrevent_t = default(global::Valve.VR.VREvent_t);
                uint uncbVREvent = (uint)global::System.Runtime.InteropServices.Marshal.SizeOf(typeof(global::Valve.VR.VREvent_t));
                int  i           = 0;
                while (i < 64)
                {
                    bool flag3 = !system.PollNextEvent(ref vrevent_t, uncbVREvent);
                    if (flag3)
                    {
                        break;
                    }
                    global::Valve.VR.EVREventType eventType    = (global::Valve.VR.EVREventType)vrevent_t.eventType;
                    global::Valve.VR.EVREventType evreventType = eventType;
                    if (evreventType <= global::Valve.VR.EVREventType.VREvent_InputFocusReleased)
                    {
                        if (evreventType != global::Valve.VR.EVREventType.VREvent_InputFocusCaptured)
                        {
                            if (evreventType != global::Valve.VR.EVREventType.VREvent_InputFocusReleased)
                            {
                                goto IL_16D;
                            }
                            bool flag4 = vrevent_t.data.process.pid == 0U;
                            if (flag4)
                            {
                                global::SteamVR_Utils.Event.Send("input_focus", new object[]
                                {
                                    true
                                });
                            }
                        }
                        else
                        {
                            bool flag5 = vrevent_t.data.process.oldPid == 0U;
                            if (flag5)
                            {
                                global::SteamVR_Utils.Event.Send("input_focus", new object[]
                                {
                                    false
                                });
                            }
                        }
                    }
                    else if (evreventType != global::Valve.VR.EVREventType.VREvent_HideRenderModels)
                    {
                        if (evreventType != global::Valve.VR.EVREventType.VREvent_ShowRenderModels)
                        {
                            goto IL_16D;
                        }
                        global::SteamVR_Utils.Event.Send("hide_render_models", new object[]
                        {
                            false
                        });
                    }
                    else
                    {
                        global::SteamVR_Utils.Event.Send("hide_render_models", new object[]
                        {
                            true
                        });
                    }
IL_1B3:
                    i++;
                    continue;
IL_16D:
                    string name = global::System.Enum.GetName(typeof(global::Valve.VR.EVREventType), vrevent_t.eventType);
                    bool flag6 = name != null;
                    if (flag6)
                    {
                        global::SteamVR_Utils.Event.Send(name.Substring(8), new object[]
                        {
                            vrevent_t
                        });
                    }
                    goto IL_1B3;
                }
            }
            global::UnityEngine.Application.targetFrameRate     = -1;
            global::UnityEngine.Application.runInBackground     = true;
            global::UnityEngine.QualitySettings.maxQueuedFrames = -1;
            global::UnityEngine.QualitySettings.vSyncCount      = 0;
            bool flag7 = this.lockPhysicsUpdateRateToRenderFrequency && global::UnityEngine.Time.timeScale > 0f;
            if (flag7)
            {
                global::SteamVR instance = global::SteamVR.instance;
                bool            flag8    = instance != null;
                if (flag8)
                {
                    global::Valve.VR.Compositor_FrameTiming compositor_FrameTiming = default(global::Valve.VR.Compositor_FrameTiming);
                    compositor_FrameTiming.m_nSize = (uint)global::System.Runtime.InteropServices.Marshal.SizeOf(typeof(global::Valve.VR.Compositor_FrameTiming));
                    instance.compositor.GetFrameTiming(ref compositor_FrameTiming, 0U);
                    global::UnityEngine.Time.fixedDeltaTime   = global::UnityEngine.Time.timeScale / instance.hmd_DisplayFrequency;
                    global::UnityEngine.Time.maximumDeltaTime = global::UnityEngine.Time.fixedDeltaTime * compositor_FrameTiming.m_nNumFramePresents;
                }
            }
        }
    }