40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.Editor
|
|
{
|
|
public class DynamicUIButton : DynamicUIElement
|
|
{
|
|
public Button button;
|
|
public TMP_Text buttonText;
|
|
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
|
{
|
|
base.Initialize(baseElement, title, parameterName);
|
|
|
|
}
|
|
public void SetText(string buttonText)
|
|
{
|
|
this.buttonText.text = buttonText;
|
|
}
|
|
|
|
public void ApplyFunction(UnityAction function)
|
|
{
|
|
button.onClick.AddListener(function);
|
|
if (connectedBaseElement != null)
|
|
{
|
|
button.onClick.AddListener(connectedBaseElement.Refresh);
|
|
}
|
|
}
|
|
|
|
public override DynamicUIElement AddListenerFunction(UnityAction action)
|
|
{
|
|
button.onClick.AddListener(action);
|
|
return this;
|
|
}
|
|
}
|
|
} |