private void createInputAxis(string aName, InputDevice aDevice, string aPositiveInput, string aNegativeInput) { InputAxis axis = new InputAxis(aName); axis.deviceType = aDevice; axis.player = InputPlayer.ANY; axis.setPositiveKey(aPositiveInput, KeyCode.None); axis.setNegativeKey(aNegativeInput, KeyCode.None); axis.resetOnRelease = true; if (axis.validatePositiveKey() == false) { Debug.LogWarning("Failed to validate InputKey. InputDevice: " + aDevice + ". Positive Input:" + aPositiveInput + ". Negative Input:" + aNegativeInput); } m_Axis.Add(axis); }
private bool drawAxis(InputAxis aAxis, int aIndex) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField((aIndex + 1) + PERIOD + aAxis.name, EditorStyles.boldLabel, GUILayout.Width(190.0f)); if (aAxis.foldOut == true && GUILayout.Button(HIDE, GUILayout.Width(100.0f))) { aAxis.foldOut = false; } else if (aAxis.foldOut == false && GUILayout.Button(SHOW, GUILayout.Width(100.0f))) { aAxis.foldOut = true; } if (GUILayout.Button(DELETE, GUILayout.Width(100.0f))) { return true; } EditorGUILayout.EndHorizontal(); if (aAxis.foldOut == true) { float width = 400.0f; //Draw it... aAxis.name = EditorGUILayout.TextField(NAME, aAxis.name, GUILayout.Width(width)); aAxis.speed = EditorGUILayout.FloatField(SPEED, aAxis.speed, GUILayout.Width(width)); aAxis.deviceType = (InputDevice)EditorGUILayout.EnumPopup(DEVICE, aAxis.deviceType, GUILayout.Width(width)); aAxis.player = (InputPlayer)EditorGUILayout.EnumPopup(PLAYER, aAxis.player, GUILayout.Width(width)); aAxis.resetOnRelease = EditorGUILayout.Toggle(RESET_ON_RELEASE, aAxis.resetOnRelease, GUILayout.Width(width)); EditorGUILayout.LabelField(POSITIVE_KEY, EditorStyles.boldLabel, GUILayout.Width(width)); KeyCode modifier = KeyCode.None; string inputName = string.Empty; aAxis.getPositiveKey(out inputName, out modifier); inputName = EditorGUILayout.TextField(INPUT_NAME, inputName, GUILayout.Width(width)); InputModifierKey mod = (InputModifierKey)EditorGUILayout.EnumPopup(MODIFIER, InputUtilities.parseModifierKey(modifier), GUILayout.Width(width)); aAxis.setPositiveKey(inputName, InputUtilities.parseModifierKey(mod)); EditorGUILayout.LabelField(NEGATIVE_KEY, EditorStyles.boldLabel, GUILayout.Width(width)); aAxis.getNegativeKey(out inputName, out modifier); inputName = EditorGUILayout.TextField(INPUT_NAME, inputName, GUILayout.Width(width)); mod = (InputModifierKey)EditorGUILayout.EnumPopup(MODIFIER, InputUtilities.parseModifierKey(modifier), GUILayout.Width(width)); aAxis.setNegativeKey(inputName, InputUtilities.parseModifierKey(mod)); } return false; }