后台:json上传
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 关卡表
|
||||
import {decodeArrayListStr, decodeArrayStr, readJsonFile} from '../util'
|
||||
import {decodeArrayListStr, decodeArrayStr, readFileAndParse} from '../util'
|
||||
import { WAR_RELATE_TABLES, WAR_TYPE } from '../../consts';
|
||||
|
||||
export interface DicWar {
|
||||
@@ -37,28 +37,28 @@ export interface DicWar {
|
||||
export const dicWar = new Map<number, DicWar>();
|
||||
export const dicWarPvp = new Array<DicWar>();
|
||||
export const dicDailyWarByType = new Map<number, DicWar[]>();
|
||||
|
||||
for(let filename of WAR_RELATE_TABLES) {
|
||||
const str = readJsonFile(filename);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.fixReward = parseFixReward(o.fixReward);
|
||||
o.conditionReward = parseConditionReward(o.conditionReward);
|
||||
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
||||
o.detailUIBg = parseDetailUIBg(o.detailUIBg);
|
||||
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
||||
|
||||
dicWar.set(o.war_id, o);
|
||||
if(o.warType == WAR_TYPE.PVP) {
|
||||
dicWarPvp.push(o);
|
||||
} else if (o.warType == WAR_TYPE.DAILY) {
|
||||
if(!dicDailyWarByType.has(o.dailyType)) {
|
||||
dicDailyWarByType.set(o.dailyType, []);
|
||||
export function loadWar() {
|
||||
for(let filename of WAR_RELATE_TABLES) {
|
||||
let arr = readFileAndParse(filename);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.fixReward = parseFixReward(o.fixReward);
|
||||
o.conditionReward = parseConditionReward(o.conditionReward);
|
||||
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
||||
o.detailUIBg = parseDetailUIBg(o.detailUIBg);
|
||||
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
||||
|
||||
dicWar.set(o.war_id, o);
|
||||
if(o.warType == WAR_TYPE.PVP) {
|
||||
dicWarPvp.push(o);
|
||||
} else if (o.warType == WAR_TYPE.DAILY) {
|
||||
if(!dicDailyWarByType.has(o.dailyType)) {
|
||||
dicDailyWarByType.set(o.dailyType, []);
|
||||
}
|
||||
dicDailyWarByType.get(o.dailyType).push(o);
|
||||
}
|
||||
dicDailyWarByType.get(o.dailyType).push(o);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function parseFixReward(str: string = '') {
|
||||
|
||||
Reference in New Issue
Block a user