using System;
using UnityEngine;
public class TestPanel : MonoBehaviour
{
private UIToggle tog;
private UIButton but;
void Awake()
{
tog = transform.FindChild("Toggle").GetComponent<UIToggle>();
but = transform.FindChild("Button").GetComponent<UIButton>();
EventDelegate.Add(tog.onChange, delegate ()
{
OnToggleClick(tog.value);
});
EventDelegate.Add(but.onClick, delegate ()
{
OnButtonClick(but.gameObject);
});
}
public void OnToggleClick(bool isON)
{
if (isON)
Debug.LogError("开");
else
Debug.LogError("关");
}
public void OnButtonClick(GameObject but)
{
Debug.LogError(but.name);
}
}