From ea7dfe1147f9bd0fc90148013b62ac9e66737a17 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Wed, 4 Mar 2015 10:42:08 +0800 Subject: [PATCH] lua test --- .../lua_cocos2dx_extension_manual.cpp | 10 ++--- .../src/Particle3DTest/Particle3DTest.lua | 38 ++++++++++++++++++- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/cocos/scripting/lua-bindings/manual/extension/lua_cocos2dx_extension_manual.cpp b/cocos/scripting/lua-bindings/manual/extension/lua_cocos2dx_extension_manual.cpp index 143f587f10..23f1c9d4e7 100644 --- a/cocos/scripting/lua-bindings/manual/extension/lua_cocos2dx_extension_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/extension/lua_cocos2dx_extension_manual.cpp @@ -1065,7 +1065,7 @@ static void extendParticleSystem3D(lua_State* tolua_S) lua_pop(tolua_S, 1); } -int lua_cocos2dx_extension_ParticlePool_getActiveParticleList(lua_State* tolua_S) +int lua_cocos2dx_extension_ParticlePool_getActiveDataList(lua_State* tolua_S) { int argc = 0; cocos2d::ParticlePool* cobj = nullptr; @@ -1085,7 +1085,7 @@ int lua_cocos2dx_extension_ParticlePool_getActiveParticleList(lua_State* tolua_S #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ParticlePool_getActiveParticleList'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ParticlePool_getActiveDataList'", nullptr); return 0; } #endif @@ -1095,10 +1095,10 @@ int lua_cocos2dx_extension_ParticlePool_getActiveParticleList(lua_State* tolua_S { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_ParticlePool_getActiveParticleList'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_ParticlePool_getActiveDataList'", nullptr); return 0; } - const ParticlePool::PoolList& ret = cobj->getActiveParticleList(); + const ParticlePool::PoolList& ret = cobj->getActiveDataList(); lua_newtable(tolua_S); if (ret.empty()) @@ -1135,7 +1135,7 @@ static void extendParticlePool(lua_State* tolua_S) lua_rawget(tolua_S, LUA_REGISTRYINDEX); if (lua_istable(tolua_S,-1)) { - tolua_function(tolua_S, "getActiveParticleList", lua_cocos2dx_extension_ParticlePool_getActiveParticleList); + tolua_function(tolua_S, "getActiveDataList", lua_cocos2dx_extension_ParticlePool_getActiveDataList); } lua_pop(tolua_S, 1); } diff --git a/tests/lua-tests/src/Particle3DTest/Particle3DTest.lua b/tests/lua-tests/src/Particle3DTest/Particle3DTest.lua index 27090915c5..f0d8e7a6fc 100644 --- a/tests/lua-tests/src/Particle3DTest/Particle3DTest.lua +++ b/tests/lua-tests/src/Particle3DTest/Particle3DTest.lua @@ -376,6 +376,41 @@ function Particle3DElectricBeamSystemDemo:onExit() self:unscheduleUpdate() end +-- Particle3DFlareShield +local Particle3DFlareShieldDemo = class("Particle3DFlareShield", function () + local layer = cc.Layer:create() + Helper.initWithLayer(layer) + return layer +end) + +function Particle3DFlareShieldDemo:ctor() + -- body + self:init() +end + +function Particle3DFlareShieldDemo:init() + baseInit(self) +end + +function Particle3DFlareShieldDemo:title() + return "Particle3D Test" +end + +function Particle3DFlareShieldDemo:subtitle() + return "FlareShield" +end + +function Particle3DFlareShieldDemo:onEnter() + local rootps = cc.PUParticleSystem3D:create("flareShield.pu") + rootps:setCameraMask(cc.CameraFlag.USER1) + rootps:startParticleSystem() + self:addChild(rootps, 0, PARTICLE_SYSTEM_TAG) +end + +function Particle3DFlareShieldDemo:onExit() + self:unscheduleUpdate() +end + function Particle3DTest() local scene = cc.Scene:create() @@ -388,7 +423,8 @@ function Particle3DTest() Particle3DTimeShiftDemo.create, Particle3DUVAnimDemo.create, Particle3DFirePlaceDemo.create, - Particle3DElectricBeamSystemDemo.create + Particle3DElectricBeamSystemDemo.create, + Particle3DFlareShieldDemo.create } scene:addChild(Particle3DLineStreakDemo.create())