后台:json上传
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 关卡表
|
||||
import {decodeArrayListStr, readWarJsonFileList} from '../util'
|
||||
import {decodeArrayListStr, readWarJsonFileAndParse} from '../util'
|
||||
|
||||
export interface DicWarJson {
|
||||
|
||||
@@ -49,18 +49,19 @@ export interface DicWarJson {
|
||||
}
|
||||
|
||||
export const dicWarJson = new Map<number, Array<DicWarJson>>();
|
||||
readWarJsonFileList().forEach(str => {
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
let warjson = new Array<DicWarJson>();
|
||||
let warid = 0;
|
||||
arr.forEach(o => {
|
||||
o.attribute = parseAttribute(o.attribute);
|
||||
warid = o.warId;
|
||||
warjson.push(o);
|
||||
});
|
||||
dicWarJson.set(warid, warjson);
|
||||
})
|
||||
export function loadWarJson() {
|
||||
readWarJsonFileAndParse().forEach(arr => {
|
||||
|
||||
let warjson = new Array<DicWarJson>();
|
||||
let warid = 0;
|
||||
arr.forEach(o => {
|
||||
o.attribute = parseAttribute(o.attribute);
|
||||
warid = o.warId;
|
||||
warjson.push(o);
|
||||
});
|
||||
dicWarJson.set(warid, warjson);
|
||||
})
|
||||
}
|
||||
|
||||
export function parseAttribute(str: string) {
|
||||
let result = new Array<{ id: number, val: number }>();
|
||||
|
||||
Reference in New Issue
Block a user