Example #1
0
 public override Capture ForceEndCapture(InputState input, CaptureData data)
 {
     // do animated dismiss that will destroy menu on completion
     HUDUtil.AnimatedDimiss_Scene(popup, cockpit.Scene, true, 0.2f);
     // lose our reference
     popup = null;
     return(Capture.End);
 }
Example #2
0
        public override Capture UpdateCapture(InputState input, CaptureData data)
        {
            bool       bReleased = false;
            bool       bContinue = false;
            InputEvent e         = null;

            if (input.IsForDevice(InputDevice.Mouse))
            {
                bReleased = input.bRightMouseReleased;
                bContinue = input.bRightMouseDown;
                e         = InputEvent.Mouse(input);
            }
            else if (input.IsForDevice(InputDevice.Gamepad))
            {
                bReleased = input.bRightTriggerReleased;
                bContinue = input.bRightTriggerDown;
                e         = InputEvent.Gamepad(input);
            }
            else if (input.IsForDevice(InputDevice.AnySpatialDevice))
            {
                bReleased =
                    (data.which == CaptureSide.Left && input.bXButtonReleased) ||
                    (data.which == CaptureSide.Right && input.bAButtonReleased);
                bContinue =
                    (data.which == CaptureSide.Left && input.bXButtonDown) ||
                    (data.which == CaptureSide.Right && input.bAButtonDown);
                e = InputEvent.Spatial(data.which, input);
            }


            if (bReleased)
            {
                UIRayHit hit = new UIRayHit();
                if (popup.FindRayIntersection(e.ray, out hit))
                {
                    popup.EndCapture(e);
                }

                // do animated dismiss that will destroy menu on completion
                HUDUtil.AnimatedDimiss_Scene(popup, cockpit.Scene, true, 0.2f);

                // lose our reference
                popup = null;

                return(Capture.End);
            }
            else if (bContinue)
            {
                popup.UpdateCapture(e);
                return(Capture.Continue);
            }
            // should never get here...
            DebugUtil.Log(2, "[RightClickBehavior::UpdateCapture] how did we get here?");
            return(Capture.End);
        }