计算积分

This commit is contained in:
2025-05-22 17:17:47 +08:00
parent 2bf07ab8f6
commit b3681e5c1e
19 changed files with 41383 additions and 378 deletions

View File

@@ -1,3 +1,4 @@
import { config } from "../constants/config"
@@ -12,4 +13,27 @@ export function Utility_ConvertSecondToString(second: number) {
return value>=10?value.toString():("0"+value)
}
return `${format(hour)}:${format(minite)}:${format(second)}`
}
//计算积分
export function Utility_CalculateScore(difficulty: string, second: number): number {
var score = 0
var currentTime = Math.min(120, second)
if (difficulty == config.DIFFICULTY_TYPE.Easy) {
score = 270 - currentTime
}
else if (difficulty == config.DIFFICULTY_TYPE.Medium) {
score = 420 - currentTime * 2
}
else if (difficulty == config.DIFFICULTY_TYPE.Hard) {
score = 760 - currentTime * 3
}
else if (difficulty == config.DIFFICULTY_TYPE.Expert) {
score = 1120 - currentTime * 3
}
else if (difficulty == config.DIFFICULTY_TYPE.Extreme) {
score = 1320 - currentTime * 4
}
// console.log("计算积分 >>>>>", difficulty, second, score)
return score
}