Commit d7651dfb authored by asdf's avatar asdf

去掉本地资源

parent 856618f1
...@@ -103,9 +103,9 @@ cc.Class({ ...@@ -103,9 +103,9 @@ cc.Class({
// imageUrl = 'http://127.0.0.1/NewProject_2_tex.png'; // imageUrl = 'http://127.0.0.1/NewProject_2_tex.png';
// skeUrl = 'http://127.0.0.1/NewProject_2_ske.json'; // skeUrl = 'http://127.0.0.1/NewProject_2_ske.json';
// atlasUrl = 'http://127.0.0.1/NewProject_2_tex.json'; // atlasUrl = 'http://127.0.0.1/NewProject_2_tex.json';
imageUrl = 'http://127.0.0.1/walkingfish_tex.png'; // imageUrl = 'http://127.0.0.1/walkingfish_tex.png';
skeUrl = 'http://127.0.0.1/walkingfish_ske.json'; // skeUrl = 'http://127.0.0.1/walkingfish_ske.json';
atlasUrl = 'http://127.0.0.1/walkingfish_tex.json'; // atlasUrl = 'http://127.0.0.1/walkingfish_tex.json';
cc.assetManager.loadAny([{ url: atlasUrl, ext: '.txt' }, { url: skeUrl, ext: '.txt' }], (error, assets) => { cc.assetManager.loadAny([{ url: atlasUrl, ext: '.txt' }, { url: skeUrl, ext: '.txt' }], (error, assets) => {
if (error) { if (error) {
console.log(error) console.log(error)
...@@ -303,7 +303,7 @@ cc.Class({ ...@@ -303,7 +303,7 @@ cc.Class({
playAudioOption(cb1, cb2) { playAudioOption(cb1, cb2) {
GameData.audioCount++; GameData.audioCount++;
let url = this.data.optionAudio; let url = this.data.optionAudio;
url = 'http://127.0.0.1/iamflying.mp3'; // url = 'http://127.0.0.1/iamflying.mp3';
cc.assetManager.loadRemote(url, null, (err, clip) => { cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) { if (err) {
console.log(err) console.log(err)
......
cc.Class({
extends: cc.Component,
properties: {
nodBg1: cc.Node,
nodBg2: cc.Node,
dragonBone: dragonBones.ArmatureDisplay,
labQuestion1: cc.Label,
labQuestion2: cc.Label,
labQuestion3: cc.Label,
},
// onLoad () {},
start() {
},
onEnable() {
this.node.on('touchstart', this.onTouchStart, this);
},
onDisable() {
this.node.off('touchstart', this.onTouchStart, this);
},
setInfo(data, index, scene) {
this.scene = scene;
this.data = data;
this.index = index;
this.updateLabels();
this.loadDragonBone();
},
loadDragonBone() {
this.dragonBone.dragonAtlasAsset = null;
this.dragonBone.dragonAsset = null;
this.dragonBone.armatureName = '';
var imageUrl = this.data.optionDragonBone.texPngData.url;
var skeUrl = this.data.optionDragonBone.skeJsonData.url;
var atlasUrl = this.data.optionDragonBone.texJsonData.url;
// imageUrl = 'http://127.0.0.1/NewProject_2_tex.png';
// skeUrl = 'http://127.0.0.1/NewProject_2_ske.json';
// atlasUrl = 'http://127.0.0.1/NewProject_2_tex.json';
// imageUrl = 'http://127.0.0.1/walkingfish_tex.png';
// skeUrl = 'http://127.0.0.1/walkingfish_ske.json';
// atlasUrl = 'http://127.0.0.1/walkingfish_tex.json';
cc.assetManager.loadAny([{ url: atlasUrl, ext: '.txt' }, { url: skeUrl, ext: '.txt' }], (error, assets) => {
if (error) {
console.log(error)
}
else {
cc.assetManager.loadRemote(imageUrl, (error, texture) => {
if (error) {
console.log(error)
}
else {
var atlas = new dragonBones.DragonBonesAtlasAsset();
atlas._uuid = atlasUrl;
atlas.atlasJson = assets[0];
atlas.texture = texture;
var asset = new dragonBones.DragonBonesAsset();
asset._uuid = skeUrl;
asset.dragonBonesJson = assets[1];
this.dragonBone.dragonAtlasAsset = atlas;
this.dragonBone.dragonAsset = asset;
let data = asset._dragonBonesJsonData.armature[0];
if (!data) {
return;
}
this.dragonBone.armatureName = data.name;
this.animationName = data.animation[0].name;
// this.dragonBone.premultipliedAlpha = true;
// atlas.texture.setPremultiplyAlpha(true);
}
});
}
});
},
updateLabels() {
this.labQuestion1.string = this.data.text;
this.labQuestion2.string = this.data.text;
this.labQuestion3.string = this.data.text;
this.labQuestion1._forceUpdateRenderData();
this.labQuestion2._forceUpdateRenderData();
this.labQuestion3._forceUpdateRenderData();
if (this.labQuestion1.node.width > 145) {
this.labQuestion1.node.scale = 145 / this.labQuestion1.node.width;
this.labQuestion2.node.scale = 145 / this.labQuestion1.node.width;
this.labQuestion3.node.scale = 145 / this.labQuestion1.node.width;
}
},
setChooseRight(dragonBone, animationName) {
this.isRight = true;
this.animationName2 = animationName;
this.nodBg1.active = false;
this.nodBg2.active = true;
this.labQuestion1.node.parent.active = false;
this.labQuestion2.node.parent.active = false;
this.labQuestion3.node.active = true;
this.nodDragonBone2 = cc.instantiate(dragonBone.node);
this.nodDragonBone2.parent = this.node;
this.nodDragonBone2.x = 40;
this.nodDragonBone2.y = this.dragonBone.node.y;
this.dragonBone.node.x = -40;
this.playAudioOption(true);
this.dragonBone.playAnimation(this.animationName, 0);
this.nodDragonBone2.getComponent(dragonBones.ArmatureDisplay).playAnimation(animationName, 0);
},
stopRightAnimation() {
this.dragonBone.playAnimation(this.animationName, 1);
this.nodDragonBone2.getComponent(dragonBones.ArmatureDisplay).playAnimation(this.animationName2, 1);
},
setGray() {
this.isGray = true;
this.labQuestion1.node.parent.active = false;
this.labQuestion2.node.parent.active = false;
this.nodBg1.color = new cc.Color().fromHEX('#7E7E7E');
this.dragonBone.node.color = new cc.Color().fromHEX('#7E7E7E');
},
setNormal() {
this.isGray = false;
this.nodBg1.color = new cc.Color().fromHEX('#ffffff');
this.dragonBone.node.color = new cc.Color().fromHEX('#ffffff');
},
onTouchStart() {
if (GameData.isMoving) {
return;
}
if (this.isRight) {
return;
}
if (this.isGray) {
return;
}
if (GameData.audioCount != 0) {
return;
}
this.showQipao();
this.playAudioOption();
},
showQipao() {
if (this.index == 3) {
this.labQuestion1.node.parent.active = false;
this.labQuestion2.node.parent.active = true;
} else {
this.labQuestion1.node.parent.active = true;
this.labQuestion2.node.parent.active = false;
}
},
playAudioOption(showNext) {
GameData.audioCount++;
let url = this.data.optionAudio;
// url = 'http://127.0.0.1/iamflying.mp3';
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
let id = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
if(!cc.isValid(this)){
return;
}
GameData.audioCount--;
if (showNext) {
this.scene.showNext(this.index);
}
})
});
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "801cd7c3-d02a-4ae9-8bd2-42c13f8f7456",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -215,7 +215,7 @@ cc.Class({ ...@@ -215,7 +215,7 @@ cc.Class({
playAudioQuestion(isBtn) { playAudioQuestion(isBtn) {
GameData.audioCount++; GameData.audioCount++;
let url = this.data.questionList[GameData.questionIndex].questionAudio; let url = this.data.questionList[GameData.questionIndex].questionAudio;
url = 'http://127.0.0.1/iamflying.mp3'; // url = 'http://127.0.0.1/iamflying.mp3';
cc.assetManager.loadRemote(url, null, (err, clip) => { cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) { if (err) {
console.log(err) console.log(err)
...@@ -465,7 +465,7 @@ cc.Class({ ...@@ -465,7 +465,7 @@ cc.Class({
playAudio(cb) { playAudio(cb) {
GameData.audioCount++; GameData.audioCount++;
let url = this.data.optionAudio; let url = this.data.optionAudio;
url = 'http://127.0.0.1/iamflying.mp3'; // url = 'http://127.0.0.1/iamflying.mp3';
cc.assetManager.loadRemote(url, null, (err, clip) => { cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) { if (err) {
console.log(err) console.log(err)
......
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