Exemplo n.º 1
0
 public KBMInputMap()
 {
     //TODO setup some temporary mappings, just for testing
     AxisMappings.Add("NavigateX", new AxisMapping(KeyCode.RightArrow, KeyCode.LeftArrow, KeyCode.D, KeyCode.A, MouseAxis.Undefined, false));
     AxisMappings.Add("NavigateY", new AxisMapping(KeyCode.UpArrow, KeyCode.DownArrow, KeyCode.W, KeyCode.S, MouseAxis.Undefined, false));
     ButtonMappings.Add("Submit", new ButtonMapping(KeyCode.Return, KeyCode.Space, KeyCode.E));
     ButtonMappings.Add("Cancel", new ButtonMapping(KeyCode.Escape, KeyCode.Backspace, KeyCode.None));
 }
 public GameController(Guid id, string name)
 {
     this.Id          = id;
     this.Name        = name;
     this.IsConnected = true;
     foreach (var command in EnumHelper.ToList(typeof(GameControllerButtonCommand)))
     {
         ButtonMappings.Add(new GameControllerButtonMapping((GameControllerButtonCommand)command.Key));
     }
     foreach (var command in EnumHelper.ToList(typeof(GameControllerAxisCommand)))
     {
         AxisMappings.Add(new GameControllerAxisMapping((GameControllerAxisCommand)command.Key, false));
     }
 }
        private void Deserialized(StreamingContext context)
        {
            foreach (var command in EnumHelper.ToList(typeof(GameControllerButtonCommand)))
            {
                if (!ButtonMappings.Any(m => m.Command == (GameControllerButtonCommand)command.Key))
                {
                    ButtonMappings.Add(new GameControllerButtonMapping((GameControllerButtonCommand)command.Key));
                }
            }

            foreach (var command in EnumHelper.ToList(typeof(GameControllerAxisCommand)))
            {
                if (!AxisMappings.Any(m => m.Command == (GameControllerAxisCommand)command.Key))
                {
                    AxisMappings.Add(new GameControllerAxisMapping((GameControllerAxisCommand)command.Key, false));
                }
            }
        }