Commit 2775e0f1 authored by 范雪寒's avatar 范雪寒

test:

parent e8504d2a
......@@ -745,7 +745,7 @@ cc.Class({
return;
}
middleLayerNode.getComponent('middleLayer').log(str);
middleLayerNode.getComponent('middleLayer').showLog(str);
},
......@@ -943,36 +943,6 @@ cc.Class({
curDragonDisplay: null,
setStakeAnima(data) {
// const picNode = cc.find('Canvas/centerPart_2/frame/pic');
// // const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
// const rectNode = new cc.Node();
// // rectNode.name = 'rect' + data.index;
// rectNode = picNode;
// const ctx = rectNode.addComponent(cc.Graphics);
// // 红色矩形
// ctx.lineWidth = 4;
// ctx.strokeColor = cc.Color.BLACK;
// ctx.fillColor = cc.Color.WHITE.setA(100);
// const scale = rate / this.hotZoneBg.scaleY;
// rectNode.width = data.rect.width * scale;
// rectNode.height = data.rect.height * scale;
// rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
// rectNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;
// rectNode.anchorX = rectNode.anchorY = 0;
// if (this.data.bgItem.isShowDebugLine) {
// ctx.rect(0, 0, rectNode.width, rectNode.height);
// }
// ctx.stroke();
// ctx.fill();
const picNode = this.stake;
console.log('data: ', data);
......@@ -983,14 +953,6 @@ cc.Class({
animaNode.parent = picNode;
picNode.animaNode = animaNode;
// if (data.audio_url) {
// cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
// animaNode.audioClip = audioClip;
// });
// }
const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
this.curDragonDisplay = dragonDisplay;
......@@ -1007,94 +969,52 @@ cc.Class({
return;
}
setTimeout(() => {
cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson;
atlas.texture = texture;
const asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = dragonBonesJson;
// console.log(' texture: ', texture)
// console.log(' atlasJson: ', atlasJson)
// console.log(' dragonBonesJson: ', dragonBonesJson)
cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson;
atlas.texture = texture;
const asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = dragonBonesJson;
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
let json = JSON.parse(asset.dragonBonesJson);
let armatures = json["armature"];
// console.log('armatures: ', armatures);
let armatureNames = [];
for (let i = 0; i < armatures.length; i++) {
armatureNames.push(armatures[i].name);
let json = JSON.parse(asset.dragonBonesJson);
let armatures = json["armature"];
// console.log('armatures: ', armatures);
let armatureNames = [];
for (let i = 0; i < armatures.length; i++) {
armatureNames.push(armatures[i].name);
}
// console.log('armatureNames: ', armatureNames);
if (armatureNames.length > 0) {
let defaultArmatureName = armatureNames[0];
dragonDisplay.armatureName = defaultArmatureName;
// let animationNames = dragonDisplay.getAnimationNames(defaultArmatureName);
let defaultArmature = armatures[0];
let animations = defaultArmature.animation;
let animationNames = [];
for (let i = 0; i < animations.length; i++) {
animationNames.push(animations[i].name);
}
// console.log('armatureNames: ', armatureNames);
if (armatureNames.length > 0) {
let defaultArmatureName = armatureNames[0];
dragonDisplay.armatureName = defaultArmatureName;
// let animationNames = dragonDisplay.getAnimationNames(defaultArmatureName);
let defaultArmature = armatures[0];
let animations = defaultArmature.animation;
let animationNames = [];
for (let i = 0; i < animations.length; i++) {
animationNames.push(animations[i].name);
}
console.log('animationNames: ', animationNames.toString())
// rectNode.addComponent(cc.Button);
// rectNode.on('click', () => {
// if (rectNode.isClicked) {
// // return;
// }
// rectNode.isClicked = true;
// console.log('clicked');
// if (animaNode.audioClip) {
// cc.audioEngine.stopAll();
// cc.audioEngine.play(animaNode.audioClip, false, 0.8);
// }
// if (animationNames.length > 0) {
// dragonDisplay.playAnimation(animationNames[0], -1);
// }
// });
dragonDisplay.playAnimation('normal', -1);
dragonDisplay.animaNames = animationNames;
animaNode.y -= 30;
console.log('animationNames: ', animationNames.toString())
if (animaNode.height) {
animaNode.scale = 376 / animaNode.height;
}
dragonDisplay.playAnimation('normal', -1);
dragonDisplay.animaNames = animationNames;
animaNode.y -= 30;
// animaNode.on('click', () => {
// console.log('anima node clicked ~~~');
// this.showDragonAnima();
// })
if (animaNode.height) {
animaNode.scale = 376 / animaNode.height;
}
});
}
});
});
}, 300);
});
},
showDragonAnima() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment