Commit 4bd8bccf authored by LMZ's avatar LMZ

feat: 宽字母 点击不了 自动播完撒花 双字母中间对齐 重播所有动画异常

parent a315d709
......@@ -257,7 +257,7 @@ cc.Class({
letterAudioData[arr[i]] = cc.find('Canvas/res/audio/letter/big/' + arr[i]).getComponent(cc.AudioSource).clip;
}
this.letterAudioData = letterAudioData;
console.log('letterAudioData: ', letterAudioData);
// console.log('letterAudioData: ', letterAudioData);
},
......@@ -303,7 +303,8 @@ cc.Class({
console.log('this.data: ' , this.data);
this.curLetterData = this.getCurLetterData();
this.setLetter(this.curLetterData.letter);
// this.setLetter(this.curLetterData.letter);
this.setLetter('iw');
this.startEditMode();
},
......@@ -385,6 +386,7 @@ cc.Class({
replay.on(cc.Node.EventType.TOUCH_START, () => {
if (this.data.batch == 'all') {
this.removeAllLetterNode();
this.replayAllLetterAnim();
} else {
this.cleanLetterAnim();
......@@ -421,7 +423,7 @@ cc.Class({
initStar() {
console.log(' in initStar');
console.log(' in initStar, this.data.groupArr.length: ', this.data.groupArr.length);
// console.log(' in initStar, this.data.groupArr.length: ', this.data.groupArr.length);
const starNode = cc.find("Canvas/starNode");
starNode.zIndex = 20;
const script = starNode.getComponent("star");
......@@ -438,6 +440,7 @@ cc.Class({
const starNode = cc.find("Canvas/starNode");
const script = starNode.getComponent("star");
script.add();
},
letterNodeArr: null,
......@@ -447,10 +450,15 @@ cc.Class({
this.dotColor = '#fd9c7c';
if (letter.length == 2) {
const letter1 = this.addLetterItem(letter[0], -1);
const letter2 = this.addLetterItem(letter[1], 1);
this.letterNodeArr = [letter1, letter2];
this.refreshLetterPos();
} else {
const letterNode = this.addLetterItem(letter);
......@@ -469,6 +477,22 @@ cc.Class({
},
refreshLetterPos() {
const arr = this.letterNodeArr;
let totalW = 0;
for (let i=0; i<arr.length; i++) {
totalW += arr[i].emptyNode.width;
}
totalW *= this._mapScaleMin;
let baseX = -totalW / 2;
for (let i=0; i<arr.length; i++) {
arr[i].emptyNode.x = baseX + arr[i].emptyNode.width * arr[i].emptyNode.scale / 2;
arr[i].x = arr[i].emptyNode.x + arr[i].subX;
baseX += arr[i].emptyNode.width * arr[i].emptyNode.scale;
}
},
async showLetterAnimByNodeArr() {
if (this.debugMode) {
return;
......@@ -647,6 +671,7 @@ cc.Class({
letterNode.height = 594;
letterNode.scale = this._mapScaleMin;
letterNode.letter = letter;
letterNode.zIndex = 1;
this.bgLayer.addChild(letterNode);
this.addMaskNode(letterNode, 'letter/' + key)
......@@ -657,7 +682,7 @@ cc.Class({
const emptyNode = this.addEmptyNode('letter_empty/' + key);
letterNode.emptyNode = emptyNode;
offX *= emptyNode.width / 2;
offX *= emptyNode.width / 2 ;
emptyNode.x = offX;
// if (!this.traceMode) {
......@@ -666,6 +691,7 @@ cc.Class({
letterNode.y += subY;
letterNode.x += subX + offX;
letterNode.subX = subX;
// this.curLetterNode = letterNode;
......@@ -680,7 +706,7 @@ cc.Class({
if (!this.curLetterNode) {
console.log('~~~curletterNode: ', letterNode);
// console.log('~~~curletterNode: ', letterNode);
if (this.debugMode) {
this.curLetterNode = letterNode;
}
......@@ -694,6 +720,8 @@ cc.Class({
return;
}
console.log('touch start');
this.letterTouchDown(letterNode, e);
......@@ -949,7 +977,7 @@ cc.Class({
this.checkAddCenterFoodPos(firstPos, lastPos, foodPosArr)
console.log('foodPosArr: ', foodPosArr);
// console.log('foodPosArr: ', foodPosArr);
return foodPosArr;
},
......@@ -1000,7 +1028,7 @@ cc.Class({
letterTouchMove(letterNode, e) {
console.log('this.isTouch: ',this.isTouch);
// console.log('this.isTouch: ',this.isTouch);
if (!this.isTouch) {
return;
}
......@@ -1048,7 +1076,7 @@ cc.Class({
traceStartDot: null,
addTracePoint(px, py) {
console.log(' in addTracePoint ')
// console.log(' in addTracePoint ')
const dot = this.drawDot(this.dotWidth);
dot.x = px;
dot.y = py;
......@@ -1159,12 +1187,12 @@ cc.Class({
this.pointGroup = [];
console.log('in setDataToGroup: ', dataPointGroup);
// console.log('in setDataToGroup: ', dataPointGroup);
for (let i=0; i<dataPointGroup.length; i++) {
const curPointArr = [];
const targetPointArr = dataPointGroup[i];
console.log('targetPointArr: ', targetPointArr);
// console.log('targetPointArr: ', targetPointArr);
for (let j=0; j<targetPointArr.length; j++) {
const dot = this.drawDot(this.dotWidth);
dot.x = targetPointArr[j].x;
......@@ -1206,7 +1234,7 @@ cc.Class({
const dataPointGroup = this.letterData[this.curLetterNode.letter];
console.log('in setDataToGroup: ', dataPointGroup);
// console.log('in setDataToGroup: ', dataPointGroup);
const i = this.curTraceGroupIndex;
const curPointArr = [];
......@@ -1248,7 +1276,7 @@ cc.Class({
dotReset(pointGroup) {
console.log('this.pointGroup: ', this.pointGroup);
// console.log('this.pointGroup: ', this.pointGroup);
for (let i=0; i<pointGroup.length; i++) {
......@@ -1399,7 +1427,7 @@ cc.Class({
let distance = p1.sub(p2).mag();
console.log('distance: ', distance);
// console.log('distance: ', distance);
if (distance < this.checkTouchLen) {
......@@ -1473,11 +1501,12 @@ cc.Class({
checkTouchLastDot() {
console.log(' in checkTouchLastDot')
// console.log(' in checkTouchLastDot')
if (!this.isTraceEnd) {
this.traceFail();
}
},
traceFail() {
......@@ -1647,7 +1676,7 @@ cc.Class({
this.traceEnd();
this.curLetterNode.isTraceEnd = true;
this.curLetterNode.zIndex = 1;
this.curLetterNode.zIndex = 0;
this.removeDecorate(this.curLetterNode);
this.curLetterNode = null;
......@@ -1762,9 +1791,15 @@ cc.Class({
},
isGameEnd: null,
async gameEnd() {
gameEnd() {
this.isGameEnd = true;
if (this.traceMode) {
this.showEndAnim();
}
},
async showEndAnim() {
await asyncDelay(0.5);
......
......@@ -3,6 +3,6 @@
"packages": "packages",
"name": "play",
"id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231",
"version": "2.4.4",
"version": "2.4.5",
"isNew": false
}
\ No newline at end of file
{"ios":{"sceneName":"dfzx_cocos_trace_letter","version":"18af9"},"android":{"sceneName":"dfzx_cocos_trace_letter","version":"18af9"}}
\ No newline at end of file
{"ios":{"sceneName":"dfzx_cocos_trace_letter","version":"fb0c8"},"android":{"sceneName":"dfzx_cocos_trace_letter","version":"fb0c8"}}
\ No newline at end of file
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