裁剪:assert-manager、2.x GUI 、Menu、Layer、Deorecated数据结构

This commit is contained in:
u0u0
2019-12-26 11:23:01 +08:00
parent 7e2382fd6f
commit b4cb0d04f0
87 changed files with 12 additions and 42418 deletions

View File

@@ -49,13 +49,10 @@ extern "C" {
#include "scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp"
#include "scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.hpp"
#include "scripting/lua-bindings/manual/LuaBasicConversions.h"
#include "scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_deprecated.h"
#include "scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp"
#include "scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_physics_manual.hpp"
#include "scripting/lua-bindings/auto/lua_cocos2dx_backend_auto.hpp"
#include "base/ZipUtils.h"
#include "scripting/deprecated/CCBool.h"
#include "scripting/deprecated/CCDouble.h"
#include "platform/CCFileUtils.h"
namespace {
@@ -164,8 +161,6 @@ bool LuaStack::init()
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
LuaJavaBridge::luaopen_luaj(_state);
#endif
register_all_cocos2dx_deprecated(_state);
register_all_cocos2dx_manual_deprecated(_state);
tolua_script_handler_mgr_open(_state);
@@ -521,97 +516,6 @@ int LuaStack::reallocateScriptHandler(int nHandler)
}
int LuaStack::executeFunctionReturnArray(int handler,int numArgs,int numResults,__Array& resultArray)
{
int top = lua_gettop(_state);
if (pushFunctionByHandler(handler)) /* L: ... arg1 arg2 ... func */
{
if (numArgs > 0)
{
lua_insert(_state, -(numArgs + 1)); /* L: ... func arg1 arg2 ... */
}
int functionIndex = -(numArgs + 1);
if (!lua_isfunction(_state, functionIndex))
{
CCLOG("value at stack [%d] is not function", functionIndex);
lua_pop(_state, numArgs + 1); // remove function and arguments
lua_settop(_state,top);
return 0;
}
int traceback = 0;
lua_getglobal(_state, "__G__TRACKBACK__"); /* L: ... func arg1 arg2 ... G */
if (!lua_isfunction(_state, -1))
{
lua_pop(_state, 1); /* L: ... func arg1 arg2 ... */
}
else
{
lua_insert(_state, functionIndex - 1); /* L: ... G func arg1 arg2 ... */
traceback = functionIndex - 1;
}
int error = 0;
++_callFromLua;
error = lua_pcall(_state, numArgs, numResults, traceback); /* L: ... [G] ret1 ret2 ... retResults*/
--_callFromLua;
if (error)
{
if (traceback == 0)
{
CCLOG("[LUA ERROR] %s", lua_tostring(_state, - 1)); /* L: ... error */
lua_pop(_state, 1); // remove error message from stack
}
else /* L: ... G error */
{
lua_pop(_state, 2); // remove __G__TRACKBACK__ and error message from stack
}
lua_settop(_state,top);
return 0;
}
// get return value,don't pass LUA_MULTRET to numResults,
if (numResults <= 0)
{
lua_settop(_state,top);
return 0;
}
for (int i = 0 ; i < numResults; i++)
{
if (lua_type(_state, -1) == LUA_TBOOLEAN) {
bool value = lua_toboolean(_state, -1);
resultArray.addObject(__Bool::create(value));
}else if (lua_type(_state, -1) == LUA_TNUMBER) {
double value = lua_tonumber(_state, -1);
resultArray.addObject(__Double::create(value));
}else if (lua_type(_state, -1) == LUA_TSTRING) {
const char* value = lua_tostring(_state, -1);
resultArray.addObject(__String::create(value));
}else{
resultArray.addObject(static_cast<Ref*>(tolua_tousertype(_state, -1, nullptr)));
}
// remove return value from stack
lua_pop(_state, 1); /* L: ... [G] ret1 ret2 ... ret*/
}
/* L: ... [G]*/
if (traceback)
{
lua_pop(_state, 1); // remove __G__TRACKBACK__ from stack /* L: ... */
}
}
lua_settop(_state,top);
return 1;
}
int LuaStack::executeFunction(int handler, int numArgs, int numResults, const std::function<void(lua_State*,int)>& func)
{
if (pushFunctionByHandler(handler)) /* L: ... arg1 arg2 ... func */