Unity3D
06 Jan 20151. 获取按钮并设置点击事件
using UnityEngine.UI;
var button = transform.Find("Btn_login").gameObject.GetComponent<Button>();
if (button != null) {
button.onClick.RemoveAllListeners();
button.onClick.AddListener(
delegate {
this.onLogin(button);
}
);
}
2. JSON解析
using SimpleJSON;
var json = JSON.Parse("{\"array\":[1,2,3],\"boolean\":true,\"null\":null,\"number\":123,\"object\":{\"a\":\"b\",\"c\":\"d\",\"e\":\"f\"},\"string\":\"Hello World\"}");
Debug.Log(json["string"].Value);
Debug.Log(json["boolean"].AsBool);
Debug.Log(json["array"].AsArray);