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])));
        }
예제 #3
0
		public InputStateEditor(InputEditorViewModel inputEditorViewModel)
		{
			this.inputEditorViewModel = inputEditorViewModel;
		}
예제 #4
0
 //ncrunch: no coverage start
 public InputTypeEditor(InputEditorViewModel inputEditorViewModel)
 {
     this.inputEditorViewModel = inputEditorViewModel;
 }
예제 #5
0
 public void Init(Service service)
 {
     DataContext = new InputEditorViewModel(service);
 }
예제 #6
0
 //ncrunch: no coverage start
 public InputKeyAndButtonEditor(InputEditorViewModel inputEditorViewModel)
 {
     this.inputEditorViewModel = inputEditorViewModel;
 }
예제 #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);
				}
			}
		}
예제 #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;
		}
예제 #10
0
		public void Init(Service service)
		{
			DataContext = new InputEditorViewModel(service);
		}