增加单人游戏结束后星星的获取
This commit is contained in:
parent
e71accb7b9
commit
dcf7a0be44
@ -93,6 +93,7 @@
|
||||
"comboCount": 0, // 当前连续答对的数量
|
||||
"maxCombo": 1, // 当局连续答对的最大数量
|
||||
"score": 10, // 当局胜利后的得分
|
||||
"star": 1, // 当局胜利后获得的星星
|
||||
"gameResult": 0 // 当局的游戏结果, 单人的话和上一层gameResult相同
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class PuzzleController extends BaseController {
|
||||
if (gameResult) {
|
||||
history.status = 9
|
||||
if (gameResult === 1) {
|
||||
let score = calcSingleScore(history, accountid)
|
||||
let { score } = calcSingleScore(history, accountid)
|
||||
let rankObj = {
|
||||
shop: history.shop,
|
||||
level: history.level,
|
||||
|
@ -50,6 +50,9 @@ export class PuzzleStatusClass {
|
||||
@prop({default: 0})
|
||||
score: number
|
||||
|
||||
@prop({default: 0})
|
||||
star: number
|
||||
|
||||
/**
|
||||
* 游戏结果
|
||||
* @type {number}
|
||||
|
@ -208,12 +208,15 @@ export function calcSingleScore(history: any, accountId: string) {
|
||||
hp = hp < 0 ? 0 : hp
|
||||
time = time < 0 ? 0 : time
|
||||
let cfg = new GameEnv()
|
||||
let score = time * cfg.singleTimeRate + hp * cfg.singleHpRate + combo * cfg.singleComboRate
|
||||
if (history.difficultyMode) {
|
||||
score *= cfg.singleLowLvlRate
|
||||
}
|
||||
let score = time * cfg.singleTimeRate + hp * cfg.singleHpRate + combo * cfg.singleComboRate;
|
||||
(history.difficultyMode) && (score *= cfg.singleLowLvlRate)
|
||||
stat.score = score
|
||||
return score
|
||||
let star = 0;
|
||||
(time >= cfgLevel.timestar) && star++;
|
||||
(stat.maxCombo >= cfgLevel.enemystar) && star++;
|
||||
(hp >= cfgLevel.hpstar) && star ++;
|
||||
stat.star = star
|
||||
return { score, star }
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user