public static void LoadInput(InputEditorViewModel editor)
        {
            var metadataXml =
                XDocument.Load(Path.Combine("Content/" + editor.service.ProjectName, "InputCommands.xml"));

            foreach (XElement contentElement in metadataXml.Root.Elements())
            {
                var commandName = contentElement.FirstAttribute;
                editor.NewCommand = commandName.Value;
                editor.AddNewCommand();
                foreach (var element in contentElement.Elements())
                {
                    if (element.Name == "KeyTrigger")
                    {
                        LoadKeyCommand(element, editor, commandName.Value);
                    }
                    if (element.Name == "MouseButtonTrigger")
                    {
                        LoadMouseCommand(element, editor, commandName.Value);
                    }
                    if (element.Name == "GamePadButtonTrigger")
                    {
                        LoadGamepadCommand(element, editor, commandName.Value);
                    }
                }
            }
        }
        private static void LoadGamepadCommand(XElement element, InputEditorViewModel editor,
                                               string commandName)
        {
            var valueSplit = element.Value.Split(' ');

            editor.availableCommands.AddTrigger(commandName,
                                                ((GamePadButton)Enum.Parse(typeof(GamePadButton), valueSplit[0])),
                                                ((State)Enum.Parse(typeof(State), valueSplit[0])));
        }
Exemplo n.º 3
0
		public InputStateEditor(InputEditorViewModel inputEditorViewModel)
		{
			this.inputEditorViewModel = inputEditorViewModel;
		}
Exemplo n.º 4
0
 //ncrunch: no coverage start
 public InputTypeEditor(InputEditorViewModel inputEditorViewModel)
 {
     this.inputEditorViewModel = inputEditorViewModel;
 }
Exemplo n.º 5
0
 public void Init(Service service)
 {
     DataContext = new InputEditorViewModel(service);
 }
Exemplo n.º 6
0
 //ncrunch: no coverage start
 public InputKeyAndButtonEditor(InputEditorViewModel inputEditorViewModel)
 {
     this.inputEditorViewModel = inputEditorViewModel;
 }
Exemplo n.º 7
0
		public static void LoadInput(InputEditorViewModel editor)
		{
			var metadataXml =
				XDocument.Load(Path.Combine("Content/" + editor.service.ProjectName, "InputCommands.xml"));
			foreach (XElement contentElement in metadataXml.Root.Elements())
			{
				var commandName = contentElement.FirstAttribute;
				editor.NewCommand = commandName.Value;
				editor.AddNewCommand();
				foreach (var element in contentElement.Elements())
				{
					if (element.Name == "KeyTrigger")
						LoadKeyCommand(element, editor, commandName.Value);
					if (element.Name == "MouseButtonTrigger")
						LoadMouseCommand(element, editor, commandName.Value);
					if (element.Name == "GamePadButtonTrigger")
						LoadGamepadCommand(element, editor, commandName.Value);
				}
			}
		}
Exemplo n.º 8
0
		private static void LoadGamepadCommand(XElement element, InputEditorViewModel editor,
			string commandName)
		{
			var valueSplit = element.Value.Split(' ');
			editor.availableCommands.AddTrigger(commandName,
				((GamePadButton)Enum.Parse(typeof(GamePadButton), valueSplit[0])),
				((State)Enum.Parse(typeof(State), valueSplit[0])));
		}
		//ncrunch: no coverage start
		public InputKeyAndButtonEditor(InputEditorViewModel inputEditorViewModel)
		{
			this.inputEditorViewModel = inputEditorViewModel;
		}
Exemplo n.º 10
0
		public void Init(Service service)
		{
			DataContext = new InputEditorViewModel(service);
		}