private void TickUploadCount() { if (Time.timeSinceStartup - tmpLastUploadTime >= GlobalID.UPLOAD_ONLINE_COUNT_TIME * 1000) { ss2ws.OnlineCount msg = PacketPools.Get(ss2ws.msg.ONLINE_COUNT) as ss2ws.OnlineCount; msg.count = (ushort)this.GetPlayerCount(); ServerNetManager.Instance.Send2WS(msg); tmpLastUploadTime = Time.timeSinceStartup; } }
/// <summary> /// 上报玩家数量 /// </summary> private void OnPlayerCount(PacketBase packet) { ss2ws.OnlineCount msg = packet as ss2ws.OnlineCount; ServerInfoManager.Instance.UpdatePlayerCount(msg.server_uid.ss_uid, msg.count); }