| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- //const dragonBones = require('dragonBones');
- cc.Class({
- extends: cc.Component,
- properties: {
- dice: [cc.Node]
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
-
- },
- start () {
-
- },
- update (dt) {
-
- },
- rollDice(dice) {
- for (let i = 0; i < this.dice.length; i++) {
- let diceNode = this.dice[i];
- let spine = diceNode.getComponent(dragonBones.ArmatureDisplay);
- let randomNumber = dice[i];
- spine.animationName = "newAnimation"
- let animationName = "dice" + randomNumber;
- spine.armatureName = animationName;
- spine.timeScale = Math.floor(Math.random() * 2) + 1 ;
- spine.playTimes = 1;
- console.log(spine.armatureName)
-
- }
- }
- });
|