stage sth.

This commit is contained in:
James Chen 2012-09-10 18:38:18 +08:00
parent 2f51246bbd
commit ae320b5f9c
2 changed files with 26 additions and 47 deletions

View File

@ -27,8 +27,8 @@
NS_CC_BEGIN NS_CC_BEGIN
#pragma mark - // #pragma mark -
#pragma mark CCScriptHandlerEntry // #pragma mark CCScriptHandlerEntry
CCScriptHandlerEntry* CCScriptHandlerEntry::create(int nHandler) CCScriptHandlerEntry* CCScriptHandlerEntry::create(int nHandler)
{ {
@ -42,8 +42,8 @@ CCScriptHandlerEntry::~CCScriptHandlerEntry(void)
CCScriptEngineManager::sharedManager()->getScriptEngine()->removeLuaHandler(m_nHandler); CCScriptEngineManager::sharedManager()->getScriptEngine()->removeLuaHandler(m_nHandler);
} }
#pragma mark - // #pragma mark -
#pragma mark CCSchedulerScriptHandlerEntry // #pragma mark CCSchedulerScriptHandlerEntry
CCSchedulerScriptHandlerEntry* CCSchedulerScriptHandlerEntry::create(int nHandler, float fInterval, bool bPaused) CCSchedulerScriptHandlerEntry* CCSchedulerScriptHandlerEntry::create(int nHandler, float fInterval, bool bPaused)
{ {
@ -71,8 +71,8 @@ CCSchedulerScriptHandlerEntry::~CCSchedulerScriptHandlerEntry(void)
} }
#pragma mark - // #pragma mark -
#pragma mark CCTouchScriptHandlerEntry // #pragma mark CCTouchScriptHandlerEntry
CCTouchScriptHandlerEntry* CCTouchScriptHandlerEntry::create(int nHandler, CCTouchScriptHandlerEntry* CCTouchScriptHandlerEntry::create(int nHandler,
bool bIsMultiTouches, bool bIsMultiTouches,
@ -101,8 +101,8 @@ bool CCTouchScriptHandlerEntry::init(bool bIsMultiTouches, int nPriority, bool b
} }
#pragma mark - // #pragma mark -
#pragma mark CCScriptValue // #pragma mark CCScriptValue
const CCScriptValue CCScriptValue::intValue(const int intValue) const CCScriptValue CCScriptValue::intValue(const int intValue)
{ {
@ -232,8 +232,8 @@ void CCScriptValue::copy(const CCScriptValue& rhs)
} }
#pragma mark - // #pragma mark -
#pragma mark CCScriptEngineManager // #pragma mark CCScriptEngineManager
static CCScriptEngineManager* s_pSharedScriptEngineManager = NULL; static CCScriptEngineManager* s_pSharedScriptEngineManager = NULL;

View File

@ -46,8 +46,8 @@ typedef int LUA_FUNCTION;
typedef int LUA_TABLE; typedef int LUA_TABLE;
typedef int LUA_STRING; typedef int LUA_STRING;
#pragma mark - // #pragma mark -
#pragma mark CCScriptHandlerEntry // #pragma mark CCScriptHandlerEntry
class CCScriptHandlerEntry : public CCObject class CCScriptHandlerEntry : public CCObject
{ {
@ -81,8 +81,8 @@ protected:
* @{ * @{
*/ */
#pragma mark - // #pragma mark -
#pragma mark CCSchedulerScriptHandlerEntry // #pragma mark CCSchedulerScriptHandlerEntry
class CCTimer; class CCTimer;
@ -125,8 +125,8 @@ private:
}; };
#pragma mark - // #pragma mark -
#pragma mark CCTouchScriptHandlerEntry // #pragma mark CCTouchScriptHandlerEntry
class CCTouchScriptHandlerEntry : public CCScriptHandlerEntry class CCTouchScriptHandlerEntry : public CCScriptHandlerEntry
{ {
@ -161,8 +161,8 @@ private:
bool m_bSwallowsTouches; bool m_bSwallowsTouches;
}; };
#pragma mark - // #pragma mark -
#pragma mark CCScriptValue // #pragma mark CCScriptValue
class CCScriptValue; class CCScriptValue;
@ -259,8 +259,8 @@ private:
}; };
#pragma mark - // #pragma mark -
#pragma mark CCScriptEngineProtocol // #pragma mark CCScriptEngineProtocol
// Don't make CCScriptEngineProtocol inherits from CCObject since setScriptEngine is invoked only once in AppDelegate.cpp, // Don't make CCScriptEngineProtocol inherits from CCObject since setScriptEngine is invoked only once in AppDelegate.cpp,
// It will affect the lifecycle of ScriptCore instance, the autorelease pool will be destroyed before destructing ScriptCore. // It will affect the lifecycle of ScriptCore instance, the autorelease pool will be destroyed before destructing ScriptCore.
@ -271,31 +271,20 @@ public:
virtual ~CCScriptEngineProtocol() {}; virtual ~CCScriptEngineProtocol() {};
virtual ccScriptType getScriptType() { return kScriptTypeNone; }; virtual ccScriptType getScriptType() { return kScriptTypeNone; };
/** /**
@brief Method used to get a pointer to the lua_State that the script module is attached to. @brief Remove scripte object.
@return A pointer to the lua_State that the script module is attached to. @param object to remove,
in LuaBinding, it's m_nLuaID in CCObject,
in JSBinding it means current CCObject pointer.
*/ */
virtual lua_State* getLuaState(void) = 0; virtual void removeScriptObjectByID(int nId) = 0;
/**
@brief Remove CCObject from lua state
@param object to remove
*/
virtual void removeCCObjectByID(int nLuaID) = 0;
virtual void removeJSObjectByCCObject(void * cobj) = 0;
/** /**
@brief Remove Lua function handler @brief Remove Lua function handler
*/ */
virtual void removeLuaHandler(int nHandler) = 0; virtual void removeLuaHandler(int nHandler) = 0;
/**
@brief Add a path to find lua files in
@param path to be added to the Lua path
*/
virtual void addSearchPath(const char* path) = 0;
/** /**
@brief Execute script code contained in the given string. @brief Execute script code contained in the given string.
@param codes holding the valid script code that should be executed. @param codes holding the valid script code that should be executed.
@ -331,16 +320,6 @@ public:
virtual int executeFunctionWithCCObject(int nHandler, CCObject* pObject, const char* typeName) = 0; virtual int executeFunctionWithCCObject(int nHandler, CCObject* pObject, const char* typeName) = 0;
virtual int executeFunctionWithStringData(int nHandler, const char* data) = 0; virtual int executeFunctionWithStringData(int nHandler, const char* data) = 0;
virtual int pushIntegerData(int data) = 0;
virtual int pushFloatData(float data) = 0;
virtual int pushBooleanData(bool data) = 0;
virtual int pushStringData(const char* data) = 0;
virtual int pushCCObject(CCObject* pObject, const char* typeName) = 0;
virtual int pushCCScriptValue(const CCScriptValue& value) = 0;
virtual int pushCCScriptValueDict(const CCScriptValueDict& dict) = 0;
virtual int pushCCScriptValueArray(const CCScriptValueArray& array) = 0;
virtual void cleanStack(void) = 0;
// execute a schedule function // execute a schedule function
virtual int executeSchedule(int nHandler, float dt, CCNode *self = NULL) = 0; virtual int executeSchedule(int nHandler, float dt, CCNode *self = NULL) = 0;