/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public PlayerAccepted(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.PlayerAccepted)
			{
				throw new InvalidCastException("Cannot convert this message to PlayerAccepted");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.UserId = s.GetUInt32();
			this.InGame = s.GetBool();

			ushort players = s.GetUInt16();
			this.Players = new List<IPlayerData>();
			for (int i = 0; i < players; i++)
			{
				var player = new Player.PlayerData(s.GetUInt32());
				player.Nick = s.GetString();
				player.InGame = s.GetBool();
				this.Players.Add(player);
			}

			ushort nations = s.GetUInt16();
			this.AvailableNations = new List<string>();
			for (int i = 0; i < nations; i++)
			{
				this.AvailableNations.Add(s.GetString());
			}
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public GameStarted(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.GameStarted)
			{
				throw new InvalidCastException("Cannot convert this message to GameStarted");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.PlayerA = s.GetUInt32();
			this.PlayerB = s.GetUInt32();
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public ResourceGathered(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.ResourceGathered)
			{
				throw new InvalidCastException("Cannot convert this message to ResourceGathered");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.ResourceId = s.GetUInt32();
			this.PlayerId = s.GetByte();
			this.UnitId = s.GetUInt32();
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public ResourceAdded(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.ResourceAdded)
			{
				throw new InvalidCastException("Cannot convert this message to ResourceAdded");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.ResourceId = s.GetString();
			this.NumericResourceId = s.GetUInt32();
			this.Amount = s.GetUInt32();
			this.Position = s.GetFloat();
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public PlayerChangedState(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.PlayerChangedState)
			{
				throw new InvalidCastException("Cannot convert this message to PlayerChangedNick");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.UserId = s.GetUInt32();
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public PlayerDisconnected(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.PlayerDisconnected)
			{
				throw new InvalidCastException("Cannot convert this message to PlayerDisconnected");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.UserId = s.GetUInt32();
			this.Reason = (DisconnectionReason)s.GetByte();
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public PlayerConnected(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.PlayerConnected)
			{
				throw new InvalidCastException("Cannot convert this message to ClientConnected");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.UserId = s.GetUInt32();
			this.Nick = s.GetString();
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public UnitCreated(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.UnitCreated)
			{
				throw new InvalidCastException("Cannot convert this message to UnitCreated");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.PlayerId = s.GetByte();
			this.UnitId = s.GetString();
			this.NumericUnitId = s.GetUInt32();
			this.Position = new Vector2(s.GetFloat(), s.GetFloat());
		}