using BepInEx;
using UnityEngine;
using UnityEngine.UI;
namespace KKAPI.Maker.UI
{
///
/// Custom control that draws a simple blue button.
///
public class MakerButton : BaseGuiEntry
{
private static Transform _buttonCopy;
///
/// Create a new custom control. Create and register it in .
///
/// Text displayed on the button
/// Category the control will be created under
/// Plugin that owns the control
public MakerButton(string text, MakerCategory category, BaseUnityPlugin owner) : base(category, owner)
{
Text = text;
OnClick = new Button.ButtonClickedEvent();
TextColor = new Color(0.090f, 0.118f, 0.141f);
}
///
/// Fired when user clicks on the button
///
public Button.ButtonClickedEvent OnClick { get; }
///
/// Text displayed on the button
///
public string Text { get; }
private static Transform ButtonCopy
{
get
{
if (_buttonCopy == null)
MakeCopy();
return _buttonCopy;
}
}
private static void MakeCopy()
{
var original = GameObject.Find("DefaultColor").transform;
_buttonCopy = Object.Instantiate(original, GuiCacheTransfrom, false);
_buttonCopy.gameObject.SetActive(false);
_buttonCopy.name = "btnCustom";
var button = _buttonCopy.GetComponentInChildren