Example #1
0
 public ActionsControllerPressManager DirectionAction(PressHandlerDelegate <DirectionActionsPress> handler)
 {
     AddHandler(
         handler,
         DirectionActionsPressComparator,
         ActionsController.DirectionActionPress,
         ActionsController.DirectionActionUnpress);
     return(this);
 }
        private ActionsControllerPressManager AddOutputActionHandler(PressHandlerDelegate <DirectionActionChange> handler, OutputAction outputAction)
        {
            AddHandler(handler,
                       DirectionActionChangeComparator,
                       ActionsController.DirectionActionPressed[outputAction],
                       ActionsController.DirectionActionUnpressed[outputAction]);

            return(this);
        }
Example #3
0
 public ActionsControllerPressManager Menu(PressHandlerDelegate <ButtonPress> handler)
 {
     AddHandler(
         handler,
         ButtonPressComparator,
         ActionsController.MenuPress,
         ActionsController.MenuUnpress);
     return(this);
 }
Example #4
0
        protected void AddHandler <PressEvent>(
            PressHandlerDelegate <PressEvent> handler,
            PressEventComparator <PressEvent> comparator,
            Events.Event <PressEvent> pressEvent,
            Events.Event <PressEvent> unpressEvent
            )
        {
            UnityAction <PressEvent> ephemeralHandler = (PressEvent pEv) =>
            {
                var unpressHandler = handler(pEv);
                UnityAction <PressEvent> ephemeralUnpressHandler = null;
                void cleanupEphemeralUnpressHandler()
                {
                    unpressEvent.Remove(ephemeralUnpressHandler);
                }

                ephemeralUnpressHandler = (PressEvent uEv) =>
                {
                    if (!comparator(pEv, uEv))
                    {
                        return;
                    }

                    unpressHandler(uEv);
                    cleanupEphemeralUnpressHandler();
                    cleanupActions.Remove(cleanupEphemeralUnpressHandler);
                };
                unpressEvent.Listen(ephemeralUnpressHandler);
                cleanupActions.Add(cleanupEphemeralUnpressHandler);
            };

            pressEvent.Listen(ephemeralHandler);

            // Cleanup
            cleanupActions.Add(() =>
            {
                pressEvent.Remove(ephemeralHandler);
            });
        }
 public ActionsControllerPressManager ButtonSecondary(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.ButtonSecondary));
 }
 public ActionsControllerPressManager GrabPinch(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.GrabPinch));
 }
 public ActionsControllerPressManager InteractUI(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.InteractUI));
 }
 public ActionsControllerPressManager ResetSeatedPosition(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.ResetSeatedPosition));;
 }
 public ActionsControllerPressManager FSSTargetCurrentSignal(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.FSSTargetCurrentSignal));
 }
 public ActionsControllerPressManager UITabNext(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.UITabNext));
 }
 public ActionsControllerPressManager UINavigate(PressHandlerDelegate <DirectionActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.UINavigate));
 }
 public ActionsControllerPressManager MenuNestedToggle(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.MenuNestedToggle));
 }
 public ActionsControllerPressManager MenuSelect(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.MenuSelect));
 }
 public ActionsControllerPressManager DirectionPOV2(PressHandlerDelegate <DirectionActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.POV2));
 }
 public ActionsControllerPressManager ButtonPOV1(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.POV1));
 }
 public ActionsControllerPressManager FSSExit(PressHandlerDelegate <ActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.FSSExit));
 }
 public ActionsControllerPressManager FSSSteppedZoom(PressHandlerDelegate <DirectionActionChange> handler)
 {
     return(AddOutputActionHandler(handler, OutputAction.FSSSteppedZoom));
 }