private void OnGUI() { //GUILayout.BeginArea(new Rect(10, 10, position.width * 0.15f, position.height)); scroll = GUILayout.BeginScrollView(scroll); GUILayout.BeginHorizontal(); EditorLayout.Button("Add ActionInput", CreateActionInput); EditorLayout.Button("Add AxisInput", CreateAxisInput); EditorLayout.Button("Save Change", SaveChange); GUILayout.EndHorizontal(); EditorLayout.Space(); showActionInput = EditorGUILayout.Foldout(showActionInput, "Actions Input"); DrawAllActionInput(showActionInput); EditorLayout.Space(); showAxisInput = EditorGUILayout.Foldout(showAxisInput, "Axis Input"); DrawAllAxisInput(showAxisInput); GUILayout.EndScrollView(); EditorLayout.Space(); }
private void OnGUI() { currentName = EditorGUILayout.TextField(currentName); EditorLayout.Space(2); EditorGUILayout.BeginHorizontal(); EditorLayout.Button("OK", ValidateChangeName, currentName); EditorLayout.Button("Cancel", Close); EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); UtilityEditor.VersioningTool("TCT", 0, 1, 0, 0); EditorLayout.Space(2); EditorReflectionLayout.TextField(eTarget, "name", "Character Name"); EditorLayout.Space(); EditorLayout.Button("Add Component Character", eTarget.AddComponent, currentComponent); }
void DrawAxisInput(bool _show, TCT_AxisInput _axis) { if (!_show) { return; } if (_axis == null || _axis.AllAxisCode.Count < 1) { return; } for (int i = 0; i < _axis.AllAxisCode.Count; i++) { Enum _currentKeyCode = _axis.AllAxisCode[i]; EditorGUILayout.BeginHorizontal(); EditorGUILayout.Separator(); _currentKeyCode = EditorGUILayout.EnumPopup(_currentKeyCode, GUILayout.MaxWidth(100)); if (_axis.ExistKeyCode((AxisCode)_currentKeyCode) && (AxisCode)_currentKeyCode != _axis.AllAxisCode[i]) { Debug.LogWarning("this Axis is already assign in this Action. Please select an other"); } else { _axis.AllAxisCode[i] = (AxisCode)_currentKeyCode; } GUILayout.Box("Sensibility", GUILayout.MaxWidth(80)); _axis.sensibilty = EditorGUILayout.FloatField(_axis.sensibilty, GUILayout.MaxWidth(50)); GUILayout.Box("DeadZone", GUILayout.MaxWidth(80)); _axis.deadZone = EditorGUILayout.FloatField(_axis.deadZone, GUILayout.MaxWidth(50)); EditorLayout.Button("x", RemoveAxisCode, _axis, (AxisCode)_currentKeyCode); EditorGUILayout.EndHorizontal(); EditorLayout.Space(); } }
void DrawKeysActionInput(bool _show, TCT_ActionInput _action) { if (!_show) { return; } if (_action == null || _action.AllKeyCodes.Count < 1) { return; } for (int i = 0; i < _action.AllKeyCodes.Count; i++) { Enum _currentKeyCode = _action.AllKeyCodes[i]; EditorGUILayout.BeginHorizontal(); EditorGUILayout.Separator(); EditorLayout.EnumPopup(ref _currentKeyCode, ""); if (_action.ExistKeyCode((KeyCode)_currentKeyCode) && (KeyCode)_currentKeyCode != _action.AllKeyCodes[i]) { Debug.LogWarning("this Key is already assign in this Action. Please select an other"); } else { _action.AllKeyCodes[i] = (KeyCode)_currentKeyCode; } EditorLayout.Button("x", RemoveKeyCode, _action, (KeyCode)_currentKeyCode); EditorGUILayout.EndHorizontal(); EditorLayout.Space(); } }
void DrawAllActionInput(bool _show) { if (!_show || allActionInput.Count < 1) { return; } for (int i = 0; i < allActionInput.Count; i++) { bool _showInputs = allActionInput[i].editorUtility.show; GUILayout.BeginHorizontal(); EditorGUILayout.Separator(); allActionInput[i].editorUtility.show = EditorGUILayout.Foldout(_showInputs, allActionInput[i].name); EditorLayout.Button("...", RenameInput, allActionInput[i]); EditorLayout.Button("+", AddKeyInAction, allActionInput[i], KeyCode.None); EditorLayout.Button("x", RemoveActionInput, allActionInput[i]); GUILayout.EndHorizontal(); EditorLayout.Space(); if (allActionInput.Count <= i) { return; } DrawKeysActionInput(_showInputs, allActionInput[i]); EditorLayout.Space(); } }