using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NGUIBtnTest : MonoBehaviour {
//public GameObject target_sprite;
public UIButton myButton;
// Use this for initialization
void Start () {
//UISprite theSpriteComponent = target_sprite.GetComponent<UISprite>();
//theSpriteComponent.color = Color.red;
if (myButton != null)
{
EventDelegate theED = new EventDelegate(this, "ClickTheButton");
//EventDelegate.Add(myButton.onClick, theED);//方法1
myButton.onClick.Add(theED);//方法2
}
}
// Update is called once per frame
void Update () {
}
public void ClickTheButton()
{
Debug.Log("我单击了这个按钮!");
}
}