예제 #1
0
 void onVoiceCommand(VoicePaketCommand args, NetPeer peer)
 {
     try
     {
         VoicePlugin.Log("VoiceCommand {0} => {1}", args.Command, args.Data);
         if (args.Command == "DISCONNECT")
         {
             _needConnection = false;
             var Connection = Client.GetFirstPeer();
             Connection?.Disconnect();
             Connection = null;
             var con = VoicePlugin.GetConnection(_connectionInfo.ServerGUID);
             if (con != null)
             {
                 con.DisconnectVoiceServer();
             }
             OnDisconnected?.Invoke(this, this);
             return;
         }
         if (args.Command == "SETNAME")
         {
             var con = VoicePlugin.GetConnection(_connectionInfo.ServerGUID);
             if (con != null)
             {
                 con.ConnectVoiceServer(args.Data);
             }
         }
     }
     catch (Exception ex)
     {
         VoicePlugin.Log(ex.ToString());
     }
 }
예제 #2
0
 void OnVoiceCommand(VoicePaketCommand args, NetPeer peer)
 {
     Logger.Debug("VoiceCommand {0}", args.Command);
     VoiceClientCommand?.Invoke(peer.ConnectId, args.Command, args.Data);
 }