mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
31 lines
751 B
TypeScript
31 lines
751 B
TypeScript
import { TableGRole } from "../../../resources/config/ts/TableGRole";
|
|
import GRoleBase from "../base/role/GRoleBase";
|
|
|
|
//角色工具类
|
|
export class GRoleUtil{
|
|
|
|
//获取存活的玩家 如果不存活则返回 null
|
|
static get<T>(player:GRoleBase<T>):() => GRoleBase<T>{
|
|
if(!player) return null;
|
|
return ():GRoleBase<T> => {
|
|
if(player)
|
|
return player.get();
|
|
return null;
|
|
}
|
|
}
|
|
|
|
//通过Id 获取 GRole
|
|
static getGRole(id:number):TableGRole{
|
|
let info:TableGRole;
|
|
if(!(info = TableGRole.getConfig(id))) return null;
|
|
return info
|
|
}
|
|
|
|
static getGRoles(ids:number[]):TableGRole[]{
|
|
return ids.map(id => GRoleUtil.getGRole(id));
|
|
}
|
|
|
|
}
|
|
|
|
|