Inheritance: MessageBase
 public static NetSystem.StringMessage GetStringMessage(string value)
 {
     if (_stringMessage == null)
     {
         _stringMessage = new NetSystem.StringMessage();
     }
     _stringMessage.value = value; return(_stringMessage);
 }
Beispiel #2
0
        public void SendChatMessage(string msg)
        {
            StringMessage strMsg = new StringMessage(msg);
            Debug.Log("input box:" + inputBox.text);

            if (isServer)
            {
                NetworkServer.SendToAll(CHAT_MSG, strMsg); // Send to all clients
            }
            else if (client.isConnected)
            {
                client.Send(CHAT_MSG, strMsg); // Sending message from client to server
                inputBox.text = string.Empty;
            }
        }
 internal void OnServerConnectInternal(NetworkMessage netMsg)
 {
   if (LogFilter.logDebug)
     Debug.Log((object) "NetworkManager:OnServerConnectInternal");
   netMsg.conn.SetMaxDelay(this.m_MaxDelay);
   if (NetworkManager.networkSceneName != string.Empty && NetworkManager.networkSceneName != this.m_OfflineScene)
   {
     StringMessage stringMessage = new StringMessage(NetworkManager.networkSceneName);
     netMsg.conn.Send((short) 39, (MessageBase) stringMessage);
   }
   if ((UnityEngine.Object) this.m_MigrationManager != (UnityEngine.Object) null)
     this.m_MigrationManager.SendPeerInfo();
   this.OnServerConnect(netMsg.conn);
 }
Beispiel #4
0
 public virtual void ServerChangeScene(string newSceneName)
 {
     if (string.IsNullOrEmpty(newSceneName))
     {
         if (LogFilter.logError)
         {
             Debug.LogError("ServerChangeScene empty scene name");
         }
     }
     else
     {
         if (LogFilter.logDebug)
         {
             Debug.Log("ServerChangeScene " + newSceneName);
         }
         NetworkServer.SetAllClientsNotReady();
         networkSceneName = newSceneName;
         s_LoadingSceneAsync = Application.LoadLevelAsync(newSceneName);
         StringMessage msg = new StringMessage(networkSceneName);
         NetworkServer.SendToAll(0x27, msg);
         s_StartPositionIndex = 0;
         s_StartPositions.Clear();
     }
 }
Beispiel #5
0
 internal void OnServerConnectInternal(NetworkMessage netMsg)
 {
     if (LogFilter.logDebug)
     {
         Debug.Log("NetworkManager:OnServerConnectInternal");
     }
     netMsg.conn.SetMaxDelay(this.m_MaxDelay);
     if ((networkSceneName != string.Empty) && (networkSceneName != this.m_OfflineScene))
     {
         StringMessage msg = new StringMessage(networkSceneName);
         netMsg.conn.Send(0x27, msg);
     }
     this.OnServerConnect(netMsg.conn);
 }
 internal void OnServerConnectInternal(NetworkMessage netMsg)
 {
     if (LogFilter.logDebug)
     {
         Debug.Log("NetworkManager:OnServerConnectInternal");
     }
     netMsg.conn.SetMaxDelay(this.m_MaxDelay);
     if (this.m_MaxBufferedPackets != 0x200)
     {
         for (int i = 0; i < NetworkServer.numChannels; i++)
         {
             netMsg.conn.SetChannelOption(i, ChannelOption.MaxPendingBuffers, this.m_MaxBufferedPackets);
         }
     }
     if (!this.m_AllowFragmentation)
     {
         for (int j = 0; j < NetworkServer.numChannels; j++)
         {
             netMsg.conn.SetChannelOption(j, ChannelOption.AllowFragmentation, 0);
         }
     }
     if ((networkSceneName != "") && (networkSceneName != this.m_OfflineScene))
     {
         StringMessage msg = new StringMessage(networkSceneName);
         netMsg.conn.Send(0x27, msg);
     }
     if (this.m_MigrationManager != null)
     {
         this.m_MigrationManager.SendPeerInfo();
     }
     this.OnServerConnect(netMsg.conn);
 }