Cocos2dx中播放CCB动画与播放CCS动画的区别

1.播放CCB动画

    local animationName = parms.animationName
    local src = parms.src or self
    local controler = parms.controler or src
    local proxy = CCBProxy:create()
    local animationLayer, ccbReader = CCBuilderReaderLoad(Global.Dir.Effect .. "Effect/" .. animationName .. ".ccbi", proxy, controler)
    animationLayer = tolua.cast(animationLayer, "CCLayer")
    animationLayer:setZOrder(parms.zOrder or 0)
    animationLayer:setContentSize(CCSizeMake(0, 0))
    src:addChild(animationLayer)

    local animationManager = tolua.cast(ccbReader:getAnimationManager(), "CCBAnimationManager")
    animationManager:setAnimationCompletedCallback(function()
    end)
    --animationManager:runAnimationsForSequenceNamed(animationName)
    animationLayer:setPosition(parms.pos or GameDirector.centerPos)


2.播放CCS动画

local animationName = parms.animationName
CCArmatureDataManager:sharedArmatureDataManager():addArmatureFileInfo("Effect/" .. animationName .. "/" .. animationName .. ".ExportJson")

local arm = CCArmature:create(animationName)
arm:setPosition(parms.pos or GameDirector.centerPos)
arm:getAnimation():playWithIndex(0)
arm:setZOrder(parms.zOrder or 0)

local src = parms.src or self
src:addChild(arm)

arm:getAnimation():setMovementEventCallFunc(function()
end)

你可能感兴趣的:(Cocos2dx+lua)