Example #1
0
 public VRGamepadUIBehavior(FContext scene)
 {
     this.scene  = scene;
     pCapturing  = null;
     Priority    = 0;
     ActiveInput = WhichInput.LeftTrigger;
 }
Example #2
0
 public override Capture ForceEndCapture(InputState input, CaptureData data)
 {
     if (pCapturing != null)
     {
         pCapturing.EndCapture(InputEvent.Gamepad(input));
         pCapturing  = null;
         ActiveInput = WhichInput.None;
     }
     return(Capture.End);
 }
Example #3
0
        public override CaptureRequest WantsCapture(InputState input)
        {
            UIRayHit uiHit;

            if (input.bLeftTriggerPressed || input.bAButtonPressed)
            {
                ActiveInput = (input.bLeftTriggerPressed) ? WhichInput.LeftTrigger : WhichInput.AButton;
                if (scene.FindUIHit(input.vGamepadWorldRay, out uiHit))
                {
                    bool bCanCapture = uiHit.hitUI.WantsCapture(InputEvent.Gamepad(input, new AnyRayHit(uiHit)));
                    if (bCanCapture)
                    {
                        return(CaptureRequest.Begin(this));
                    }
                }
            }
            return(CaptureRequest.Ignore);
        }
Example #4
0
        public override Capture BeginCapture(InputState input, CaptureSide eWhich)
        {
            pCapturing = null;

            UIRayHit uiHit;

            if (input.bLeftTriggerPressed || input.bAButtonPressed)
            {
                ActiveInput = (input.bLeftTriggerPressed) ? WhichInput.LeftTrigger : WhichInput.AButton;
                if (scene.FindUIHit(input.vGamepadWorldRay, out uiHit))
                {
                    bool bCanCapture = uiHit.hitUI.BeginCapture(InputEvent.Gamepad(input, new AnyRayHit(uiHit)));
                    if (bCanCapture)
                    {
                        pCapturing = uiHit.hitUI;
                        return(Capture.Begin(this));
                    }
                }
            }
            return(Capture.Ignore);
        }
Example #5
0
 public override Capture UpdateCapture(InputState input, CaptureData data)
 {
     if ((ActiveInput == WhichInput.LeftTrigger && input.bLeftTriggerDown) ||
         (ActiveInput == WhichInput.AButton && input.bAButtonDown))
     {
         pCapturing.UpdateCapture(InputEvent.Gamepad(input));
         return(Capture.Continue);
     }
     else if ((ActiveInput == WhichInput.LeftTrigger && input.bLeftTriggerReleased) ||
              (ActiveInput == WhichInput.AButton && input.bAButtonReleased))
     {
         pCapturing.EndCapture(InputEvent.Gamepad(input));
         pCapturing  = null;
         ActiveInput = WhichInput.None;
         return(Capture.End);
     }
     else
     {
         // [RMS] can end up here sometimes in Gamepad if we do camera controls
         //   while we are capturing...
         ActiveInput = WhichInput.None;
         return(Capture.End);
     }
 }