mirror of https://github.com/axmolengine/axmol.git
Adding function to cleanup actions and schedule to ScriptingCore
This commit is contained in:
parent
a2ee6c3761
commit
7ede1373f7
|
@ -620,6 +620,16 @@ void ScriptingCore::resumeSchedulesAndActions(CCNode *node) {
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptingCore::cleanupSchedulesAndActions(CCNode *node) {
|
||||
|
||||
CCArray * arr = JSSchedule::getTargetForNativeNode(node);
|
||||
if(! arr) return;
|
||||
for(unsigned int i = 0; i < arr->count(); ++i) {
|
||||
if(arr->objectAtIndex(i)) {
|
||||
arr->removeObjectAtIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ScriptingCore::executeNodeEvent(CCNode* pNode, int nAction)
|
||||
{
|
||||
|
@ -651,6 +661,9 @@ int ScriptingCore::executeNodeEvent(CCNode* pNode, int nAction)
|
|||
{
|
||||
executeJSFunctionWithName(this->cx_, p->obj, "onExitTransitionDidStart", dataVal, retval);
|
||||
}
|
||||
else if(nAction == kCCNodeOnCleanup) {
|
||||
cleanupSchedulesAndActions(pNode);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1100,7 +1113,7 @@ jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v) {
|
|||
return JSVAL_NULL;
|
||||
}
|
||||
|
||||
jsval cccolor3b_to_jsval(JSContext* cx, ccColor3B& v) {
|
||||
jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v) {
|
||||
JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
if (!tmp) return JSVAL_NULL;
|
||||
JSBool ok = JS_DefineProperty(cx, tmp, "r", INT_TO_JSVAL(v.r), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
|
||||
|
|
|
@ -59,7 +59,8 @@ public:
|
|||
virtual int executeString(const char* codes) { return 0; }
|
||||
void pauseSchedulesAndActions(CCNode *node);
|
||||
void resumeSchedulesAndActions(CCNode *node);
|
||||
|
||||
void cleanupSchedulesAndActions(CCNode *node);
|
||||
|
||||
/**
|
||||
@brief Execute a script file.
|
||||
@param filename String object holding the filename of the script file that is to be executed
|
||||
|
@ -197,10 +198,7 @@ jsval ccsize_to_jsval(JSContext* cx, CCSize& v);
|
|||
jsval ccgridsize_to_jsval(JSContext* cx, ccGridSize& v);
|
||||
jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v);
|
||||
jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v);
|
||||
jsval cccolor3b_to_jsval(JSContext* cx, ccColor3B& v);
|
||||
|
||||
JSObject* NewGlobalObject(JSContext* cx);
|
||||
JSBool jsNewGlobal(JSContext* cx, unsigned argc, jsval* vp);
|
||||
jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v);
|
||||
|
||||
JSBool jsSocketOpen(JSContext* cx, unsigned argc, jsval* vp);
|
||||
JSBool jsSocketRead(JSContext* cx, unsigned argc, jsval* vp);
|
||||
|
|
Loading…
Reference in New Issue