登录:更新服务器列表
This commit is contained in:
67
shared/domain/gameField/serverlist.ts
Normal file
67
shared/domain/gameField/serverlist.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { ServerInfo } from '../../db/Game';
|
||||
import { RoleType } from '../../db/Role';
|
||||
import { getSeconds } from '../../pubUtils/timeUtil';
|
||||
|
||||
export class ServerParam {
|
||||
id: number; // 区号
|
||||
serverStr: string; // 显示的区号 S1
|
||||
name: string; // 区名
|
||||
host: string; // pinus地址
|
||||
port: number; // pinus端口
|
||||
status: number; // 状态
|
||||
openTime: number; // 开服时间
|
||||
serverType: string; // 分区类型 官服 测试服 开发服
|
||||
|
||||
constructor(server: ServerInfo) {
|
||||
this.id = server.id;
|
||||
this.serverStr = `S${this.id}`;
|
||||
this.name = server.name;
|
||||
this.host = server.host;
|
||||
this.port = server.port;
|
||||
this.status = server.status;
|
||||
this.openTime = getSeconds(server.openTime);
|
||||
this.serverType = server.serverType;
|
||||
}
|
||||
}
|
||||
|
||||
export class GroupParam {
|
||||
groupId: number; // 大区号
|
||||
groupName: string; // 大区名
|
||||
serverStr: string; // 大区内小区编号 S1-S10
|
||||
servers: ServerParam[]; // 区
|
||||
|
||||
constructor(server: ServerInfo) {
|
||||
this.groupId = server.groupId;
|
||||
this.groupName = server.groupName;
|
||||
this.serverStr = `S${server.id}-S${server.id + 9}`;
|
||||
this.servers = new Array<ServerParam>();
|
||||
}
|
||||
|
||||
public pushServer(server: ServerInfo) {
|
||||
let srv = new ServerParam(server);
|
||||
this.servers.push(srv);
|
||||
}
|
||||
}
|
||||
|
||||
export class ServerParamWithRole extends ServerParam {
|
||||
groupId: number; // 大区号
|
||||
groupName: string; // 大区名
|
||||
|
||||
roleId: string; // 玩家账号
|
||||
roleName: string; // 玩家名
|
||||
headHid: number; // 头像
|
||||
sHid: number; // 形象
|
||||
lv: number; // 等级
|
||||
|
||||
constructor(role: RoleType, server: ServerInfo) {
|
||||
super(server);
|
||||
this.groupId = server.groupId;
|
||||
this.groupName = server.groupName;
|
||||
|
||||
this.roleId = role.roleId;
|
||||
this.roleName = role.roleName;
|
||||
this.headHid = role.headHid;
|
||||
this.sHid = role.sHid;
|
||||
this.lv = role.lv;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user