Commit 4bd8bccf authored by LMZ's avatar LMZ

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

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