后台: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
+14 -12
View File
@@ -1,4 +1,4 @@
import { readJsonFile, parseNumberList } from '../util'
import { readFileAndParse, parseNumberList } from '../util'
import { FILENAME, GACHA_CONTENT_TYPE } from '../../consts'
export interface DicGachaContent {
@@ -12,17 +12,19 @@ export interface DicGachaContent {
readonly count: number;
}
const str = readJsonFile(FILENAME.DIC_GACHA_CONTENT);
let arr = JSON.parse(str);
export const dicGachaContent = new Map<number, DicGachaContent>(); // id => dic
export const dicGachaContentHero = new Map<number, number>(); // quality => dic
arr.forEach(o => {
o.param = parseNumberList(o.param);
if(o.type == GACHA_CONTENT_TYPE.HERO) {
dicGachaContentHero.set(o.param[0], o.id);
}
dicGachaContent.set(o.id, o);
});
export function loadGachaContent() {
arr = undefined;
let arr = readFileAndParse(FILENAME.DIC_GACHA_CONTENT);
arr.forEach(o => {
o.param = parseNumberList(o.param);
if(o.type == GACHA_CONTENT_TYPE.HERO) {
dicGachaContentHero.set(o.param[0], o.id);
}
dicGachaContent.set(o.id, o);
});
arr = undefined;
}