Example #1
0
        public void Initialize(EnumArray <byte, T> userCommands, RailDriverInputGameComponent inputGameComponent, UserCommandController <T> userCommandController)
        {
            if (null == userCommands)
            {
                throw new ArgumentNullException(nameof(userCommands));
            }

            this.userCommandController = userCommandController ?? throw new ArgumentNullException(nameof(userCommandController));
            this.inputGameComponent    = inputGameComponent ?? throw new ArgumentNullException(nameof(inputGameComponent));

            (T Command, byte CommandValue, bool AvailableForMapping)emergencyCommand = (default, byte.MaxValue, false);
Example #2
0
        public UserCommandController <T> AddTopLayerController()
        {
            if (null == layeredControllers)
            {
                layeredControllers = new List <UserCommandController <T> >();
            }
            UserCommandController <T> layeredController = new UserCommandController <T>();

            layeredControllers.Add(layeredController);
            return(layeredController);
        }
Example #3
0
        public bool TopLayerControllerBringOnTop(UserCommandController <T> commandController)
        {
            int index;

            if (layeredControllers?.Count > 1 && (index = layeredControllers.IndexOf(commandController)) > -1)
            {
                layeredControllers.RemoveAt(index);
                layeredControllers.Add(commandController);
                return(true);
            }
            return(false);
        }
        public void Initialize(MouseInputGameComponent mouseInputGameComponent, KeyboardInputGameComponent keyboardInputGameComponent, UserCommandController <T> userCommandController)
        {
            if (null == mouseInputGameComponent)
            {
                throw new ArgumentNullException(nameof(mouseInputGameComponent));
            }

            this.userCommandController      = userCommandController ?? throw new ArgumentNullException(nameof(userCommandController));
            this.keyboardInputGameComponent = keyboardInputGameComponent;

            mouseInputGameComponent.AddMouseEvent(MouseMovedEventType.MouseMoved, MouseMovedEvent);
            mouseInputGameComponent.AddMouseEvent(MouseButtonEventType.LeftButtonPressed, LeftMouseButtonPressedEvent);
            mouseInputGameComponent.AddMouseEvent(MouseButtonEventType.LeftButtonDown, LeftMouseButtonDownEvent);
            mouseInputGameComponent.AddMouseEvent(MouseButtonEventType.LeftButtonReleased, LeftMouseButtonReleasedEvent);
            mouseInputGameComponent.AddMouseEvent(MouseMovedEventType.MouseMovedLeftButtonDown, MouseDraggedEvent);
            mouseInputGameComponent.AddMouseEvent(MouseButtonEventType.RightButtonPressed, RightMouseButtonPressedEvent);
            mouseInputGameComponent.AddMouseEvent(MouseButtonEventType.RightButtonDown, RightMouseButtonDownEvent);
            mouseInputGameComponent.AddMouseEvent(MouseButtonEventType.RightButtonReleased, RightMouseButtonReleasedEvent);
            mouseInputGameComponent.AddMouseEvent(MouseMovedEventType.MouseMovedRightButtonDown, MouseRightDraggedEvent);
            mouseInputGameComponent.AddMouseEvent(MouseWheelEventType.MouseWheelChanged, MouseWheelEvent);
        }
Example #5
0
 public bool RemoveTopLayerController(UserCommandController <T> commandController)
 {
     return(layeredControllers?.Remove(commandController) ?? false);
 }