feat(活动): 小游戏

This commit is contained in:
luying
2023-03-17 16:48:23 +08:00
parent 04cecc2d5d
commit 3669d557a7
14 changed files with 565 additions and 10 deletions

View File

@@ -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;
}
}
}