void HandleDatapacket(Message msg) { var packet = new NetworkPacketManager(msg.data); switch (packet.GetTagPacket()) { case TagPacket.ServerAccepted: break; case TagPacket.ServerInfo: Logger.Log("- server info packet received"); var a = new PacketServerInfo(); a.Deserialize(packet.Buffer); SingleServer tmp = new SingleServer(); tmp.serverName = a.ServerName; tmp.serverMaxPlayers = a.MaxPlayers; _serverManager.AddNewServer(msg.connectionId, tmp); break; default: Logger.Log("UNHANDLED PACKED TYPE RECEIVED", Logger.LOG_TYPE.ERROR); break; } }
public void AddNewServer(int id, SingleServer data) { _serverList.Add(id, data); Logger.Log($"New server has been added. ID: {id}"); }