后台:活动类型表
This commit is contained in:
@@ -84,6 +84,7 @@ import { dicRecruit, loadRecruit } from './dictionary/DicRecruit';
|
||||
import { loadRMB, dicRMB } from './dictionary/DicRMB';
|
||||
import { dicActivityType, loadActivityType } from './dictionary/DicActivityType';
|
||||
import { dicTaskTypeDesc, loadTaskType } from './dictionary/DicTaskType';
|
||||
import { dicServerName, dicServerGroupName, loadServerName } from "./dictionary/DicServerName";
|
||||
|
||||
export const gameData = {
|
||||
blurprtCompose: dicBlueprtCompose,
|
||||
@@ -204,7 +205,9 @@ export const gameData = {
|
||||
recruit: dicRecruit,
|
||||
rmb: dicRMB,
|
||||
activityType: dicActivityType,
|
||||
taskTypeDesc: dicTaskTypeDesc
|
||||
taskTypeDesc: dicTaskTypeDesc,
|
||||
serverNames: dicServerName,
|
||||
serverGroupNames: dicServerGroupName,
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -668,6 +671,36 @@ function getHeroTransPiece() {
|
||||
gameData.heroTransPiece = newMap
|
||||
}
|
||||
|
||||
// 根据groupId获得当前大区名
|
||||
export function getServerGroupName(groupId: number) {
|
||||
let name = gameData.serverGroupNames.get(groupId);
|
||||
if(!name) {
|
||||
let maxId = 0;
|
||||
gameData.serverGroupNames.forEach((gname, id) => {
|
||||
if(id > maxId) {
|
||||
maxId = id;
|
||||
name = gname;
|
||||
}
|
||||
})
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
// 根据服务器id获得当前大区名
|
||||
export function getServerName(id: number) {
|
||||
let name = gameData.serverNames.get(id);
|
||||
if(!name) {
|
||||
let maxId = 0;
|
||||
gameData.serverNames.forEach((sname, id) => {
|
||||
if(id > maxId) {
|
||||
maxId = id;
|
||||
name = sname;
|
||||
}
|
||||
})
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
function initDatas() {
|
||||
parseDicParam();
|
||||
@@ -765,6 +798,7 @@ function loadDatas() {
|
||||
loadRMB();
|
||||
loadActivityType();
|
||||
loadTaskType();
|
||||
loadServerName();
|
||||
}
|
||||
|
||||
// 重载dicParam
|
||||
|
||||
35
shared/pubUtils/dictionary/DicServerName.ts
Normal file
35
shared/pubUtils/dictionary/DicServerName.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// 武将特技表
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicServerName {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 小区名
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
export const dicServerName = new Map<number, string>();
|
||||
export const dicServerGroupName = new Map<number, string>();
|
||||
export function loadServerName() {
|
||||
|
||||
{
|
||||
let arr = readFileAndParse(FILENAME.DIC_SERVER_NAME);
|
||||
|
||||
arr.forEach(o => {
|
||||
let { id, sname } = o;
|
||||
dicServerName.set(id, sname);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
{
|
||||
let arr = readFileAndParse(FILENAME.DIC_SERVER_GROUP_NAME);
|
||||
|
||||
arr.forEach(o => {
|
||||
let { id, groupName } = o;
|
||||
dicServerGroupName.set(id, groupName);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user