zoukankan      html  css  js  c++  java
  • cocos 点击遍历播放该骨骼所有动画

    cc.Class({
        extends: cc.Component,
    
        properties: {
            _musicVolume: 1.0,
            _playEffect: [],
            _switchEffect: true
        },
    
        // LIFE-CYCLE CALLBACKS:
    
        onLoad () {
            this.arr = new Array();
            this.count = 0;
            this.node.on('touchstart',  (event) => {
                // 骨骼动画复制
                this.donghua = this.node.getChildByName("touch").getComponent(dragonBones.ArmatureDisplay);
                // 注册监听事件
                this.donghua.addEventListener(dragonBones.EventObject.COMPLETE, this._animationEventHandler, this);
                // 播放第一个动画,动画结束时调监听事件
                this.donghua.playAnimation("walk",1);
                // 获取该骨骼所有动画名称
                this.arr = this.donghua.getAnimationNames("armatureName");
                cc.log("动画名称:" + this.arr);
    
            });
    
        },
    
        _animationEventHandler: function(event) {
            cc.log("动画开始播放 = " + this.arr[this.count]);
            this.donghua.playAnimation(this.arr[this.count],1);
            this.donghua.addEventListener(dragonBones.EventObject.COMPLETE, this._animationEventHandler, this);
            this.count++;
            if (this.count>this.arr.length-1)
            {
                cc.log("动画已经全部播放!");
                // 播放结束以后,删除事件
                this.donghua.removeEventListener(dragonBones.EventObject.COMPLETE, this._animationEventHandler, this);
                return ;
            }
        },
    
        
        start () {
    
        },
    
    
        // update (dt) {},
    });
  • 相关阅读:
    注释
    选择器
    SQL语句中查找字符的位置
    SQL语句中截取字符串Substr
    IDENTITY(函数)
    SQL Server设置主键自增长列
    SQL语句操作ALTER
    表的主键
    南京夜市
    夜班
  • 原文地址:https://www.cnblogs.com/Hunter-541695/p/9852891.html
Copyright © 2011-2022 走看看