public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(_inputConfigDatabase); serializedObject.ApplyModifiedProperties(); InputConfig inputConfigDatabase = ((InputConfigBuilder)target).inputConfigDatabase; if (GUILayout.Button("Build Shortcut Input From Scratch")) { RepopulateInput(inputConfigDatabase); } if (GUILayout.Button("Build Shortcut Input Keep Names")) { RepopulateInput(inputConfigDatabase, true); } EditorGUILayout.Space(); _newActionAdded = (MSChartEditorInputActions)EditorGUILayout.EnumPopup("New Action Added", _newActionAdded); // Use this when adding a new input into the middle of the rest of the pack if (GUILayout.Button("Do post added new action setup")) { InsertForNewActionAt(inputConfigDatabase, (int)_newActionAdded); } }
public static float?GetAxisMaybe(MSChartEditorInputActions key) { if (ChartEditor.hasFocus && !Services.IsTyping) { return(primaryInputs.GetActionConfig(key).GetAxisMaybe(InputManager.Instance.devices)); } return(null); }
public static bool GetInput(MSChartEditorInputActions key) { if (ChartEditor.hasFocus && !Services.IsTyping) { return(primaryInputs.GetActionConfig(key).GetInput(InputManager.Instance.devices)); } return(false); }
public bool TryGetPropertiesConfig(MSChartEditorInputActions shortcut, out MSE.Input.InputAction.Properties properties) { foreach (ShortcutInputConfig config in shortcutInputs) { if (config.shortcut == shortcut) { properties = config.properties.ToMSEInputProperties(); return(true); } } properties = kDefaultProperties.ToMSEInputProperties(); return(false); }
void RepopulateInput(InputConfig inputConfigDatabase, bool preserveDisplayNames = false) { MSChartEditorInput.MSChartEditorActionContainer controls = new MSChartEditorInput.MSChartEditorActionContainer(); ShortcutInputConfig[] shortcutInputs = new ShortcutInputConfig[EnumX <MSChartEditorInputActions> .Count]; for (int i = 0; i < shortcutInputs.Length; ++i) { MSChartEditorInputActions scEnum = (MSChartEditorInputActions)i; InputConfig.Properties properties; if (!inputExplicitProperties.TryGetValue(scEnum, out properties)) { properties = kDefaultProperties; } if (string.IsNullOrEmpty(properties.displayName)) { properties.displayName = scEnum.ToString(); } ShortcutInputConfig config = new ShortcutInputConfig(); var defaultConfig = controls.GetActionConfig(scEnum); var defaultProperties = defaultConfig.properties; config.shortcut = scEnum; config.properties = properties; if (preserveDisplayNames && i < inputConfigDatabase.shortcutInputs.Length) { config.properties.displayName = inputConfigDatabase.shortcutInputs[i].properties.displayName; } shortcutInputs[i] = config; } inputConfigDatabase.shortcutInputs = shortcutInputs; }
public static float GetAxis(MSChartEditorInputActions key) { float?value = GetAxisMaybe(key); return(value.HasValue ? value.Value : 0); }