using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace CG.Framework
{
public enum UIEventType
{
Normal,
OnButtonClick,
OnToggleValueChanged,
OnInputFieldValueChanged,
OnInputFieldEndEdit,
OnInputFieldSubmitEdit,
OnSliderValueChanged,
OnDropdownValueChanged
}
public class UIBehaviours : MonoBehaviour
{
private string panelName;
///
/// 自定义Awake
/// 如果_N对应物体刚是出于隐藏状态,那麽在加入脚本后,脚本上的Awke会执行
/// 此处需要优化,这里的自定义Awake方法和单例当中的Awake方法原则不统一,重新规划
///
public void AwakeCustom()
{
panelName = GetComponentInParent().name;
UI_Manage.Instance.RegisterUIWedge(panelName, this.name, gameObject);
}
public void SetText(string msg)
{
Text t = GetComponent();
if (t != null)
{
t.text = msg;
}
}
#region 事件监听
public void AddEventListener(UIEventType type, UnityAction callback)
{
switch (type)
{
case UIEventType.OnButtonClick:
Button button = GetComponent