后台:json上传
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user