SHA256
Add UIComponentWrapper
This commit is contained in:
3 files changed
+117
-144
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using O5Kit.Control;
|
||||
using O5Kit.Core;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ADOFAIRenderer.Util.UI;
|
||||
|
||||
internal abstract record UIWrapperBase(TextMeshProUGUI? label)
|
||||
{
|
||||
public readonly TextMeshProUGUI? label = label;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
public ITweenHandle? tween;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
|
||||
internal record O5InputFieldWrapper(O5InputField component, TextMeshProUGUI? label) : UIWrapperBase(label)
|
||||
{
|
||||
public readonly O5InputField component = component;
|
||||
|
||||
public string Value => component.Value;
|
||||
public void Set(string value, bool invoke = true) => component.Set(value, invoke);
|
||||
}
|
||||
|
||||
internal record O5ToggleWrapper(O5Toggle component, TextMeshProUGUI? label) : UIWrapperBase(label)
|
||||
{
|
||||
public readonly O5Toggle component = component;
|
||||
|
||||
public bool Value => component.Value;
|
||||
public void Set(bool value, bool invoke = true) => component.Set(value, invoke);
|
||||
}
|
||||
|
||||
internal record O5DropdownWrapper<T>(O5Dropdown<T> component, TextMeshProUGUI? label) : UIWrapperBase(label)
|
||||
{
|
||||
public readonly O5Dropdown<T> component = component;
|
||||
|
||||
public T? Value => component.Value;
|
||||
public IReadOnlyList<T> Values => component.Values;
|
||||
public void Set(T? value, bool invoke = true) => component.Set(value, invoke);
|
||||
public void SetValues(IReadOnlyList<T> values) => component.SetValues(values);
|
||||
}
|
||||
Reference in new issue
Block a user