mirror of
https://github.com/u0u0/Cocos2d-Lua-Community.git
synced 2026-06-10 00:27:32 +08:00
裁剪:assert-manager、2.x GUI 、Menu、Layer、Deorecated数据结构
This commit is contained in:
@@ -27,12 +27,10 @@
|
||||
#include "scripting/lua-bindings/manual/CCLuaEngine.h"
|
||||
#include "scripting/lua-bindings/manual/tolua_fix.h"
|
||||
|
||||
#include "extensions/GUI/CCControlExtension/CCControl.h"
|
||||
#include "scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.hpp"
|
||||
#include "scripting/lua-bindings/manual/extension/lua_cocos2dx_extension_manual.h"
|
||||
#include "scripting/lua-bindings/manual/cocostudio/lua_cocos2dx_coco_studio_manual.hpp"
|
||||
#include "scripting/lua-bindings/manual/ui/lua_cocos2dx_ui_manual.hpp"
|
||||
#include "2d/CCMenuItem.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCEventCustom.h"
|
||||
|
||||
@@ -117,17 +115,6 @@ int LuaEngine::executeMenuItemEvent(MenuItem* pMenuItem)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngine::executeNotificationEvent(__NotificationCenter* pNotificationCenter, const char* pszName)
|
||||
{
|
||||
int nHandler = pNotificationCenter->getObserverHandlerByName(pszName);
|
||||
if (!nHandler) return 0;
|
||||
|
||||
_stack->pushString(pszName);
|
||||
int ret = _stack->executeFunctionByHandler(nHandler, 1);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::executeCallFuncActionEvent(CallFunc* pAction, Ref* pTarget/* = NULL*/)
|
||||
{
|
||||
return 0;
|
||||
@@ -147,11 +134,6 @@ int LuaEngine::executeLayerTouchEvent(Layer* pLayer, int eventType, Touch *pTouc
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngine::executeLayerTouchesEvent(Layer* pLayer, int eventType, __Set *pTouches)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngine::executeLayerKeypadEvent(Layer* pLayer, int eventType)
|
||||
{
|
||||
return 0;
|
||||
@@ -216,11 +198,6 @@ int LuaEngine::sendEvent(ScriptEvent* evt)
|
||||
return handleNodeEvent(evt->data);
|
||||
}
|
||||
break;
|
||||
case kMenuClickedEvent:
|
||||
{
|
||||
return handleMenuClickedEvent(evt->data);
|
||||
}
|
||||
break;
|
||||
case kCallFuncEvent:
|
||||
{
|
||||
return handleCallFuncActionEvent(evt->data);
|
||||
@@ -256,11 +233,6 @@ int LuaEngine::sendEvent(ScriptEvent* evt)
|
||||
return handleCommonEvent(evt->data);
|
||||
}
|
||||
break;
|
||||
case kControlEvent:
|
||||
{
|
||||
return handlerControlEvent(evt->data);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -313,28 +285,6 @@ int LuaEngine::handleNodeEvent(void* data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleMenuClickedEvent(void* data)
|
||||
{
|
||||
if (NULL == data)
|
||||
return 0;
|
||||
|
||||
BasicScriptData* basicScriptData = (BasicScriptData*)data;
|
||||
if (NULL == basicScriptData->nativeObject)
|
||||
return 0;
|
||||
|
||||
MenuItem* menuItem = static_cast<MenuItem*>(basicScriptData->nativeObject);
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(menuItem, ScriptHandlerMgr::HandlerType::MENU_CLICKED);
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
||||
_stack->pushInt(menuItem->getTag());
|
||||
_stack->pushObject(menuItem, "cc.MenuItem");
|
||||
int ret = _stack->executeFunctionByHandler(handler, 2);
|
||||
_stack->clean();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleCallFuncActionEvent(void* data)
|
||||
{
|
||||
if (NULL == data)
|
||||
@@ -562,40 +512,6 @@ int LuaEngine::handleTouchesEvent(void* data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handlerControlEvent(void* data)
|
||||
{
|
||||
if ( NULL == data )
|
||||
return 0;
|
||||
|
||||
BasicScriptData* basicScriptData = static_cast<BasicScriptData*>(data);
|
||||
if (NULL == basicScriptData->nativeObject)
|
||||
return 0;
|
||||
|
||||
int controlEvents = *((int*)(basicScriptData->value));
|
||||
|
||||
int handler = 0;
|
||||
int ret = 0;
|
||||
|
||||
for (int i = 0; i < kControlEventTotalNumber; i++)
|
||||
{
|
||||
if ((controlEvents & (1 << i)))
|
||||
{
|
||||
ScriptHandlerMgr::HandlerType controlHandler = ScriptHandlerMgr::HandlerType((int)ScriptHandlerMgr::HandlerType::CONTROL_TOUCH_DOWN + i);
|
||||
handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, controlHandler);
|
||||
|
||||
if (0 != handler)
|
||||
{
|
||||
_stack->pushObject((Ref*)basicScriptData->nativeObject, "cc.Ref");
|
||||
_stack->pushInt(controlEvents);
|
||||
ret = _stack->executeFunctionByHandler(handler, 2);
|
||||
_stack->clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LuaEngine::handleEventAcc(void* data)
|
||||
{
|
||||
if (nullptr == data)
|
||||
|
||||
Reference in New Issue
Block a user