////////////////////// CREATE STATE GUI /////////////////////// /// <summary> /// Creates the state GUI. /// </summary> /// <param name="name">State Name.</param> /// <param name="hash">State Hash.</param> void createInputStateGUI(string name, int hash) { InputCombination[] combinations; string currentCombinationString; GUILayout.BeginHorizontal(); GUILayout.Label(name, _stateNameLabelStyle); if (_selectedStateHash != hash) { if (InputMapper._stateInputCombinations.ContainsKey(hash)) { combinations = InputMapper._stateInputCombinations [hash].combinations; if (combinations [0] == null) { combinations [0] = new InputCombination("None"); } if (GUILayout.Button(combinations [0].combinationString)) { _selectedStateHash = hash; _previousStateInput = null; _isPrimary = 0; EditorGUIUtility.keyboardControl = 0; } if (combinations [1] == null) { combinations [1] = new InputCombination("None"); } if (GUILayout.Button(combinations [1].combinationString)) { _selectedStateHash = hash; _previousStateInput = null; _isPrimary = 1; EditorGUIUtility.keyboardControl = 0; } //DELETE if (GUILayout.Button("-", _addRemoveButtonStyle)) { //delete _deleteStateWithHash = hash; //this.Repaint(); } } else { if (GUILayout.Button("None")) { InputState state = _stateInputCombinations [hash] = new InputState(name, hash); state.Add(new InputCombination((int)KeyCode.None), 0); _selectedStateHash = hash; _previousStateInput = null; _isPrimary = 0; EditorGUIUtility.keyboardControl = 0; } if (GUILayout.Button("None")) { InputState state = _stateInputCombinations [hash] = new InputState(name, hash); state.Add(new InputCombination((int)KeyCode.None), 1); _selectedStateHash = hash; _previousStateInput = null; _isPrimary = 1; EditorGUIUtility.keyboardControl = 0; } } } else { if (InputMapper._stateInputCombinations.ContainsKey(hash)) { combinations = InputMapper._stateInputCombinations [hash].combinations; currentCombinationString = combinations [_isPrimary].combinationString; if (_previousStateInput == null) { _previousStateInput = combinations [_isPrimary].Clone(); } } else { currentCombinationString = "None"; } GUILayout.Label(currentCombinationString); //, _inputLabelStyle); this.Repaint(); } // GUILayout.EndHorizontal(); EditorGUILayout.Separator(); }