studycase2

This commit is contained in:
2025-11-24 21:29:46 +08:00
parent 749719e862
commit 173fe7574b
608 changed files with 52537 additions and 39 deletions

View 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();
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e001eb24a06011408df25d4fcad5120
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: