fighterGob.GetComponent<Button>().onClick.AddListener(delegate()
{
GameObject fighterInfoGob = WindowUIManager.Instance.OpenWindow(WindowUIType.FightInfo);
fighterInfoGob.GetComponent<UIFighterInfoCtrl>().groupId = fighter.groupId;
ReadFighterInfo(fighterInfoGob, fighter.groupId);
});
其中delegate()是委托,还可以添加action作为监听事件,Action无参无返回值,Function 可以有参有返回值