Commit a716cdba authored by huoshizhe's avatar huoshizhe

feat:

parent 37bc2229
......@@ -6,7 +6,7 @@
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// import { getSprNode } from "./util";
import { getSprNode, playAudioByUrl, showBtnAnima, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, getSprNodeByUrl, setSprNodeMaxLen, delayCall, asyncDelay, RandomInt, exchangeNodePos, onHomeworkFinish} from "./util";
import { getSprNode, playAudioByUrl, showBtnAnima, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, getSprNodeByUrl, setSprNodeMaxLen, delayCall, asyncDelay, RandomInt, exchangeNodePos, onHomeworkFinish } from "./util";
cc.Class({
extends: cc.Component,
......@@ -206,9 +206,9 @@ cc.Class({
if (this.data.questionArr) {
const arr = this.data.questionArr;
for (let i=0 ;i<arr.length; i++) {
this._audioResList.push({url: arr[i].audio_url || ''});
this._audioResList.push({url: arr[i].video_url || ''});
for (let i = 0; i < arr.length; i++) {
this._audioResList.push({ url: arr[i].audio_url || '' });
this._audioResList.push({ url: arr[i].video_url || '' });
}
}
......@@ -221,8 +221,8 @@ cc.Class({
this.data.hotZoneItemArr.forEach((item) => {
if (item.skeJsonData) {
this._animaResList.push({ url: item.skeJsonData.url || '' });
this._animaResList.push({ url: item.texJsonData.url || ''});
this._animaResList.push({ url: item.texPngData.url || ''});
this._animaResList.push({ url: item.texJsonData.url || '' });
this._animaResList.push({ url: item.texPngData.url || '' });
}
})
},
......@@ -361,7 +361,7 @@ cc.Class({
cleanStar() {
if (this.bigStarArr && this.bigStarArr.length > 0) {
for (let i=0; i<this.bigStarArr.length; i++) {
for (let i = 0; i < this.bigStarArr.length; i++) {
this.bigStarArr[i].removeFromParent();
}
}
......@@ -421,7 +421,7 @@ cc.Class({
checkGameEnd() {
this.curGroupIndex ++;
this.curGroupIndex++;
this.setCurGroupAndQuestion();
......@@ -462,7 +462,7 @@ cc.Class({
this.checkBtn.opacity = 0;
const arr = this.curOptionArr;
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].light.opacity > 254) {
this.checkBtn.opacity = 255;
return;
......@@ -483,9 +483,9 @@ cc.Class({
showTryAgain() {
const time = 0.3;
cc.tween(this.tryagain)
.to(time, {opacity: 255}, {easing: "cubicOut"})
.to(time, { opacity: 255 }, { easing: "cubicOut" })
.delay(0.3)
.to(time, {opacity: 0}, {easing: "cubicIn"})
.to(time, { opacity: 0 }, { easing: "cubicIn" })
.start();
},
......@@ -689,7 +689,7 @@ cc.Class({
initPicOption() {
// console.log('this.data: ', this.data);
this.optionPicBgArr = [];
for (let i=0; i<4; i++) {
for (let i = 0; i < 4; i++) {
const pic = this.getOnePicOption();
this.canvas.addChild(pic);
......@@ -711,9 +711,9 @@ cc.Class({
let count = 0;
for (let i=0; i<4; i++) {
for (let i = 0; i < 4; i++) {
if (i==2) {
if (i == 2) {
count = 0;
baseY -= disH;
}
......@@ -724,7 +724,7 @@ cc.Class({
pic.y = baseY;
this.optionPicBgBigArr.push(pic);
count ++;
count++;
}
},
......@@ -772,7 +772,7 @@ cc.Class({
picBgParent.on(cc.Node.EventType.TOUCH_START, () => {
if( light.opacity == 0 ) {
if (light.opacity == 0) {
light.opacity = 255;
playAudio(this.selectClip);
} else {
......@@ -805,7 +805,7 @@ cc.Class({
addIconRight(bg) {
const px = bg.width / 2;
const py = -bg.height / 2 ;
const py = -bg.height / 2;
const worldPos = bg.convertToWorldSpaceAR(cc.v2(px, py));
const localPos = this.canvas.convertToNodeSpaceAR(worldPos);
......@@ -826,7 +826,7 @@ cc.Class({
optionAudioBgArr: null,
initAudioOption() {
this.optionAudioBgArr = [];
for (let i=0; i<4; i++) {
for (let i = 0; i < 4; i++) {
const audio = this.getOneAudioOption();
this.canvas.addChild(audio);
......@@ -847,9 +847,9 @@ cc.Class({
const disH = 350 * this._mapScaleMin;
let count = 0;
for (let i=0; i<4; i++) {
for (let i = 0; i < 4; i++) {
if (i==2) {
if (i == 2) {
count = 0;
baseY -= disH;
}
......@@ -861,7 +861,7 @@ cc.Class({
audio.y = baseY;
this.optionAudioBgBigArr.push(audio);
count ++;
count++;
}
},
......@@ -869,7 +869,7 @@ cc.Class({
optionTextBgArr: null,
initTextOption() {
this.optionTextBgArr = [];
for (let i=0; i<4; i++) {
for (let i = 0; i < 4; i++) {
const textOption = this.getOneTextOption();
this.canvas.addChild(textOption);
......@@ -888,7 +888,7 @@ cc.Class({
const disH = 150 * this._mapScaleMin;
this.optionTextBgBigArr = [];
for (let i=0; i<4; i++) {
for (let i = 0; i < 4; i++) {
const textOption = this.getOneTextOption(true);
this.canvas.addChild(textOption);
......@@ -899,7 +899,7 @@ cc.Class({
}
},
getOneAudioOption(isBig=false) {
getOneAudioOption(isBig = false) {
let lightResName = "option_pic_bg_l";
let bgResName = "option_pic_bg";
......@@ -948,7 +948,7 @@ cc.Class({
}
audioBgNode.on(cc.Node.EventType.TOUCH_START, () => {
if( light.opacity == 0 ) {
if (light.opacity == 0) {
light.opacity = 255;
playAudio(this.selectClip);
......@@ -973,7 +973,7 @@ cc.Class({
return audioBgNode;
},
getOneTextOption(isBig=false) {
getOneTextOption(isBig = false) {
let lightResName = "option_text_bg_l";
let bgResName = "option_text_bg";
......@@ -1012,7 +1012,7 @@ cc.Class({
textBgParent.label = label;
const color = new cc.Color();
cc.Color.fromHEX(color, '#023659' );
cc.Color.fromHEX(color, '#023659');
labelNode.color = color;
......@@ -1034,7 +1034,7 @@ cc.Class({
textBgParent.on(cc.Node.EventType.TOUCH_START, () => {
if( light.opacity == 0 ) {
if (light.opacity == 0) {
light.opacity = 255;
playAudio(this.selectClip);
} else {
......@@ -1076,7 +1076,7 @@ cc.Class({
setCurQuestion() {
switch(this.curQuestionData.questionType) {
switch (this.curQuestionData.questionType) {
case "pic":
this.setQuestionPic();
break;
......@@ -1194,7 +1194,7 @@ cc.Class({
const isBig = this.curQuestionData.questionType == 'audio';
switch(this.curQuestionData.answerType) {
switch (this.curQuestionData.answerType) {
case "pic":
this.setOptionPic(arr, isBig);
break;
......@@ -1211,7 +1211,7 @@ cc.Class({
curOptionArr: null,
setOptionPic(arr, isBig=false) {
setOptionPic(arr, isBig = false) {
let opItemArr = this.optionPicBgArr;
if (isBig) {
......@@ -1220,7 +1220,7 @@ cc.Class({
this.curOptionArr = [];
const disW = 158 * this._mapScaleMin;
const baseX = -(arr.length - 1) * disW;
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
opItemArr[i].active = true;
if (!isBig) {
......@@ -1265,7 +1265,7 @@ cc.Class({
},
setOptionAudio(arr, isBig=false) {
setOptionAudio(arr, isBig = false) {
let opItemArr = this.optionAudioBgArr;
if (isBig) {
......@@ -1275,10 +1275,10 @@ cc.Class({
this.curOptionArr = [];
const disW = 158 * this._mapScaleMin;
const baseX = -(arr.length - 1) * disW;
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
opItemArr[i].active = true;
if(!isBig) {
if (!isBig) {
opItemArr[i].x = baseX + i * disW * 2;
}
......@@ -1298,7 +1298,7 @@ cc.Class({
setOptionAudioBig(arr) {
this.curOptionArr = [];
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
this.optionAudioBgArr[i].active = true;
......@@ -1317,7 +1317,7 @@ cc.Class({
},
setOptionText(options, isBig=false) {
setOptionText(options, isBig = false) {
console.log(' in setOptionText, isBig: ', isBig);
......@@ -1329,15 +1329,15 @@ cc.Class({
this.curOptionArr = [];
const disW = 315 * this._mapScaleMin;
const disH = 120 * this._mapScaleMin;
const baseX = - disW ;
const baseX = - disW;
let baseY = -235 * this._mapScaleMin;
if (options.length > 2) {
baseY = -170 * this._mapScaleMin;
}
let count = 0;
for (let i=0; i<options.length; i++) {
for (let i = 0; i < options.length; i++) {
if ( i == 2 ) {
if (i == 2) {
baseY -= disH;
count = 0;
}
......@@ -1424,7 +1424,7 @@ cc.Class({
// })
} else {
if ( arr[index].light.opacity > 254 && arr[index].audioClip ) {
if (arr[index].light.opacity > 254 && arr[index].audioClip) {
playAudio(arr[index].audioClip, () => {
this.playAnswerAudio(index + 1);
})
......@@ -1438,7 +1438,7 @@ cc.Class({
checkItemWrong() {
const arr = this.curOptionArr;
console.log('arr: ', arr);
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
const itemBg = arr[i];
if (itemBg.light.opacity >= 254) {
this.shakeArr.push(itemBg);
......@@ -1453,17 +1453,17 @@ cc.Class({
checkItemRightCount() {
let rightTotalCount = 0;
const answerArr = this.curQuestionData.answerArr;
for (let i=0; i<answerArr.length; i++) {
for (let i = 0; i < answerArr.length; i++) {
if (answerArr[i].answerRight == '1') {
rightTotalCount ++;
rightTotalCount++;
}
}
let curRightCount = 0;
const curOptionArr = this.curOptionArr;
for (let i=0; i<curOptionArr.length; i++) {
for (let i = 0; i < curOptionArr.length; i++) {
if (curOptionArr[i].light.opacity > 254) {
curRightCount ++;
curRightCount++;
}
}
......@@ -1477,7 +1477,7 @@ cc.Class({
}
const arr = this.shakeArr;
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
this.rotateShake(arr[i], rate);
if (arr[i].stopAnim) {
arr[i].stopAnim();
......@@ -1489,7 +1489,7 @@ cc.Class({
hideLight() {
const arr = this.curOptionArr;
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
arr[i].light.opacity = 0;
}
this.checkBtn.opacity = 0;
......@@ -1499,20 +1499,20 @@ cc.Class({
const time = 0.9;
cc.tween(item)
.to(time / 6 / 2, {angle: -20 * rate}, {easing: 'sineInOut'})
.to(time / 6, {angle: 12 * rate}, {easing: 'sineInOut'})
.to(time / 6, {angle: -7 * rate}, {easing: 'sineInOut'})
.to(time / 6, {angle: 4 * rate}, {easing: 'sineInOut'})
.to(time / 6, {angle: -2 * rate}, {easing: 'sineInOut'})
.to(time / 6, {angle: 1 * rate}, {easing: 'sineInOut'})
.to(time / 6, {angle: 0 * rate}, {easing: 'sineInOut'})
.to(time / 6 / 2, { angle: -20 * rate }, { easing: 'sineInOut' })
.to(time / 6, { angle: 12 * rate }, { easing: 'sineInOut' })
.to(time / 6, { angle: -7 * rate }, { easing: 'sineInOut' })
.to(time / 6, { angle: 4 * rate }, { easing: 'sineInOut' })
.to(time / 6, { angle: -2 * rate }, { easing: 'sineInOut' })
.to(time / 6, { angle: 1 * rate }, { easing: 'sineInOut' })
.to(time / 6, { angle: 0 * rate }, { easing: 'sineInOut' })
.start();
},
showAllRight() {
const curOptionArr = this.curOptionArr;
for (let i=0; i<curOptionArr.length; i++) {
for (let i = 0; i < curOptionArr.length; i++) {
if (curOptionArr[i].light.opacity > 254) {
this.addIconRight(curOptionArr[i]);
}
......@@ -1522,7 +1522,7 @@ cc.Class({
changeNextQuestion() {
console.log(' in changeNextQuestion')
this.curQuestionIndex ++ ;
this.curQuestionIndex++;
this.setCurQuestionData();
if (!this.curQuestionData) {
......@@ -1573,13 +1573,13 @@ cc.Class({
hideCurOptionAnim(cb) {
const arr = this.curOptionArr;
const time = 0.5;
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].iconRight) {
arr[i].iconRight.removeFromParent();
arr[i].iconRight = null;
}
cc.tween(arr[i])
.to(time, {opacity: 0}, {easing: "cubicOut"})
.to(time, { opacity: 0 }, { easing: "cubicOut" })
.call(() => {
arr[i].active = false;
})
......@@ -1590,13 +1590,13 @@ cc.Class({
})
},
showCurOptionAnim(cb=null) {
showCurOptionAnim(cb = null) {
const arr = this.curOptionArr;
const time = 0.5;
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
arr[i].opacity = 0;
cc.tween(arr[i])
.to(time, {opacity: 255}, {easing: "cubicIn"})
.to(time, { opacity: 255 }, { easing: "cubicIn" })
.start();
}
......@@ -1611,7 +1611,7 @@ cc.Class({
hideCurQuestion(cb) {
const time = 0.5;
cc.tween(this.curQuesBg)
.to(time, {opacity: 0}, {easing: "cubicOut"})
.to(time, { opacity: 0 }, { easing: "cubicOut" })
.call(() => {
this.curQuesBg.active = false;
cb();
......@@ -1626,7 +1626,7 @@ cc.Class({
const time = 0.5;
cc.tween(this.curQuesBg)
.to(time, {opacity: 255}, {easing: "cubicIn"})
.to(time, { opacity: 255 }, { easing: "cubicIn" })
.start();
},
......@@ -1645,7 +1645,12 @@ cc.Class({
showTrebleFirework(camera, cc.find('RibbonNodeBase').children);
cc.tween(this.node)
.delay(3)
.call(() => {
onHomeworkFinish();
})
.start();
},
showRestart() {
......@@ -1667,14 +1672,14 @@ cc.Class({
btn.scale = 0;
cc.tween(btn)
.delay(1)
.to(time, {scale: btn.baseS}, {easing: "elasticOut"})
.to(time, { scale: btn.baseS }, { easing: "elasticOut" })
.start();
},
async showOneFirework(pos, parentNode, nodeList, w, h, n, timeRate=1) {
async showOneFirework(pos, parentNode, nodeList, w, h, n, timeRate = 1) {
for (let i = 0; i < 3; i++) {
this.showFirework(pos, parentNode, nodeList, w, h, n, timeRate);
......@@ -1682,7 +1687,7 @@ cc.Class({
}
},
showFirework(pos, parentNode, nodeList, width = 200, height = 500, number = 30, timeRate=1) {
showFirework(pos, parentNode, nodeList, width = 200, height = 500, number = 30, timeRate = 1) {
const subTime = 1;
for (let i = 0; i < number; i++) {
const quad = this.createQuads(pos, parentNode, nodeList);
......@@ -1702,7 +1707,7 @@ cc.Class({
cc.tween(quad)
.delay(1 * timeRate)
.to((0.5 + subTime * Math.random()) * timeRate , { opacity: 0 })
.to((0.5 + subTime * Math.random()) * timeRate, { opacity: 0 })
.start();
}
},
......@@ -1788,7 +1793,7 @@ cc.Class({
const label = labelNode.addComponent(cc.RichText);
const size = 42
label.font = cc.find('Canvas/res/font/aharoni').getComponent(cc.Label).font;
label.string = `<outline color=#a83c13 width=2><size=${size}><color=#ffffff>${this.data.title || " " }</color></size></outline>`
label.string = `<outline color=#a83c13 width=2><size=${size}><color=#ffffff>${this.data.title || " "}</color></size></outline>`
// label.string = `<size=${size}><color=#751e00>${this.curGroup.title }</color></size>`
label.lineHeight = size;
label.horizontalAlign = cc.macro.TextAlignment.LEFT
......@@ -1836,7 +1841,7 @@ cc.Class({
return;
}
cc.loader.load({url: this.data.bgItem.url}, (err, img) => {
cc.loader.load({ url: this.data.bgItem.url }, (err, img) => {
// this.addMask(this.hotZoneBg);
......@@ -1854,7 +1859,7 @@ cc.Class({
sprNode.width = this.hotZoneBg.width;
sprNode.height = this.hotZoneBg.height;
sprNode.parent = this.hotZoneBg;
window['bg'] =sprNode
window['bg'] = sprNode
const sx = this.canvas.width / this.hotZoneBg.width;
......@@ -1912,13 +1917,13 @@ cc.Class({
ctx.strokeColor = cc.Color.BLACK;
ctx.fillColor = cc.Color.WHITE.setA(100);
const scale = rate / this.hotZoneBg.scaleY ;
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;
const {x, y, width, height} = rectNode;
const { x, y, width, height } = rectNode;
// rectNode.anchorX = rectNode.anchorY = 0;
if (this.data.bgItem.isShowDebugLine) {
......@@ -1947,7 +1952,7 @@ cc.Class({
const realRate = this.hotZoneBg.width / this.data.bgItem.rect.width;
rectNode.targetPx = -this.hotZoneBg.width / 2 + ( data.dragDot.x - this.data.bgItem.rect.x ) * realRate;
rectNode.targetPx = -this.hotZoneBg.width / 2 + (data.dragDot.x - this.data.bgItem.rect.x) * realRate;
rectNode.targetPy = this.hotZoneBg.height / 2 - (data.dragDot.y - this.data.bgItem.rect.y) * realRate;
......@@ -2002,13 +2007,13 @@ cc.Class({
ctx.strokeColor = cc.Color.BLACK;
ctx.fillColor = cc.Color.WHITE.setA(100);
const scale = rate / this.hotZoneBg.scaleY ;
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;
const {x, y, width, height} = rectNode;
const { x, y, width, height } = rectNode;
rectNode.anchorX = rectNode.anchorY = 0;
if (this.data.bgItem.isShowDebugLine) {
......@@ -2066,24 +2071,24 @@ cc.Class({
const tweenArr = [];
for (let i = 0; i < opArr.length; i++ ) {
for (let i = 0; i < opArr.length; i++) {
const opData = opArr[i];
console.log('opArr[0]', opArr[i])
if (opData[0] == 'fontColor') {
const color = new cc.Color();
cc.Color.fromHEX(color, opData[1] );
cc.Color.fromHEX(color, opData[1]);
labelNode.color = color;
} else if (opData[0] == 'opacity') {
// console.log('opData: ', opData)
labelNode.opacity = Number( opData[1] / 100 * 255 ) + 0.1;
labelNode.opacity = Number(opData[1] / 100 * 255) + 0.1;
// console.log(labelNode.opacity);
tweenArr.push({item: labelNode , option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[0]},)
tweenArr.push({ item: labelNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[0] },)
} else {
label[opData[0]] = opData[1];
tweenArr.push({item: label, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[0]})
tweenArr.push({ item: label, option: `{"${opData[0]}" : ${opData[2]}}`, optionName: opData[0] })
}
}
......@@ -2141,7 +2146,7 @@ cc.Class({
const picNode = new cc.Node();
rectNode.addChild(picNode);
cc.loader.load({url: actionData.pic_url}, (err, img) => {
cc.loader.load({ url: actionData.pic_url }, (err, img) => {
const spr = picNode.addComponent(cc.Sprite);
spr.spriteFrame = new cc.SpriteFrame(img)
......@@ -2155,15 +2160,15 @@ cc.Class({
const opArr = actionData.changeOption
const tweenArr = [];
for (let i = 0; i < opArr.length; i++ ) {
for (let i = 0; i < opArr.length; i++) {
const opData = opArr[i];
console.log('opData: ~~~ ', opData);
if (opData[0] == 'opacity') {
picNode.opacity = Number( opData[1] / 100 * 255 ) + 0.1;
picNode.opacity = Number(opData[1] / 100 * 255) + 0.1;
console.log(picNode.opacity);
tweenArr.push({item: picNode , option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[0]},)
tweenArr.push({ item: picNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[0] },)
} else {
// picNode[opData[0]] = Number(opData[1]);
......@@ -2191,12 +2196,12 @@ cc.Class({
}
rectNode.isClicked = true;
for (let i=0; i<tweenArr.length; i++) {
for (let i = 0; i < tweenArr.length; i++) {
const tweenData = tweenArr[i];
if (tweenData.optionName == 'opacity') {
cc.tween(tweenData.item)
.to(actionData.changeTime, JSON.parse(tweenData.option) )
.to(actionData.changeTime, JSON.parse(tweenData.option))
.start();
}
}
......@@ -2233,9 +2238,9 @@ cc.Class({
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
cc.loader.load(image, (error, texture) => {
cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({url: ske, type: 'txt'}, (error, dragonBonesJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson;
......@@ -2311,15 +2316,15 @@ cc.Class({
const opArr = actionData.changeOption
const tweenArr = [];
for (let i = 0; i < opArr.length; i++ ) {
for (let i = 0; i < opArr.length; i++) {
const opData = opArr[i];
console.log('opData: ~~~ ', opData);
if (opData[0] == 'opacity') {
animaNode.opacity = Number( opData[1] / 100 * 255 ) + 0.1;
animaNode.opacity = Number(opData[1] / 100 * 255) + 0.1;
console.log(animaNode.opacity);
tweenArr.push({item: animaNode , option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[2] == null ? '' : opData[0]},)
tweenArr.push({ item: animaNode, option: `{"${opData[0]}" : ${opData[2] / 100 * 255}}`, optionName: opData[2] == null ? '' : opData[0] },)
} else {
// animaNode[opData[0]] = Number(opData[1]);
......@@ -2347,7 +2352,7 @@ cc.Class({
}
rectNode.isClicked = true;
for (let j=0; j<tweenArr.length; j++) {
for (let j = 0; j < tweenArr.length; j++) {
const tweenData = tweenArr[j];
console.log('tweenData: ', tweenData);
......@@ -2437,9 +2442,9 @@ cc.Class({
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
cc.loader.load(image, (error, texture) => {
cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({url: ske, type: 'txt'}, (error, dragonBonesJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson;
......@@ -2511,11 +2516,11 @@ cc.Class({
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
const picNode = new cc.Node();
picNode.name= 'pic' + data.index;
picNode.name = 'pic' + data.index;
picNode.data = data;
this.hotZoneBg.addChild(picNode);
cc.loader.load({url: data.pic_url}, (err, img) => {
cc.loader.load({ url: data.pic_url }, (err, img) => {
const spr = picNode.addComponent(cc.Sprite);
spr.spriteFrame = new cc.SpriteFrame(img)
......@@ -2548,7 +2553,7 @@ cc.Class({
picNode.baseY = picNode.y;
const realRate = this.hotZoneBg.width / this.data.bgItem.rect.width;
picNode.targetPx = -this.hotZoneBg.width / 2 + ( data.dragDot.x - this.data.bgItem.rect.x ) * realRate;
picNode.targetPx = -this.hotZoneBg.width / 2 + (data.dragDot.x - this.data.bgItem.rect.x) * realRate;
picNode.targetPy = this.hotZoneBg.height / 2 - (data.dragDot.y - this.data.bgItem.rect.y) * realRate;
......@@ -2580,11 +2585,11 @@ cc.Class({
const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
const picNode = new cc.Node();
picNode.name= 'pic' + data.index;
picNode.name = 'pic' + data.index;
picNode.data = data;
this.hotZoneBg.addChild(picNode);
cc.loader.load({url: data.pic_url}, (err, img) => {
cc.loader.load({ url: data.pic_url }, (err, img) => {
const spr = picNode.addComponent(cc.Sprite);
spr.spriteFrame = new cc.SpriteFrame(img)
......@@ -2748,7 +2753,7 @@ cc.Class({
removeHtmlCanvasListener(type) {
const canvasHtml = document.querySelector('canvas');
canvasHtml.addEventListener(type, (e) => {})
canvasHtml.addEventListener(type, (e) => { })
},
removeHtmlTouchEnd() {
const canvasHtml = document.querySelector('canvas');
......@@ -2807,7 +2812,7 @@ cc.Class({
cc.audioEngine.playEffect(this.wrongClip, false, 0.8);
cc.tween(this._curShowItem)
.to(0.5, {x: this._curShowItem.baseX, y: this._curShowItem.baseY}, {easing: "elasticOut"})
.to(0.5, { x: this._curShowItem.baseX, y: this._curShowItem.baseY }, { easing: "elasticOut" })
.start();
},
......
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