任务:完成主要接口

This commit is contained in:
luying
2021-04-19 19:35:45 +08:00
parent b29b8634ad
commit ced80d9b94
16 changed files with 515 additions and 41 deletions

View File

@@ -0,0 +1,37 @@
// 主线任务阶段内容
import {readJsonFile, parseGoodStr} from '../util'
import { FILENAME, TASK_FUN_TYPE } from '../../consts'
import { RewardInter } from '../interface';
export interface DicTaskBox {
// id
readonly id: number;
// 积分
readonly point: number;
// 奖励
readonly reward: RewardInter[];
}
export const dicTaskBox = new Map<number, Map<number, DicTaskBox>>();
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;