------------------------------------------------ --作者: _SqL_ --日期: 2019-04-22 --文件: ServerMatchInfo.lua --模块: ServerMatchInfo --描述: 日常数据 ------------------------------------------------ local ServerMatchInfo = { -- 平均等级 AverageLv = 0, -- 服务器信息 ServersInfo = List:New(), } local L_ServerInfo = { -- 服务器ID ServerID = 0, -- 服务器Name ServerName = nil, -- 服务器对应的世界等级 ServerWorldLv = 0, } -- 初始划活动数据 function ServerMatchInfo:New(list) local _M = Utils.DeepCopy(self) _M.ServersInfo:Clear() local _totalLv = 0 for i = 1, #list do local _t = Utils.DeepCopy(L_ServerInfo) _t.ServerID = list[i].serverid _t.ServerName = list[i].servername _t.ServerWorldLv = list[i].serverWroldLv _M.ServersInfo:Add(_t) _totalLv = _totalLv + list[i].serverWroldLv end -- 平均世界等级 向上取整 _M.AverageLv = math.ceil( _totalLv / #list ) return _M end return ServerMatchInfo