后台:json上传
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 奇遇表
|
||||
import { parseGoodStr, decodeArrayStr, readJsonFile, parseNumberList } from '../util'
|
||||
import { parseGoodStr, decodeArrayStr, readFileAndParse, parseNumberList } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../../pubUtils/interface';
|
||||
|
||||
@@ -32,19 +32,22 @@ export interface DicEvent {
|
||||
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_EVENT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicEvent = new Map<number, DicEvent>();
|
||||
export const dicEventList = new Array<DicEvent>();
|
||||
arr.forEach(o => {
|
||||
o.winReward = parseGoodStr(o.winReward);
|
||||
o.loseReward = parseGoodStr(o.loseReward);
|
||||
o.suitLevel = parseSuitLevel(o.suitLevel);
|
||||
o.movePointArray = parseNumberList(o.movePointArray);
|
||||
dicEventList.push(o);
|
||||
dicEvent.set(o.eventID, o);
|
||||
});
|
||||
|
||||
export function loadEvent () {
|
||||
let arr = readFileAndParse(FILENAME.DIC_EVENT);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.winReward = parseGoodStr(o.winReward);
|
||||
o.loseReward = parseGoodStr(o.loseReward);
|
||||
o.suitLevel = parseSuitLevel(o.suitLevel);
|
||||
o.movePointArray = parseNumberList(o.movePointArray);
|
||||
dicEventList.push(o);
|
||||
dicEvent.set(o.eventID, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
|
||||
function parseSuitLevel(str: string) {
|
||||
|
||||
Reference in New Issue
Block a user