后台:json上传
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 主线任务阶段内容
|
||||
import {readJsonFile, parseGoodStr} from '../util'
|
||||
import {readFileAndParse, parseGoodStr} from '../util'
|
||||
import { FILENAME, TASK_FUN_TYPE } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
@@ -13,25 +13,25 @@ export interface DicTaskBox {
|
||||
}
|
||||
|
||||
export const dicTaskBox = new Map<number, Map<number, DicTaskBox>>();
|
||||
export function loadTaskBox() {
|
||||
|
||||
const str1 = readJsonFile(FILENAME.DIC_TASK_BOX);
|
||||
let arr1 = JSON.parse(str1);
|
||||
arr1.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.DAILY)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.DAILY, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.DAILY).set(o.id, o);
|
||||
});
|
||||
arr1 = undefined;
|
||||
|
||||
const str2 = readJsonFile(FILENAME.DIC_ACHIEVEMENT_BOX);
|
||||
let arr2 = JSON.parse(str2);
|
||||
arr2.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.ACHIEVEMENT)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.ACHIEVEMENT, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.ACHIEVEMENT).set(o.id, o);
|
||||
});
|
||||
arr2 = undefined;
|
||||
let arr1 = readFileAndParse(FILENAME.DIC_TASK_BOX);
|
||||
arr1.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.DAILY)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.DAILY, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.DAILY).set(o.id, o);
|
||||
});
|
||||
arr1 = undefined;
|
||||
|
||||
let arr2 = readFileAndParse(FILENAME.DIC_ACHIEVEMENT_BOX);
|
||||
arr2.forEach(o => {
|
||||
if(!dicTaskBox.has(TASK_FUN_TYPE.ACHIEVEMENT)) {
|
||||
dicTaskBox.set(TASK_FUN_TYPE.ACHIEVEMENT, new Map<number, DicTaskBox>());
|
||||
}
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicTaskBox.get(TASK_FUN_TYPE.ACHIEVEMENT).set(o.id, o);
|
||||
});
|
||||
arr2 = undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user