unity 中基于NGUI中实现引导,拦截玩家的点击动作

unity 中基于NGUI中实现引导,拦截玩家的点击动作

转自

http://blog.csdn.net/niuzb/article/details/52045192


原创 2016年07月27日 14:39:18

通常游戏中的引导分为两种,强制引导和非强制引导,强制引导只能点被引导的按钮,点屏幕别的界面会提示玩家跟据引导提示走。刚接触ngui代码,大概了解了一下NGUI的工作原理,基本上实现了策划的要求。


在uicamera.cs中拦截玩家的点击事件:


  1. static public void Notify (GameObject go, string funcName, object obj)  
  2. {  
  3.     if (mNotifying > 10) return;  
  4.   
  5.     // Automatically forward events to the currently open popup list  
  6.     if (currentScheme == ControlScheme.Controller && UIPopupList.isOpen &&  
  7.         UIPopupList.current.source == go && UIPopupList.isOpen)  
  8.             go = UIPopupList.current.gameObject;  
  9.   
  10.     if (go && go.activeInHierarchy)  
  11.     {  
  12.         ///start by jackniu  
  13.         //add for tutorial jackniu  
  14.         if (TutorialManage.GetInstance().CheckTutorial(go, funcName)) return;  
  15.         ///end by jackniu  
  16.   
  17.         ++mNotifying;  
  18.         //if (currentScheme == ControlScheme.Controller)  
  19.         //  Debug.Log((go != null ? "[" + go.name + "]." : "[global].") + funcName + "(" + obj + ");", go);  
  20.               
  21.         go.SendMessage(funcName, obj, SendMessageOptions.DontRequireReceiver);  
  22.   
  23.         ///start by jackniu  
  24.         //add for tutorial jackniu  
  25.         if ((funcName == "OnPress" && (bool)obj == true) ||  
  26.            funcName == "OnClick") {  
  27.             //Debug.Log("########path is " + NGUITools.GetHierarchy(go));  
  28.             TutorialManage.GetInstance ().MoveToNextStep (go, funcName);  
  29.         }  
  30.         ///end by jackniu  
  31.   
  32.         if (mGenericHandler != null && mGenericHandler != go)  
  33.             mGenericHandler.SendMessage(funcName, obj, SendMessageOptions.DontRequireReceiver);  
  34.         --mNotifying;  
  35.     }  

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值