Button[] btns = xxx.transform.GetComponentsInChildren<Button>();
if (btns.Length>0)
{
for (int i = 0; i < btns.Length; i++)
{
int j = i;
btns[i].onClick.AddListener(delegate ( )
{
if (j == xxx.CurIndexBtn)
{
return;
}
xxx.CurIndexBtn = j;
if (j==0)
{
xxx.PlaySelectedAnim(btns[j], btns[j + 1]);
}
else
{
xxx.PlaySelectedAnim(btns[j], btns[j - 1]);
}
});
}
}
按钮批量注册点击事件
猜你喜欢
转载自blog.csdn.net/zhuangjialo/article/details/123053744
今日推荐
周排行