当前位置: 首页>>代码示例>>C#>>正文


C# NetworkConnection.SetMaxDelay方法代码示例

本文整理汇总了C#中UnityEngine.Networking.NetworkConnection.SetMaxDelay方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkConnection.SetMaxDelay方法的具体用法?C# NetworkConnection.SetMaxDelay怎么用?C# NetworkConnection.SetMaxDelay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Networking.NetworkConnection的用法示例。


在下文中一共展示了NetworkConnection.SetMaxDelay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InternalUpdate

 internal void InternalUpdate()
 {
     if (this.m_ServerId == -1 || !NetworkTransport.IsStarted)
     return;
       int num = 0;
       byte error1;
       if (this.m_RelaySlotId != -1)
       {
     NetworkEventType networkEventType = NetworkTransport.ReceiveRelayEventFromHost(this.m_ServerId, out error1);
     if (networkEventType != NetworkEventType.Nothing && LogFilter.logDebug)
       Debug.Log((object) ("NetGroup event:" + (object) networkEventType));
     if (networkEventType == NetworkEventType.ConnectEvent && LogFilter.logDebug)
       Debug.Log((object) "NetGroup server connected");
     if (networkEventType == NetworkEventType.DisconnectEvent && LogFilter.logDebug)
       Debug.Log((object) "NetGroup server disconnected");
       }
       NetworkEventType networkEventType1;
       do
       {
     int connectionId;
     int channelId;
     int receivedSize;
     networkEventType1 = NetworkTransport.ReceiveFromHost(this.m_ServerId, out connectionId, out channelId, this.m_MsgBuffer, (int) (ushort) this.m_MsgBuffer.Length, out receivedSize, out error1);
     if (networkEventType1 != NetworkEventType.Nothing && LogFilter.logDev)
     {
       object[] objArray = new object[6];
       int index1 = 0;
       string str1 = "Server event: host=";
       objArray[index1] = (object) str1;
       int index2 = 1;
       // ISSUE: variable of a boxed type
       __Boxed<int> local1 = (ValueType) this.m_ServerId;
       objArray[index2] = (object) local1;
       int index3 = 2;
       string str2 = " event=";
       objArray[index3] = (object) str2;
       int index4 = 3;
       // ISSUE: variable of a boxed type
       __Boxed<NetworkEventType> local2 = (Enum) networkEventType1;
       objArray[index4] = (object) local2;
       int index5 = 4;
       string str3 = " error=";
       objArray[index5] = (object) str3;
       int index6 = 5;
       // ISSUE: variable of a boxed type
       __Boxed<byte> local3 = (ValueType) error1;
       objArray[index6] = (object) local3;
       Debug.Log((object) string.Concat(objArray));
     }
     switch (networkEventType1)
     {
       case NetworkEventType.DataEvent:
     NetworkConnection conn = this.m_Connections.Get(connectionId);
     if ((int) error1 != 0)
     {
       this.GenerateDataError(conn, (int) error1);
       return;
     }
     NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Incoming, (short) 29, "msg", 1);
     if (conn != null)
     {
       this.m_MsgReader.SeekZero();
       conn.HandleMessage(this.m_MessageHandlers.GetHandlers(), this.m_MsgReader, receivedSize, channelId);
       goto case 3;
     }
     else if (LogFilter.logError)
     {
       Debug.LogError((object) "Unknown connection data event?!?");
       goto case 3;
     }
     else
       goto case 3;
       case NetworkEventType.ConnectEvent:
     if (LogFilter.logDebug)
       Debug.Log((object) ("Server accepted client:" + (object) connectionId));
     if ((int) error1 != 0)
     {
       this.GenerateConnectError((int) error1);
       return;
     }
     string address;
     int port;
     NetworkID network;
     NodeID dstNode;
     byte error2;
     NetworkTransport.GetConnectionInfo(this.m_ServerId, connectionId, out address, out port, out network, out dstNode, out error2);
     NetworkConnection networkConnection = new NetworkConnection();
     networkConnection.Initialize(address, this.m_ServerId, connectionId, this.m_hostTopology);
     networkConnection.SetMaxDelay(this.m_MaxDelay);
     this.m_Connections.Add(connectionId, networkConnection);
     this.m_MessageHandlers.InvokeHandlerNoData((short) 32, networkConnection);
     if (this.m_SendPeerInfo)
       this.SendNetworkInfo(networkConnection);
     this.SendCRC(networkConnection);
     goto case 3;
       case NetworkEventType.DisconnectEvent:
     NetworkConnection @unsafe = this.m_Connections.GetUnsafe(connectionId);
     if ((int) error1 != 0 && (int) error1 != 6)
       this.GenerateDisconnectError(@unsafe, (int) error1);
     this.m_Connections.Remove(connectionId);
//.........这里部分代码省略.........
开发者ID:Kitabalef,项目名称:Unet-Decompiles,代码行数:101,代码来源:NetworkServer.cs

示例2: OnConnected

 private void OnConnected(NetworkConnection conn)
 {
     if (LogFilter.logDebug)
     {
         Debug.Log("Server accepted client:" + conn.connectionId);
     }
     conn.SetMaxDelay(this.m_MaxDelay);
     conn.InvokeHandlerNoData(0x20);
     SendCrc(conn);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:10,代码来源:NetworkServer.cs


注:本文中的UnityEngine.Networking.NetworkConnection.SetMaxDelay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。