Don't make ScriptEngineProtocol inherits from Object since setScriptEngine is invoked only once in AppDelegate.cpp, It will affect the lifecycle of ScriptEngine instance, the autorelease pool will be destroyed before destructing ScriptEngine. More...
Inherited by LuaEngine, and ScriptingCore.
Public Types | |
enum | ConfigType |
ConfigType enum. More... | |
Public Member Functions | |
ScriptEngineProtocol () | |
Constructor of ScriptEngineProtocol. | |
virtual | ~ScriptEngineProtocol () |
Destructor of ScriptEngineProtocol. | |
virtual ccScriptType | getScriptType () |
Get the specific script type. More... | |
virtual void | retainScriptObject (Ref *, Ref *) |
Reflect the retain relationship to script scope. | |
local | retainScriptObject () |
Reflect the retain relationship to script scope. | |
virtual void | rootScriptObject (Ref *) |
Add the script object to root object. | |
virtual void | releaseScriptObject (Ref *, Ref *) |
Reflect the release relationship to script scope. | |
local | releaseScriptObject () |
Reflect the release relationship to script scope. | |
virtual void | unrootScriptObject (Ref *) |
Remove the script object from root object. | |
virtual void | releaseAllChildrenRecursive (Node *) |
Release all children native refs for the given node in script scope. | |
local | releaseAllChildrenRecursive () |
Release all children native refs for the given node in script scope. | |
virtual void | releaseAllNativeRefs (cocos2d::Ref *) |
Release all native refs for the given owner in script scope. | |
local | releaseAllNativeRefs () |
Release all native refs for the given owner in script scope. | |
virtual void | removeScriptObjectByObject (Ref *) |
Remove script object,The specific meaning should refer to the ScriptType. More... | |
virtual void | removeScriptHandler (int) |
Remove script function handler, only LuaEngine class need to implement this function. More... | |
virtual int | reallocateScriptHandler (int) |
Reallocate script function handler, only LuaEngine class need to implement this function. More... | |
virtual int | executeString (const char *codes)=0 |
Execute script code contained in the given string. More... | |
virtual int | executeScriptFile (const char *filename)=0 |
Execute a script file. More... | |
virtual int | executeGlobalFunction (const char *functionName)=0 |
Execute a scripted global function. More... | |
virtual int | sendEvent (ScriptEvent *evt)=0 |
When trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be nullptr in Lua. | |
virtual bool | handleAssert (const char *msg)=0 |
Handle the assert message. More... | |
virtual void | setCalledFromScript (bool) |
Useless for Lua. | |
virtual bool | isCalledFromScript () |
Useless for Lua. | |
virtual bool | parseConfig (ConfigType type, const std::string &str)=0 |
Parse configuration file. More... | |
virtual void | rootObject (Ref *) |
Root a Reference. More... | |
virtual void | unrootObject (Ref *) |
Unroot a Reference. More... | |
virtual void | removeObjectProxy (Ref *obj) |
Remove proxy for a native object. | |
virtual void | garbageCollect () |
Triggers the garbage collector. | |
local | garbageCollect () |
Triggers the garbage collector. | |
Don't make ScriptEngineProtocol inherits from Object since setScriptEngine is invoked only once in AppDelegate.cpp, It will affect the lifecycle of ScriptEngine instance, the autorelease pool will be destroyed before destructing ScriptEngine.
So a crash will appear on Win32 if you click the close button.
|
inlinevirtual |
Get the specific script type.
Reimplemented in ScriptingCore, and LuaEngine.
|
inlinevirtual |
Remove script object,The specific meaning should refer to the ScriptType.
For Lua,
Reimplemented in ScriptingCore, and LuaEngine.
|
inlinevirtual |
Remove script function handler, only LuaEngine class need to implement this function.
Reimplemented in LuaEngine.
|
inlinevirtual |
Reallocate script function handler, only LuaEngine class need to implement this function.
Reimplemented in LuaEngine.
|
pure virtual |
Execute script code contained in the given string.
codes | holding the valid script code that should be executed. |
Implemented in ScriptingCore, and LuaEngine.
|
pure virtual |
Execute a script file.
filename | String object holding the filename of the script file that is to be executed. |
Implemented in ScriptingCore, and LuaEngine.
|
pure virtual |
Execute a scripted global function.
The function should not take any parameters and should return an integer.
functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
Implemented in ScriptingCore, and LuaEngine.
|
pure virtual |
Handle the assert message.
Implemented in ScriptingCore, and LuaEngine.
|
pure virtual |
Parse configuration file.
type | the specific type value. |
str | the information data. |
Implemented in LuaEngine, and ScriptingCore.
|
inlinevirtual |
Root a Reference.
It tells the Garbage Collector that the associated Scripting object should not be collected
Reimplemented in ScriptingCore.
|
inlinevirtual |
Root a Reference.
It tells the Garbage Collector that the associated Scripting object should not be collected
Reimplemented in ScriptingCore.
|
inlinevirtual |
Unroot a Reference.
It tells the Garbage Collector that the associated Scripting object can be collected
Reimplemented in ScriptingCore.
|
inlinevirtual |
Unroot a Reference.
It tells the Garbage Collector that the associated Scripting object can be collected
Reimplemented in ScriptingCore.