mirror of https://github.com/axmolengine/axmol.git
Optimize & sync sources
This commit is contained in:
parent
ddb30e881c
commit
a558bc2198
|
@ -207,57 +207,26 @@ int LuaEngine::sendEvent(const ScriptEvent& evt)
|
|||
switch (evt.type)
|
||||
{
|
||||
case kNodeEvent:
|
||||
{
|
||||
return handleNodeEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleNodeEvent(evt.data);
|
||||
case kMenuClickedEvent:
|
||||
{
|
||||
return handleMenuClickedEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleMenuClickedEvent(evt.data);
|
||||
case kCallFuncEvent:
|
||||
{
|
||||
return handleCallFuncActionEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleCallFuncActionEvent(evt.data);
|
||||
case kScheduleEvent:
|
||||
{
|
||||
return handleScheduler(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleScheduler(evt.data);
|
||||
case kTouchEvent:
|
||||
{
|
||||
return handleTouchEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleTouchEvent(evt.data);
|
||||
case kTouchesEvent:
|
||||
{
|
||||
return handleTouchesEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleTouchesEvent(evt.data);
|
||||
case kKeypadEvent:
|
||||
{
|
||||
return handleKeypadEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleKeypadEvent(evt.data);
|
||||
case kAccelerometerEvent:
|
||||
{
|
||||
return handleAccelerometerEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleAccelerometerEvent(evt.data);
|
||||
case kCommonEvent:
|
||||
{
|
||||
return handleCommonEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
return handleCommonEvent(evt.data);
|
||||
case kControlEvent:
|
||||
{
|
||||
return handlerControlEvent(evt.data);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return handlerControlEvent(evt.data);
|
||||
default: ;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -715,14 +715,14 @@ static int executeScriptTouchHandler(Layer* layer, EventTouch::EventCode eventTy
|
|||
{
|
||||
TouchScriptData data(eventType, layer, touch, event);
|
||||
ScriptEvent scriptEvent(kTouchEvent, &data);
|
||||
return ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
return ScriptEngineManager::sendEventToLua(scriptEvent);
|
||||
}
|
||||
|
||||
static int executeScriptTouchesHandler(Layer* layer, EventTouch::EventCode eventType, const std::vector<Touch*>& touches, Event* event)
|
||||
{
|
||||
TouchesScriptData data(eventType, layer, touches, event);
|
||||
ScriptEvent scriptEvent(kTouchesEvent, &data);
|
||||
return ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
return ScriptEngineManager::sendEventToLua(scriptEvent);
|
||||
}
|
||||
|
||||
static void setTouchEnabledForLayer(Layer* layer, bool enabled)
|
||||
|
@ -1197,7 +1197,7 @@ static int lua_cocos2dx_Layer_setKeyboardEnabled(lua_State* L)
|
|||
listener->onKeyReleased = [self](EventKeyboard::KeyCode keyCode, Event* event){
|
||||
KeypadScriptData data(keyCode, self);
|
||||
ScriptEvent scriptEvent(kKeypadEvent,&data);
|
||||
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
|
||||
ScriptEngineManager::sendEventToLua(scriptEvent);
|
||||
};
|
||||
CCLOG("come in the keyboardEnable");
|
||||
dispatcher->addEventListenerWithSceneGraphPriority(listener, self);
|
||||
|
@ -1316,7 +1316,7 @@ static int lua_cocos2dx_Layer_setAccelerometerEnabled(lua_State* L)
|
|||
auto listener = EventListenerAcceleration::create([self](Acceleration* acc, Event* event){
|
||||
BasicScriptData data(self,(void*)acc);
|
||||
ScriptEvent accEvent(kAccelerometerEvent,&data);
|
||||
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&accEvent);
|
||||
ScriptEngineManager::sendEventToLua(accEvent);
|
||||
});
|
||||
|
||||
dispatcher->addEventListenerWithSceneGraphPriority(listener, self);
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
{
|
||||
CommonScriptData data(handler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
LuaEngine::getInstance()->sendEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
{
|
||||
CommonScriptData data(handler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
LuaEngine::getInstance()->sendEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ void LuaMinXmlHttpRequest::_sendRequest()
|
|||
CCLOG("come in handler, handler is %d", handler);
|
||||
cocos2d::CommonScriptData data(handler,"");
|
||||
cocos2d::ScriptEvent event(cocos2d::ScriptEventType::kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||
cocos2d::ScriptEngineManager::sendEventToLua(event);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ void LuaMinXmlHttpRequest::_sendRequest()
|
|||
{
|
||||
cocos2d::CommonScriptData data(handler,"");
|
||||
cocos2d::ScriptEvent event(cocos2d::ScriptEventType::kCommonEvent,(void*)&data);
|
||||
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||
cocos2d::ScriptEngineManager::sendEventToLua(event);
|
||||
}
|
||||
release();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue