Files
XRLib/Assets/Scenes/Sample/PropertyWindowSample.cs
2025-09-22 20:12:56 +09:00

61 lines
2.0 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using UVC.UI.Tooltip;
using UVC.UI.Window.PropertyWindow;
public class PropertyWindowSample : MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
TooltipManager.Instance.Initialize();
PropertyWindow.Instance.LoadProperties(new List<IPropertyItem>
{
//new StringProperty("prop1", "String Property", "Initial Value")
//{
// Description = "This is a sample string property.",
// Tooltip = "Enter a string value here.",
// IsReadOnly = true
//}
new IntProperty("prop2", "Int Property", 42, true)
{
Description = "This is a sample integer property.",
Tooltip = "Enter an integer value here.",
IsReadOnly = false
},
new FloatProperty("prop3", "Float Property", 0.5f, true)
{
Description = "This is a sample float property.",
Tooltip = "Enter an float value here.",
IsReadOnly = true
},
new BoolProperty("prop4", "Boolean Property", true)
{
Description = "This is a sample boolean property.",
Tooltip = "Toggle the boolean value here.",
IsReadOnly = true
},
new ColorProperty("prop5", "Color Property", Color.red)
{
Description = "This is a sample color property.",
Tooltip = "Select a color here.",
IsReadOnly = false
},
//new EnumProperty("prop6", "Enum Property", new List<string> { "Option 1", "Option 2", "Option 3" }, "Option 2")
});
PropertyWindow.Instance.PropertyValueChanged += (sender, e) =>
{
Debug.Log($"Property '{e.PropertyId}' changed to: {e.NewValue}");
};
}
// Update is called once per frame
void Update()
{
}
}