/// <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 GameWillStartAfter(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.GameWillStartAfter)
			{
				throw new InvalidCastException("Cannot convert this message to GameWillStartAfter");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.Time = new TimeSpan(s.GetInt64());
		}
		/// <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 UnitDestroyed(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.UnitDestroyed)
			{
				throw new InvalidCastException("Cannot convert this message to UnitDestroyed");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.PlayerId = s.GetByte();
			this.UnitId = s.GetUInt32();
		}
		/// <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 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 PlayerHurt(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.PlayerHurt)
			{
				throw new InvalidCastException("Cannot convert this message to PlayerHurt");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.PlayerId = s.GetByte();
			this.Value = s.GetInt32();
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public UnitQueueAction(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.UnitQueueAction)
			{
				throw new InvalidCastException("Cannot convert this message to CreateUnit");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.UnitId = s.GetString();
			this.Created = s.GetBool();
		}
		/// <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 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());
		}
		/// <summary>
		/// Parsuje wiadomość.
		/// </summary>
		/// <param name="msg">Wiadomość.</param>
		public PlayersFirstConfiguration(Message msg)
		{
			if (msg.Type != (MessageType)GameMessageType.PlayersFirstConfiguration)
			{
				throw new InvalidCastException("Cannot convert this message to PlayersFirstConfiguration");
			}
			BinarySerializer s = new BinarySerializer(msg.Data);
			this.Nick = s.GetString();

			this.Nations = new List<KeyValuePair<string, byte[]>>();
			ushort nations = s.GetUInt16();
			for (int i = 0; i < nations; i++)
			{
				this.Nations.Add(new KeyValuePair<string, byte[]>(s.GetString(), s.GetByteArray()));
			}
		}