Commit 0bcbd4be authored by Li MingZhe's avatar Li MingZhe

fix: 瓶子异常

parent 652562c0
...@@ -85,12 +85,14 @@ cc.Class({ ...@@ -85,12 +85,14 @@ cc.Class({
if (aspect) { if (aspect) {
console.log('aspect : ', aspect); console.log('aspect : ', aspect);
this.serverAllUser = aspect.all_user; this.serverAllUser = aspect.all_user;
this.initHistoryData(aspect.user_aspect);
} }
this.initHistoryData(aspect.user_aspect);
console.log('data:', data); console.log('data:', data);
this.data = data || this.getDefaultData(); this.data = data || this.getDefaultData();
this.preloadItem() this.preloadItem()
}) })
}, },
...@@ -196,6 +198,7 @@ cc.Class({ ...@@ -196,6 +198,7 @@ cc.Class({
c.onEvent('show_cap', (data, next) => { c.onEvent('show_cap', (data, next) => {
console.log('in show_cap event', data); console.log('in show_cap event', data);
this.historyData = data.historyData; this.historyData = data.historyData;
this.data.groupArr = this.historyData.arrData;
this.showCapAnima(data.index); this.showCapAnima(data.index);
next(); next();
}); });
...@@ -247,10 +250,13 @@ cc.Class({ ...@@ -247,10 +250,13 @@ cc.Class({
if (user_aspect) { if (user_aspect) {
let data = JSON.parse(user_aspect).historyData; let data = JSON.parse(user_aspect).historyData;
for (let i=0; i<this.serverAllUser.length; i++) { for (let i=0; i<this.serverAllUser.length; i++) {
const userHistoryData = JSON.parse(this.serverAllUser[i].aspect).historyData if (this.serverAllUser[i].aspect) {
if (userHistoryData.dateTime > data.dateTime) { const userHistoryData = JSON.parse(this.serverAllUser[i].aspect).historyData
data = userHistoryData; if (userHistoryData && userHistoryData.dateTime > data.dateTime) {
data = userHistoryData;
}
} }
} }
this.historyData = data; this.historyData = data;
console.log('this.historyData: ', this.historyData); console.log('this.historyData: ', this.historyData);
...@@ -274,7 +280,7 @@ cc.Class({ ...@@ -274,7 +280,7 @@ cc.Class({
return; return;
} }
this.data.groupArr = this.historyData.arrData; this.data.groupArr = this.historyData.arrData;
this.groupIndex = this.historyData.index; // this.groupIndex = this.historyData.index;
this.curBottle = this.bottleArr[this.historyData.index]; this.curBottle = this.bottleArr[this.historyData.index];
this.reconnectBottleState(); this.reconnectBottleState();
...@@ -288,6 +294,7 @@ cc.Class({ ...@@ -288,6 +294,7 @@ cc.Class({
if (arrData[i]?.isEnd) { if (arrData[i]?.isEnd) {
this.bottleArr[i].scroll.active = false; this.bottleArr[i].scroll.active = false;
this.bottleArr[i].cap.active = false; this.bottleArr[i].cap.active = false;
this.bottleArr[i].data.isEnd = true;
} }
} }
}, },
...@@ -745,8 +752,10 @@ cc.Class({ ...@@ -745,8 +752,10 @@ cc.Class({
}) })
this.curBottle = bottle; this.curBottle = bottle;
this.groupIndex = this.data.groupArr.indexOf( bottle.data ); // this.groupIndex = this.data.groupArr.indexOf( bottle.data );
this.curBottle.data.isEnd = true; // this.curBottle.data.isEnd = true;
this.data.groupArr[index].isEnd = true;
playAudio(this.capClip); playAudio(this.capClip);
}, },
......
No preview for this file type
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