Commit 97b89194 authored by limingzhe's avatar limingzhe

fix: debug

parent 81ff8b16
......@@ -202,7 +202,6 @@ cc.Class({
console.log('[answer] thinking and playing');
// check every second
const id = setInterval(() => {
console.log("aaaaaa");
if (!this._lastFingerPosition.dirty) {
return;
}
......@@ -217,7 +216,7 @@ cc.Class({
} else {
callback('WRONG')
}
}, 300);
}, 100);
this._intervalIds.push(id);
// Perform cleanup
......@@ -246,8 +245,20 @@ cc.Class({
const an = context.questions[context.questionIndex].node;
console.log('in right ' + (typeof an))
an.active = true;
const dragonDisplay = an.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
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);
}
const ddLogoCat = this.logoCat.getComponent(dragonBones.ArmatureDisplay)
ddLogoCat.playAnimation('right', 1)
ddLogoCat.once(dragonBones.EventObject.COMPLETE, function() {
......@@ -611,11 +622,14 @@ cc.Class({
},
checkInRegion(r) {
console.log('r~~~: ', r);
if (!this._lastFingerPosition && !this._lastFingerPosition.pos) {
return null;
}
const p = this._lastFingerPosition ? this._lastFingerPosition.pos || {x:0, y:0} : {x:0, y:0};
console.log('~p: ', p);
console.log('~r: ', r);
const w = p.x > r.x && p.x < (r.x + r.width);
const h = p.y > r.y && p.y < (r.y + r.height);
return w && h;
......@@ -999,13 +1013,13 @@ cc.Class({
addRectNodeListener(data) {
const bg = cc.find(`Canvas/frame-border/ground/bg`);
const bg = cc.find(`Canvas/frame-border/ground/bg`).parent;
const rate = (bg.scale * bg.width) / this.data.bgItem.rect.width;
const rectNode = new cc.Node();
rectNode.name = 'rect' + data.index;
bg.addChild(rectNode);
bg.addChild(rectNode, 20);
const ctx = rectNode.addComponent(cc.Graphics);
......@@ -1016,20 +1030,47 @@ cc.Class({
const scale = rate / bg.scaleY;
console.log('scale~ : ', scale)
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.x = -bg.width / 2 + data.rect.x * scale + bg.x;
rectNode.y = bg.height / 2 - data.rect.height * scale - data.rect.y * scale + bg.y;
rectNode.anchorX = rectNode.anchorY = 0;
console.log('data: ', data);
console.log('rectNode: ', rectNode);
// if (pageData.bgItem.isShowDebugLine) {
ctx.rect(0, 0, rectNode.width, rectNode.height);
// ctx.fillRect(0, 0, 200, 200);
// }
ctx.stroke();
ctx.fill();
rectNode.addComponent(cc.Button);
rectNode.on("click", () => {
console.log(" in rectNode click");
const _x = rectNode.x / bg.width;
const _y = rectNode.y / bg.height;
const _w = rectNode.width / bg.width;
const _h = rectNode.height / bg.height;
const pos = {
x: _x + _w / 2 + 0.5,
y: -(_y + _h / 2 - 0.5)
}
this._lastFingerPosition = {
pos: pos,
dirty: true
};
})
},
initBg() {
......
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