NGUI之添加响应函数

时间:2016-03-31 21:33:07   收藏:0   阅读:233
 public void ButtonNextClicked()
    {
        SelectIndex++;
        SelectIndex %= 2;
        showGameObject();
    }
 public void ButtonPreClicked()
    {
        SelectIndex--;
        if (SelectIndex < 0)
            SelectIndex += 2;
        showGameObject();
    }
 public void ButtonOkClicked()
 {
     PlayerPrefs.SetInt("CharacterSelectIndex", SelectIndex);
     PlayerPrefs.SetString("PlayerName", NameInput.value);

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

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

技术分享

 

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

技术分享

 

原文:http://www.cnblogs.com/YTYMblog/p/5342741.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!