コード例 #1
0
ファイル: MappingWizard.cs プロジェクト: lfdelta/Nid3D
 private void WriteMappingResult(AxisMapping result, XmlWriter writer)
 {
     writer.WriteStartElement("Axis");
     writer.WriteAttributeString("name", result.Name);
     writer.WriteAttributeString("key", result.Key.ToString());
     writer.WriteAttributeString("joystickAxis", result.JoystickAxis.ToString());
     writer.WriteAttributeString("scanType", result.ScanType.ToString());
     writer.WriteEndElement();
 }
コード例 #2
0
ファイル: MappingWizard.cs プロジェクト: lfdelta/Nid3D
        private void DisplayCurrentTestItem()
        {
            string description = string.Format("{0} <b>{1}</b>", _items[_currentItem].ScanType == ScanType.Button ? "Press" : "Move",
                                               _items[_currentItem].AxisName);

            GUI.Label(new Rect(0.0f, 0.0f, Screen.width, 25.0f), description, "centered_label");

            if (_items[_currentItem].ScanType == ScanType.Button && _lastKeyCode != KeyCode.None)
            {
                GUI.Label(new Rect(0.0f, 0.0f, Screen.width, Screen.height),
                          string.Format("<color=lime><size=30><b>{0}</b></size></color>", _lastKeyCode),
                          "centered_label");
            }
            else if (_items[_currentItem].ScanType == ScanType.Axis && _lastAxis >= 0)
            {
                GUI.Label(new Rect(0.0f, 0.0f, Screen.width, Screen.height),
                          string.Format("<color=lime><size=30><b>{0}</b></size></color>", _axisDisplayNames[_lastAxis]),
                          "centered_label");
            }

            GUI.Label(new Rect(Screen.width - 100.0f, Screen.height - 34.0f, 100.0f, 24.0f), (_currentItem + 1) + "/" + _items.Length, "centered_label");

            GUI.enabled = _items[_currentItem].ScanType == ScanType.Button && _lastKeyCode != KeyCode.None ||
                          _items[_currentItem].ScanType == ScanType.Axis && _lastAxis >= 0;
            Rect buttonPosition = new Rect(Screen.width / 2 - 100.0f, Screen.height - 34.0f, 200.0f, 24.0f);

            if (GUI.Button(buttonPosition, "Continue"))
            {
                if (_items[_currentItem].ScanType == ScanType.Button)
                {
                    _results[_currentItem] = new AxisMapping(_items[_currentItem].AxisName, _lastKeyCode);
                }
                else
                {
                    _results[_currentItem] = new AxisMapping(_items[_currentItem].AxisName, _lastAxis);
                }
                _currentItem++;
                _lastKeyCode = KeyCode.None;
                _lastAxis    = -1;
            }

            GUI.enabled = true;
        }
コード例 #3
0
		private void WriteMappingResult(AxisMapping result, XmlWriter writer)
		{
			writer.WriteStartElement("Axis");
			writer.WriteAttributeString("name", result.Name);
			writer.WriteAttributeString("key", result.Key.ToString());
			writer.WriteAttributeString("joystickAxis", result.JoystickAxis.ToString());
			writer.WriteAttributeString("scanType", result.ScanType.ToString());
			writer.WriteEndElement();
		}
コード例 #4
0
		private void DisplayCurrentTestItem()
		{
			string description = string.Format("{0} <b>{1}</b>", _items[_currentItem].ScanType == ScanType.Button ? "Press" : "Move",
			                                   _items[_currentItem].AxisName);
			GUI.Label(new Rect(0.0f, 0.0f, Screen.width, 25.0f), description, "centered_label");

			if(_items[_currentItem].ScanType == ScanType.Button && _lastKeyCode != KeyCode.None)
			{
				GUI.Label(new Rect(0.0f, 0.0f, Screen.width, Screen.height), 
				          string.Format("<color=lime><size=30><b>{0}</b></size></color>", _lastKeyCode), 
				          "centered_label");
			}
			else if(_items[_currentItem].ScanType == ScanType.Axis && _lastAxis >= 0)
			{
				GUI.Label(new Rect(0.0f, 0.0f, Screen.width, Screen.height), 
				          string.Format("<color=lime><size=30><b>{0}</b></size></color>", _axisDisplayNames[_lastAxis]), 
				          "centered_label");
			}

			GUI.Label(new Rect(Screen.width - 100.0f, Screen.height - 34.0f, 100.0f, 24.0f), (_currentItem + 1) + "/" + _items.Length, "centered_label");

			GUI.enabled = _items[_currentItem].ScanType == ScanType.Button && _lastKeyCode != KeyCode.None ||
							_items[_currentItem].ScanType == ScanType.Axis && _lastAxis >= 0;
			Rect buttonPosition = new Rect(Screen.width / 2 - 100.0f, Screen.height - 34.0f, 200.0f, 24.0f);
			if(GUI.Button(buttonPosition, "Continue"))
			{
				if(_items[_currentItem].ScanType == ScanType.Button)
				{
					_results[_currentItem] = new AxisMapping(_items[_currentItem].AxisName, _lastKeyCode);
				}
				else
				{
					_results[_currentItem] = new AxisMapping(_items[_currentItem].AxisName, _lastAxis);
				}
				_currentItem++;
				_lastKeyCode = KeyCode.None;
				_lastAxis = -1;
			}

			GUI.enabled = true;
		}