private void InternalLoad(string xmlData) { try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlData); _name = doc.DocumentElement.Attributes["name"].InnerText; foreach (XmlNode axisNode in doc.DocumentElement) { string name = axisNode.Attributes["name"].InnerText; KeyCode key = (KeyCode)System.Enum.Parse(typeof(KeyCode), axisNode.Attributes["key"].InnerText, true); int joystickAxis = int.Parse(axisNode.Attributes["joystickAxis"].InnerText); MappingWizard.ScanType scanType = (MappingWizard.ScanType)System.Enum.Parse(typeof(MappingWizard.ScanType), axisNode.Attributes["scanType"].InnerText, true); if (scanType == MappingWizard.ScanType.Button) { _axes.Add(new AxisMapping(name, key)); } else { _axes.Add(new AxisMapping(name, joystickAxis)); } } } catch { _name = null; _axes.Clear(); } }
public AxisMapping(string name, int joystickAxis) { _name = name; _joystickAxis = joystickAxis; _key = KeyCode.None; _scanType = MappingWizard.ScanType.Axis; }
public AxisMapping(string name, KeyCode key) { _name = name; _key = key; _joystickAxis = -1; _scanType = MappingWizard.ScanType.Button; }
public MappingWizardItem(string axisName, MappingWizard.ScanType scanType) { _axisName = axisName; _scanType = scanType; }