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]))); }
public InputStateEditor(InputEditorViewModel inputEditorViewModel) { this.inputEditorViewModel = inputEditorViewModel; }
//ncrunch: no coverage start public InputTypeEditor(InputEditorViewModel inputEditorViewModel) { this.inputEditorViewModel = inputEditorViewModel; }
public void Init(Service service) { DataContext = new InputEditorViewModel(service); }
//ncrunch: no coverage start public InputKeyAndButtonEditor(InputEditorViewModel inputEditorViewModel) { this.inputEditorViewModel = inputEditorViewModel; }
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); } } }