#include <CCNotificationCenter.h>
void addObserver |
( |
Ref * |
target, |
|
|
SEL_CallFuncO |
selector, |
|
|
const std::string & |
name, |
|
|
Ref * |
sender |
|
) |
| |
Adds an observer for the specified target.
- Parameters
-
target | The target which wants to observe notification events. |
selector | The callback function which will be invoked when the specified notification event was posted. |
name | The name of this notification. |
sender | The 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 |
int getObserverHandlerByName |
( |
const std::string & |
name | ) |
|
Gets observer script handler.
- Parameters
-
name | The name of this notification. |
- Returns
- The observer script handle.
int getScriptHandler |
( |
| ) |
const |
|
inline |
Gets script handler.
- Note
- Only supports Lua Binding now.
- Returns
- The script handle.
void postNotification |
( |
const std::string & |
name | ) |
|
Posts one notification event by name.
- Parameters
-
name | The name of this notification. |
void postNotification |
( |
const std::string & |
name, |
|
|
Ref * |
sender |
|
) |
| |
Posts one notification event by name.
- Parameters
-
name | The name of this notification. |
sender | The object posting the notification. Can be nullptr |
static void purgeNotificationCenter |
( |
void |
| ) |
|
|
static |
void registerScriptObserver |
( |
Ref * |
target, |
|
|
int |
handler, |
|
|
const std::string & |
name |
|
) |
| |
Registers one hander for script binding.
- Note
- Only supports Lua Binding now.
- Parameters
-
int removeAllObservers |
( |
Ref * |
target | ) |
|
Removes all notifications registered by this target.
- Parameters
-
target | The target of this notification. |
- Returns
- the number of observers removed
void removeObserver |
( |
Ref * |
target, |
|
|
const std::string & |
name |
|
) |
| |
Removes the observer by the specified target and name.
- Parameters
-
target | The target of this notification. |
name | The name of this notification. |
void unregisterScriptObserver |
( |
Ref * |
target, |
|
|
const std::string & |
name |
|
) |
| |
Unregisters script observer.
The documentation for this class was generated from the following file: