This repository has been archived on 2024-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
colourmeok/ColourMeOKGame/Assets/Scripts/DemoOklchColourPicker.cs

26 lines
No EOL
942 B
C#

using UnityEngine.UIElements;
/// <summary>
/// class that inherits from OklchColourPickerUI for the demo colour picker on the DefaultView
/// </summary>
public class DemoOklchColourPicker : OklchColourPickerUI
{
/// <summary>
/// initialise the ui elements and register change event callbacks functions
/// </summary>
public new void OnEnable()
{
var ui = GetComponent<UIDocument>().rootVisualElement;
LightnessSlider = ui.Q<Slider>("DemoResponseLightnessSlider");
LightnessSlider.RegisterCallback<ChangeEvent<float>>(OnLightnessChange);
ChromaSlider = ui.Q<Slider>("DemoResponseChromaSlider");
ChromaSlider.RegisterCallback<ChangeEvent<float>>(OnChromaChange);
HueSlider = ui.Q<Slider>("DemoResponseHueSlider");
HueSlider.RegisterCallback<ChangeEvent<float>>(OnHueChange);
ResponseColour = ui.Q<VisualElement>("DemoResponseColour");
}
}