✨ feat(活动): 小游戏
This commit is contained in:
@@ -62,17 +62,18 @@ export class ForgeManual {
|
||||
this.quality = data.quality;
|
||||
}
|
||||
|
||||
public setPlayerData(playerData: ActivityForgeModelType, todayIndex: number) {
|
||||
public setPlayerData(playerData: ActivityForgeModelType, todayIndex: number, hintDic?: ForgeHintInDb[]) {
|
||||
this.buildCnt = playerData.buildCnt||0;
|
||||
this.buyCnt = playerData.buyCnt||0;
|
||||
let todayFailRecord = playerData.record?.filter(cur => cur.todayIndex == todayIndex && cur.isSuccess == false)||[];
|
||||
this.failCnt = todayFailRecord.length;
|
||||
this.failCnt = todayFailRecord.length;
|
||||
if(hintDic) this.calHintType(hintDic);
|
||||
}
|
||||
|
||||
public calHintType(hintDic: ForgeHintInDb[]) {
|
||||
for(let { failCnt, hintType } of hintDic) {
|
||||
if(this.failCnt < failCnt) {
|
||||
this.hintType = hintType; break;
|
||||
if(this.failCnt >= failCnt) {
|
||||
this.hintType = hintType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user