您的位置:首页 > 移动开发 > Unity3D

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

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

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

static public void Notify (GameObject go, string funcName, object obj)
{
if (mNotifying > 10) return;

// Automatically forward events to the currently open popup list
if (currentScheme == ControlScheme.Controller && UIPopupList.isOpen &&
UIPopupList.current.source == go && UIPopupList.isOpen)
go = UIPopupList.current.gameObject;

if (go && go.activeInHierarchy)
{
///start by jackniu
//add for tutorial jackniu
if (TutorialManage.GetInstance().CheckTutorial(go, funcName)) return;
///end by jackniu

++mNotifying;
//if (currentScheme == ControlScheme.Controller)
// Debug.Log((go != null ? "[" + go.name + "]." : "[global].") + funcName + "(" + obj + ");", go);

go.SendMessage(funcName, obj, SendMessageOptions.DontRequireReceiver);

///start by jackniu
//add for tutorial jackniu
if ((funcName == "OnPress" && (bool)obj == true) ||
funcName == "OnClick") {
//Debug.Log("########path is " + NGUITools.GetHierarchy(go));
TutorialManage.GetInstance ().MoveToNextStep (go, funcName);
}
///end by jackniu

if (mGenericHandler != null && mGenericHandler != go)
mGenericHandler.SendMessage(funcName, obj, SendMessageOptions.DontRequireReceiver);
--mNotifying;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: