Reverting cocos/scripting/lua-bindings/auto

This commit is contained in:
pipu 2014-10-13 13:06:42 +08:00
parent 96c8fde63a
commit fc8be6f0ff
14 changed files with 892 additions and 223 deletions

View File

@ -5,35 +5,7 @@
--------------------------------
-- Clone a action with the specified name from the container.
-- @function [parent=#ActionTimelineCache] createActionFromJson
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
--
-- @function [parent=#ActionTimelineCache] createActionFromProtocolBuffers
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
--
-- @function [parent=#ActionTimelineCache] createActionFromXML
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
--
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFileFromProtocolBuffers
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
--
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFileFromXML
-- @function [parent=#ActionTimelineCache] createAction
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
@ -48,13 +20,6 @@
-- @function [parent=#ActionTimelineCache] init
-- @param self
--------------------------------
--
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFile
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
--
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithContent
@ -63,29 +28,22 @@
-- @param #string content
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
--
-- @function [parent=#ActionTimelineCache] loadAnimationActionWithFile
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
-- Remove action with filename, and also remove other resource relate with this file
-- @function [parent=#ActionTimelineCache] removeAction
-- @param self
-- @param #string fileName
--------------------------------
--
-- @function [parent=#ActionTimelineCache] loadActionTimelineFromXML
-- @param self
-- @param #tinyxml2.XMLElement animationElement
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
--------------------------------
-- Destroys the singleton
-- @function [parent=#ActionTimelineCache] destroyInstance
-- @param self
--------------------------------
--
-- @function [parent=#ActionTimelineCache] createAction
-- @param self
-- @param #string fileName
-- @return ActionTimeline#ActionTimeline ret (return value: ccs.ActionTimeline)
return nil

View File

@ -16,12 +16,6 @@
-- @param #unsigned long length
-- @return string#string ret (return value: string)
--------------------------------
--
-- @function [parent=#Helper] doLayout
-- @param self
-- @param #cc.Node rootNode
--------------------------------
-- Finds a widget whose tag equals to param tag from root widget.<br>
-- param root widget which will be seeked.<br>

View File

@ -292,11 +292,6 @@
-- @param #int hAlignment
-- @param #int vAlignment
--------------------------------
--
-- @function [parent=#Label] requestSystemFontRefresh
-- @param self
--------------------------------
--
-- @function [parent=#Label] createWithBMFont

View File

@ -10,15 +10,18 @@
-- @param self
--------------------------------
--
-- @function [parent=#Scale9Sprite] updateWithSprite
-- @overload self, cc.Sprite, rect_table, bool, vec2_table, size_table, rect_table
-- @overload self, cc.Sprite, rect_table, bool, rect_table
-- @function [parent=#Scale9Sprite] updateWithSprite
-- @param self
-- @param #cc.Sprite sprite
-- @param #rect_table rect
-- @param #bool rotated
-- @param #vec2_table offset
-- @param #size_table originalSize
-- @param #rect_table capInsets
-- @return bool#bool ret (return value: bool)
-- @return bool#bool ret (retunr value: bool)
--------------------------------
-- Returns the flag which indicates whether the widget is flipped horizontally or not.<br>
-- It only flips the texture of the widget, and not the texture of the widget's children.<br>
@ -86,11 +89,14 @@
-- @overload self, cc.Sprite, rect_table, bool, rect_table
-- @overload self
-- @overload self, cc.Sprite, rect_table, rect_table
-- @overload self, cc.Sprite, rect_table, bool, vec2_table, size_table, rect_table
-- @function [parent=#Scale9Sprite] init
-- @param self
-- @param #cc.Sprite sprite
-- @param #rect_table rect
-- @param #bool rotated
-- @param #vec2_table offset
-- @param #size_table originalSize
-- @param #rect_table capInsets
-- @return bool#bool ret (retunr value: bool)
@ -111,6 +117,7 @@
-- @function [parent=#Scale9Sprite] setSpriteFrame
-- @param self
-- @param #cc.SpriteFrame spriteFrame
-- @param #rect_table capInsets
--------------------------------
--

View File

@ -291,13 +291,6 @@
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- param enable Unify Size of a widget<br>
-- return void
-- @function [parent=#Widget] setUnifySizeEnabled
-- @param self
-- @param #bool enable
--------------------------------
-- Return whether the widget is propagate touch events to its parents or not<br>
-- since v3.3

View File

@ -176,6 +176,11 @@
-- @field [parent=#ccs] SceneReader#SceneReader SceneReader preloaded module
--------------------------------------------------------
-- the ccs NodeReader
-- @field [parent=#ccs] NodeReader#NodeReader NodeReader preloaded module
--------------------------------------------------------
-- the ccs ActionTimelineCache
-- @field [parent=#ccs] ActionTimelineCache#ActionTimelineCache ActionTimelineCache preloaded module

View File

@ -38283,49 +38283,6 @@ int lua_cocos2dx_Label_setAlignment(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_Label_requestSystemFontRefresh(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Label* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_requestSystemFontRefresh'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
cobj->requestSystemFontRefresh();
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:requestSystemFontRefresh",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_requestSystemFontRefresh'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Label_createWithBMFont(lua_State* tolua_S)
{
int argc = 0;
@ -38665,7 +38622,6 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S)
tolua_function(tolua_S,"getBMFontFilePath",lua_cocos2dx_Label_getBMFontFilePath);
tolua_function(tolua_S,"setHorizontalAlignment",lua_cocos2dx_Label_setHorizontalAlignment);
tolua_function(tolua_S,"setAlignment",lua_cocos2dx_Label_setAlignment);
tolua_function(tolua_S,"requestSystemFontRefresh",lua_cocos2dx_Label_requestSystemFontRefresh);
tolua_function(tolua_S,"createWithBMFont", lua_cocos2dx_Label_createWithBMFont);
tolua_function(tolua_S,"create", lua_cocos2dx_Label_create);
tolua_function(tolua_S,"createWithCharMap", lua_cocos2dx_Label_createWithCharMap);

View File

@ -1580,7 +1580,6 @@ int register_all_cocos2dx(lua_State* tolua_S);
#endif // __cocos2dx_h__

View File

@ -2614,52 +2614,6 @@ int lua_cocos2dx_ui_Widget_isBright(lua_State* tolua_S)
return 0;
}
int lua_cocos2dx_ui_Widget_setUnifySizeEnabled(lua_State* tolua_S)
{
int argc = 0;
cocos2d::ui::Widget* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Widget*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Widget_setUnifySizeEnabled'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccui.Widget:setUnifySizeEnabled");
if(!ok)
return 0;
cobj->setUnifySizeEnabled(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:setUnifySizeEnabled",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Widget_setUnifySizeEnabled'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Widget_isPropagateTouchEvents(lua_State* tolua_S)
{
int argc = 0;
@ -3537,7 +3491,6 @@ int lua_register_cocos2dx_ui_Widget(lua_State* tolua_S)
tolua_function(tolua_S,"setFocusEnabled",lua_cocos2dx_ui_Widget_setFocusEnabled);
tolua_function(tolua_S,"getBottomBoundary",lua_cocos2dx_ui_Widget_getBottomBoundary);
tolua_function(tolua_S,"isBright",lua_cocos2dx_ui_Widget_isBright);
tolua_function(tolua_S,"setUnifySizeEnabled",lua_cocos2dx_ui_Widget_setUnifySizeEnabled);
tolua_function(tolua_S,"isPropagateTouchEvents",lua_cocos2dx_ui_Widget_isPropagateTouchEvents);
tolua_function(tolua_S,"getCurrentFocusedWidget",lua_cocos2dx_ui_Widget_getCurrentFocusedWidget);
tolua_function(tolua_S,"requestFocus",lua_cocos2dx_ui_Widget_requestFocus);
@ -16600,38 +16553,6 @@ int lua_cocos2dx_ui_Helper_getSubStringOfUTF8String(lua_State* tolua_S)
#endif
return 0;
}
int lua_cocos2dx_ui_Helper_doLayout(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"ccui.Helper",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
cocos2d::Node* arg0;
ok &= luaval_to_object<cocos2d::Node>(tolua_S, 2, "cc.Node",&arg0);
if(!ok)
return 0;
cocos2d::ui::Helper::doLayout(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ccui.Helper:doLayout",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Helper_doLayout'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_ui_Helper_seekWidgetByTag(lua_State* tolua_S)
{
int argc = 0;
@ -16750,7 +16671,6 @@ int lua_register_cocos2dx_ui_Helper(lua_State* tolua_S)
tolua_beginmodule(tolua_S,"Helper");
tolua_function(tolua_S,"getSubStringOfUTF8String", lua_cocos2dx_ui_Helper_getSubStringOfUTF8String);
tolua_function(tolua_S,"doLayout", lua_cocos2dx_ui_Helper_doLayout);
tolua_function(tolua_S,"seekWidgetByTag", lua_cocos2dx_ui_Helper_seekWidgetByTag);
tolua_function(tolua_S,"seekActionWidgetByActionTag", lua_cocos2dx_ui_Helper_seekActionWidgetByActionTag);
tolua_function(tolua_S,"seekWidgetByName", lua_cocos2dx_ui_Helper_seekWidgetByName);
@ -18102,48 +18022,79 @@ int lua_cocos2dx_ui_Scale9Sprite_updateWithSprite(lua_State* tolua_S)
int argc = 0;
cocos2d::ui::Scale9Sprite* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"ccui.Scale9Sprite",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::ui::Scale9Sprite*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Scale9Sprite_updateWithSprite'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 4)
{
cocos2d::Sprite* arg0;
cocos2d::Rect arg1;
bool arg2;
cocos2d::Rect arg3;
do{
if (argc == 6) {
cocos2d::Sprite* arg0;
ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0);
ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0);
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1, "ccui.Scale9Sprite:updateWithSprite");
ok &= luaval_to_rect(tolua_S, 3, &arg1, "ccui.Scale9Sprite:updateWithSprite");
if (!ok) { break; }
bool arg2;
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccui.Scale9Sprite:updateWithSprite");
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccui.Scale9Sprite:updateWithSprite");
if (!ok) { break; }
cocos2d::Vec2 arg3;
ok &= luaval_to_vec2(tolua_S, 5, &arg3, "ccui.Scale9Sprite:updateWithSprite");
ok &= luaval_to_rect(tolua_S, 5, &arg3, "ccui.Scale9Sprite:updateWithSprite");
if(!ok)
return 0;
bool ret = cobj->updateWithSprite(arg0, arg1, arg2, arg3);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:updateWithSprite",argc, 4);
if (!ok) { break; }
cocos2d::Size arg4;
ok &= luaval_to_size(tolua_S, 6, &arg4, "ccui.Scale9Sprite:updateWithSprite");
if (!ok) { break; }
cocos2d::Rect arg5;
ok &= luaval_to_rect(tolua_S, 7, &arg5, "ccui.Scale9Sprite:updateWithSprite");
if (!ok) { break; }
bool ret = cobj->updateWithSprite(arg0, arg1, arg2, arg3, arg4, arg5);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 4) {
cocos2d::Sprite* arg0;
ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0);
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1, "ccui.Scale9Sprite:updateWithSprite");
if (!ok) { break; }
bool arg2;
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccui.Scale9Sprite:updateWithSprite");
if (!ok) { break; }
cocos2d::Rect arg3;
ok &= luaval_to_rect(tolua_S, 5, &arg3, "ccui.Scale9Sprite:updateWithSprite");
if (!ok) { break; }
bool ret = cobj->updateWithSprite(arg0, arg1, arg2, arg3);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:updateWithSprite",argc, 4);
return 0;
#if COCOS2D_DEBUG >= 1
@ -18646,7 +18597,39 @@ int lua_cocos2dx_ui_Scale9Sprite_init(lua_State* tolua_S)
}
}while(0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:init",argc, 3);
do{
if (argc == 6) {
cocos2d::Sprite* arg0;
ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0);
if (!ok) { break; }
cocos2d::Rect arg1;
ok &= luaval_to_rect(tolua_S, 3, &arg1, "ccui.Scale9Sprite:init");
if (!ok) { break; }
bool arg2;
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccui.Scale9Sprite:init");
if (!ok) { break; }
cocos2d::Vec2 arg3;
ok &= luaval_to_vec2(tolua_S, 5, &arg3, "ccui.Scale9Sprite:init");
if (!ok) { break; }
cocos2d::Size arg4;
ok &= luaval_to_size(tolua_S, 6, &arg4, "ccui.Scale9Sprite:init");
if (!ok) { break; }
cocos2d::Rect arg5;
ok &= luaval_to_rect(tolua_S, 7, &arg5, "ccui.Scale9Sprite:init");
if (!ok) { break; }
bool ret = cobj->init(arg0, arg1, arg2, arg3, arg4, arg5);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:init",argc, 6);
return 0;
#if COCOS2D_DEBUG >= 1
@ -18782,6 +18765,19 @@ int lua_cocos2dx_ui_Scale9Sprite_setSpriteFrame(lua_State* tolua_S)
cobj->setSpriteFrame(arg0);
return 0;
}
if (argc == 2)
{
cocos2d::SpriteFrame* arg0;
cocos2d::Rect arg1;
ok &= luaval_to_object<cocos2d::SpriteFrame>(tolua_S, 2, "cc.SpriteFrame",&arg0);
ok &= luaval_to_rect(tolua_S, 3, &arg1, "ccui.Scale9Sprite:setSpriteFrame");
if(!ok)
return 0;
cobj->setSpriteFrame(arg0, arg1);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Scale9Sprite:setSpriteFrame",argc, 1);
return 0;

View File

@ -477,8 +477,6 @@ int register_all_cocos2dx_ui(lua_State* tolua_S);

View File

@ -0,0 +1,379 @@
require "json"
require "extern"
ccs = ccs or {}
function ccs.sendTriggerEvent(event)
local triggerObjArr = ccs.TriggerMng.getInstance():get(event)
if nil == triggerObjArr then
return
end
for i = 1, table.getn(triggerObjArr) do
local triObj = triggerObjArr[i]
if nil ~= triObj and triObj:detect() then
triObj:done()
end
end
end
function ccs.registerTriggerClass(className, createFunc)
ccs.TInfo.new(className,createFunc)
end
ccs.TInfo = class("TInfo")
ccs.TInfo._className = ""
ccs.TInfo._fun = nil
function ccs.TInfo:ctor(c,f)
-- @param {String|ccs.TInfo}c
-- @param {Function}f
if nil ~= f then
self._className = c
self._fun = f
else
self._className = c._className
self._fun = c._fun
end
ccs.ObjectFactory.getInstance():registerType(self)
end
ccs.ObjectFactory = class("ObjectFactory")
ccs.ObjectFactory._typeMap = nil
ccs.ObjectFactory._instance = nil
function ccs.ObjectFactory:ctor()
self._typeMap = {}
end
function ccs.ObjectFactory.getInstance()
if nil == ccs.ObjectFactory._instance then
ccs.ObjectFactory._instance = ccs.ObjectFactory.new()
end
return ccs.ObjectFactory._instance
end
function ccs.ObjectFactory.destroyInstance()
ccs.ObjectFactory._instance = nil
end
function ccs.ObjectFactory:createObject(classname)
local obj = nil
local t = self._typeMap[classname]
if nil ~= t then
obj = t._fun()
end
return obj
end
function ccs.ObjectFactory:registerType(t)
self._typeMap[t._className] = t
end
ccs.TriggerObj = class("TriggerObj")
ccs.TriggerObj._cons = {}
ccs.TriggerObj._acts = {}
ccs.TriggerObj._enable = false
ccs.TriggerObj._id = 0
ccs.TriggerObj._vInt = {}
function ccs.TriggerObj.extend(target)
local t = tolua.getpeer(target)
if not t then
t = {}
tolua.setpeer(target, t)
end
setmetatable(t, TriggerObj)
return target
end
function ccs.TriggerObj:ctor()
self:init()
end
function ccs.TriggerObj:init()
self._id = 0
self._enable = true
self._cons = {}
self._acts = {}
self._vInt = {}
end
function ccs.TriggerObj:detect()
if (not self._enable) or (table.getn(self._cons) == 0) then
return true
end
local ret = true
local obj = nil
for i = 1 , table.getn(self._cons) do
obj = self._cons[i]
if nil ~= obj and nil ~= obj.detect then
ret = ret and obj:detect()
end
end
return ret
end
function ccs.TriggerObj:done()
if (not self._enable) or (table.getn(self._acts) == 0) then
return
end
local obj = nil
for i = 1, table.getn(self._acts) do
obj = self._acts[i]
if nil ~= obj and obj.done then
obj:done()
end
end
end
function ccs.TriggerObj:removeAll()
local obj = nil
for i=1, table.getn(self._cons) do
obj = self._cons[i]
if nil ~= obj then
obj:removeAll()
end
end
self._cons = {}
for i=1, table.getn(self._acts) do
obj = self._acts[i]
if nil ~= obj then
obj:removeAll()
end
end
self._acts = {}
end
function ccs.TriggerObj:serialize(jsonValue)
self._id = jsonValue["id"]
local count = 0
--condition
local cons = jsonValue["conditions"]
if nil ~= cons then
count = table.getn(cons)
for i = 1, count do
local subDict = cons[i]
local className = subDict["classname"]
if nil ~= className then
local obj = ccs.ObjectFactory.getInstance():createObject(className)
assert(nil ~= obj, string.format("class named %s can not implement!",className))
obj:serialize(subDict)
obj:init()
table.insert(self._cons, obj)
end
end
end
local actions = jsonValue["actions"]
if nil ~= actions then
count = table.getn(actions)
for i = 1,count do
local subAction = actions[i]
local className = subAction["classname"]
if nil ~= className then
local act = ccs.ObjectFactory.getInstance():createObject(className)
assert(nil ~= act ,string.format("class named %s can not implement!",className))
act:serialize(subAction)
act:init()
table.insert(self._acts,act)
end
end
end
local events = jsonValue["events"]
if nil ~= events then
count = table.getn(events)
for i = 1, count do
local subEveent = events[i]
local eventID = subEveent["id"]
if eventID >= 0 then
table.insert(self._vInt,eventID)
end
end
end
end
function ccs.TriggerObj:getId()
return self._id
end
function ccs.TriggerObj:setEnable(enable)
self._enable = enable
end
function ccs.TriggerObj:getEvents()
return self._vInt
end
ccs.TriggerMng = class("TriggerMng")
ccs.TriggerMng._eventTriggers = nil
ccs.TriggerMng._triggerObjs = nil
ccs.TriggerMng._movementDispatches = nil
ccs.TriggerMng._instance = nil
function ccs.TriggerMng:ctor()
self._triggerObjs = {}
self._movementDispatches = {}
self._eventTriggers = {}
end
function ccs.TriggerMng.getInstance()
if ccs.TriggerMng._instance == nil then
ccs.TriggerMng._instance = ccs.TriggerMng.new()
end
return ccs.TriggerMng._instance
end
function ccs.TriggerMng.destroyInstance()
if ccs.TriggerMng._instance ~= nil then
ccs.TriggerMng._instance:removeAll()
ccs.TriggerMng._instance = nil
end
end
function ccs.TriggerMng:triggerMngVersion()
return "1.0.0.0"
end
function ccs.TriggerMng:parse(jsonStr)
local parseTable = json.decode(jsonStr,1)
if nil == parseTable then
return
end
local count = table.getn(parseTable)
for i = 1, count do
local subDict = parseTable[i]
local triggerObj = ccs.TriggerObj.new()
triggerObj:serialize(subDict)
local events = triggerObj:getEvents()
for j = 1, table.getn(events) do
local event = events[j]
self:add(event, triggerObj)
end
self._triggerObjs[triggerObj:getId()] = triggerObj
end
end
function ccs.TriggerMng:get(event)
return self._eventTriggers[event]
end
function ccs.TriggerMng:getTriggerObj(id)
return self._triggerObjs[id]
end
function ccs.TriggerMng:add(event,triggerObj)
local eventTriggers = self._eventTriggers[event]
if nil == eventTriggers then
eventTriggers = {}
end
local exist = false
for i = 1, table.getn(eventTriggers) do
if eventTriggers[i] == triggers then
exist = true
break
end
end
if not exist then
table.insert(eventTriggers,triggerObj)
self._eventTriggers[event] = eventTriggers
end
end
function ccs.TriggerMng:removeAll( )
for k in pairs(self._eventTriggers) do
local triObjArr = self._eventTriggers[k]
for j = 1, table.getn(triObjArr) do
local obj = triObjArr[j]
obj:removeAll()
end
end
self._eventTriggers = {}
end
function ccs.TriggerMng:remove(event, obj)
if nil ~= obj then
return self:removeObjByEvent(event, obj)
end
assert(event >= 0,"event must be larger than 0")
if nil == self._eventTriggers then
return false
end
local triObjects = self._eventTriggers[event]
if nil == triObjects then
return false
end
for i = 1, table.getn(triObjects) do
local triObject = triggers[i]
if nil ~= triObject then
triObject:remvoeAll()
end
end
self._eventTriggers[event] = nil
return true
end
function ccs.TriggerMng:removeObjByEvent(event, obj)
assert(event >= 0,"event must be larger than 0")
if nil == self._eventTriggers then
return false
end
local triObjects = self._eventTriggers[event]
if nil == triObjects then
return false
end
for i = 1,table.getn(triObjects) do
local triObject = triObjects[i]
if nil ~= triObject and triObject == obj then
triObject:remvoeAll()
table.remove(triObjects, i)
return true
end
end
end
function ccs.TriggerMng:removeTriggerObj(id)
local obj = self.getTriggerObj(id)
if nil == obj then
return false
end
local events = obj:getEvents()
for i = 1, table.getn(events) do
self:remove(events[i],obj)
end
return true
end
function ccs.TriggerMng:isEmpty()
return (not (nil == self._eventTriggers)) or table.getn(self._eventTriggers) <= 0
end
function __onParseConfig(configType,jasonStr)
if configType == cc.ConfigType.COCOSTUDIO then
ccs.TriggerMng.getInstance():parse(jasonStr)
end
end

View File

@ -0,0 +1,304 @@
-- This is the DeprecatedExtensionClass
DeprecatedExtensionClass = {} or DeprecatedExtensionClass
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
end
--CCArmature class will be Deprecated,begin
function DeprecatedExtensionClass.CCArmature()
deprecatedTip("CCArmature","ccs.Armature")
return ccs.Armature
end
_G["CCArmature"] = DeprecatedExtensionClass.CCArmature()
--CCArmature class will be Deprecated,end
--CCArmatureAnimation class will be Deprecated,begin
function DeprecatedExtensionClass.CCArmatureAnimation()
deprecatedTip("CCArmatureAnimation","ccs.ArmatureAnimation")
return ccs.ArmatureAnimation
end
_G["CCArmatureAnimation"] = DeprecatedExtensionClass.CCArmatureAnimation()
--CCArmatureAnimation class will be Deprecated,end
--CCSkin class will be Deprecated,begin
function DeprecatedExtensionClass.CCSkin()
deprecatedTip("CCSkin","ccs.Skin")
return ccs.Skin
end
_G["CCSkin"] = DeprecatedExtensionClass.CCSkin()
--CCSkin class will be Deprecated,end
--CCBone class will be Deprecated,begin
function DeprecatedExtensionClass.CCBone()
deprecatedTip("CCBone","ccs.Bone")
return ccs.Bone
end
_G["CCBone"] = DeprecatedExtensionClass.CCBone()
--CCBone class will be Deprecated,end
--CCArmatureDataManager class will be Deprecated,begin
function DeprecatedExtensionClass.CCArmatureDataManager()
deprecatedTip("CCArmatureDataManager","ccs.ArmatureDataManager")
return ccs.ArmatureDataManager
end
_G["CCArmatureDataManager"] = DeprecatedExtensionClass.CCArmatureDataManager()
--CCArmatureDataManager class will be Deprecated,end
--CCBatchNode class will be Deprecated,begin
function DeprecatedExtensionClass.CCBatchNode()
deprecatedTip("CCBatchNode","ccs.BatchNode")
return ccs.BatchNode
end
_G["CCBatchNode"] = DeprecatedExtensionClass.CCBatchNode()
--CCBatchNode class will be Deprecated,end
--CCTween class will be Deprecated,begin
function DeprecatedExtensionClass.CCTween()
deprecatedTip("CCTween","ccs.Tween")
return ccs.Tween
end
_G["CCTween"] = DeprecatedExtensionClass.CCTween()
--CCTween class will be Deprecated,end
--CCBaseData class will be Deprecated,begin
function DeprecatedExtensionClass.CCBaseData()
deprecatedTip("CCBaseData","ccs.BaseData")
return ccs.BaseData
end
_G["CCBaseData"] = DeprecatedExtensionClass.CCBaseData()
--CCBaseData class will be Deprecated,end
--CCDisplayManager class will be Deprecated,begin
function DeprecatedExtensionClass.CCDisplayManager()
deprecatedTip("CCDisplayManager","ccs.DisplayManager")
return ccs.DisplayManager
end
_G["CCDisplayManager"] = DeprecatedExtensionClass.CCDisplayManager()
--CCDisplayManager class will be Deprecated,end
--UIHelper class will be Deprecated,begin
function DeprecatedExtensionClass.UIHelper()
deprecatedTip("UIHelper","ccs.UIHelper")
return ccs.UIHelper
end
_G["UIHelper"] = DeprecatedExtensionClass.UIHelper()
--UIHelper class will be Deprecated,end
--UILayout class will be Deprecated,begin
function DeprecatedExtensionClass.UILayout()
deprecatedTip("UILayout","ccs.UILayout")
return ccs.UILayout
end
_G["UILayout"] = DeprecatedExtensionClass.UILayout()
--UILayout class will be Deprecated,end
--UIWidget class will be Deprecated,begin
function DeprecatedExtensionClass.UIWidget()
deprecatedTip("UIWidget","ccs.UIWidget")
return ccs.UIWidget
end
_G["UIWidget"] = DeprecatedExtensionClass.UIWidget()
--UIWidget class will be Deprecated,end
--UILayer class will be Deprecated,begin
function DeprecatedExtensionClass.UILayer()
deprecatedTip("UILayer","ccs.UILayer")
return ccs.UILayer
end
_G["UILayer"] = DeprecatedExtensionClass.UILayer()
--UILayer class will be Deprecated,end
--UIButton class will be Deprecated,begin
function DeprecatedExtensionClass.UIButton()
deprecatedTip("UIButton","ccs.UIButton")
return ccs.UIButton
end
_G["UIButton"] = DeprecatedExtensionClass.UIButton()
--UIButton class will be Deprecated,end
--UICheckBox class will be Deprecated,begin
function DeprecatedExtensionClass.UICheckBox()
deprecatedTip("UICheckBox","ccs.UICheckBox")
return ccs.UICheckBox
end
_G["UICheckBox"] = DeprecatedExtensionClass.UICheckBox()
--UICheckBox class will be Deprecated,end
--UIImageView class will be Deprecated,begin
function DeprecatedExtensionClass.UIImageView()
deprecatedTip("UIImageView","ccs.UIImageView")
return ccs.UIImageView
end
_G["UIImageView"] = DeprecatedExtensionClass.UIImageView()
--UIImageView class will be Deprecated,end
--UILabel class will be Deprecated,begin
function DeprecatedExtensionClass.UILabel()
deprecatedTip("UILabel","ccs.UILabel")
return ccs.UILabel
end
_G["UILabel"] = DeprecatedExtensionClass.UILabel()
--UILabel class will be Deprecated,end
--UILabelAtlas class will be Deprecated,begin
function DeprecatedExtensionClass.UILabelAtlas()
deprecatedTip("UILabelAtlas","ccs.UILabelAtlas")
return ccs.UILabelAtlas
end
_G["UILabelAtlas"] = DeprecatedExtensionClass.UILabelAtlas()
--UILabelAtlas class will be Deprecated,end
--UILabelBMFont class will be Deprecated,begin
function DeprecatedExtensionClass.UILabelBMFont()
deprecatedTip("UILabelBMFont","ccs.UILabelBMFont")
return ccs.UILabelBMFont
end
_G["UILabelBMFont"] = DeprecatedExtensionClass.UILabelBMFont()
--UILabelBMFont class will be Deprecated,end
--UILoadingBar class will be Deprecated,begin
function DeprecatedExtensionClass.UILoadingBar()
deprecatedTip("UILoadingBar","ccs.UILoadingBar")
return ccs.UILoadingBar
end
_G["UILoadingBar"] = DeprecatedExtensionClass.UILoadingBar()
--UILoadingBar class will be Deprecated,end
--UISlider class will be Deprecated,begin
function DeprecatedExtensionClass.UISlider()
deprecatedTip("UISlider","ccs.UISlider")
return ccs.UISlider
end
_G["UISlider"] = DeprecatedExtensionClass.UISlider()
--UISlider class will be Deprecated,end
--UITextField class will be Deprecated,begin
function DeprecatedExtensionClass.UITextField()
deprecatedTip("UITextField","ccs.UITextField")
return ccs.UITextField
end
_G["UITextField"] = DeprecatedExtensionClass.UITextField()
--UITextField class will be Deprecated,end
--UIScrollView class will be Deprecated,begin
function DeprecatedExtensionClass.UIScrollView()
deprecatedTip("UIScrollView","ccs.UIScrollView")
return ccs.UIScrollView
end
_G["UIScrollView"] = DeprecatedExtensionClass.UIScrollView()
--UIScrollView class will be Deprecated,end
--UIPageView class will be Deprecated,begin
function DeprecatedExtensionClass.UIPageView()
deprecatedTip("UIPageView","ccs.UIPageView")
return ccs.UIPageView
end
_G["UIPageView"] = DeprecatedExtensionClass.UIPageView()
--UIPageView class will be Deprecated,end
--UIListView class will be Deprecated,begin
function DeprecatedExtensionClass.UIListView()
deprecatedTip("UIListView","ccs.UIListView")
return ccs.UIListView
end
_G["UIListView"] = DeprecatedExtensionClass.UIListView()
--UIListView class will be Deprecated,end
--UILayoutParameter class will be Deprecated,begin
function DeprecatedExtensionClass.UILayoutParameter()
deprecatedTip("UILayoutParameter","ccs.UILayoutParameter")
return ccs.UILayoutParameter
end
_G["UILayoutParameter"] = DeprecatedExtensionClass.UILayoutParameter()
--UILayoutParameter class will be Deprecated,end
--UILinearLayoutParameter class will be Deprecated,begin
function DeprecatedExtensionClass.UILinearLayoutParameter()
deprecatedTip("UILinearLayoutParameter","ccs.UILinearLayoutParameter")
return ccs.UILinearLayoutParameter
end
_G["UILinearLayoutParameter"] = DeprecatedExtensionClass.UILinearLayoutParameter()
--UILinearLayoutParameter class will be Deprecated,end
--UIRelativeLayoutParameter class will be Deprecated,begin
function DeprecatedExtensionClass.UIRelativeLayoutParameter()
deprecatedTip("UIRelativeLayoutParameter","ccs.UIRelativeLayoutParameter")
return ccs.UIRelativeLayoutParameter
end
_G["UIRelativeLayoutParameter"] = DeprecatedExtensionClass.UIRelativeLayoutParameter()
--UIRelativeLayoutParameter class will be Deprecated,end
--CCComController class will be Deprecated,begin
function DeprecatedExtensionClass.CCComController()
deprecatedTip("CCComController","ccs.ComController")
return ccs.CCComController
end
_G["CCComController"] = DeprecatedExtensionClass.CCComController()
--CCComController class will be Deprecated,end
--CCComAudio class will be Deprecated,begin
function DeprecatedExtensionClass.CCComAudio()
deprecatedTip("CCComAudio","ccs.ComAudio")
return ccs.ComAudio
end
_G["CCComAudio"] = DeprecatedExtensionClass.CCComAudio()
--CCComAudio class will be Deprecated,end
--CCComAttribute class will be Deprecated,begin
function DeprecatedExtensionClass.CCComAttribute()
deprecatedTip("CCComAttribute","ccs.ComAttribute")
return ccs.ComAttribute
end
_G["CCComAttribute"] = DeprecatedExtensionClass.CCComAttribute()
--CCComAttribute class will be Deprecated,end
--CCComRender class will be Deprecated,begin
function DeprecatedExtensionClass.CCComRender()
deprecatedTip("CCComRender","ccs.ComRender")
return ccs.ComRender
end
_G["CCComRender"] = DeprecatedExtensionClass.CCComRender()
--CCComRender class will be Deprecated,end
--ActionManager class will be Deprecated,begin
function DeprecatedExtensionClass.ActionManager()
deprecatedTip("ActionManager","ccs.ActionManagerEx")
return ccs.ActionManagerEx
end
_G["ActionManager"] = DeprecatedExtensionClass.ActionManager()
--CCComRender class will be Deprecated,end
--SceneReader class will be Deprecated,begin
function DeprecatedExtensionClass.SceneReader()
deprecatedTip("SceneReader","ccs.SceneReader")
return ccs.SceneReader
end
_G["SceneReader"] = DeprecatedExtensionClass.SceneReader()
--SceneReader class will be Deprecated,end
--GUIReader class will be Deprecated,begin
function DeprecatedExtensionClass.GUIReader()
deprecatedTip("GUIReader","ccs.GUIReader")
return ccs.GUIReader
end
_G["GUIReader"] = DeprecatedExtensionClass.GUIReader()
--GUIReader class will be Deprecated,end
--UIRootWidget class will be Deprecated,begin
function DeprecatedExtensionClass.UIRootWidget()
deprecatedTip("UIRootWidget","ccs.UIRootWidget")
return ccs.UIRootWidget
end
_G["UIRootWidget"] = DeprecatedExtensionClass.UIRootWidget()
--UIRootWidget class will be Deprecated,end
--ActionObject class will be Deprecated,begin
function DeprecatedExtensionClass.ActionObject()
deprecatedTip("ActionObject","ccs.ActionObject")
return ccs.ActionObject
end
_G["ActionObject"] = DeprecatedExtensionClass.ActionObject()
--ActionObject class will be Deprecated,end

View File

@ -0,0 +1,77 @@
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
end
--functions of GUIReader will be deprecated begin
local GUIReaderDeprecated = { }
function GUIReaderDeprecated.shareReader()
deprecatedTip("GUIReader:shareReader","ccs.GUIReader:getInstance")
return ccs.GUIReader:getInstance()
end
rawset(GUIReader,"shareReader",GUIReaderDeprecated.shareReader)
function GUIReaderDeprecated.purgeGUIReader()
deprecatedTip("GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance")
return ccs.GUIReader:destroyInstance()
end
rawset(GUIReader,"purgeGUIReader",GUIReaderDeprecated.purgeGUIReader)
--functions of GUIReader will be deprecated end
--functions of SceneReader will be deprecated begin
local SceneReaderDeprecated = { }
function SceneReaderDeprecated.sharedSceneReader()
deprecatedTip("SceneReader:sharedSceneReader","ccs.SceneReader:getInstance")
return ccs.SceneReader:getInstance()
end
rawset(SceneReader,"sharedSceneReader",SceneReaderDeprecated.sharedSceneReader)
function SceneReaderDeprecated.purgeSceneReader(self)
deprecatedTip("SceneReader:purgeSceneReader","ccs.SceneReader:destroyInstance")
return self:destroyInstance()
end
rawset(SceneReader,"purgeSceneReader",SceneReaderDeprecated.purgeSceneReader)
--functions of SceneReader will be deprecated end
--functions of ccs.GUIReader will be deprecated begin
local CCSGUIReaderDeprecated = { }
function CCSGUIReaderDeprecated.purgeGUIReader()
deprecatedTip("ccs.GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance")
return ccs.GUIReader:destroyInstance()
end
rawset(ccs.GUIReader,"purgeGUIReader",CCSGUIReaderDeprecated.purgeGUIReader)
--functions of ccs.GUIReader will be deprecated end
--functions of ccs.ActionManagerEx will be deprecated begin
local CCSActionManagerExDeprecated = { }
function CCSActionManagerExDeprecated.destroyActionManager()
deprecatedTip("ccs.ActionManagerEx:destroyActionManager","ccs.ActionManagerEx:destroyInstance")
return ccs.ActionManagerEx:destroyInstance()
end
rawset(ccs.ActionManagerEx,"destroyActionManager",CCSActionManagerExDeprecated.destroyActionManager)
--functions of ccs.ActionManagerEx will be deprecated end
--functions of ccs.SceneReader will be deprecated begin
local CCSSceneReaderDeprecated = { }
function CCSSceneReaderDeprecated.destroySceneReader(self)
deprecatedTip("ccs.SceneReader:destroySceneReader","ccs.SceneReader:destroyInstance")
return self:destroyInstance()
end
rawset(ccs.SceneReader,"destroySceneReader",CCSSceneReaderDeprecated.destroySceneReader)
--functions of ccs.SceneReader will be deprecated end
--functions of CCArmatureDataManager will be deprecated begin
local CCArmatureDataManagerDeprecated = { }
function CCArmatureDataManagerDeprecated.sharedArmatureDataManager()
deprecatedTip("CCArmatureDataManager:sharedArmatureDataManager","ccs.ArmatureDataManager:getInstance")
return ccs.ArmatureDataManager:getInstance()
end
rawset(CCArmatureDataManager,"sharedArmatureDataManager",CCArmatureDataManagerDeprecated.sharedArmatureDataManager)
function CCArmatureDataManagerDeprecated.purge()
deprecatedTip("CCArmatureDataManager:purge","ccs.ArmatureDataManager:destoryInstance")
return ccs.ArmatureDataManager:destoryInstance()
end
rawset(CCArmatureDataManager,"purge",CCArmatureDataManagerDeprecated.purge)
--functions of CCArmatureDataManager will be deprecated end

View File

@ -0,0 +1,8 @@
ccs = ccs or {}
ccs.MovementEventType = {
start = 0,
complete = 1,
loopComplete = 2,
}