首页 > 其他 > 详细

NGUI之添加响应函数

时间:2016-03-31 21:33:07      阅读:227      评论:0      收藏:0      [点我收藏+]
 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界面,哈哈,美不美

技术分享

 

NGUI之添加响应函数

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!