NGUI之添加响应函数

时间:2023-03-09 03:57:27
NGUI之添加响应函数
 public void ButtonNextClicked()
{
SelectIndex++;
SelectIndex %= ;
showGameObject();
}
public void ButtonPreClicked()
{
SelectIndex--;
if (SelectIndex < )
SelectIndex += ;
showGameObject();
}
public void ButtonOkClicked()
{
PlayerPrefs.SetInt("CharacterSelectIndex", SelectIndex);
PlayerPrefs.SetString("PlayerName", NameInput.value);

这段代码是attach在一个空的GameObject上,注意是public

,另外在按钮的UIButton上挂载函数的时候记得得先挂载对象(GameObject)

NGUI之添加响应函数

最后,放一张已经完成的UI界面,哈哈,美不美

NGUI之添加响应函数