后台:json上传

This commit is contained in:
luying
2021-05-12 18:56:47 +08:00
parent 2fc5017af8
commit 148a11edab
102 changed files with 1675 additions and 1117 deletions
+12 -11
View File
@@ -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;
}