public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Mobile Joystick Logic"); EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { MalbersEditor.DrawScript(script); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { if (MalbersEditor.Foldout(AxisEditor, "Axis Properties")) { EditorGUILayout.BeginHorizontal(); { MalbersEditor.BoolButton(invertX, new GUIContent("Invert X")); MalbersEditor.BoolButton(invertY, new GUIContent("Invert Y")); MalbersEditor.BoolButton(Relative, new GUIContent("Drag")); } EditorGUILayout.EndHorizontal(); EditorGUILayout.PropertyField(deathpoint); EditorGUILayout.PropertyField(sensitivityX); EditorGUILayout.PropertyField(sensitivityY); } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { if (MalbersEditor.Foldout(ReferencesEditor, "References")) { EditorGUILayout.PropertyField(axisValue); EditorGUILayout.PropertyField(pressed); } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EventsEditor.boolValue = MalbersEditor.Foldout(EventsEditor, "Events"); if (EventsEditor.boolValue) { EditorGUILayout.PropertyField(OnJoystickDown); EditorGUILayout.PropertyField(OnJoystickUp); EditorGUILayout.PropertyField(OnJoystickPressed); EditorGUILayout.Space(); EditorGUILayout.PropertyField(OnAxisChange); EditorGUILayout.PropertyField(OnXAxisChange); EditorGUILayout.PropertyField(OnYAxisChange); } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Stats Manager"); EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { if (Application.isPlaying) { EditorGUI.BeginDisabledGroup(true); { if (M.PinnedStat != null) { EditorGUILayout.ObjectField("Pin Stat: ", (StatID)M.PinnedStat.ID, typeof(StatID), false); } else { EditorGUILayout.LabelField("Pin Stat: NULL "); } } EditorGUI.EndDisabledGroup(); } list.DoLayoutList(); if (list.index != -1) { var element = statList.GetArrayElementAtIndex(list.index); var id = element.FindPropertyRelative("ID"); var ShowEvents = element.FindPropertyRelative("ShowEvents"); var BelowValue = element.FindPropertyRelative("Below"); var AboveValue = element.FindPropertyRelative("Above"); var Value = element.FindPropertyRelative("value"); var MaxValue = element.FindPropertyRelative("maxValue"); var MinValue = element.FindPropertyRelative("minValue"); var resetTo = element.FindPropertyRelative("resetTo"); var InmuneTime = element.FindPropertyRelative("InmuneTime"); var Regenerate = element.FindPropertyRelative("regenerate"); var RegenRate = element.FindPropertyRelative("RegenRate"); var RegenWaitTime = element.FindPropertyRelative("RegenWaitTime"); var Degenerate = element.FindPropertyRelative("degenerate"); var DegenRate = element.FindPropertyRelative("DegenRate"); var DegenWaitTime = element.FindPropertyRelative("DegenWaitTime"); var multiplier = element.FindPropertyRelative("multiplier"); var OnValueChange = element.FindPropertyRelative("OnValueChange"); var OnValueChangeNormalized = element.FindPropertyRelative("OnValueChangeNormalized"); var OnStatFull = element.FindPropertyRelative("OnStatFull"); var OnStatEmpty = element.FindPropertyRelative("OnStatEmpty"); var OnRegenerate = element.FindPropertyRelative("OnRegenerate"); var OnDegenerate = element.FindPropertyRelative("OnDegenerate"); var OnStatBelow = element.FindPropertyRelative("OnStatBelow"); var OnStatAbove = element.FindPropertyRelative("OnStatAbove"); EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); { EditorGUIUtility.labelWidth = 60; EditorGUILayout.PropertyField(Value, new GUIContent("Value", "Current Value of the Stat")); EditorGUILayout.PropertyField(multiplier, new GUIContent("Mult", "Stat Multiplier to be used when the value is modified")); EditorGUIUtility.labelWidth = 0; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); { EditorGUIUtility.labelWidth = 55; EditorGUILayout.PropertyField(MinValue, new GUIContent("Min", "Minimun value of the Stat")); EditorGUILayout.PropertyField(MaxValue, new GUIContent("Max", "Maximum value of the Stat")); EditorGUIUtility.labelWidth = 0; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(Regenerate, new GUIContent("Regenerate", "Can the Stat Regenerate over time?")); EditorGUILayout.PropertyField(RegenRate, new GUIContent("Rate", "Regeneration Rate, how fast/Slow the Stat will regenerate")); EditorGUILayout.PropertyField(RegenWaitTime, new GUIContent("Wait Time", "After the Stat is modified, the time to wait to start regenerating")); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(Degenerate, new GUIContent("Degenerate", "Can the Stat Degenerate over time?")); EditorGUILayout.PropertyField(DegenRate, new GUIContent("Rate", "Degeneration Rate, how fast/Slow the Stat will Degenerate")); EditorGUILayout.PropertyField(DegenWaitTime, new GUIContent("Wait Time", "After the Stat is modified, the time to wait to start degenerating")); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(resetTo, new GUIContent("Reset To", "When called the Funtion RESET() it will reset to the Min Value or the Max Value")); EditorGUILayout.PropertyField(InmuneTime, new GUIContent("Inmune Time", "If greater than zero, the Stat cannot be modify until the inmune time have passed")); if (Application.isPlaying) { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.Toggle("Is Inmune", M.stats[list.index].IsInmune); EditorGUI.EndDisabledGroup(); } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { if (MalbersEditor.Foldout(ShowEvents, "Events")) { string name = "Stat"; if (id.objectReferenceValue != null) { name = id.objectReferenceValue.name; } EditorGUILayout.PropertyField(OnValueChange, new GUIContent("On " + name + " change")); EditorGUILayout.PropertyField(OnValueChangeNormalized, new GUIContent("On " + name + " change normalized")); MalbersEditor.DrawSplitter(); EditorGUILayout.Space(); EditorGUILayout.PropertyField(OnStatFull, new GUIContent("On " + name + " full ")); EditorGUILayout.PropertyField(OnStatEmpty, new GUIContent("On " + name + " empty ")); EditorGUILayout.PropertyField(OnRegenerate, new GUIContent("On " + name + " Regenerate ")); EditorGUILayout.PropertyField(OnDegenerate, new GUIContent("On " + name + " Degenerate ")); MalbersEditor.DrawSplitter(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); { EditorGUIUtility.labelWidth = 55; EditorGUILayout.PropertyField(BelowValue, new GUIContent("Below", "Used to Check when the Stat is below this value")); EditorGUILayout.PropertyField(AboveValue, new GUIContent("Above", "Used to Check when the Stat is Above this value")); EditorGUIUtility.labelWidth = 0; } EditorGUILayout.EndHorizontal(); EditorGUILayout.PropertyField(OnStatBelow, new GUIContent("On " + name + " Below " + BelowValue.floatValue.ToString("F1"))); EditorGUILayout.PropertyField(OnStatAbove, new GUIContent("On " + name + " Above " + AboveValue.floatValue.ToString("F1"))); } } EditorGUILayout.EndVertical(); } } EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }