mirror of https://github.com/axmolengine/axmol.git
Fix:Add lua binding of ’registerScriptHandler’、’unregisterScriptHandler’ and ’removeObjectAllHandlers’ of ScriptHandlerMgr and some constants define
This commit is contained in:
parent
3721ffde64
commit
98bd84c436
|
@ -1 +1 @@
|
|||
4604aa76ce1cd72165190c09b5eba4faf2efca40
|
||||
9104cc5ff14c7548ea6924a2785400db7526c1e1
|
|
@ -219,6 +219,7 @@ static void tolua_reg_script_handler_mgr_type(lua_State* tolua_S)
|
|||
tolua_usertype(tolua_S, "ScheduleHandlerDelegate");
|
||||
tolua_usertype(tolua_S, "ScriptHandlerMgr");
|
||||
}
|
||||
|
||||
/* method: getInstance of class ScriptHandlerMgr */
|
||||
#ifndef TOLUA_DISABLE_tolua_Cocos2d_ScriptHandlerMgr_getInstance00
|
||||
static int tolua_Cocos2d_ScriptHandlerMgr_getInstance00(lua_State* tolua_S)
|
||||
|
@ -243,6 +244,101 @@ tolua_lerror:
|
|||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: registerScriptHandler of class ScriptHandlerMgr */
|
||||
static int tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "Object", 0, &tolua_err) ||
|
||||
!toluafix_isfunction(tolua_S, 3, "LUA_FUNCTION", 0, &tolua_err) ||
|
||||
!tolua_isnumber(tolua_S, 4, 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,5,&tolua_err) )
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cocos2d::ScriptHandlerMgr* scriptHanlderMgr = static_cast<cocos2d::ScriptHandlerMgr*>(tolua_tousertype(tolua_S,1,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (nullptr == scriptHanlderMgr)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'scriptHanlderMgr' in function 'tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
LUA_FUNCTION handler = toluafix_ref_function(tolua_S,3,0);
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)tolua_tonumber(tolua_S, 4, 0);
|
||||
scriptHanlderMgr->addObjectHandler(tolua_tousertype(tolua_S, 2, 0), handler,handlerType);
|
||||
}
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* method: unregisterScriptHandler of class ScriptHandlerMgr */
|
||||
static int tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "Object", 0, &tolua_err) ||
|
||||
!tolua_isnumber(tolua_S, 3, 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err) )
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cocos2d::ScriptHandlerMgr* scriptHanlderMgr = static_cast<cocos2d::ScriptHandlerMgr*>(tolua_tousertype(tolua_S,1,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (nullptr == scriptHanlderMgr)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'scriptHanlderMgr' in function 'tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)tolua_tonumber(tolua_S, 3, 0);
|
||||
scriptHanlderMgr->removeObjectHandler(tolua_tousertype(tolua_S, 2, 0), handlerType);
|
||||
}
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'unregisterScriptHandler'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* method: removeObjectAllHandlers of class ScriptHandlerMgr */
|
||||
static int tolua_Cocos2d_ScriptHandlerMgr_removeObjectAllHandlers00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isusertype(tolua_S,1,"ScriptHandlerMgr",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S, 2, "Object", 0, &tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err) )
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cocos2d::ScriptHandlerMgr* scriptHanlderMgr = static_cast<cocos2d::ScriptHandlerMgr*>(tolua_tousertype(tolua_S,1,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (nullptr == scriptHanlderMgr)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'scriptHanlderMgr' in function 'tolua_Cocos2d_ScriptHandlerMgr_removeObjectAllHandlers00'\n", NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
scriptHanlderMgr->removeObjectAllHandlers(tolua_tousertype(tolua_S, 2, 0));
|
||||
}
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'removeObjectAllHandlers'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S)
|
||||
{
|
||||
|
@ -253,6 +349,9 @@ TOLUA_API int tolua_script_handler_mgr_open(lua_State* tolua_S)
|
|||
tolua_cclass(tolua_S,"ScriptHandlerMgr","ScriptHandlerMgr","",NULL);
|
||||
tolua_beginmodule(tolua_S, "ScriptHandlerMgr");
|
||||
tolua_function(tolua_S, "getInstance", tolua_Cocos2d_ScriptHandlerMgr_getInstance00);
|
||||
tolua_function(tolua_S, "registerScriptHandler", tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00);
|
||||
tolua_function(tolua_S, "unregisterScriptHandler", tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00);
|
||||
tolua_function(tolua_S, "removeObjectAllHandlers", tolua_Cocos2d_ScriptHandlerMgr_removeObjectAllHandlers00);
|
||||
tolua_endmodule(tolua_S);
|
||||
tolua_endmodule(tolua_S);
|
||||
return 1;
|
||||
|
|
|
@ -134,9 +134,6 @@ private:
|
|||
|
||||
NS_CC_END
|
||||
|
||||
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_script_handler_mgr_open(lua_State* tolua_S);
|
||||
|
||||
#endif //__LUA_SCRIPT_HANDLER_MGR_H__
|
||||
|
|
|
@ -288,4 +288,42 @@ cc.ASSETSMANAGER_UNCOMPRESS = 3
|
|||
cc.ASSETSMANAGER_PROTOCOL_PROGRESS = 0
|
||||
cc.ASSETSMANAGER_PROTOCOL_SUCCESS = 1
|
||||
cc.ASSETSMANAGER_PROTOCOL_ERROR = 2
|
||||
|
||||
cc.HANDLERTYPE_NODE = 0
|
||||
cc.HANDLERTYPE_MENU_CLICKED = 1
|
||||
cc.HANDLERTYPE_NOTIFICATION = 2
|
||||
cc.HANDLERTYPE_CALLFUNC = 3
|
||||
cc.HANDLERTYPE_SCHEDULE = 4
|
||||
cc.HANDLERTYPE_TOUCHES = 5
|
||||
cc.HANDLERTYPE_KEYPAD = 6
|
||||
cc.HANDLERTYPE_ACCELEROMETER = 7
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_DOWN = 8
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_INSIDE = 9
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_OUTSIDE = 10
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_ENTER = 11
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_DRAG_EXIT = 12
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_UP_INSIDE = 13
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_UP_OUTSIDE = 14
|
||||
cc.HANDLERTYPE_CONTROL_TOUCH_UP_CANCEL = 15
|
||||
cc.HANDLERTYPE_CONTROL_VALUE_CHANGED = 16
|
||||
cc.HANDLERTYPE_WEBSOCKET_OPEN = 17
|
||||
cc.HANDLERTYPE_WEBSOCKET_MESSAGE = 18
|
||||
cc.HANDLERTYPE_WEBSOCKET_CLOSE = 19
|
||||
cc.HANDLERTYPE_WEBSOCKET_ERROR = 20
|
||||
cc.HANDLERTYPE_GL_NODE_DRAW = 21
|
||||
cc.HANDLERTYPE_SCROLLVIEW_SCROLL = 22
|
||||
cc.HANDLERTYPE_SCROLLVIEW_ZOOM = 23
|
||||
cc.HANDLERTYPE_TABLECELL_TOUCHED = 24
|
||||
cc.HANDLERTYPE_TABLECELL_HIGHLIGHT = 25
|
||||
cc.HANDLERTYPE_TABLECELL_UNHIGHLIGHT = 26
|
||||
cc.HANDLERTYPE_TABLECELL_WILL_RECYCLE = 27
|
||||
cc.HANDLERTYPE_TABLECELL_SIZE_FOR_INDEX = 28
|
||||
cc.HANDLERTYPE_TABLECELL_AT_INDEX = 29
|
||||
cc.HANDLERTYPE_TABLEVIEW_NUMS_OF_CELLS = 30
|
||||
cc.HANDLERTYPE_XMLHTTPREQUEST_READY_STATE_CHANGE = 31
|
||||
cc.HANDLERTYPE_ASSETSMANAGER_PROGRESS = 32
|
||||
cc.HANDLERTYPE_ASSETSMANAGER_SUCCESS = 33
|
||||
cc.HANDLERTYPE_ASSETSMANAGER_ERROR = 34
|
||||
cc.HANDLERTYPE_EVENT_LISTENER = 35
|
||||
cc.HANDLERTYPE_ARMATURE_EVENT = 36
|
||||
|
Loading…
Reference in New Issue