private void ParseChannelEvent(Internal.ByteArray message) { int channelId = message.ReadUnsignedShort(); var channel = ChatStorage.GetChannel(channelId); string playerName = message.ReadString(); var eventType = message.ReadEnum <ChannelEvent>(); switch (eventType) { case ChannelEvent.PlayerJoined: channel.PlayerJoined(playerName); break; case ChannelEvent.PlayerLeft: channel.PlayerLeft(playerName); break; case ChannelEvent.PlayerInvited: channel.PlayerInvited(playerName); break; case ChannelEvent.PlayerExcluded: channel.PlayerExcluded(playerName); break; case ChannelEvent.PlayerPending: channel.PlayerPending(playerName); break; } }
private void ParseChannelEvent(Internal.CommunicationStream message) { int channelId = message.ReadUnsignedShort(); var channel = ChatStorage.GetChannel(channelId); string playerName = message.ReadString(); var eventType = message.ReadEnum <ChannelEvent>(); if (channel == null) { #if DEBUG || NDEBUG Debug.LogWarning("ProtocolGame.ParseChannelEvent: invalid channel id " + channelId); #endif return; } switch (eventType) { case ChannelEvent.PlayerJoined: channel.PlayerJoined(playerName); break; case ChannelEvent.PlayerLeft: channel.PlayerLeft(playerName); break; case ChannelEvent.PlayerInvited: channel.PlayerInvited(playerName); break; case ChannelEvent.PlayerExcluded: channel.PlayerExcluded(playerName); break; case ChannelEvent.PlayerPending: channel.PlayerPending(playerName); break; } }