Initial commit: AetherBags + KamiToolKit for FC Gitea
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace KamiToolKit.Nodes;
|
||||
|
||||
public class TextDropDownNode : DropDownNode<TextButtonListNode, string> {
|
||||
|
||||
public TextDropDownNode() {
|
||||
OptionListNode.OnOptionSelected += OptionSelectedHandler;
|
||||
}
|
||||
|
||||
public Action<string>? OnOptionSelected { get; set; }
|
||||
|
||||
public required List<string>? Options {
|
||||
get => OptionListNode.Options;
|
||||
set {
|
||||
OptionListNode.Options = value;
|
||||
OptionListNode.SelectDefaultOption();
|
||||
UpdateLabel(OptionListNode.SelectedOption);
|
||||
}
|
||||
}
|
||||
|
||||
private void OptionSelectedHandler(string option) {
|
||||
OnOptionSelected?.Invoke(option);
|
||||
UpdateLabel(option);
|
||||
Toggle(false);
|
||||
}
|
||||
|
||||
protected override void UpdateLabel(string? option) {
|
||||
LabelNode.String = option ?? "ERROR: Invalid Default Option";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user