后台:json上传
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 主公经验
|
||||
import {readJsonFile} from '../util'
|
||||
import {readFileAndParse} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicKingExp {
|
||||
@@ -9,16 +9,17 @@ export interface DicKingExp {
|
||||
readonly exp: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_KING_EXP);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicKingExp = new Map<number, {sum: number, cur: number}>();
|
||||
export let maxPlayerLv = 0;
|
||||
|
||||
let exp = 0;
|
||||
arr.forEach(o => {
|
||||
exp += o.exp;
|
||||
if(o.level > maxPlayerLv) maxPlayerLv = o.level;
|
||||
dicKingExp.set(o.level, { sum: exp, cur: o.exp });
|
||||
});
|
||||
arr = null;
|
||||
export function loadKingExp() {
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_KING_EXP);
|
||||
let exp = 0;
|
||||
arr.forEach(o => {
|
||||
exp += o.exp;
|
||||
if(o.level > maxPlayerLv) maxPlayerLv = o.level;
|
||||
dicKingExp.set(o.level, { sum: exp, cur: o.exp });
|
||||
});
|
||||
arr = null;
|
||||
}
|
||||
Reference in New Issue
Block a user