cocos中的观察者:
NotificationCenter:通知中心
NotificationObserver:通知的观察者
代码:
class CC_DLL __NotificationCenter : public Ref
{
friend class ScriptHandlerMgr;
public:
/// 构造函数
__NotificationCenter();
/// 析构函数
~__NotificationCenter();
/// 得到单例
static __NotificationCenter *getInstance();
/// 销毁单例
static void destroyInstance();
/// 添加一个观察者
/// 为指定的目标添加一个观察者
/// target 想要观察通知事件