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;
}
}
在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;
}
}
相关文章推荐
- protobuf-net的序列化与反序列化(本地存储)
- Unity因为对象锁定在运行时会抛出错误
- unity中基于NGUI实现一张图片上在某个地方挖个洞
- Unity3D学习笔记——NGUI之UIToggle
- unity批量拖拽到属性排序问题小技巧
- Unity 旋转角度计算
- shader内置变量和函数
- Unity3D 学习资料
- Unity防反编译的两种手段
- 给The Lab Renderer for Unity中地形添加阴影
- unity打开Excel/Word/PPT
- unity3d第十五天
- Unity3D热更新<四> 从头开始学习LuaFramework_UGUI
- unity如何查找某个脚本挂在了哪些物体上
- C# for Unity 编程语言快速入门教程(连载1)---C#语言入门
- unity解析Json字符串案例
- Unity Font Maker 更新Bitmap字体后字体错乱
- Unity3d 5.3.5使用sqlite3
- max导unity注意及解决
- unity GearVr环境搭建与打包