Table of Contents

Class UITKColorPicker

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

UI Toolkit color picker supporting an HSV picking texture plus H/S/V and R/G/B/A sliders, inputs and a hex field. Spectrum textures are generated via TinyColor and bound to element background images.

public class UITKColorPicker : UITKControl
Inheritance
Object
Component
Behaviour
MonoBehaviour
UITKColorPicker
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Fields

HSV_TEXTURE_HEIGHT

Height of HSV texture in pixels.

public const int HSV_TEXTURE_HEIGHT = 192

Field Value

int

HSV_TEXTURE_WIDTH

Width of HSV texture in pixels.

public const int HSV_TEXTURE_WIDTH = 192

Field Value

int

HUE_MAX

Maximum hue value (359).

public const int HUE_MAX = 359

Field Value

int

InitialColor

Initial color for the picker.

public Color InitialColor

Field Value

Color

NUM_HUES

Number of hue values supported (degrees).

public const int NUM_HUES = 360

Field Value

int

OnColorChanged

Callback invoked whenever the selected color changes. Consumers should assign this before calling Show() to receive updates.

public Action<Color> OnColorChanged

Field Value

Action<Color>

RGBA_MAX

Maximum RGBA value (255).

public const int RGBA_MAX = 255

Field Value

int

SLIDER_BACKGROUND_HEIGHT

Height of slider backgrounds in pixels.

public const int SLIDER_BACKGROUND_HEIGHT = 1

Field Value

int

SLIDER_BACKGROUND_WIDTH

Width of slider backgrounds in pixels.

public const int SLIDER_BACKGROUND_WIDTH = 134

Field Value

int

SV_MAX

Maximum saturation/value (100).

public const int SV_MAX = 100

Field Value

int

Properties

Layer

Draw order tier for this panel. See UITKPanelLayer.

protected override UITKPanelLayer Layer { get; }

Property Value

UITKPanelLayer

Methods

Hide(bool)

Hides the picker and stops reporting changes to whoever opened it.

public override void Hide(bool overrideIsAlwaysOpen)

Parameters

overrideIsAlwaysOpen bool

When true, the call is a no-op.

Remarks

The override is on Hide(bool), not on Hide(). Hide() forwards here, but quit-to-login calls Hide(false) directly — so an override on the parameterless form alone left the Options panel still subscribed to colour changes after the player had returned to the login screen.

OnAfterShow()

Re-applies the picker's colour to the tree the player will actually see.

protected override void OnAfterShow()

OnAfterStarting()

Re-binds the textures and re-applies the colour after a visual tree rebuild.

protected override void OnAfterStarting()

Remarks

The strips survive the rebuild but the elements they were bound to do not, so a re-shown picker came back with no spectrum behind any of its sliders.

OnDestroying()

Releases every texture and any outstanding pointer capture.

public override void OnDestroying()

OnStarting()

Resolves elements, configures sliders, wires callbacks and applies the initial color.

public override void OnStarting()

Open(Color, Action<Color>)

Shows the picker seeded with a colour, reporting each change to one caller.

public void Open(Color initial, Action<Color> onChanged)

Parameters

initial Color

Colour to start from.

onChanged Action<Color>

Invoked with the selected colour as it changes.

Remarks

The picker is a single shared panel, so OnColorChanged is a field that every caller writes to in turn. Assigning it directly means whoever opened the picker last silently keeps receiving colours after they are done with it — this replaces the subscriber outright on each open, so exactly one caller is ever listening.

SetColor(Color)

Sets the picker color and refreshes all sliders, inputs, backgrounds and the cursor.

public void SetColor(Color color)

Parameters

color Color

The color to set.

SetCursor()

Positions the HSV cursor from the current color's saturation/value.

public void SetCursor()

UpdateAlphaInputValue(int)

Updates the alpha channel from the input field and refreshes the color.

public void UpdateAlphaInputValue(int value)

Parameters

value int

UpdateAlphaSliderValue(float)

Updates the alpha channel from the slider and refreshes the color.

public void UpdateAlphaSliderValue(float value)

Parameters

value float

UpdateBlueInputValue(int)

Updates the blue channel from the input field and refreshes the color.

public void UpdateBlueInputValue(int value)

Parameters

value int

UpdateBlueSliderValue(float)

Updates the blue channel from the slider and refreshes the color.

public void UpdateBlueSliderValue(float value)

Parameters

value float

UpdateGreenInputValue(int)

Updates the green channel from the input field and refreshes the color.

public void UpdateGreenInputValue(int value)

Parameters

value int

UpdateGreenSliderValue(float)

Updates the green channel from the slider and refreshes the color.

public void UpdateGreenSliderValue(float value)

Parameters

value float

UpdateHexValue(string)

Updates the picker color from a hexadecimal string.

public void UpdateHexValue(string value)

Parameters

value string

The hexadecimal color string.

UpdateHueInputValue(int)

Updates the hue from the input field and refreshes the color.

public void UpdateHueInputValue(int value)

Parameters

value int

UpdateHueSliderValue(float)

Updates the hue from the slider and refreshes the color.

public void UpdateHueSliderValue(float value)

Parameters

value float

UpdateRedInputValue(int)

Updates the red channel from the input field and refreshes the color.

public void UpdateRedInputValue(int value)

Parameters

value int

UpdateRedSliderValue(float)

Updates the red channel from the slider and refreshes the color.

public void UpdateRedSliderValue(float value)

Parameters

value float

UpdateSaturationInputValue(int)

Updates the saturation from the input field and refreshes the color.

public void UpdateSaturationInputValue(int value)

Parameters

value int

UpdateSaturationSliderValue(float)

Updates the saturation from the slider and refreshes the color.

public void UpdateSaturationSliderValue(float value)

Parameters

value float

UpdateValueInputValue(int)

Updates the value (brightness) from the input field and refreshes the color.

public void UpdateValueInputValue(int value)

Parameters

value int

UpdateValueSliderValue(float)

Updates the value (brightness) from the slider and refreshes the color.

public void UpdateValueSliderValue(float value)

Parameters

value float