Commit 81ff8b16 authored by limingzhe's avatar limingzhe

fix: debug

parent 519a274e
......@@ -202,6 +202,7 @@ cc.Class({
console.log('[answer] thinking and playing');
// check every second
const id = setInterval(() => {
console.log("aaaaaa");
if (!this._lastFingerPosition.dirty) {
return;
}
......@@ -295,9 +296,21 @@ cc.Class({
if (context.questionPlayTimes >= context.maxQuestionTryTimes) {
const an = context.questions[context.questionIndex].node;
an.active = true;
const dragonDisplay = an.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
console.log('show animation', an.active);
if (an.isSpine) {
const skeleton = an.getComponent(sp.Skeleton);
skeleton.setToSetupPose();
setTimeout(() => {
skeleton.setAnimation(0, 'normal', true);
}, 1);
} else {
const dragonDisplay = an.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
console.log('show animation', an.active);
}
}
playAudioByUrl(wrongEffect, () => {
......@@ -461,9 +474,12 @@ cc.Class({
if (t.isSpine) {
const skeleton = t.getComponent(sp.Skeleton);
skeleton.pause();
skeleton.loop = false;
skeleton.animation = 'enlarge';
skeleton.setToSetupPose();
setTimeout(() => {
skeleton.setAnimation(0, 'enlarge', false);
}, 1);
// skeleton.animation = skeleton.animationNames[0];
} else {
......@@ -504,9 +520,16 @@ cc.Class({
if (t.isSpine) {
const skeleton = t.getComponent(sp.Skeleton);
skeleton.pause();
skeleton.loop = true;
skeleton.animation = 'normal'
console.log('skeleton: ', skeleton);
skeleton.setToSetupPose();
setTimeout(() => {
skeleton.setAnimation(0, 'normal', true);
}, 1);
console.log('skeleton 22: ', skeleton);
// skeleton.animation = skeleton.animationNames[0];
} else {
......@@ -535,6 +558,10 @@ cc.Class({
},
// 生命周期 start
start() {
let getData = this.getData.bind(this);
......@@ -584,6 +611,7 @@ cc.Class({
},
checkInRegion(r) {
console.log('r~~~: ', r);
if (!this._lastFingerPosition && !this._lastFingerPosition.pos) {
return null;
}
......@@ -611,7 +639,7 @@ cc.Class({
},
getDefaultData() {
return {"begin_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","begin_sep_time":1,"guide_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","playing_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","right_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","wrong_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","wrong_audio1":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","wrong_audio2":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","end_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/84ec6edc20bceaaa9dbe824092b6860d.png","rect":{"x":549.55,"y":0,"width":449.9,"height":582}},"hotZoneItemArr":[{"id":"1659333645573","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/5a1a2670845bfe76662e86d9a3a69f81.mp3","itemType":"rect","fontScale":1.21015625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":1.21015625,"dragDot":{"x":774.5,"y":289.55016883743366},"gIdx":"1","labelText":"1","posX":887.5,"posY":165.5,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/d1f859d3fba84bd03565e543c986fb28.json","name":"6_4_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/70f96e1cc7f013e27ed1952c503fb750.json","name":"6_4_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/b06f9b90018a6eb0175a01e355b9ced6.png","name":"6_4_tex.png"},"animType":"dragonBone","rect":{"x":36.08,"y":49.19,"width":153.95,"height":150.19}},{"id":"1659334098930","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/16eb06a6beb9e4fa77c9b5d2d643ab29.mp3","itemType":"rect","fontScale":1.21015625,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":1.21015625,"dragDot":{"x":774.5,"y":289.55016883743366},"gIdx":"0","labelText":"1","posX":1212.5,"posY":643.5,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/bdbadb06e0c1157e727cecd28f28d10e.json","name":"spineboy-pro.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/e0945b8265ea3b8053afb814c6b849d3.atlas","name":"spineboy-pro.atlas"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/517553f50224915148f9efc5b7556798.png","name":"spineboy-pro.png"},"animType":"spine","rect":{"x":282.03,"y":408.15,"width":150.19,"height":150.19}}]}
return {"begin_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","begin_sep_time":1,"guide_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","playing_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","right_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","wrong_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","wrong_audio1":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","wrong_audio2":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","end_audio":"http://staging-teach.cdn.ireadabc.com/3d307a02663e1cd667b7c951340ec98b.mp3","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/84ec6edc20bceaaa9dbe824092b6860d.png","rect":{"x":736.95,"y":0,"width":599.09,"height":775}},"hotZoneItemArr":[{"id":"1659333645573","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/5a1a2670845bfe76662e86d9a3a69f81.mp3","itemType":"rect","fontScale":1.61953125,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":1.61953125,"dragDot":{"x":1036.5,"y":387.5},"gIdx":"1","labelText":"1","posX":887.5,"posY":165.5,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/133a1f60719ed26247e35dc022d82862.json","name":"spineboy-pro.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/e0945b8265ea3b8053afb814c6b849d3.atlas","name":"spineboy-pro.atlas"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/517553f50224915148f9efc5b7556798.png","name":"spineboy-pro.png"},"animType":"spine","rect":{"x":48.05,"y":65.5,"width":205,"height":200}},{"id":"1659334098930","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/16eb06a6beb9e4fa77c9b5d2d643ab29.mp3","itemType":"rect","fontScale":1.61953125,"imgScale":1,"imgSizeW":0,"imgSizeH":0,"mapScale":1.61953125,"dragDot":{"x":1036.5,"y":387.5},"gIdx":"0","labelText":"1","posX":1212.5,"posY":643.5,"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/679fed26daa464819d553de6331b3552.json","name":"alien-pro.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/65d8214c6b5c5d0496e17adb0408276a.atlas","name":"alien-pro.atlas"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/a319b372899239325b90bb4ec07b4970.png","name":"alien-pro.png"},"animType":"spine","rect":{"x":375.56,"y":543.5,"width":200,"height":200}}]}
// return defaultData;
},
......@@ -829,9 +857,8 @@ cc.Class({
n.height = height;
n.active = true;
// db.playAnimation('null', 0);
// skeleton.loop = true;
// skeleton.animation = skeleton.animationNames[0]
// skeleton.setToSetupPose();
// skeleton.setAnimation(0, 'enlarge', true);
this._allAnimationNodes.push(n);
finishDbCount++;
......@@ -875,7 +902,7 @@ cc.Class({
});
}
if (block.gIdx == '0') {
const rectInfo = {
......@@ -889,6 +916,8 @@ cc.Class({
}
};
this._figurePointRectArray.push(rectInfo);
// this.addRectNodeListener(block);
if (block.labelText) {
const k = +block.labelText * 1000;
......@@ -967,6 +996,42 @@ cc.Class({
// this.initIcon();
// },
addRectNodeListener(data) {
const bg = cc.find(`Canvas/frame-border/ground/bg`);
const rate = (bg.scale * bg.width) / this.data.bgItem.rect.width;
const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index;
bg.addChild(rectNode);
const ctx = rectNode.addComponent(cc.Graphics);
// 红色矩形
ctx.lineWidth = 4;
ctx.strokeColor = cc.Color.BLACK;
ctx.fillColor = cc.Color.WHITE.setA(100);
const scale = rate / bg.scaleY;
rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale;
rectNode.x = -bg.width / 2 + data.rect.x * scale;
rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
rectNode.anchorX = rectNode.anchorY = 0;
// if (pageData.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height);
// }
ctx.stroke();
ctx.fill();
},
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
......
......@@ -206,6 +206,8 @@ cc.Class({
console.log('[answer] thinking and playing'); // check every second
var id = setInterval(function () {
console.log("aaaaaa");
if (!_this._lastFingerPosition.dirty) {
return;
}
......@@ -308,9 +310,18 @@ cc.Class({
if (context.questionPlayTimes >= context.maxQuestionTryTimes) {
var an = context.questions[context.questionIndex].node;
an.active = true;
var dragonDisplay = an.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
console.log('show animation', an.active);
if (an.isSpine) {
var skeleton = an.getComponent(sp.Skeleton);
skeleton.setToSetupPose();
setTimeout(function () {
skeleton.setAnimation(0, 'normal', true);
}, 1);
} else {
var dragonDisplay = an.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
console.log('show animation', an.active);
}
}
(0, _util.playAudioByUrl)(wrongEffect, function () {
......@@ -470,9 +481,10 @@ cc.Class({
actions: function actions() {
if (t.isSpine) {
var skeleton = t.getComponent(sp.Skeleton);
skeleton.pause();
skeleton.loop = false;
skeleton.animation = 'enlarge'; // skeleton.animation = skeleton.animationNames[0];
skeleton.setToSetupPose();
setTimeout(function () {
skeleton.setAnimation(0, 'enlarge', false);
}, 1); // skeleton.animation = skeleton.animationNames[0];
} else {
var dragonDisplay = t.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('enlarge', 1);
......@@ -510,11 +522,16 @@ cc.Class({
var _t = _this._allAnimationNodes[_i];
if (_t.isSpine) {
var skeleton = _t.getComponent(sp.Skeleton);
skeleton.pause();
skeleton.loop = true;
skeleton.animation = 'normal'; // skeleton.animation = skeleton.animationNames[0];
(function () {
var skeleton = _t.getComponent(sp.Skeleton);
console.log('skeleton: ', skeleton);
skeleton.setToSetupPose();
setTimeout(function () {
skeleton.setAnimation(0, 'normal', true);
}, 1);
console.log('skeleton 22: ', skeleton); // skeleton.animation = skeleton.animationNames[0];
})();
} else {
var dragonDisplay = _t.getComponent(dragonBones.ArmatureDisplay);
......@@ -593,6 +610,8 @@ cc.Class({
this.isDebug = false;
},
checkInRegion: function checkInRegion(r) {
console.log('r~~~: ', r);
if (!this._lastFingerPosition && !this._lastFingerPosition.pos) {
return null;
}
......@@ -638,10 +657,10 @@ cc.Class({
"bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/84ec6edc20bceaaa9dbe824092b6860d.png",
"rect": {
"x": 549.55,
"x": 736.95,
"y": 0,
"width": 449.9,
"height": 582
"width": 599.09,
"height": 775
}
},
"hotZoneItemArr": [{
......@@ -649,74 +668,74 @@ cc.Class({
"index": 0,
"audio_url": "http://staging-teach.cdn.ireadabc.com/5a1a2670845bfe76662e86d9a3a69f81.mp3",
"itemType": "rect",
"fontScale": 1.21015625,
"fontScale": 1.61953125,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 1.21015625,
"mapScale": 1.61953125,
"dragDot": {
"x": 774.5,
"y": 289.55016883743366
"x": 1036.5,
"y": 387.5
},
"gIdx": "1",
"labelText": "1",
"posX": 887.5,
"posY": 165.5,
"skeJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/d1f859d3fba84bd03565e543c986fb28.json",
"name": "6_4_ske.json"
"url": "http://staging-teach.cdn.ireadabc.com/133a1f60719ed26247e35dc022d82862.json",
"name": "spineboy-pro.json"
},
"texJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/70f96e1cc7f013e27ed1952c503fb750.json",
"name": "6_4_tex.json"
"url": "http://staging-teach.cdn.ireadabc.com/e0945b8265ea3b8053afb814c6b849d3.atlas",
"name": "spineboy-pro.atlas"
},
"texPngData": {
"url": "http://staging-teach.cdn.ireadabc.com/b06f9b90018a6eb0175a01e355b9ced6.png",
"name": "6_4_tex.png"
"url": "http://staging-teach.cdn.ireadabc.com/517553f50224915148f9efc5b7556798.png",
"name": "spineboy-pro.png"
},
"animType": "dragonBone",
"animType": "spine",
"rect": {
"x": 36.08,
"y": 49.19,
"width": 153.95,
"height": 150.19
"x": 48.05,
"y": 65.5,
"width": 205,
"height": 200
}
}, {
"id": "1659334098930",
"index": 1,
"audio_url": "http://staging-teach.cdn.ireadabc.com/16eb06a6beb9e4fa77c9b5d2d643ab29.mp3",
"itemType": "rect",
"fontScale": 1.21015625,
"fontScale": 1.61953125,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 1.21015625,
"mapScale": 1.61953125,
"dragDot": {
"x": 774.5,
"y": 289.55016883743366
"x": 1036.5,
"y": 387.5
},
"gIdx": "0",
"labelText": "1",
"posX": 1212.5,
"posY": 643.5,
"skeJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/bdbadb06e0c1157e727cecd28f28d10e.json",
"name": "spineboy-pro.json"
"url": "http://staging-teach.cdn.ireadabc.com/679fed26daa464819d553de6331b3552.json",
"name": "alien-pro.json"
},
"texJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/e0945b8265ea3b8053afb814c6b849d3.atlas",
"name": "spineboy-pro.atlas"
"url": "http://staging-teach.cdn.ireadabc.com/65d8214c6b5c5d0496e17adb0408276a.atlas",
"name": "alien-pro.atlas"
},
"texPngData": {
"url": "http://staging-teach.cdn.ireadabc.com/517553f50224915148f9efc5b7556798.png",
"name": "spineboy-pro.png"
"url": "http://staging-teach.cdn.ireadabc.com/a319b372899239325b90bb4ec07b4970.png",
"name": "alien-pro.png"
},
"animType": "spine",
"rect": {
"x": 282.03,
"y": 408.15,
"width": 150.19,
"height": 150.19
"x": 375.56,
"y": 543.5,
"width": 200,
"height": 200
}
}]
}; // return defaultData;
......@@ -985,8 +1004,9 @@ cc.Class({
n.width = width;
n.height = height;
n.active = true; // db.playAnimation('null', 0);
// skeleton.loop = true;
// skeleton.animation = skeleton.animationNames[0]
// skeleton.setToSetupPose();
skeleton.setAnimation(0, 'enlarge', true);
_this4._allAnimationNodes.push(n);
......@@ -1048,7 +1068,8 @@ cc.Class({
}
};
_this4._figurePointRectArray.push(rectInfo);
_this4._figurePointRectArray.push(rectInfo); // this.addRectNodeListener(block);
if (_block.labelText) {
var k = +_block.labelText * 1000;
......@@ -1116,6 +1137,29 @@ cc.Class({
// // this.initBtn();
// this.initIcon();
// },
addRectNodeListener: function addRectNodeListener(data) {
var bg = cc.find("Canvas/frame-border/ground/bg");
var rate = bg.scale * bg.width / this.data.bgItem.rect.width;
var rectNode = new cc.Node();
rectNode.name = 'rect' + data.index;
bg.addChild(rectNode);
var ctx = rectNode.addComponent(cc.Graphics); // 红色矩形
ctx.lineWidth = 4;
ctx.strokeColor = cc.Color.BLACK;
ctx.fillColor = cc.Color.WHITE.setA(100);
var scale = rate / bg.scaleY;
rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale;
rectNode.x = -bg.width / 2 + data.rect.x * scale;
rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
rectNode.anchorX = rectNode.anchorY = 0; // if (pageData.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height); // }
ctx.stroke();
ctx.fill();
},
initBg: function initBg() {
var bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{
"nodeFoldStates": [
"37BUaKzO1GZatP7LpgbPNB"
"37BUaKzO1GZatP7LpgbPNB",
"a5esZu+45LA5mBpvttspPD",
"4ap0eXsutH0p6T23R6gLW2",
"4cweWAxLhJZ6Y+paziXBfG",
"15R6Qnt3BGO7etkSPd83yJ",
"8c7k8ep/ZFNpO263+1QHz9",
"0aAzbH6R1E+6AmGRrkKa5O",
"9bLfcYeeNKrr524vzWchiM",
"53LUHHG2pEr79fyrvazXJs",
"b823DIVC9L+Ihc3T9Bt7m3"
]
}
{"version":"1.0.8","stats":{"/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/__qc_index__.js":"2022-08-01T06:30:44.713Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/defaultData.js":"2022-08-01T06:30:44.689Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/scene/OP15.js":"2022-08-01T06:30:44.691Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/state.js":"2022-08-01T06:30:44.688Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/util.js":"2022-08-01T06:30:44.689Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/xstate.js":"2022-08-01T06:30:44.690Z"}}
{"version":"1.0.8","stats":{"/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/__qc_index__.js":"2022-08-02T07:11:42.746Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/util.js":"2022-08-02T07:11:42.719Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/state.js":"2022-08-02T07:11:42.717Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/defaultData.js":"2022-08-02T07:11:42.722Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/scene/OP15.js":"2022-08-02T07:11:42.726Z","/Users/lmz/Documents/workspace/pro_hw/OP15/temp/quick-scripts/src/assets/OP15/script/xstate.js":"2022-08-02T07:11:42.724Z"}}
This diff is collapsed.
(function () {
var scripts = [{"deps":{"./assets/OP15/script/state":3,"./assets/OP15/script/xstate":5,"./assets/OP15/script/defaultData":1,"./assets/OP15/scene/OP15":2,"./assets/OP15/script/util":4},"path":"preview-scripts/__qc_index__.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/defaultData.js"},{"deps":{"../script/defaultData":1,"../script/xstate":5,"../script/util":4},"path":"preview-scripts/assets/OP15/scene/OP15.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/state.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/util.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/xstate.js"}];
var scripts = [{"deps":{"./assets/OP15/script/util":1,"./assets/OP15/script/state":2,"./assets/OP15/script/defaultData":3,"./assets/OP15/script/xstate":5,"./assets/OP15/scene/OP15":4},"path":"preview-scripts/__qc_index__.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/util.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/state.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/defaultData.js"},{"deps":{"../script/util":1,"../script/defaultData":3,"../script/xstate":5},"path":"preview-scripts/assets/OP15/scene/OP15.js"},{"deps":{},"path":"preview-scripts/assets/OP15/script/xstate.js"}];
var entries = ["preview-scripts/__qc_index__.js"];
var bundleScript = 'preview-scripts/__qc_bundle__.js';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -206,6 +206,8 @@ cc.Class({
console.log('[answer] thinking and playing'); // check every second
var id = setInterval(function () {
console.log("aaaaaa");
if (!_this._lastFingerPosition.dirty) {
return;
}
......@@ -308,9 +310,18 @@ cc.Class({
if (context.questionPlayTimes >= context.maxQuestionTryTimes) {
var an = context.questions[context.questionIndex].node;
an.active = true;
var dragonDisplay = an.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
console.log('show animation', an.active);
if (an.isSpine) {
var skeleton = an.getComponent(sp.Skeleton);
skeleton.setToSetupPose();
setTimeout(function () {
skeleton.setAnimation(0, 'normal', true);
}, 1);
} else {
var dragonDisplay = an.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
console.log('show animation', an.active);
}
}
(0, _util.playAudioByUrl)(wrongEffect, function () {
......@@ -470,9 +481,10 @@ cc.Class({
actions: function actions() {
if (t.isSpine) {
var skeleton = t.getComponent(sp.Skeleton);
skeleton.pause();
skeleton.loop = false;
skeleton.animation = 'enlarge'; // skeleton.animation = skeleton.animationNames[0];
skeleton.setToSetupPose();
setTimeout(function () {
skeleton.setAnimation(0, 'enlarge', false);
}, 1); // skeleton.animation = skeleton.animationNames[0];
} else {
var dragonDisplay = t.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('enlarge', 1);
......@@ -510,11 +522,16 @@ cc.Class({
var _t = _this._allAnimationNodes[_i];
if (_t.isSpine) {
var skeleton = _t.getComponent(sp.Skeleton);
skeleton.pause();
skeleton.loop = true;
skeleton.animation = 'normal'; // skeleton.animation = skeleton.animationNames[0];
(function () {
var skeleton = _t.getComponent(sp.Skeleton);
console.log('skeleton: ', skeleton);
skeleton.setToSetupPose();
setTimeout(function () {
skeleton.setAnimation(0, 'normal', true);
}, 1);
console.log('skeleton 22: ', skeleton); // skeleton.animation = skeleton.animationNames[0];
})();
} else {
var dragonDisplay = _t.getComponent(dragonBones.ArmatureDisplay);
......@@ -593,6 +610,8 @@ cc.Class({
this.isDebug = false;
},
checkInRegion: function checkInRegion(r) {
console.log('r~~~: ', r);
if (!this._lastFingerPosition && !this._lastFingerPosition.pos) {
return null;
}
......@@ -638,10 +657,10 @@ cc.Class({
"bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/84ec6edc20bceaaa9dbe824092b6860d.png",
"rect": {
"x": 549.55,
"x": 736.95,
"y": 0,
"width": 449.9,
"height": 582
"width": 599.09,
"height": 775
}
},
"hotZoneItemArr": [{
......@@ -649,74 +668,74 @@ cc.Class({
"index": 0,
"audio_url": "http://staging-teach.cdn.ireadabc.com/5a1a2670845bfe76662e86d9a3a69f81.mp3",
"itemType": "rect",
"fontScale": 1.21015625,
"fontScale": 1.61953125,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 1.21015625,
"mapScale": 1.61953125,
"dragDot": {
"x": 774.5,
"y": 289.55016883743366
"x": 1036.5,
"y": 387.5
},
"gIdx": "1",
"labelText": "1",
"posX": 887.5,
"posY": 165.5,
"skeJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/d1f859d3fba84bd03565e543c986fb28.json",
"name": "6_4_ske.json"
"url": "http://staging-teach.cdn.ireadabc.com/133a1f60719ed26247e35dc022d82862.json",
"name": "spineboy-pro.json"
},
"texJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/70f96e1cc7f013e27ed1952c503fb750.json",
"name": "6_4_tex.json"
"url": "http://staging-teach.cdn.ireadabc.com/e0945b8265ea3b8053afb814c6b849d3.atlas",
"name": "spineboy-pro.atlas"
},
"texPngData": {
"url": "http://staging-teach.cdn.ireadabc.com/b06f9b90018a6eb0175a01e355b9ced6.png",
"name": "6_4_tex.png"
"url": "http://staging-teach.cdn.ireadabc.com/517553f50224915148f9efc5b7556798.png",
"name": "spineboy-pro.png"
},
"animType": "dragonBone",
"animType": "spine",
"rect": {
"x": 36.08,
"y": 49.19,
"width": 153.95,
"height": 150.19
"x": 48.05,
"y": 65.5,
"width": 205,
"height": 200
}
}, {
"id": "1659334098930",
"index": 1,
"audio_url": "http://staging-teach.cdn.ireadabc.com/16eb06a6beb9e4fa77c9b5d2d643ab29.mp3",
"itemType": "rect",
"fontScale": 1.21015625,
"fontScale": 1.61953125,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 1.21015625,
"mapScale": 1.61953125,
"dragDot": {
"x": 774.5,
"y": 289.55016883743366
"x": 1036.5,
"y": 387.5
},
"gIdx": "0",
"labelText": "1",
"posX": 1212.5,
"posY": 643.5,
"skeJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/bdbadb06e0c1157e727cecd28f28d10e.json",
"name": "spineboy-pro.json"
"url": "http://staging-teach.cdn.ireadabc.com/679fed26daa464819d553de6331b3552.json",
"name": "alien-pro.json"
},
"texJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/e0945b8265ea3b8053afb814c6b849d3.atlas",
"name": "spineboy-pro.atlas"
"url": "http://staging-teach.cdn.ireadabc.com/65d8214c6b5c5d0496e17adb0408276a.atlas",
"name": "alien-pro.atlas"
},
"texPngData": {
"url": "http://staging-teach.cdn.ireadabc.com/517553f50224915148f9efc5b7556798.png",
"name": "spineboy-pro.png"
"url": "http://staging-teach.cdn.ireadabc.com/a319b372899239325b90bb4ec07b4970.png",
"name": "alien-pro.png"
},
"animType": "spine",
"rect": {
"x": 282.03,
"y": 408.15,
"width": 150.19,
"height": 150.19
"x": 375.56,
"y": 543.5,
"width": 200,
"height": 200
}
}]
}; // return defaultData;
......@@ -985,8 +1004,9 @@ cc.Class({
n.width = width;
n.height = height;
n.active = true; // db.playAnimation('null', 0);
// skeleton.loop = true;
// skeleton.animation = skeleton.animationNames[0]
// skeleton.setToSetupPose();
skeleton.setAnimation(0, 'enlarge', true);
_this4._allAnimationNodes.push(n);
......@@ -1048,7 +1068,8 @@ cc.Class({
}
};
_this4._figurePointRectArray.push(rectInfo);
_this4._figurePointRectArray.push(rectInfo); // this.addRectNodeListener(block);
if (_block.labelText) {
var k = +_block.labelText * 1000;
......@@ -1116,6 +1137,29 @@ cc.Class({
// // this.initBtn();
// this.initIcon();
// },
addRectNodeListener: function addRectNodeListener(data) {
var bg = cc.find("Canvas/frame-border/ground/bg");
var rate = bg.scale * bg.width / this.data.bgItem.rect.width;
var rectNode = new cc.Node();
rectNode.name = 'rect' + data.index;
bg.addChild(rectNode);
var ctx = rectNode.addComponent(cc.Graphics); // 红色矩形
ctx.lineWidth = 4;
ctx.strokeColor = cc.Color.BLACK;
ctx.fillColor = cc.Color.WHITE.setA(100);
var scale = rate / bg.scaleY;
rectNode.width = data.rect.width * scale;
rectNode.height = data.rect.height * scale;
rectNode.x = -bg.width / 2 + data.rect.x * scale;
rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale;
rectNode.anchorX = rectNode.anchorY = 0; // if (pageData.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height); // }
ctx.stroke();
ctx.fill();
},
initBg: function initBg() {
var bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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