Skip to content

Commit 44d6e95

Browse files
committed
Added counter field with optional max value (MAPCO-9480)
1 parent 1d9d75d commit 44d6e95

17 files changed

Lines changed: 1966 additions & 0 deletions

Assets/YahalomUIPackage/Editor/YahalomCounterField.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using UnityEditor;
2+
3+
namespace YahalomUIPackage.Editor.YahalomStepper
4+
{
5+
[CustomEditor(typeof(Runtime.YahalomStepper.YahalomStepper))]
6+
[CanEditMultipleObjects]
7+
public class YahalomStepperEditor : UnityEditor.Editor
8+
{
9+
private SerializedProperty _value;
10+
private SerializedProperty _min;
11+
private SerializedProperty _max;
12+
private SerializedProperty _incrementButton;
13+
private SerializedProperty _decrementButton;
14+
private SerializedProperty _standardInputField;
15+
private SerializedProperty _rangeInputField;
16+
private SerializedProperty _maxLabel;
17+
private SerializedProperty _onValueChanged;
18+
19+
private void OnEnable() {
20+
_value = serializedObject.FindProperty("_value");
21+
_min = serializedObject.FindProperty("_min");
22+
_max = serializedObject.FindProperty("_max");
23+
_incrementButton = serializedObject.FindProperty("_incrementButton");
24+
_decrementButton = serializedObject.FindProperty("_decrementButton");
25+
_standardInputField = serializedObject.FindProperty("_standardInputField");
26+
_rangeInputField = serializedObject.FindProperty("_rangeInputField");
27+
_maxLabel = serializedObject.FindProperty("_maxLabel");
28+
_onValueChanged = serializedObject.FindProperty("_onValueChanged");
29+
}
30+
31+
public override void OnInspectorGUI() {
32+
serializedObject.Update();
33+
34+
EditorGUILayout.LabelField("Counter Settings", EditorStyles.boldLabel);
35+
EditorGUI.indentLevel++;
36+
EditorGUILayout.PropertyField(_value);
37+
EditorGUILayout.PropertyField(_min);
38+
EditorGUILayout.PropertyField(_max);
39+
EditorGUI.indentLevel--;
40+
41+
EditorGUILayout.Space(10);
42+
EditorGUILayout.LabelField("References", EditorStyles.boldLabel);
43+
EditorGUI.indentLevel++;
44+
EditorGUILayout.PropertyField(_incrementButton);
45+
EditorGUILayout.PropertyField(_decrementButton);
46+
EditorGUILayout.Space(4);
47+
EditorGUILayout.LabelField("Input Fields", EditorStyles.miniBoldLabel);
48+
EditorGUILayout.PropertyField(_standardInputField);
49+
EditorGUILayout.PropertyField(_rangeInputField);
50+
EditorGUILayout.PropertyField(_maxLabel);
51+
EditorGUI.indentLevel--;
52+
53+
EditorGUILayout.Space(10);
54+
EditorGUILayout.LabelField("Events", EditorStyles.boldLabel);
55+
EditorGUILayout.PropertyField(_onValueChanged);
56+
57+
serializedObject.ApplyModifiedProperties();
58+
}
59+
}
60+
}

Assets/YahalomUIPackage/Editor/YahalomCounterField/YahalomStepperEditor.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/YahalomUIPackage/Runtime/Resources/YahalomStepper.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)