mirror of https://github.com/axmolengine/axmol.git
issue #2244:Modify ScriptData struct and functions related with sendEvent
This commit is contained in:
parent
c5e5c49332
commit
570f2663f4
|
@ -162,7 +162,7 @@ void Timer::update(float dt)
|
|||
|
||||
if (0 != _scriptHandler)
|
||||
{
|
||||
SchedulerScriptEvent data(_scriptHandler,_elapsed);
|
||||
SchedulerScriptData data(_scriptHandler,_elapsed);
|
||||
ScriptEvent event(kScheduleEvent,&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ void Timer::update(float dt)
|
|||
|
||||
if (0 != _scriptHandler)
|
||||
{
|
||||
SchedulerScriptEvent data(_scriptHandler,_elapsed);
|
||||
SchedulerScriptData data(_scriptHandler,_elapsed);
|
||||
ScriptEvent event(kScheduleEvent,&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void Timer::update(float dt)
|
|||
|
||||
if (0 != _scriptHandler)
|
||||
{
|
||||
SchedulerScriptEvent data(_scriptHandler,_elapsed);
|
||||
SchedulerScriptData data(_scriptHandler,_elapsed);
|
||||
ScriptEvent event(kScheduleEvent,&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -561,8 +561,9 @@ void CallFunc::execute() {
|
|||
} else if( _function )
|
||||
_function();
|
||||
if (0 != _scriptHandler) {
|
||||
ScriptEvent event(kCallFuncEvent,NULL);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event,(void*)this);
|
||||
BasicScriptData data((void*)&_scriptHandler);
|
||||
ScriptEvent event(kCallFuncEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -545,8 +545,9 @@ void Node::cleanup()
|
|||
if ( _scriptType == kScriptTypeLua)
|
||||
{
|
||||
int action = kNodeOnCleanup;
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&action);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent,(void*)this);
|
||||
BasicScriptData data((void*)this,(void*)&action);
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
}
|
||||
else if(_scriptType != kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -923,8 +924,9 @@ void Node::onEnter()
|
|||
if (_scriptType == kScriptTypeLua)
|
||||
{
|
||||
int action = kNodeOnEnter;
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&action);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent,(void*)this);
|
||||
BasicScriptData data((void*)this,(void*)&action);
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
}
|
||||
else if(_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -941,8 +943,9 @@ void Node::onEnterTransitionDidFinish()
|
|||
if (_scriptType == kScriptTypeLua)
|
||||
{
|
||||
int action = kNodeOnEnterTransitionDidFinish;
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&action);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent,(void*)this);
|
||||
BasicScriptData data((void*)this,(void*)&action);
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
}
|
||||
else if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -956,9 +959,9 @@ void Node::onExitTransitionDidStart()
|
|||
if (_scriptType == kScriptTypeLua)
|
||||
{
|
||||
int action = kNodeOnExitTransitionDidStart;
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&action);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent,(void*)this);
|
||||
}
|
||||
BasicScriptData data((void*)this,(void*)&action);
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent); }
|
||||
else if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->executeNodeEvent(this, kNodeOnExitTransitionDidStart);
|
||||
|
@ -973,8 +976,9 @@ void Node::onExit()
|
|||
if (_scriptType == kScriptTypeLua)
|
||||
{
|
||||
int action = kNodeOnExit;
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&action);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent,(void*)this);
|
||||
BasicScriptData data((void*)this,(void*)&action);
|
||||
ScriptEvent scriptEvent(kNodeEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
}
|
||||
else if ( _scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
|
@ -1154,7 +1158,7 @@ void Node::update(float fDelta)
|
|||
if (0 != _updateScriptHandler)
|
||||
{
|
||||
//only lua use
|
||||
SchedulerScriptEvent data(_updateScriptHandler,fDelta);
|
||||
SchedulerScriptData data(_updateScriptHandler,fDelta);
|
||||
ScriptEvent event(kScheduleEvent,&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -144,9 +144,11 @@ int Layer::excuteScriptTouchHandler(int nEventType, Touch *pTouch)
|
|||
{
|
||||
if (kScriptTypeLua == _scriptType)
|
||||
{
|
||||
LayerTouchScriptEvent data(nEventType,pTouch);
|
||||
ScriptEvent event(kLayerTouchEvent,&data);
|
||||
return ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event,this);
|
||||
Set touches;
|
||||
touches.addObject((Object*)pTouch);
|
||||
TouchesScriptData data(nEventType,kLayerTouches,(void*)this,&touches);
|
||||
ScriptEvent event(kTouchesEvent,&data);
|
||||
return ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
else if(kScriptTypeJavascript == _scriptType)
|
||||
{
|
||||
|
@ -160,9 +162,9 @@ int Layer::excuteScriptTouchHandler(int nEventType, Set *pTouches)
|
|||
{
|
||||
if (kScriptTypeLua == _scriptType)
|
||||
{
|
||||
LayerTouchesScriptEvent data(nEventType,pTouches);
|
||||
ScriptEvent event(kLayerTouchesEvent,&data);
|
||||
return ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event,this);
|
||||
TouchesScriptData data(nEventType,kLayerTouches,(void*)this,pTouches);
|
||||
ScriptEvent event(kTouchesEvent,&data);
|
||||
return ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
else if(kScriptTypeJavascript == _scriptType)
|
||||
{
|
||||
|
@ -280,12 +282,13 @@ void Layer::didAccelerate(Acceleration* pAccelerationValue)
|
|||
CC_UNUSED_PARAM(pAccelerationValue);
|
||||
if (kScriptTypeJavascript == _scriptType)
|
||||
{
|
||||
ScriptEvent event(kAccelerometerEvent,(void*)pAccelerationValue);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event,this);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->executeAccelerometerEvent(this, pAccelerationValue);
|
||||
}
|
||||
else if(kScriptTypeLua == _scriptType)
|
||||
{
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->executeAccelerometerEvent(this, pAccelerationValue);
|
||||
BasicScriptData data((void*)this,(void*)pAccelerationValue);
|
||||
ScriptEvent event(kAccelerometerEvent,&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,9 +373,9 @@ void Layer::keyBackClicked(void)
|
|||
{
|
||||
if (NULL != _scriptKeypadHandlerEntry && 0 != _scriptKeypadHandlerEntry->getHandler())
|
||||
{
|
||||
int action = kTypeBackClicked;
|
||||
ScriptEvent event(kLayerKeypadEvent,(void*)&action);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event,this);
|
||||
KeypadScriptData data(kTypeBackClicked,kLayerKeypad,(void*)this);
|
||||
ScriptEvent event(kKeypadEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
else if(kScriptTypeJavascript == _scriptType)
|
||||
{
|
||||
|
@ -384,9 +387,9 @@ void Layer::keyMenuClicked(void)
|
|||
{
|
||||
if (NULL != _scriptKeypadHandlerEntry && 0 != _scriptKeypadHandlerEntry->getHandler())
|
||||
{
|
||||
int action = kTypeMenuClicked;
|
||||
ScriptEvent event(kLayerKeypadEvent,(void*)&action);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event,this);
|
||||
KeypadScriptData data(kTypeMenuClicked,kLayerKeypad,(void*)this);
|
||||
ScriptEvent event(kKeypadEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,8 +134,9 @@ void MenuItem::activate()
|
|||
|
||||
if (kScriptTypeLua == _scriptType)
|
||||
{
|
||||
ScriptEvent scriptEvent(kMenuItemEvent,NULL);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent,(void*)this);
|
||||
BasicScriptData data((void*)this);
|
||||
ScriptEvent scriptEvent(kMenuClickedEvent,&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
}
|
||||
else if (kScriptTypeJavascript == _scriptType)
|
||||
{
|
||||
|
|
|
@ -159,25 +159,46 @@ private:
|
|||
enum ScriptEventType
|
||||
{
|
||||
kNodeEvent = 0,
|
||||
kMenuItemEvent,
|
||||
kMenuClickedEvent,
|
||||
kNotificationEvent,
|
||||
kCallFuncEvent,
|
||||
kScheduleEvent,
|
||||
kLayerTouchesEvent,
|
||||
kLayerTouchEvent,
|
||||
kLayerKeypadEvent,
|
||||
kTouchesEvent,
|
||||
kKeypadEvent,
|
||||
kAccelerometerEvent,
|
||||
kCommonEvent,
|
||||
};
|
||||
|
||||
struct SchedulerScriptEvent
|
||||
enum TouchesObjectType
|
||||
{
|
||||
kLayerTouches = 0,
|
||||
};
|
||||
|
||||
enum KeypadObjectType
|
||||
{
|
||||
kLayerKeypad = 0,
|
||||
};
|
||||
|
||||
struct BasicScriptData
|
||||
{
|
||||
//nativeobject:to get handler for lua or to get jsobject for js
|
||||
void* nativeObject;
|
||||
//value: a pointer to a object that already defined
|
||||
void* value;
|
||||
BasicScriptData(void* inObject,void* inValue = NULL)
|
||||
:nativeObject(inObject),value(inValue)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct SchedulerScriptData
|
||||
{
|
||||
//lua use
|
||||
int handler;
|
||||
float elapse;
|
||||
//js use
|
||||
Node* node;
|
||||
SchedulerScriptEvent(int inHandler,float inElapse,Node* inNode = NULL)
|
||||
SchedulerScriptData(int inHandler,float inElapse,Node* inNode = NULL)
|
||||
:handler(inHandler),
|
||||
elapse(inElapse),
|
||||
node(inNode)
|
||||
|
@ -185,36 +206,40 @@ struct SchedulerScriptEvent
|
|||
}
|
||||
};
|
||||
|
||||
struct LayerTouchesScriptEvent
|
||||
struct TouchesScriptData
|
||||
{
|
||||
int actionType;
|
||||
int actionType;
|
||||
int objectType;
|
||||
void* nativeObject;
|
||||
Set* touches;
|
||||
LayerTouchesScriptEvent(int inActiontype,Set* inTouches)
|
||||
:actionType(inActiontype),
|
||||
TouchesScriptData(int inActionType,int inObjectType,void* inNativeObject,Set* inTouches)
|
||||
:actionType(inActionType),
|
||||
objectType(inObjectType),
|
||||
nativeObject(inNativeObject),
|
||||
touches(inTouches)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct LayerTouchScriptEvent
|
||||
struct KeypadScriptData
|
||||
{
|
||||
int actionType;
|
||||
Touch* touch;
|
||||
LayerTouchScriptEvent(int inActionType,Touch* inTouch)
|
||||
:actionType(inActionType),
|
||||
touch(inTouch)
|
||||
int objectType;
|
||||
void* nativeObject;
|
||||
KeypadScriptData(int inActionType,int inObjectType,void* inNativeObject)
|
||||
:actionType(inActionType),objectType(inObjectType),nativeObject(inNativeObject)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct CommonScriptEvent
|
||||
struct CommonScriptData
|
||||
{
|
||||
//now,only use lua
|
||||
int handler;
|
||||
char eventName[64];
|
||||
Object* eventSource;
|
||||
char eventSourceClassName[64];
|
||||
CommonScriptEvent(int inHandler,const char* inName,Object* inSource = NULL,const char* inClassName = NULL)
|
||||
CommonScriptData(int inHandler,const char* inName,Object* inSource = NULL,const char* inClassName = NULL)
|
||||
:handler(inHandler),
|
||||
eventSource(inSource)
|
||||
{
|
||||
|
@ -320,7 +345,7 @@ public:
|
|||
virtual bool handleAssert(const char *msg) = 0;
|
||||
|
||||
//when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be NULL in lua
|
||||
virtual int sendEvent(ScriptEvent* message,void* nativeObject = NULL){ return -1;}
|
||||
virtual int sendEvent(ScriptEvent* message){ return 0;}
|
||||
//
|
||||
};
|
||||
|
||||
|
|
|
@ -179,9 +179,10 @@ void NotificationCenter::postNotification(const char *name, Object *object)
|
|||
if (!strcmp(name,observer->getName()) && (observer->getObject() == object || observer->getObject() == NULL || object == NULL))
|
||||
{
|
||||
if (0 != observer->getHandler())
|
||||
{
|
||||
ScriptEvent scriptEvent(kNotificationEvent,(void*)name);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent,(void*)this);
|
||||
{
|
||||
BasicScriptData data((void*)this,(void*)name);
|
||||
ScriptEvent scriptEvent(kNotificationEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -200,7 +201,7 @@ int NotificationCenter::getObserverHandlerByName(const char* name)
|
|||
{
|
||||
if (NULL == name || strlen(name) == 0)
|
||||
{
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Object* obj = NULL;
|
||||
|
@ -217,7 +218,7 @@ int NotificationCenter::getObserverHandlerByName(const char* name)
|
|||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -133,7 +133,7 @@ void Control::sendActionsForControlEvents(ControlEvent controlEvents)
|
|||
int nHandler = this->getHandleOfControlEvent(controlEvents);
|
||||
if (0 != nHandler)
|
||||
{
|
||||
cocos2d::CommonScriptEvent data(nHandler, "",(Object*)this);
|
||||
cocos2d::CommonScriptData data(nHandler, "",(Object*)this);
|
||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
|
|||
EditBox* pEditBox = thiz->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
memset(data.eventName,0,64*sizeof(char));
|
||||
|
@ -282,7 +282,7 @@ void EditBoxImplAndroid::openKeyboard()
|
|||
EditBox* pEditBox = this->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
memset(data.eventName,0,64*sizeof(char));
|
||||
|
@ -236,7 +236,7 @@ static const int CC_EDIT_BOX_PADDING = 5;
|
|||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplIOS()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
cocos2d::ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@
|
|||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
|
||||
cocos2d::ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
memset(data.eventName,0,64*sizeof(char));
|
||||
|
@ -218,7 +218,7 @@
|
|||
cocos2d::extension::EditBox* pEditBox= getEditBoxImplMac()->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
cocos2d::CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
cocos2d::ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
|
|||
EditBox* pEditBox = thiz->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
memset(data.eventName,0,64*sizeof(char));
|
||||
|
@ -274,7 +274,7 @@ void EditBoxImplTizen::openKeyboard()
|
|||
EditBox* pEditBox = this->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ static void editBoxCallbackFunc(const char* pText, void* ctx)
|
|||
EditBox* pEditBox = thiz->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
memset(data.eventName,0,64*sizeof(char));
|
||||
|
@ -262,7 +262,7 @@ void EditBoxImplWin::openKeyboard()
|
|||
EditBox* pEditBox = this->getEditBox();
|
||||
if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
|
||||
{
|
||||
CommonScriptEvent data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -331,7 +331,7 @@ int LuaEngine::reallocateScriptHandler(int nHandler)
|
|||
return nRet;
|
||||
}
|
||||
|
||||
int LuaEngine::sendEvent(ScriptEvent* message,void* nativeObject)
|
||||
int LuaEngine::sendEvent(ScriptEvent* message)
|
||||
{
|
||||
if (NULL == message)
|
||||
return 0;
|
||||
|
@ -339,22 +339,22 @@ int LuaEngine::sendEvent(ScriptEvent* message,void* nativeObject)
|
|||
{
|
||||
case kNodeEvent:
|
||||
{
|
||||
return handleNodeEvent(message->data,nativeObject);
|
||||
return handleNodeEvent(message->data);
|
||||
}
|
||||
break;
|
||||
case kMenuItemEvent:
|
||||
case kMenuClickedEvent:
|
||||
{
|
||||
return handleMenuItemEvent(nativeObject);
|
||||
return handleMenuClickedEvent(message->data);
|
||||
}
|
||||
break;
|
||||
case kNotificationEvent:
|
||||
{
|
||||
return handleNotificationEvent(message->data,nativeObject);
|
||||
return handleNotificationEvent(message->data);
|
||||
}
|
||||
break;
|
||||
case kCallFuncEvent:
|
||||
{
|
||||
return handleCallFuncActionEvent(message->data,nativeObject);
|
||||
return handleCallFuncActionEvent(message->data);
|
||||
}
|
||||
break;
|
||||
case kScheduleEvent:
|
||||
|
@ -362,24 +362,19 @@ int LuaEngine::sendEvent(ScriptEvent* message,void* nativeObject)
|
|||
return handleScheduler(message->data);
|
||||
}
|
||||
break;
|
||||
case kLayerTouchesEvent:
|
||||
case kTouchesEvent:
|
||||
{
|
||||
return handleLayerTouchesEvent(message->data, nativeObject);
|
||||
return handleTouchesEvent(message->data);
|
||||
}
|
||||
break;
|
||||
case kLayerTouchEvent:
|
||||
case kKeypadEvent:
|
||||
{
|
||||
return handleLayerTouchEvent(message->data,nativeObject);
|
||||
}
|
||||
break;
|
||||
case kLayerKeypadEvent:
|
||||
{
|
||||
return handleLayerKeypadEvent(message->data,nativeObject);
|
||||
return handleKeypadEvent(message->data);
|
||||
}
|
||||
break;
|
||||
case kAccelerometerEvent:
|
||||
{
|
||||
return handleAccelerometerEvent(message->data,nativeObject);
|
||||
return handleAccelerometerEvent(message->data);
|
||||
}
|
||||
break;
|
||||
case kCommonEvent:
|
||||
|
@ -394,18 +389,22 @@ int LuaEngine::sendEvent(ScriptEvent* message,void* nativeObject)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngine::handleNodeEvent(void* data,void* nativeObject)
|
||||
int LuaEngine::handleNodeEvent(void* data)
|
||||
{
|
||||
if (NULL == nativeObject || NULL == data)
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
Node* node = (Node*)(nativeObject);
|
||||
BasicScriptData* basicScriptData = (BasicScriptData*)data;
|
||||
if (NULL == basicScriptData->nativeObject || NULL == basicScriptData->value)
|
||||
return 0;
|
||||
|
||||
Node* node = (Node*)(basicScriptData->nativeObject);
|
||||
|
||||
int handler = node->getScriptHandler();
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
||||
int action = *((int*)(data));
|
||||
int action = *((int*)(basicScriptData->value));
|
||||
switch (action)
|
||||
{
|
||||
case kNodeOnEnter:
|
||||
|
@ -436,12 +435,16 @@ int LuaEngine::handleNodeEvent(void* data,void* nativeObject)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleMenuItemEvent(void* nativeObject)
|
||||
int LuaEngine::handleMenuClickedEvent(void* data)
|
||||
{
|
||||
if ( NULL == nativeObject )
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
MenuItem* menuItem = (MenuItem*)(nativeObject);
|
||||
BasicScriptData* basicScriptData = (BasicScriptData*)data;
|
||||
if (NULL == basicScriptData->nativeObject)
|
||||
return 0;
|
||||
|
||||
MenuItem* menuItem = (MenuItem*)(basicScriptData->nativeObject);
|
||||
|
||||
int handler = menuItem->getScriptTapHandler();
|
||||
if (0 == handler)
|
||||
|
@ -454,31 +457,40 @@ int LuaEngine::handleMenuItemEvent(void* nativeObject)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleNotificationEvent(void* data,void* nativeObject)
|
||||
int LuaEngine::handleNotificationEvent(void* data)
|
||||
{
|
||||
if (NULL == nativeObject || NULL == data)
|
||||
if ( NULL == data)
|
||||
return 0;
|
||||
|
||||
NotificationCenter* center = (NotificationCenter*)(nativeObject);
|
||||
BasicScriptData* basicScriptData = (BasicScriptData*)(data);
|
||||
if (NULL == basicScriptData->nativeObject ||NULL == basicScriptData->value)
|
||||
return 0;
|
||||
|
||||
int handler = center->getObserverHandlerByName((const char*)data);
|
||||
NotificationCenter* center = (NotificationCenter*)(basicScriptData->nativeObject);
|
||||
|
||||
int handler = center->getObserverHandlerByName((const char*)basicScriptData->value);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
//Be care
|
||||
_stack->pushString((const char*)data);
|
||||
|
||||
_stack->pushString((const char*)basicScriptData->value);
|
||||
int ret = _stack->executeFunctionByHandler(handler, 1);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleCallFuncActionEvent(void* data,void* nativeObject)
|
||||
int LuaEngine::handleCallFuncActionEvent(void* data)
|
||||
{
|
||||
if (NULL == nativeObject)
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
CallFunc* callFunc = (CallFunc*)nativeObject;
|
||||
|
||||
BasicScriptData* basicScriptData = (BasicScriptData*)(data);
|
||||
if (NULL == basicScriptData->nativeObject ||NULL == basicScriptData->value)
|
||||
return 0;
|
||||
|
||||
CallFunc* callFunc = (CallFunc*)(basicScriptData->nativeObject);
|
||||
int handler = callFunc->getScriptHandler();
|
||||
Object* target = (Object*)data;
|
||||
Object* target = (Object*)(basicScriptData->value);
|
||||
if (NULL != target)
|
||||
{
|
||||
_stack->pushObject(target, "CCNode");
|
||||
|
@ -493,7 +505,7 @@ int LuaEngine::handleScheduler(void* data)
|
|||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
SchedulerScriptEvent* schedulerInfo = (SchedulerScriptEvent*)data;
|
||||
SchedulerScriptData* schedulerInfo = (SchedulerScriptData*)data;
|
||||
|
||||
_stack->pushFloat(schedulerInfo->elapse);
|
||||
int ret = _stack->executeFunctionByHandler(schedulerInfo->handler, 1);
|
||||
|
@ -502,20 +514,117 @@ int LuaEngine::handleScheduler(void* data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleLayerTouchesEvent(void* data,void* nativeObject)
|
||||
int LuaEngine::handleKeypadEvent(void* data)
|
||||
{
|
||||
if (NULL == nativeObject || NULL == data)
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
Layer* layer = (Layer*)nativeObject;
|
||||
LayerTouchesScriptEvent* info = (LayerTouchesScriptEvent*)data;
|
||||
if (NULL == info->touches)
|
||||
KeypadScriptData* keypadScriptData = (KeypadScriptData*)data;
|
||||
if (NULL == keypadScriptData->nativeObject)
|
||||
return 0;
|
||||
|
||||
switch (keypadScriptData->objectType)
|
||||
{
|
||||
case kLayerKeypad:
|
||||
{
|
||||
Layer* layer = (Layer*)(keypadScriptData->nativeObject);
|
||||
return handleLayerKeypadEvent(layer, keypadScriptData->actionType);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngine::handleAccelerometerEvent(void* data)
|
||||
{
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
BasicScriptData* basicScriptData = (BasicScriptData*)data;
|
||||
if (NULL == basicScriptData->nativeObject || NULL == basicScriptData->value)
|
||||
return 0;
|
||||
|
||||
Layer* layer = (Layer*)(basicScriptData->nativeObject);
|
||||
|
||||
ScriptHandlerEntry* scriptHandlerEntry = layer->getScriptAccelerateHandlerEntry();
|
||||
if (NULL == scriptHandlerEntry || 0 == scriptHandlerEntry->getHandler())
|
||||
return 0;
|
||||
|
||||
Acceleration* accelerationValue = (Acceleration*)(basicScriptData->value);
|
||||
_stack->pushFloat(accelerationValue->x);
|
||||
_stack->pushFloat(accelerationValue->y);
|
||||
_stack->pushFloat(accelerationValue->z);
|
||||
_stack->pushFloat(accelerationValue->timestamp);
|
||||
int ret = _stack->executeFunctionByHandler(scriptHandlerEntry->getHandler(), 4);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleCommonEvent(void* data)
|
||||
{
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
CommonScriptData* commonInfo = (CommonScriptData*)data;
|
||||
if (NULL == commonInfo->eventName || 0 == commonInfo->handler)
|
||||
return 0;
|
||||
|
||||
_stack->pushString(commonInfo->eventName);
|
||||
if (NULL != commonInfo->eventSource)
|
||||
{
|
||||
if (NULL != commonInfo->eventSourceClassName && strlen(commonInfo->eventSourceClassName) > 0)
|
||||
{
|
||||
_stack->pushObject(commonInfo->eventSource, commonInfo->eventSourceClassName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_stack->pushObject(commonInfo->eventSource, "CCObject");
|
||||
}
|
||||
}
|
||||
int ret = _stack->executeFunctionByHandler(commonInfo->handler, commonInfo->eventSource ? 2 : 1);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleTouchesEvent(void* data)
|
||||
{
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
TouchesScriptData* touchesScriptData = (TouchesScriptData*)data;
|
||||
if (NULL == touchesScriptData->nativeObject || NULL == touchesScriptData->touches)
|
||||
return 0;
|
||||
|
||||
switch (touchesScriptData->objectType)
|
||||
{
|
||||
case kLayerTouches:
|
||||
{
|
||||
Layer* layer = (Layer*)(touchesScriptData->nativeObject);
|
||||
return handleLayerTouchesEvent(layer, touchesScriptData->actionType, touchesScriptData->touches);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngine::handleLayerTouchesEvent(Layer* layer,int actionType,Set* touches)
|
||||
{
|
||||
if (NULL == layer || NULL == touches)
|
||||
return 0;
|
||||
|
||||
TouchScriptHandlerEntry* scriptHandlerEntry = layer->getScriptTouchHandlerEntry();
|
||||
if (NULL == scriptHandlerEntry || 0 == scriptHandlerEntry->getHandler())
|
||||
return 0;
|
||||
switch (info->actionType)
|
||||
|
||||
switch (actionType)
|
||||
{
|
||||
case CCTOUCHBEGAN:
|
||||
_stack->pushString("began");
|
||||
|
@ -539,80 +648,47 @@ int LuaEngine::handleLayerTouchesEvent(void* data,void* nativeObject)
|
|||
|
||||
Director* pDirector = Director::sharedDirector();
|
||||
lua_State *L = _stack->getLuaState();
|
||||
lua_newtable(L);
|
||||
int i = 1;
|
||||
for (SetIterator it = info->touches->begin(); it != info->touches->end(); ++it)
|
||||
int count = touches->count();
|
||||
int ret = 0;
|
||||
if (count == 1)
|
||||
{
|
||||
Touch* pTouch = (Touch*)*it;
|
||||
Point pt = pDirector->convertToGL(pTouch->getLocationInView());
|
||||
lua_pushnumber(L, pt.x);
|
||||
lua_rawseti(L, -2, i++);
|
||||
lua_pushnumber(L, pt.y);
|
||||
lua_rawseti(L, -2, i++);
|
||||
lua_pushinteger(L, pTouch->getID());
|
||||
lua_rawseti(L, -2, i++);
|
||||
Touch* touch = (Touch*)*(touches->begin());
|
||||
if (NULL != touch) {
|
||||
const Point pt = Director::sharedDirector()->convertToGL(touch->getLocationInView());
|
||||
_stack->pushFloat(pt.x);
|
||||
_stack->pushFloat(pt.y);
|
||||
ret = _stack->executeFunctionByHandler(scriptHandlerEntry->getHandler(), 3);
|
||||
}
|
||||
}
|
||||
else if(count > 1)
|
||||
{
|
||||
lua_newtable(L);
|
||||
int i = 1;
|
||||
for (SetIterator it = touches->begin(); it != touches->end(); ++it)
|
||||
{
|
||||
Touch* pTouch = (Touch*)*it;
|
||||
Point pt = pDirector->convertToGL(pTouch->getLocationInView());
|
||||
lua_pushnumber(L, pt.x);
|
||||
lua_rawseti(L, -2, i++);
|
||||
lua_pushnumber(L, pt.y);
|
||||
lua_rawseti(L, -2, i++);
|
||||
lua_pushinteger(L, pTouch->getID());
|
||||
lua_rawseti(L, -2, i++);
|
||||
}
|
||||
ret = _stack->executeFunctionByHandler(scriptHandlerEntry->getHandler(), 2);
|
||||
}
|
||||
int ret = _stack->executeFunctionByHandler(scriptHandlerEntry->getHandler(), 2);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleLayerTouchEvent(void* data,void* nativeObject)
|
||||
int LuaEngine::handleLayerKeypadEvent(Layer* layer,int actionType)
|
||||
{
|
||||
if (NULL == nativeObject || NULL == data)
|
||||
if (NULL == layer)
|
||||
return 0;
|
||||
|
||||
Layer* layer = (Layer*)nativeObject;
|
||||
LayerTouchScriptEvent* info = (LayerTouchScriptEvent*)data;
|
||||
if (NULL == info->touch)
|
||||
return 0;
|
||||
|
||||
TouchScriptHandlerEntry* scriptHandlerEntry = layer->getScriptTouchHandlerEntry();
|
||||
if (NULL == scriptHandlerEntry || 0 == scriptHandlerEntry->getHandler())
|
||||
return 0;
|
||||
|
||||
|
||||
switch (info->actionType)
|
||||
{
|
||||
case CCTOUCHBEGAN:
|
||||
_stack->pushString("began");
|
||||
break;
|
||||
|
||||
case CCTOUCHMOVED:
|
||||
_stack->pushString("moved");
|
||||
break;
|
||||
|
||||
case CCTOUCHENDED:
|
||||
_stack->pushString("ended");
|
||||
break;
|
||||
|
||||
case CCTOUCHCANCELLED:
|
||||
_stack->pushString("cancelled");
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Point pt = Director::sharedDirector()->convertToGL(info->touch->getLocationInView());
|
||||
_stack->pushFloat(pt.x);
|
||||
_stack->pushFloat(pt.y);
|
||||
int ret = _stack->executeFunctionByHandler(scriptHandlerEntry->getHandler(), 3);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleLayerKeypadEvent(void* data,void* nativeObject)
|
||||
{
|
||||
if (NULL == nativeObject || NULL == data)
|
||||
return 0;
|
||||
|
||||
Layer* layer = (Layer*)(nativeObject);
|
||||
ScriptHandlerEntry* pScriptHandlerEntry = layer->getScriptKeypadHandlerEntry();
|
||||
if (NULL == pScriptHandlerEntry || 0 == pScriptHandlerEntry->getHandler())
|
||||
return 0;
|
||||
|
||||
int action = *((int*)(data));
|
||||
|
||||
int action = actionType;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
|
@ -631,53 +707,4 @@ int LuaEngine::handleLayerKeypadEvent(void* data,void* nativeObject)
|
|||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleAccelerometerEvent(void* data,void* nativeObject)
|
||||
{
|
||||
if (NULL == nativeObject || NULL == data)
|
||||
return 0;
|
||||
|
||||
Layer* layer = (Layer*)(nativeObject);
|
||||
|
||||
ScriptHandlerEntry* scriptHandlerEntry = layer->getScriptAccelerateHandlerEntry();
|
||||
if (NULL == scriptHandlerEntry || 0 == scriptHandlerEntry->getHandler())
|
||||
return 0;
|
||||
|
||||
Acceleration* accelerationValue = (Acceleration*)data;
|
||||
_stack->pushFloat(accelerationValue->x);
|
||||
_stack->pushFloat(accelerationValue->y);
|
||||
_stack->pushFloat(accelerationValue->z);
|
||||
_stack->pushFloat(accelerationValue->timestamp);
|
||||
int ret = _stack->executeFunctionByHandler(scriptHandlerEntry->getHandler(), 4);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngine::handleCommonEvent(void* data)
|
||||
{
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
CommonScriptEvent* commonInfo = (CommonScriptEvent*)data;
|
||||
if (NULL == commonInfo->eventName || 0 == commonInfo->handler)
|
||||
return 0;
|
||||
|
||||
_stack->pushString(commonInfo->eventName);
|
||||
if (NULL != commonInfo->eventSource)
|
||||
{
|
||||
if (NULL != commonInfo->eventSourceClassName && strlen(commonInfo->eventSourceClassName) > 0)
|
||||
{
|
||||
_stack->pushObject(commonInfo->eventSource, commonInfo->eventSourceClassName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_stack->pushObject(commonInfo->eventSource, "CCObject");
|
||||
}
|
||||
}
|
||||
int ret = _stack->executeFunctionByHandler(commonInfo->handler, commonInfo->eventSource ? 2 : 1);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -118,18 +118,19 @@ public:
|
|||
|
||||
virtual bool handleAssert(const char *msg);
|
||||
|
||||
virtual int sendEvent(ScriptEvent* message,void* nativeObject = NULL);
|
||||
virtual int sendEvent(ScriptEvent* message);
|
||||
private:
|
||||
int handleNodeEvent(void* data,void* nativeObject);
|
||||
int handleMenuItemEvent(void* nativeObject);
|
||||
int handleNotificationEvent(void* data,void* nativeObject);
|
||||
int handleCallFuncActionEvent(void* data,void* nativeObject);
|
||||
int handleNodeEvent(void* data);
|
||||
int handleMenuClickedEvent(void* data);
|
||||
int handleNotificationEvent(void* data);
|
||||
int handleCallFuncActionEvent(void* data);
|
||||
int handleScheduler(void* data);
|
||||
int handleLayerTouchesEvent(void* data,void* nativeObject);
|
||||
int handleLayerTouchEvent(void* data,void* nativeObject);
|
||||
int handleLayerKeypadEvent(void* data,void* nativeObject);
|
||||
int handleAccelerometerEvent(void* data,void* nativeObject);
|
||||
int handleKeypadEvent(void* data);
|
||||
int handleAccelerometerEvent(void* data);
|
||||
int handleCommonEvent(void* data);
|
||||
int handleTouchesEvent(void* data);
|
||||
int handleLayerTouchesEvent(Layer* layer,int actionType,Set* touches);
|
||||
int handleLayerKeypadEvent(Layer* layer,int actionType);
|
||||
private:
|
||||
LuaEngine(void)
|
||||
: _stack(NULL)
|
||||
|
|
|
@ -1 +1 @@
|
|||
014ec1c1422ae9a346307e5e2cbeeaa36b6ca7a5
|
||||
9396440a0938c40aad23960e8c269af670a12110
|
|
@ -35,7 +35,7 @@ public:
|
|||
int nHandler = luaView->getScriptHandler(LuaScrollView::kScrollViewScriptScroll);
|
||||
if (0 != nHandler)
|
||||
{
|
||||
CommonScriptEvent data(nHandler,"");
|
||||
CommonScriptData data(nHandler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
int nHandler = luaView->getScriptHandler(LuaScrollView::kScrollViewScriptZoom);
|
||||
if (0 != nHandler)
|
||||
{
|
||||
CommonScriptEvent data(nHandler,"");
|
||||
CommonScriptData data(nHandler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
if (NULL != luaWs) {
|
||||
int nHandler = luaWs->getScriptHandler(LuaWebSocket::kWebSocketScriptHandlerOpen);
|
||||
if (0 != nHandler) {
|
||||
CommonScriptEvent data(nHandler,"");
|
||||
CommonScriptData data(nHandler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
|
||||
int nHandler = luaWs->getScriptHandler(LuaWebSocket::kWebSocketScriptHandlerMessage);
|
||||
if (0 != nHandler) {
|
||||
CommonScriptEvent commonData(nHandler,data.bytes);
|
||||
CommonScriptData commonData(nHandler,data.bytes);
|
||||
ScriptEvent event(kCommonEvent,(void*)&commonData);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
int nHandler = luaWs->getScriptHandler(LuaWebSocket::kWebSocketScriptHandlerClose);
|
||||
if (0 != nHandler)
|
||||
{
|
||||
CommonScriptEvent data(nHandler,"");
|
||||
CommonScriptData data(nHandler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
int nHandler = luaWs->getScriptHandler(LuaWebSocket::kWebSocketScriptHandlerError);
|
||||
if (0 != nHandler)
|
||||
{
|
||||
CommonScriptEvent data(nHandler,"");
|
||||
CommonScriptData data(nHandler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
ScriptEngineManager::sharedManager()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue