예제 #1
0
        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();
            }
        }
예제 #2
0
 public AxisMapping(string name, int joystickAxis)
 {
     _name         = name;
     _joystickAxis = joystickAxis;
     _key          = KeyCode.None;
     _scanType     = MappingWizard.ScanType.Axis;
 }
예제 #3
0
 public AxisMapping(string name, KeyCode key)
 {
     _name         = name;
     _key          = key;
     _joystickAxis = -1;
     _scanType     = MappingWizard.ScanType.Button;
 }
예제 #4
0
		public AxisMapping(string name, int joystickAxis)
		{
			_name = name;
			_joystickAxis = joystickAxis;
			_key = KeyCode.None;
			_scanType = MappingWizard.ScanType.Axis;
		}
예제 #5
0
		public AxisMapping(string name, KeyCode key)
		{
			_name = name;
			_key = key;
			_joystickAxis = -1;
			_scanType = MappingWizard.ScanType.Button;
		}
예제 #6
0
		public MappingWizardItem(string axisName, MappingWizard.ScanType scanType)
		{
			_axisName = axisName;
			_scanType = scanType;
		}
예제 #7
0
 public MappingWizardItem(string axisName, MappingWizard.ScanType scanType)
 {
     _axisName = axisName;
     _scanType = scanType;
 }