case3
This commit is contained in:
49
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/Notebox/NoteboxInspector.cs
vendored
Normal file
49
Assets/ThirdParty/BOXOPHOBIC/Utils/Editor/Notebox/NoteboxInspector.cs
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.Utility
|
||||
{
|
||||
[CustomEditor(typeof(Notebox))]
|
||||
[CanEditMultipleObjects]
|
||||
public class NoteBoxInspector : Editor
|
||||
{
|
||||
const int MIN_SIZE = 11;
|
||||
const int MAX_SIZE = 25;
|
||||
|
||||
SerializedProperty size;
|
||||
SerializedProperty color;
|
||||
SerializedProperty text;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
size = serializedObject.FindProperty("noteSize");
|
||||
color = serializedObject.FindProperty("noteColor");
|
||||
text = serializedObject.FindProperty("noteText");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
GUIStyle textStyle = new GUIStyle();
|
||||
textStyle.normal.textColor = color.colorValue;
|
||||
textStyle.fontSize = size.intValue;
|
||||
textStyle.wordWrap = true;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("");
|
||||
color.colorValue = EditorGUILayout.ColorField("", color.colorValue, GUILayout.Width(35));
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
text.stringValue = EditorGUILayout.TextArea(text.stringValue, textStyle);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("");
|
||||
size.intValue = Mathf.RoundToInt(GUILayout.HorizontalSlider(Mathf.RoundToInt(size.intValue), MIN_SIZE, MAX_SIZE, GUILayout.Width(35)));
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user