// Learn cc.Class: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html // Learn Attribute: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html cc.Class({ extends: cc.Component, properties: { // foo: { // // ATTRIBUTES: // default: null, // The default value will be used only when the component attaching // // to a node for the first time // type: cc.SpriteFrame, // optional, default is typeof default // serializable: true, // optional, default is true // }, // bar: { // get () { // return this._bar; // }, // set (value) { // this._bar = value; // } // }, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { this.animationDisplay = this.getComponent(dragonBones.ArmatureDisplay); // this.animationDisplay.getAnimationNames() // var ArmatureName = this.animationDisplay.getArmatureNames() // Log.info("所有动画1",this.getArmatureNames(this.animationDisplay)) // // var AnimationNames = this.getAnimationNames(this.animationDisplay,this.getArmatureNames(this.animationDisplay)) // // Log.info("所有动画2",AnimationNames) // this.Play(this.animationDisplay,AnimationNames[0],function (type, listener, target) { // Log.info("播放完毕 type",type) // // Log.info("播放完毕 listener",listener) // // Log.info("播放完毕 target",target) // }.bind(this),1) }, _init(){ return this.getAnimationNames(this.animationDisplay,this.getArmatureNames(this.animationDisplay)) }, getAnimationNames(animationDisplay,name){ return animationDisplay.getAnimationNames(name) }, getArmatureNames(animationDisplay){ return animationDisplay.getArmatureNames() }, play( newAnimation, completeCallback, playTimes) { //动态加载龙骨 this.animationDisplay.playAnimation(newAnimation, playTimes); // this.node.scale = new cc.Vec2(scaleX, 1); this.animationDisplay.addEventListener(dragonBones.EventObject.COMPLETE, completeCallback, this.animationDisplay);//.apply(this)); }, timeScale( timeScale) { //动态加载龙骨 this.animationDisplay.timeScale = timeScale; }, playNotEvent( newAnimation, completeCallback, playTimes) { //动态加载龙骨 this.animationDisplay.playAnimation(newAnimation, playTimes); }, removeEvent(completeCallback) { //动态加载龙骨 this.animationDisplay.removeEventListener(dragonBones.EventObject.COMPLETE, completeCallback, this.animationDisplay);//.apply(this)); }, //帧回调 frame(completeCallback) { //动态加载龙骨 this.animationDisplay.addEventListener(dragonBones.EventObject.FRAME_EVENT, completeCallback, this.animationDisplay);//.apply(this)); }, // update (dt) {}, });