计算积分
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user