Esempio n. 1
0
        // Token: 0x0600045C RID: 1116 RVA: 0x00015B58 File Offset: 0x00013D58
        protected override void OnUpdate()
        {
            base.OnUpdate();
            global::SteamVR_Controller.Device controller = base.Controller;
            bool pressDown = controller.GetPressDown(12884901888UL);

            if (pressDown)
            {
                global::VRGIN.Core.VR.Input.Mouse.LeftButtonDown();
                this.pressDownTime = global::UnityEngine.Time.unscaledTime;
            }
            bool pressUp = controller.GetPressUp(4UL);

            if (pressUp)
            {
                bool flag = this.Gui;
                if (flag)
                {
                    this.AbandonGUI();
                }
                else
                {
                    this.TakeGUI(global::System.Linq.Enumerable.FirstOrDefault <global::VRGIN.Visuals.GUIQuad>(global::VRGIN.Visuals.GUIQuadRegistry.Quads, (global::VRGIN.Visuals.GUIQuad q) => !q.IsOwned));
                }
            }
            bool touchDown = controller.GetTouchDown(4294967296UL);

            if (touchDown)
            {
                this.touchDownPosition      = controller.GetAxis(global::Valve.VR.EVRButtonId.k_EButton_Axis0);
                this.touchDownMousePosition = global::VRGIN.Native.MouseOperations.GetClientCursorPosition();
            }
            bool flag2 = controller.GetTouch(4294967296UL) && global::UnityEngine.Time.unscaledTime - this.pressDownTime > 0.3f;

            if (flag2)
            {
                global::UnityEngine.Vector2 axis   = controller.GetAxis(global::Valve.VR.EVRButtonId.k_EButton_Axis0);
                global::UnityEngine.Vector2 vector = axis - ((global::VRGIN.Core.VR.HMD == global::VRGIN.Core.HMDType.Oculus) ? global::UnityEngine.Vector2.zero : this.touchDownPosition);
                float num = (global::VRGIN.Core.VR.HMD == global::VRGIN.Core.HMDType.Oculus) ? (global::UnityEngine.Time.unscaledDeltaTime * 5f) : 1f;
                this._DeltaX += (double)(vector.x * (float)global::VRGIN.Core.VRGUI.Width) * 0.1 * (double)num;
                this._DeltaY += (double)(-(double)vector.y * (float)global::VRGIN.Core.VRGUI.Height) * 0.2 * (double)num;
                int num2 = (int)((this._DeltaX > 0.0) ? global::System.Math.Floor(this._DeltaX) : global::System.Math.Ceiling(this._DeltaX));
                int num3 = (int)((this._DeltaY > 0.0) ? global::System.Math.Floor(this._DeltaY) : global::System.Math.Ceiling(this._DeltaY));
                this._DeltaX -= (double)num2;
                this._DeltaY -= (double)num3;
                global::VRGIN.Core.VR.Input.Mouse.MoveMouseBy(num2, num3);
                this.touchDownPosition = axis;
            }
            bool pressUp2 = controller.GetPressUp(12884901888UL);

            if (pressUp2)
            {
                global::VRGIN.Core.VR.Input.Mouse.LeftButtonUp();
                this.pressDownTime = 0f;
            }
        }
Esempio n. 2
0
        // Token: 0x06000424 RID: 1060 RVA: 0x00014B00 File Offset: 0x00012D00
        protected override void OnUpdate()
        {
            base.OnUpdate();
            global::SteamVR_Controller.Device device = global::SteamVR_Controller.Input((int)this.Tracking.index);
            bool flag = this._Lock != null && this._Lock.IsInvalidating;

            if (flag)
            {
                this.TryReleaseLock();
            }
            bool flag2 = this._Lock == null || !this._Lock.IsValid;

            if (flag2)
            {
                bool pressDown = device.GetPressDown(global::Valve.VR.EVRButtonId.k_EButton_ApplicationMenu);
                if (pressDown)
                {
                    this.appButtonPressTime = new float?(global::UnityEngine.Time.unscaledTime);
                }
                bool flag3;
                if (device.GetPress(global::Valve.VR.EVRButtonId.k_EButton_ApplicationMenu))
                {
                    float?num  = global::UnityEngine.Time.unscaledTime - this.appButtonPressTime;
                    float num2 = 0.5f;
                    flag3 = (num.GetValueOrDefault() > num2 & num != null);
                }
                else
                {
                    flag3 = false;
                }
                bool flag4 = flag3;
                if (flag4)
                {
                    this.ShowHelp();
                    this.appButtonPressTime = default(float?);
                }
                bool pressUp = device.GetPressUp(global::Valve.VR.EVRButtonId.k_EButton_ApplicationMenu);
                if (pressUp)
                {
                    bool flag5 = this.helpShown;
                    if (flag5)
                    {
                        this.HideHelp();
                    }
                    else
                    {
                        bool flag6 = this.ActiveTool;
                        if (flag6)
                        {
                            this.ActiveTool.enabled = false;
                        }
                        this.ToolIndex = (this.ToolIndex + 1) % this.Tools.Count;
                        bool flag7 = this.ActiveTool;
                        if (flag7)
                        {
                            this.ActiveTool.enabled = true;
                        }
                    }
                    this.appButtonPressTime = default(float?);
                }
            }
        }