mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into doxygen
This commit is contained in:
commit
3a334b7478
|
@ -24,6 +24,7 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCGeometry.h"
|
||||
#include "ccMacros.h"
|
||||
#include <algorithm>
|
||||
|
||||
// implementation of Point
|
||||
NS_CC_BEGIN
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d94972074fcba0d2595b974d52d721e1eaee5da5
|
||||
Subproject commit 4067a380cdc9bec8c8e5344643cd5273560cd908
|
|
@ -142,7 +142,7 @@ void CCBProxy::setCallback(Node* node,int handle, int controlEvents)
|
|||
{
|
||||
MenuItem *menuItem = dynamic_cast<MenuItem*>(node);
|
||||
if (nullptr != menuItem) {
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)menuItem, handle, ScriptHandlerMgr::kMenuClickHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)menuItem, handle, ScriptHandlerMgr::HandlerType::MENU_CLICKED);
|
||||
}
|
||||
}
|
||||
else if (NULL != dynamic_cast<Control*>(node))
|
||||
|
@ -154,8 +154,8 @@ void CCBProxy::setCallback(Node* node,int handle, int controlEvents)
|
|||
{
|
||||
if ((controlEvents & (1 << i)))
|
||||
{
|
||||
int handlerevent = ScriptHandlerMgr::kControlTouchDownHandler + i;
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)control, handle, handlerevent);
|
||||
ScriptHandlerMgr::HandlerType handlerType = ScriptHandlerMgr::HandlerType((int)ScriptHandlerMgr::HandlerType::CONTROL_TOUCH_DOWN + i);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)control, handle, handlerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ int LuaEngine::handleNodeEvent(void* data)
|
|||
if (NULL == basicScriptData->nativeObject || NULL == basicScriptData->value)
|
||||
return 0;
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::kNodeHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::HandlerType::NODE);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
@ -315,7 +315,7 @@ int LuaEngine::handleMenuClickedEvent(void* data)
|
|||
|
||||
MenuItem* menuItem = static_cast<MenuItem*>(basicScriptData->nativeObject);
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(menuItem, ScriptHandlerMgr::kMenuClickHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(menuItem, ScriptHandlerMgr::HandlerType::MENU_CLICKED);
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
||||
|
@ -357,7 +357,7 @@ int LuaEngine::handleCallFuncActionEvent(void* data)
|
|||
if (NULL == basicScriptData->nativeObject)
|
||||
return 0;
|
||||
|
||||
int handler =ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::kCallFuncHandler);
|
||||
int handler =ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
@ -395,7 +395,7 @@ int LuaEngine::handleKeypadEvent(void* data)
|
|||
if (NULL == keypadScriptData->nativeObject)
|
||||
return 0;
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(keypadScriptData->nativeObject, ScriptHandlerMgr::kKeypadHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(keypadScriptData->nativeObject, ScriptHandlerMgr::HandlerType::KEYPAD);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
@ -429,7 +429,7 @@ int LuaEngine::handleAccelerometerEvent(void* data)
|
|||
if (NULL == basicScriptData->nativeObject || NULL == basicScriptData->value)
|
||||
return 0;
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::kAccelerometerHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::HandlerType::ACCELEROMETER);
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
||||
|
@ -478,7 +478,7 @@ int LuaEngine::handleTouchEvent(void* data)
|
|||
if (NULL == touchScriptData->nativeObject || NULL == touchScriptData->touch)
|
||||
return 0;
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)touchScriptData->nativeObject, ScriptHandlerMgr::kTouchesHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)touchScriptData->nativeObject, ScriptHandlerMgr::HandlerType::TOUCHES);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
@ -527,7 +527,7 @@ int LuaEngine::handleTouchesEvent(void* data)
|
|||
if (NULL == touchesScriptData->nativeObject || NULL == touchesScriptData->touches)
|
||||
return 0;
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)touchesScriptData->nativeObject, ScriptHandlerMgr::kTouchesHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)touchesScriptData->nativeObject, ScriptHandlerMgr::HandlerType::TOUCHES);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
@ -587,28 +587,28 @@ int LuaEngine::handleTableViewEvent(void* data)
|
|||
return 0;
|
||||
|
||||
LuaTableViewEventData* tableViewEventData = static_cast<LuaTableViewEventData*>(eventData->value);
|
||||
if (tableViewEventData->eventType < ScriptHandlerMgr::kScrollViewScrollHandler || tableViewEventData->eventType > ScriptHandlerMgr::kNumberOfCellsInTableView )
|
||||
if (tableViewEventData->handlerType < ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL || tableViewEventData->handlerType > ScriptHandlerMgr::HandlerType::TABLEVIEW_NUMS_OF_CELLS )
|
||||
return 0;
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)eventData->nativeObject, tableViewEventData->eventType);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)eventData->nativeObject, tableViewEventData->handlerType);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
||||
int ret = 0;
|
||||
switch (tableViewEventData->eventType)
|
||||
switch (tableViewEventData->handlerType)
|
||||
{
|
||||
case ScriptHandlerMgr::kScrollViewScrollHandler:
|
||||
case ScriptHandlerMgr::kScrollViewZoomHandler:
|
||||
case ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL:
|
||||
case ScriptHandlerMgr::HandlerType::SCROLLVIEW_ZOOM:
|
||||
{
|
||||
_stack->pushObject(static_cast<Object*>(eventData->nativeObject), "TableView");
|
||||
ret = _stack->executeFunctionByHandler(handler, 1);
|
||||
}
|
||||
break;
|
||||
case ScriptHandlerMgr::kTableCellTouched:
|
||||
case ScriptHandlerMgr::kTableCellHighlight:
|
||||
case ScriptHandlerMgr::kTableCellUnhighlight:
|
||||
case ScriptHandlerMgr::kTableCellWillRecycle:
|
||||
case ScriptHandlerMgr::HandlerType::TABLECELL_TOUCHED:
|
||||
case ScriptHandlerMgr::HandlerType::TABLECELL_HIGHLIGHT:
|
||||
case ScriptHandlerMgr::HandlerType::TABLECELL_UNHIGHLIGHT:
|
||||
case ScriptHandlerMgr::HandlerType::TABLECELL_WILL_RECYCLE:
|
||||
{
|
||||
_stack->pushObject(static_cast<Object*>(eventData->nativeObject), "TableView");
|
||||
_stack->pushObject(static_cast<Object*>(tableViewEventData->value), "TableViewCell");
|
||||
|
@ -640,7 +640,8 @@ int LuaEngine::handlerControlEvent(void* data)
|
|||
{
|
||||
if ((controlEvents & (1 << i)))
|
||||
{
|
||||
handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::kControlTouchDownHandler + i);
|
||||
ScriptHandlerMgr::HandlerType controlHandler = ScriptHandlerMgr::HandlerType((int)ScriptHandlerMgr::HandlerType::CONTROL_TOUCH_DOWN + i);
|
||||
handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, controlHandler);
|
||||
|
||||
if (0 != handler)
|
||||
{
|
||||
|
@ -734,32 +735,32 @@ int LuaEngine::handleTableViewEventReturnArray(void* data,int numResults,Array&
|
|||
return 0;
|
||||
|
||||
LuaTableViewEventData* tableViewEventData = static_cast<LuaTableViewEventData*>(eventData->value);
|
||||
if (tableViewEventData->eventType < ScriptHandlerMgr::kScrollViewScrollHandler || tableViewEventData->eventType > ScriptHandlerMgr::kNumberOfCellsInTableView )
|
||||
if (tableViewEventData->handlerType < ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL || tableViewEventData->handlerType > ScriptHandlerMgr::HandlerType::TABLEVIEW_NUMS_OF_CELLS )
|
||||
return 0;
|
||||
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)eventData->nativeObject, tableViewEventData->eventType);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)eventData->nativeObject, tableViewEventData->handlerType);
|
||||
|
||||
if (0 == handler)
|
||||
return 0;
|
||||
|
||||
int ret = 0;
|
||||
switch (tableViewEventData->eventType)
|
||||
switch (tableViewEventData->handlerType)
|
||||
{
|
||||
case ScriptHandlerMgr::kTableCellSizeForIndex:
|
||||
case ScriptHandlerMgr::HandlerType::TABLECELL_SIZE_FOR_INDEX:
|
||||
{
|
||||
_stack->pushObject(static_cast<Object*>(eventData->nativeObject), "TableView");
|
||||
_stack->pushInt(*((int*)tableViewEventData->value));
|
||||
ret = _stack->executeFunctionReturnArray(handler, 2, 2, resultArray);
|
||||
}
|
||||
break;
|
||||
case ScriptHandlerMgr::kTableCellAtIndex:
|
||||
case ScriptHandlerMgr::HandlerType::TABLECELL_AT_INDEX:
|
||||
{
|
||||
_stack->pushObject(static_cast<Object*>(eventData->nativeObject), "TableView");
|
||||
_stack->pushInt(*((int*)tableViewEventData->value));
|
||||
ret = _stack->executeFunctionReturnArray(handler, 2, 1, resultArray);
|
||||
}
|
||||
break;
|
||||
case ScriptHandlerMgr::kNumberOfCellsInTableView:
|
||||
case ScriptHandlerMgr::HandlerType::TABLEVIEW_NUMS_OF_CELLS:
|
||||
{
|
||||
_stack->pushObject(static_cast<Object*>(eventData->nativeObject), "TableView");
|
||||
ret = _stack->executeFunctionReturnArray(handler, 1, 1, resultArray);
|
||||
|
|
|
@ -1328,3 +1328,25 @@ void dictionary_to_luaval(lua_State* L, Dictionary* dict)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void std_vector_to_luaval(lua_State* L,const std::vector<Sprite*>& inValue)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
if (inValue.empty())
|
||||
return;
|
||||
|
||||
auto iter = inValue.begin();
|
||||
int indexTable = 1;
|
||||
for (; iter != inValue.end(); ++iter)
|
||||
{
|
||||
if (nullptr == *iter)
|
||||
continue;
|
||||
|
||||
lua_pushnumber(L, (lua_Number)indexTable);
|
||||
toluafix_pushusertype_ccobject(L, (*iter)->_ID, &((*iter)->_luaID), (void*)(*iter),"Sprite");
|
||||
lua_rawset(L, -3);
|
||||
(*iter)->retain();
|
||||
++indexTable;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,5 @@ extern void affinetransform_to_luaval(lua_State* L,const AffineTransform& inValu
|
|||
extern void fontdefinition_to_luaval(lua_State* L,const FontDefinition& inValue);
|
||||
extern void array_to_luaval(lua_State* L,Array* inValue);
|
||||
extern void dictionary_to_luaval(lua_State* L, Dictionary* dict);
|
||||
extern void std_vector_to_luaval(lua_State* L,const std::vector<Sprite*>& inValue);
|
||||
#endif //__COCOS2DX_SCRIPTING_LUA_COCOS2DXSUPPORT_LUABAISCCONVERSIONS_H__
|
||||
|
|
|
@ -1 +1 @@
|
|||
82873a7bab5c684b380655f714ef4627c2cc597c
|
||||
056180de93a0fb906dd8ab3a7b1806f37a325a38
|
|
@ -54,7 +54,7 @@ LuaCallFunc * LuaCallFunc::create(int nHandler)
|
|||
if (NULL != ret )
|
||||
{
|
||||
ret->autorelease();
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, nHandler, ScriptHandlerMgr::kCallFuncHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, nHandler, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
|
@ -65,7 +65,7 @@ LuaCallFunc * LuaCallFunc::create(int nHandler)
|
|||
}
|
||||
void LuaCallFunc::execute()
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr:: kCallFuncHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
|
||||
if (0 == handler)
|
||||
return ;
|
||||
|
@ -77,7 +77,7 @@ void LuaCallFunc::execute()
|
|||
|
||||
LuaCallFunc* LuaCallFunc::clone() const
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr:: kCallFuncHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
|
||||
if (0 == handler)
|
||||
return NULL;
|
||||
|
@ -86,7 +86,7 @@ LuaCallFunc* LuaCallFunc::clone() const
|
|||
|
||||
int newscriptHandler = cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->reallocateScriptHandler(handler);
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, newscriptHandler, ScriptHandlerMgr::kCallFuncHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)ret, newscriptHandler, ScriptHandlerMgr::HandlerType::CALLFUNC);
|
||||
|
||||
ret->autorelease();
|
||||
|
||||
|
@ -118,27 +118,27 @@ void ScriptHandlerMgr::init()
|
|||
_mapObjectHandlers.clear();
|
||||
}
|
||||
|
||||
void ScriptHandlerMgr::addObjectHandler(void* object,int handler,int eventType)
|
||||
void ScriptHandlerMgr::addObjectHandler(void* object,int handler,ScriptHandlerMgr::HandlerType handlerType)
|
||||
{
|
||||
if (NULL == object)
|
||||
return;
|
||||
|
||||
//may be not need
|
||||
removeObjectHandler(object,eventType);
|
||||
removeObjectHandler(object,handlerType);
|
||||
|
||||
auto iter = _mapObjectHandlers.find(object);
|
||||
VecEventHandlers vecHandlers;
|
||||
VecHandlerPairs vecHandlers;
|
||||
vecHandlers.clear();
|
||||
if (_mapObjectHandlers.end() != iter)
|
||||
{
|
||||
vecHandlers = iter->second;
|
||||
}
|
||||
|
||||
PairEventHandler eventHanler = std::make_pair(eventType, handler);
|
||||
HandlerPair eventHanler = std::make_pair(handlerType, handler);
|
||||
vecHandlers.push_back(eventHanler);
|
||||
_mapObjectHandlers[object] = vecHandlers;
|
||||
}
|
||||
void ScriptHandlerMgr::removeObjectHandler(void* object,int eventType)
|
||||
void ScriptHandlerMgr::removeObjectHandler(void* object,ScriptHandlerMgr::HandlerType handlerType)
|
||||
{
|
||||
if (NULL == object || _mapObjectHandlers.empty())
|
||||
return;
|
||||
|
@ -154,7 +154,7 @@ void ScriptHandlerMgr::removeObjectHandler(void* object,int eventType)
|
|||
bool exist = false;
|
||||
for (; iterVec != iterMap->second.end(); iterVec++)
|
||||
{
|
||||
if (iterVec->first == eventType)
|
||||
if (iterVec->first == handlerType)
|
||||
{
|
||||
exist = true;
|
||||
break;
|
||||
|
@ -167,7 +167,7 @@ void ScriptHandlerMgr::removeObjectHandler(void* object,int eventType)
|
|||
}
|
||||
|
||||
}
|
||||
int ScriptHandlerMgr::getObjectHandler(void* object,int eventType)
|
||||
int ScriptHandlerMgr::getObjectHandler(void* object,ScriptHandlerMgr::HandlerType handlerType)
|
||||
{
|
||||
if (NULL == object || _mapObjectHandlers.empty() )
|
||||
return 0;
|
||||
|
@ -179,7 +179,7 @@ int ScriptHandlerMgr::getObjectHandler(void* object,int eventType)
|
|||
auto iterVec = (iter->second).begin();
|
||||
for (; iterVec != (iter->second).end(); iterVec++)
|
||||
{
|
||||
if (iterVec->first == eventType)
|
||||
if (iterVec->first == handlerType)
|
||||
{
|
||||
return iterVec->second;
|
||||
}
|
||||
|
@ -204,323 +204,6 @@ void ScriptHandlerMgr::removeObjectAllHandlers(void* object)
|
|||
|
||||
NS_CC_END
|
||||
|
||||
int tolua_Cocos2d_registerScriptHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCNode",0,&tolua_err) ||
|
||||
!toluafix_isfunction(tolua_S, 2, "LUA_FUNCTION", 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Node* node = (Node*)tolua_tousertype(tolua_S,1,0);
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)node, handler, ScriptHandlerMgr::kNodeHandler);
|
||||
return 0;
|
||||
}
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_unregisterScriptHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCNode",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Node* node = (Node*)tolua_tousertype(tolua_S,1,0);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)node, ScriptHandlerMgr::kNodeHandler);
|
||||
return 0;
|
||||
}
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_registerScriptTapHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCMenuItem",0,&tolua_err) ||
|
||||
!toluafix_isfunction(tolua_S, 2, "LUA_FUNCTION", 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
MenuItem* menuItem = (MenuItem*)tolua_tousertype(tolua_S,1,0);
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)menuItem, handler, ScriptHandlerMgr::kMenuClickHandler);
|
||||
return 0;
|
||||
}
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_unregisterScriptTapHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCMenuItem",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
MenuItem* menuItem = (MenuItem*)tolua_tousertype(tolua_S,1,0);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)menuItem, ScriptHandlerMgr::kMenuClickHandler);
|
||||
return 0;
|
||||
}
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_registerScriptTouchHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"CCLayer",0,&tolua_err) ||
|
||||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err)) ||
|
||||
!tolua_isboolean(tolua_S,3,1,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,4,1,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,5,1,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,6,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Layer* self = (Layer*) tolua_tousertype(tolua_S,1,0);
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
bool isMultiTouches = ((bool) tolua_toboolean(tolua_S,3,false));
|
||||
int priority = ((int) tolua_tonumber(tolua_S,4,0));
|
||||
bool swallowTouches = (bool)tolua_toboolean(tolua_S, 5, 0);
|
||||
Touch::DispatchMode touchesMode = Touch::DispatchMode::ALL_AT_ONCE;
|
||||
if (!isMultiTouches)
|
||||
touchesMode = Touch::DispatchMode::ONE_BY_ONE;
|
||||
self->setTouchMode(touchesMode);
|
||||
self->setTouchPriority(priority);
|
||||
self->setSwallowsTouches(swallowTouches);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::kTouchesHandler);
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptTouchHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_unregisterScriptTouchHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"CCLayer",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Layer* layer = (Layer*) tolua_tousertype(tolua_S,1,0);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)layer, ScriptHandlerMgr::kTouchesHandler);
|
||||
return 0;
|
||||
}
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptTouchHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_registerScriptKeypadHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"CCLayer",0,&tolua_err) ||
|
||||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err)) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Layer* layer = (Layer*) tolua_tousertype(tolua_S,1,0);
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)layer, handler, ScriptHandlerMgr::kKeypadHandler);
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptKeypadHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_unregisterScriptKeypadHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"CCLayer",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Layer* layer = (Layer*) tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler(layer, ScriptHandlerMgr::kKeypadHandler);
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'unregisterScriptKeypadHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_registerScriptAccelerateHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCLayer",0,&tolua_err) ||
|
||||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err)) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Layer* layer = (Layer*) tolua_tousertype(tolua_S,1,0);
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)layer, handler, ScriptHandlerMgr::kAccelerometerHandler);
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptAccelerateHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_unregisterScriptAccelerateHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCLayer",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Layer* layer = (Layer*) tolua_tousertype(tolua_S,1,0);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)layer, ScriptHandlerMgr::kAccelerometerHandler);
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'unregisterScriptAccelerateHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int tolua_Cocos2d_registerControlEventHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCControl",0,&tolua_err) ||
|
||||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err)) ||
|
||||
!tolua_isnumber(tolua_S, 3, 0, &tolua_err)||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Control* control = (Control*) tolua_tousertype(tolua_S,1,0);
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
int controlevent = (int)tolua_tonumber(tolua_S,3,0);
|
||||
for (int i = 0; i < kControlEventTotalNumber; i++)
|
||||
{
|
||||
if ((controlevent & (1 << i)))
|
||||
{
|
||||
int handlerevent = ScriptHandlerMgr::kControlTouchDownHandler + i;
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)control, handler, handlerevent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerControlEventHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
int tolua_Cocos2d_unregisterControlEventHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"CCControl",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S, 2, 0, &tolua_err)||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Control* control = (Control*) tolua_tousertype(tolua_S,1,0);
|
||||
int controlevent = (int)tolua_tonumber(tolua_S,2,0);
|
||||
for (int i = 0; i < kControlEventTotalNumber; i++)
|
||||
{
|
||||
if ((controlevent & (1 << i)))
|
||||
{
|
||||
int handlerevent = ScriptHandlerMgr::kControlTouchDownHandler + i;
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)control, handlerevent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerControlEventHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
int tolua_Cocos2d_WebSocket_registerScriptHandler00(lua_State* tolua_S)
|
||||
{
|
||||
|
@ -539,7 +222,7 @@ int tolua_Cocos2d_WebSocket_registerScriptHandler00(lua_State* tolua_S)
|
|||
LuaWebSocket* self = (LuaWebSocket*) tolua_tousertype(tolua_S,1,0);
|
||||
if (NULL != self ) {
|
||||
int handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::HandlerEventType handlerType = (ScriptHandlerMgr::HandlerEventType)((int)tolua_tonumber(tolua_S,3,0) + ScriptHandlerMgr::kWebSocketScriptHandlerOpen);
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)((int)tolua_tonumber(tolua_S,3,0) + (int)ScriptHandlerMgr::HandlerType::WEBSOCKET_OPEN);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, handlerType);
|
||||
}
|
||||
}
|
||||
|
@ -566,7 +249,7 @@ int tolua_Cocos2d_WebSocket_unregisterScriptHandler00(lua_State* tolua_S)
|
|||
{
|
||||
LuaWebSocket* self = (LuaWebSocket*) tolua_tousertype(tolua_S,1,0);
|
||||
if (NULL != self ) {
|
||||
ScriptHandlerMgr::HandlerEventType handlerType = (ScriptHandlerMgr::HandlerEventType)((int)tolua_tonumber(tolua_S,2,0) + ScriptHandlerMgr::kWebSocketScriptHandlerOpen);
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)((int)tolua_tonumber(tolua_S,2,0) + (int)ScriptHandlerMgr::HandlerType::WEBSOCKET_OPEN);
|
||||
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerType);
|
||||
}
|
||||
|
@ -593,7 +276,7 @@ int tolua_Cocos2d_GLNode_registerScriptDrawHandler00(lua_State* tolua_S)
|
|||
{
|
||||
GLNode* glNode = (GLNode*) tolua_tousertype(tolua_S,1,0);
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)glNode, handler, ScriptHandlerMgr::kGLNodeDrawHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)glNode, handler, ScriptHandlerMgr::HandlerType::GL_NODE_DRAW);
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
|
@ -615,7 +298,7 @@ int tolua_Cocos2d_GLNode_unregisterScriptDrawHandler00(lua_State* tolua_S)
|
|||
#endif
|
||||
{
|
||||
GLNode* glNode = (GLNode*)tolua_tousertype(tolua_S,1,0);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)glNode,ScriptHandlerMgr::kGLNodeDrawHandler);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)glNode,ScriptHandlerMgr::HandlerType::GL_NODE_DRAW);
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
|
@ -628,43 +311,9 @@ tolua_lerror:
|
|||
|
||||
static void tolua_reg_script_handler_mgr_type(lua_State* tolua_S)
|
||||
{
|
||||
tolua_usertype(tolua_S, "CCCallFunc");
|
||||
tolua_usertype(tolua_S, "ScheduleHandlerDelegate");
|
||||
tolua_usertype(tolua_S, "ScriptHandlerMgr");
|
||||
}
|
||||
|
||||
/* method: create of class LuaCallFunc */
|
||||
#ifndef TOLUA_DISABLE_tolua_Cocos2d_LuaCallFunc_create00
|
||||
static int tolua_Cocos2d_LuaCallFunc_create00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertable(tolua_S,1,"CCCallFunc",0,&tolua_err) ||
|
||||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err)) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
LUA_FUNCTION funcID = ( toluafix_ref_function(tolua_S,2,0));
|
||||
{
|
||||
LuaCallFunc* tolua_ret = (LuaCallFunc*) LuaCallFunc::create(funcID);
|
||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"CCCallFunc");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: getInstance of class ScriptHandlerMgr */
|
||||
#ifndef TOLUA_DISABLE_tolua_Cocos2d_ScriptHandlerMgr_getInstance00
|
||||
static int tolua_Cocos2d_ScriptHandlerMgr_getInstance00(lua_State* tolua_S)
|
||||
|
@ -696,10 +345,6 @@ TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S)
|
|||
tolua_reg_script_handler_mgr_type(tolua_S);
|
||||
tolua_module(tolua_S, NULL,0);
|
||||
tolua_beginmodule(tolua_S, NULL);
|
||||
tolua_cclass(tolua_S, "CCCallFunc", "CCCallFunc","CCActionInstant",NULL);
|
||||
tolua_beginmodule(tolua_S, "CCCallFunc");
|
||||
tolua_function(tolua_S, "create", tolua_Cocos2d_LuaCallFunc_create00);
|
||||
tolua_endmodule(tolua_S);
|
||||
tolua_cclass(tolua_S,"ScriptHandlerMgr","ScriptHandlerMgr","",NULL);
|
||||
tolua_beginmodule(tolua_S, "ScriptHandlerMgr");
|
||||
tolua_function(tolua_S, "getInstance", tolua_Cocos2d_ScriptHandlerMgr_getInstance00);
|
||||
|
|
|
@ -17,11 +17,7 @@ NS_CC_BEGIN
|
|||
|
||||
class ScheduleHandlerDelegate;
|
||||
|
||||
typedef int EventType;
|
||||
typedef int EventHandler;
|
||||
typedef std::pair<EventType, EventHandler> PairEventHandler;
|
||||
typedef std::vector<PairEventHandler> VecEventHandlers;
|
||||
typedef std::map<void*,VecEventHandlers> MapObjectHandlers;
|
||||
|
||||
typedef std::vector<ScheduleHandlerDelegate*> VecShedule;
|
||||
typedef std::map<cocos2d::Node*,VecShedule> MapNodeSchedules;
|
||||
|
||||
|
@ -61,56 +57,60 @@ public:
|
|||
class ScriptHandlerMgr
|
||||
{
|
||||
public:
|
||||
enum class HandlerType: int
|
||||
{
|
||||
NODE = 0,
|
||||
MENU_CLICKED,
|
||||
NOTIFICATION,
|
||||
CALLFUNC,
|
||||
SCHEDULE,
|
||||
TOUCHES,
|
||||
KEYPAD,
|
||||
ACCELEROMETER,
|
||||
|
||||
CONTROL_TOUCH_DOWN,
|
||||
CONTROL_TOUCH_DRAG_INSIDE,
|
||||
CONTROL_TOUCH_DRAG_OUTSIDE,
|
||||
CONTROL_TOUCH_DRAG_ENTER,
|
||||
CONTROL_TOUCH_DRAG_EXIT,
|
||||
CONTROL_TOUCH_UP_INSIDE,
|
||||
CONTROL_TOUCH_UP_OUTSIDE,
|
||||
CONTROL_TOUCH_UP_CANCEL,
|
||||
CONTROL_VALUE_CHANGED,
|
||||
|
||||
WEBSOCKET_OPEN,
|
||||
WEBSOCKET_MESSAGE,
|
||||
WEBSOCKET_CLOSE,
|
||||
WEBSOCKET_ERROR,
|
||||
|
||||
GL_NODE_DRAW,
|
||||
|
||||
SCROLLVIEW_SCROLL,
|
||||
SCROLLVIEW_ZOOM,
|
||||
|
||||
TABLECELL_TOUCHED,
|
||||
TABLECELL_HIGHLIGHT,
|
||||
TABLECELL_UNHIGHLIGHT,
|
||||
TABLECELL_WILL_RECYCLE,
|
||||
TABLECELL_SIZE_FOR_INDEX,
|
||||
TABLECELL_AT_INDEX,
|
||||
TABLEVIEW_NUMS_OF_CELLS,
|
||||
};
|
||||
|
||||
typedef int Handler;
|
||||
typedef std::pair<HandlerType, Handler> HandlerPair;
|
||||
typedef std::vector<HandlerPair> VecHandlerPairs;
|
||||
typedef std::map<void*,VecHandlerPairs> MapObjectHandlers;
|
||||
|
||||
ScriptHandlerMgr(void);
|
||||
virtual ~ScriptHandlerMgr(void);
|
||||
static ScriptHandlerMgr* getInstance(void);
|
||||
|
||||
void addObjectHandler(void* object,int handler,int eventType);
|
||||
void removeObjectHandler(void* object,int eventType);
|
||||
int getObjectHandler(void* object,int eventType);
|
||||
void addObjectHandler(void* object,int handler,ScriptHandlerMgr::HandlerType handlerType);
|
||||
void removeObjectHandler(void* object,ScriptHandlerMgr::HandlerType handlerType);
|
||||
int getObjectHandler(void* object,ScriptHandlerMgr::HandlerType handlerType);
|
||||
void removeObjectAllHandlers(void* object);
|
||||
|
||||
enum HandlerEventType
|
||||
{
|
||||
kNodeHandler = 0,
|
||||
kMenuClickHandler,
|
||||
kNotificationHandler,
|
||||
kCallFuncHandler,
|
||||
kScheduleHandler,
|
||||
kTouchesHandler,
|
||||
kKeypadHandler,
|
||||
kAccelerometerHandler,
|
||||
|
||||
kControlTouchDownHandler,
|
||||
kControlTouchDragInsideHandler,
|
||||
kControlTouchDragOutsideHandler,
|
||||
kControlTouchDragEnterHandler,
|
||||
kControlTouchDragExitHandler,
|
||||
kControlTouchUpInsideHandler,
|
||||
kControlTouchUpOutsideHandler,
|
||||
kControlTouchCancelHandler,
|
||||
kControlValueChangedHandler,
|
||||
|
||||
kWebSocketScriptHandlerOpen,
|
||||
kWebSocketScriptHandlerMessage,
|
||||
kWebSocketScriptHandlerClose,
|
||||
kWebSocketScriptHandlerError,
|
||||
|
||||
kGLNodeDrawHandler,
|
||||
|
||||
kScrollViewScrollHandler,
|
||||
kScrollViewZoomHandler,
|
||||
|
||||
kTableCellTouched,
|
||||
kTableCellHighlight,
|
||||
kTableCellUnhighlight,
|
||||
kTableCellWillRecycle,
|
||||
kTableCellSizeForIndex,
|
||||
kTableCellAtIndex,
|
||||
kNumberOfCellsInTableView,
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
void init(void);
|
||||
static ScriptHandlerMgr* _scriptHandlerMgr;
|
||||
|
@ -119,24 +119,6 @@ private:
|
|||
|
||||
NS_CC_END
|
||||
|
||||
TOLUA_API int tolua_Cocos2d_registerScriptHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_unregisterScriptHandler00(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int tolua_Cocos2d_registerScriptTapHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_unregisterScriptTapHandler00(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int tolua_Cocos2d_registerScriptTouchHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_unregisterScriptTouchHandler00(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int tolua_Cocos2d_registerScriptKeypadHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_unregisterScriptKeypadHandler00(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int tolua_Cocos2d_registerScriptAccelerateHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_unregisterScriptAccelerateHandler00(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int tolua_Cocos2d_registerControlEventHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_unregisterControlEventHandler00(lua_State* tolua_S);
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
TOLUA_API int tolua_Cocos2d_WebSocket_registerScriptHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_WebSocket_unregisterScriptHandler00(lua_State* tolua_S);
|
||||
|
@ -145,9 +127,6 @@ TOLUA_API int tolua_Cocos2d_WebSocket_unregisterScriptHandler00(lua_State* tolua
|
|||
TOLUA_API int tolua_Cocos2d_GLNode_registerScriptDrawHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_GLNode_unregisterScriptDrawHandler00(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int tolua_Cocos2d_ScrollView_registerScriptHandler00(lua_State* tolua_S);
|
||||
TOLUA_API int tolua_Cocos2d_ScrollView_unregisterScriptHandler00(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S);
|
||||
|
||||
#endif //__LUA_SCRIPT_HANDLER_MGR_H__
|
||||
|
|
|
@ -66,7 +66,7 @@ void LuaWebSocket::onOpen(WebSocket* ws)
|
|||
{
|
||||
LuaWebSocket* luaWs = dynamic_cast<LuaWebSocket*>(ws);
|
||||
if (NULL != luaWs) {
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::kWebSocketScriptHandlerOpen);
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::HandlerType::WEBSOCKET_OPEN);
|
||||
if (0 != nHandler) {
|
||||
CommonScriptData data(nHandler,"");
|
||||
ScriptEvent event(kCommonEvent,(void*)&data);
|
||||
|
@ -80,14 +80,14 @@ void LuaWebSocket::onMessage(WebSocket* ws, const WebSocket::Data& data)
|
|||
LuaWebSocket* luaWs = dynamic_cast<LuaWebSocket*>(ws);
|
||||
if (NULL != luaWs) {
|
||||
if (data.isBinary) {
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::kWebSocketScriptHandlerMessage);
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::HandlerType::WEBSOCKET_MESSAGE);
|
||||
if (0 != nHandler) {
|
||||
SendBinaryMessageToLua(nHandler, (const unsigned char*)data.bytes, data.len);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::kWebSocketScriptHandlerMessage);
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::HandlerType::WEBSOCKET_MESSAGE);
|
||||
if (0 != nHandler) {
|
||||
CommonScriptData commonData(nHandler,data.bytes);
|
||||
ScriptEvent event(kCommonEvent,(void*)&commonData);
|
||||
|
@ -101,7 +101,7 @@ void LuaWebSocket::onClose(WebSocket* ws)
|
|||
{
|
||||
LuaWebSocket* luaWs = dynamic_cast<LuaWebSocket*>(ws);
|
||||
if (NULL != luaWs) {
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::kWebSocketScriptHandlerClose);
|
||||
int nHandler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::HandlerType::WEBSOCKET_CLOSE);
|
||||
if (0 != nHandler)
|
||||
{
|
||||
CommonScriptData data(nHandler,"");
|
||||
|
|
|
@ -10,7 +10,6 @@ extern "C" {
|
|||
|
||||
#include "cocos2d.h"
|
||||
#include "LuaBasicConversions.h"
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
#include "CCLuaValue.h"
|
||||
#include "cocos-ext.h"
|
||||
#include "CCBProxy.h"
|
||||
|
@ -28,7 +27,7 @@ public:
|
|||
{
|
||||
if (nullptr != view)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::kScrollViewScrollHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
|
||||
if (0 != handler)
|
||||
{
|
||||
CommonScriptData data(handler,"");
|
||||
|
@ -43,7 +42,7 @@ public:
|
|||
{
|
||||
if (nullptr != view)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::kScrollViewZoomHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::HandlerType::SCROLLVIEW_ZOOM);
|
||||
if (0 != handler)
|
||||
{
|
||||
CommonScriptData data(handler,"");
|
||||
|
@ -134,7 +133,7 @@ static int tolua_cocos2d_ScrollView_registerScriptHandler(lua_State* tolua_S)
|
|||
}
|
||||
#endif
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::HandlerEventType handlerType = (ScriptHandlerMgr::HandlerEventType) ((int)tolua_tonumber(tolua_S,3,0) + ScriptHandlerMgr::kScrollViewScrollHandler);
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber(tolua_S,3,0) + (int)ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, handlerType);
|
||||
return 0;
|
||||
|
@ -180,7 +179,7 @@ static int tolua_cocos2d_ScrollView_unregisterScriptHandler(lua_State* tolua_S)
|
|||
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
|
||||
goto tolua_lerror;
|
||||
#endif
|
||||
ScriptHandlerMgr::HandlerEventType handlerType = (ScriptHandlerMgr::HandlerEventType) ((int)tolua_tonumber(tolua_S,2,0) + ScriptHandlerMgr::kScrollViewScrollHandler);
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber(tolua_S,2,0) + (int)ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerType);
|
||||
return 0;
|
||||
}
|
||||
|
@ -252,7 +251,7 @@ static int tolua_cocos2d_Control_registerControlEventHandler(lua_State* tolua_S)
|
|||
{
|
||||
if ((controlevent & (1 << i)))
|
||||
{
|
||||
int handlerevent = ScriptHandlerMgr::kControlTouchDownHandler + i;
|
||||
ScriptHandlerMgr::HandlerType handlerevent = ScriptHandlerMgr::HandlerType((int)ScriptHandlerMgr::HandlerType::CONTROL_TOUCH_DOWN + i);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, handlerevent);
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +303,7 @@ static int tolua_cocos2d_control_unregisterControlEventHandler(lua_State* tolua_
|
|||
{
|
||||
if ((controlevent & (1 << i)))
|
||||
{
|
||||
int handlerevent = ScriptHandlerMgr::kControlTouchDownHandler + i;
|
||||
ScriptHandlerMgr::HandlerType handlerevent = ScriptHandlerMgr::HandlerType((int)ScriptHandlerMgr::HandlerType::CONTROL_TOUCH_DOWN + i);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerevent);
|
||||
break;
|
||||
}
|
||||
|
@ -868,10 +867,10 @@ public:
|
|||
{
|
||||
if (nullptr != view)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::kScrollViewScrollHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
|
||||
if (0 != handler)
|
||||
{
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kScrollViewScrollHandler);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
|
||||
BasicScriptData data(view,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
|
@ -883,10 +882,10 @@ public:
|
|||
{
|
||||
if (nullptr != view)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::kScrollViewZoomHandler);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)view, ScriptHandlerMgr::HandlerType::SCROLLVIEW_ZOOM);
|
||||
if (0 != handler)
|
||||
{
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kScrollViewZoomHandler);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::SCROLLVIEW_ZOOM);
|
||||
BasicScriptData data(view,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
|
@ -898,10 +897,10 @@ public:
|
|||
{
|
||||
if (nullptr != table && nullptr != cell)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::kTableCellTouched);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::HandlerType::TABLECELL_TOUCHED);
|
||||
if (0 != handler)
|
||||
{
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kTableCellTouched,cell);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::TABLECELL_TOUCHED,cell);
|
||||
BasicScriptData data(table,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
|
@ -913,10 +912,10 @@ public:
|
|||
{
|
||||
if (nullptr != table && nullptr != cell)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::kTableCellHighlight);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::HandlerType::TABLECELL_HIGHLIGHT);
|
||||
if (0 != handler)
|
||||
{
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kTableCellHighlight,cell);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::TABLECELL_HIGHLIGHT,cell);
|
||||
BasicScriptData data(table,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
|
@ -928,10 +927,10 @@ public:
|
|||
{
|
||||
if (nullptr != table && nullptr != cell)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::kTableCellUnhighlight);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::HandlerType::TABLECELL_UNHIGHLIGHT);
|
||||
if (0 != handler)
|
||||
{
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kTableCellUnhighlight,cell);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::TABLECELL_UNHIGHLIGHT,cell);
|
||||
BasicScriptData data(table,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
|
@ -943,10 +942,10 @@ public:
|
|||
{
|
||||
if (nullptr != table && nullptr != cell)
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::kTableCellWillRecycle);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::HandlerType::TABLECELL_WILL_RECYCLE);
|
||||
if (0 != handler)
|
||||
{
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kTableCellWillRecycle,cell);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::TABLECELL_WILL_RECYCLE,cell);
|
||||
BasicScriptData data(table,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEvent(&event);
|
||||
|
@ -1024,12 +1023,12 @@ public:
|
|||
{
|
||||
if (nullptr != table )
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::kTableCellSizeForIndex);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::HandlerType::TABLECELL_SIZE_FOR_INDEX);
|
||||
if (0 != handler)
|
||||
{
|
||||
Array resultArray;
|
||||
resultArray.initWithCapacity(1);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kTableCellSizeForIndex,&idx);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::TABLECELL_SIZE_FOR_INDEX,&idx);
|
||||
BasicScriptData data(table,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEventReturnArray(&event, 2, resultArray);
|
||||
|
@ -1050,12 +1049,12 @@ public:
|
|||
{
|
||||
if (nullptr != table )
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::kTableCellAtIndex);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::HandlerType::TABLECELL_AT_INDEX);
|
||||
if (0 != handler)
|
||||
{
|
||||
Array resultArray;
|
||||
resultArray.initWithCapacity(1);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kTableCellAtIndex,&idx);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::TABLECELL_AT_INDEX,&idx);
|
||||
BasicScriptData data(table,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEventReturnArray(&event, 1, resultArray);
|
||||
|
@ -1076,12 +1075,12 @@ public:
|
|||
{
|
||||
if (nullptr != table )
|
||||
{
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::kNumberOfCellsInTableView);
|
||||
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)table, ScriptHandlerMgr::HandlerType::TABLEVIEW_NUMS_OF_CELLS);
|
||||
if (0 != handler)
|
||||
{
|
||||
Array resultArray;
|
||||
resultArray.initWithCapacity(1);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::kNumberOfCellsInTableView);
|
||||
LuaTableViewEventData eventData(ScriptHandlerMgr::HandlerType::TABLEVIEW_NUMS_OF_CELLS);
|
||||
BasicScriptData data(table,&eventData);
|
||||
ScriptEvent event(kTableViewEvent,(void*)&data);
|
||||
LuaEngine::getInstance()->sendEventReturnArray(&event, 1, resultArray);
|
||||
|
@ -1254,7 +1253,7 @@ static int lua_cocos2d_TableView_registerScriptHandler(lua_State* L)
|
|||
}
|
||||
#endif
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||
ScriptHandlerMgr::HandlerEventType handlerType = (ScriptHandlerMgr::HandlerEventType) ((int)tolua_tonumber(L,3,0) + ScriptHandlerMgr::kScrollViewScrollHandler);
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber(L,3,0) + (int)ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
|
||||
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, handlerType);
|
||||
return 0;
|
||||
|
@ -1300,7 +1299,7 @@ static int lua_cocos2d_TableView_unregisterScriptHandler(lua_State* L)
|
|||
if (!tolua_isnumber(L, 2, 0, &tolua_err))
|
||||
goto tolua_lerror;
|
||||
#endif
|
||||
ScriptHandlerMgr::HandlerEventType handlerType = (ScriptHandlerMgr::HandlerEventType) ((int)tolua_tonumber(L,2,0) + ScriptHandlerMgr::kScrollViewScrollHandler);
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber(L,2,0) + (int)ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerType);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,17 +9,19 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
#include "LuaScriptHandlerMgr.h"
|
||||
|
||||
TOLUA_API int register_all_cocos2dx_extension_manual(lua_State* tolua_S);
|
||||
TOLUA_API int register_cocos2dx_extension_CCBProxy(lua_State* tolua_S);
|
||||
|
||||
struct LuaTableViewEventData
|
||||
{
|
||||
int eventType;
|
||||
cocos2d::ScriptHandlerMgr::HandlerType handlerType;
|
||||
void* value;
|
||||
|
||||
// Constructor
|
||||
LuaTableViewEventData(int _eventType,void* _value = nullptr)
|
||||
: eventType(_eventType),value(_value)
|
||||
LuaTableViewEventData(cocos2d::ScriptHandlerMgr::HandlerType _handleType,void* _value = nullptr)
|
||||
: handlerType(_handleType),value(_value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -460,7 +460,7 @@ static int tolua_cocos2d_MenuItem_registerScriptTapHandler(lua_State* tolua_S)
|
|||
}
|
||||
#endif
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)cobj, handler, ScriptHandlerMgr::kMenuClickHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)cobj, handler, ScriptHandlerMgr::HandlerType::MENU_CLICKED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ static int tolua_cocos2d_MenuItem_unregisterScriptTapHandler(lua_State* tolua_S)
|
|||
|
||||
if (0 == argc)
|
||||
{
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)cobj, ScriptHandlerMgr::kMenuClickHandler);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)cobj, ScriptHandlerMgr::HandlerType::MENU_CLICKED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ static int tolua_cocos2d_Layer_registerScriptTouchHandler(lua_State* tolua_S)
|
|||
self->setTouchMode(touchesMode);
|
||||
self->setTouchPriority(priority);
|
||||
self->setSwallowsTouches(swallowTouches);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::kTouchesHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::TOUCHES);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -622,7 +622,7 @@ static int tolua_cocos2d_Layer_unregisterScriptTouchHandler(lua_State* tolua_S)
|
|||
|
||||
if (0 == argc)
|
||||
{
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, ScriptHandlerMgr::kTouchesHandler);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, ScriptHandlerMgr::HandlerType::TOUCHES);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ static int tolua_cocos2d_Layer_registerScriptKeypadHandler(lua_State* tolua_S)
|
|||
}
|
||||
#endif
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::kKeypadHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::KEYPAD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -710,7 +710,7 @@ static int tolua_cocos2d_Layer_unregisterScriptKeypadHandler(lua_State* tolua_S)
|
|||
|
||||
if (0 == argc)
|
||||
{
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler(self, ScriptHandlerMgr::kKeypadHandler);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler(self, ScriptHandlerMgr::HandlerType::KEYPAD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ static int tolua_cocos2d_Layer_registerScriptAccelerateHandler(lua_State* tolua_
|
|||
}
|
||||
#endif
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::kAccelerometerHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::ACCELEROMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -795,7 +795,7 @@ static int tolua_cocos2d_Layer_unregisterScriptAccelerateHandler(lua_State* tolu
|
|||
|
||||
if (0 == argc)
|
||||
{
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, ScriptHandlerMgr::kAccelerometerHandler);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, ScriptHandlerMgr::HandlerType::ACCELEROMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ static int tolua_cocos2d_Node_registerScriptHandler(lua_State* tolua_S)
|
|||
#endif
|
||||
|
||||
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::kNodeHandler);
|
||||
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, ScriptHandlerMgr::HandlerType::NODE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ static int tolua_cocos2d_Node_unregisterScriptHandler(lua_State* tolua_S)
|
|||
|
||||
if (argc == 0)
|
||||
{
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, ScriptHandlerMgr::kNodeHandler);
|
||||
ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, ScriptHandlerMgr::HandlerType::NODE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
@interface RootViewController : UIViewController {
|
||||
|
||||
}
|
||||
- (BOOL) prefersStatusBarHidden;
|
||||
|
||||
@end
|
||||
|
|
|
@ -43,6 +43,12 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
//fix not hide status on ios7
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7cc32ff48845f726937eea2c1b0cdb743db321cd
|
||||
Subproject commit 9d98b45fcdebff58bfe4372266f883cd1a6ce476
|
Loading…
Reference in New Issue