void ILobbyClientSessionHandler.OnWhisperMessageReceived(
     string fromPlayer,
     string toPlayer,
     string message)
 {
     if (this.ChatHandler != null)
     {
         this.ChatHandler.ReceiveChatMessage(ChatChannelType.NaN, fromPlayer, message);
     }
     ChatBox.AddWhisperMessage(fromPlayer, message);
 }
 void ILobbyClientSessionHandler.OnChannelMessageReceived(
     ChatChannelType channel,
     string playerName,
     string message)
 {
     if (this.ChatHandler != null)
     {
         this.ChatHandler.ReceiveChatMessage(channel, playerName, message);
     }
     ChatBox.AddWhisperMessage(playerName, message);
 }
 protected override void OnGameNetworkBegin()
 {
     this.GameLogs = new List <GameLog>();
     this._chatBox = Game.Current.GetGameHandler <ChatBox>();
     GameNetwork.NetworkMessageHandlerRegisterer handlerRegisterer = new GameNetwork.NetworkMessageHandlerRegisterer(GameNetwork.NetworkMessageHandlerRegisterer.RegisterMode.Add);
     if (!GameNetwork.IsServer)
     {
         return;
     }
     handlerRegisterer.Register <PlayerMessageAll>(new GameNetworkMessage.ClientMessageHandlerDelegate <PlayerMessageAll>(this.HandleClientEventPlayerMessageAll));
     handlerRegisterer.Register <PlayerMessageTeam>(new GameNetworkMessage.ClientMessageHandlerDelegate <PlayerMessageTeam>(this.HandleClientEventPlayerMessageTeam));
 }
 private bool ServerPrepareAndSendMessage(
     NetworkCommunicator fromPeer,
     bool toTeamOnly,
     string message)
 {
     if (fromPeer.IsMuted)
     {
         GameNetwork.BeginModuleEventAsServer(fromPeer);
         GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.ServerMessage("str_multiplayer_muted_message", true));
         GameNetwork.EndModuleEventAsServer();
         return(true);
     }
     if (!GameNetwork.IsDedicatedServer && fromPeer != GameNetwork.MyPeer && !this._mutedPlayers.Contains(fromPeer.VirtualPlayer.Id))
     {
         MissionPeer component1 = GameNetwork.MyPeer.GetComponent <MissionPeer>();
         if (component1 == null)
         {
             return(false);
         }
         bool flag;
         if (toTeamOnly)
         {
             if (component1 == null)
             {
                 return(false);
             }
             MissionPeer component2 = fromPeer.GetComponent <MissionPeer>();
             if (component2 == null)
             {
                 return(false);
             }
             flag = component1.Team == component2.Team;
         }
         else
         {
             flag = true;
         }
         if (flag)
         {
             this.OnPlayerMessageReceived(fromPeer, message, toTeamOnly);
         }
     }
     if (toTeamOnly)
     {
         ChatBox.ServerSendMessageToTeam(fromPeer, message);
     }
     else
     {
         ChatBox.ServerSendMessageToEveryone(fromPeer, message);
     }
     return(true);
 }
 protected override void OnGameEnd() => ChatBox._chatBox = (ChatBox)null;
 protected override void OnGameStart() => ChatBox._chatBox = this;