[TOC]
cocos2d-x 3.0
- 首页 - 相关页面 - 模块 - 命名空间 - - 文件 -
Public 成员函数 - 图1 Public 成员函数 - 图2)
- 类列表 - 类索引 - 类继承关系 - 类成员

全部)) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义)))

Public 成员函数 | 静态 Public 成员函数 | 友元 | 所有成员列表

__NotificationCenter类 参考

#include

类 __NotificationCenter 继承关系图:

Public 成员函数 - 图3 Ref

## Public 成员函数
__NotificationCenter ()
__NotificationCenter 构造函数 ctor 更多…
~__NotificationCenter ()
__NotificationCenter 析构函数 NA NA 更多…
void addObserver (Ref target, SEL_CallFuncO selector, const std::string &name, Ref sender)
根据指定的target,添加观察者. 更多…
void removeObserver (Ref target, const std::string &name)
根据指定的target 和 name 移除观察者. 更多…
int removeAllObservers (Ref target)
移除这个target注册的所有通知 更多…
void registerScriptObserver (Ref target, int handler, const std::string &name)
注册一个 hander 用作脚本绑定. 更多…
void unregisterScriptObserver (Ref target, const std::string &name)
取消注册脚本observer 更多…
void postNotification (const std::string &name)
根据某个名字发送一个通知事件. 更多…
void postNotification (const std::string &name, Ref sender)
根据某个名字发送一个通知事件. 更多…
int getScriptHandler () const
获取脚本 handler. 更多…
int getObserverHandlerByName (const std::string &name)
获取 observer 脚本 handler. 更多…
- Public 成员函数 继承自 Ref
void retain ()
保留所有权. 更多…
void release ()
立即释放所有权. 更多…
Ref autorelease ()
自动释放所有权在不久的将来. 更多…
unsigned int getReferenceCount () const
返回Ref对象当前的引用计数. 更多…
virtual ~Ref ()
NA NA 更多…
## 静态 Public 成员函数
static __NotificationCenter getInstance ()
得到 NotificationCenter的单例. 更多…
static void [destroyInstance](../../d5/d91/classcocos2d11_notification_center.html#a05351a268226fab089bd81f68d9b4904) ()
销毁 NotificationCenter的单例. 更多…
static CC_DEPRECATED_ATTRIBUTE [NotificationCenter](../../d5/d91/classcocos2d_1_1_notification_center.html) sharedNotificationCenter (void)
static CC_DEPRECATED_ATTRIBUTE void purgeNotificationCenter (void)
## 友元
class ScriptHandlerMgr
## 额外继承的成员函数
- Protected 成员函数 继承自 Ref
Ref ()
构造函数 更多…
- Protected 属性 继承自 Ref
unsigned int _referenceCount
引用计数 更多…

构造及析构函数说明

__NotificationCenter ( )

__NotificationCenter 构造函数 ctor

~__NotificationCenter ( )

__NotificationCenter 析构函数 NA NA

成员函数说明

void addObserver ( Ref target,
SEL_CallFuncO selector,
const std::string & name,
Ref sender
)

根据指定的target,添加观察者.

  • 参数
  • targetThe target which wants to observe notification events. selectorThe callback function which will be invoked when the specified notification event was posted. nameThe name of this notification. senderThe object whose notifications the target wants to receive. Only notifications sent by this sender are delivered to the target. nullptr means that the sender is not used to decide whether to deliver the notification to target.

static void destroyInstance ( )

static

销毁 __NotificationCenter的单例.

static __NotificationCenter* getInstance ( )

static

得到 __NotificationCenter的单例.

int getObserverHandlerByName ( const std::string & name)

获取 observer 脚本 handler.

  • 参数
  • nameThe name of this notification.

  • 返回
  • The observer script handle.

int getScriptHandler ( ) const

inline

获取脚本 handler.

  • 注解
  • Only supports Lua Binding now.
  • 返回
  • The script handle.

void postNotification ( const std::string & name)

根据某个名字发送一个通知事件.

  • 参数
  • nameThe name of this notification.

void postNotification ( const std::string & name,
Ref * sender
)

根据某个名字发送一个通知事件.

  • 参数
  • nameThe name of this notification. senderThe object posting the notification. Can be nullptr

static CC_DEPRECATED_ATTRIBUTE void purgeNotificationCenter ( void )

static

void registerScriptObserver ( Ref * target,
int handler,
const std::string & name
)

注册一个 hander 用作脚本绑定.

  • 注解
  • Only supports Lua Binding now.
  • 参数
  • handlerThe lua handler.

int removeAllObservers ( Ref * target)

移除这个target注册的所有通知

  • 参数
  • targetThe target of this notification.

  • 返回
  • the number of observers removed

void removeObserver ( Ref * target,
const std::string & name
)

根据指定的target 和 name 移除观察者.

  • 参数
  • targetThe target of this notification. nameThe name of this notification.

static CC_DEPRECATED_ATTRIBUTE __NotificationCenter* sharedNotificationCenter ( void )

static

void unregisterScriptObserver ( Ref * target,
const std::string & name
)

取消注册脚本observer

友元及相关函数文档

friend class ScriptHandlerMgr

friend


该类的文档由以下文件生成: