コード例 #1
0
    public override void OnMatchCreate(bool success, string extendedInfo, UnityEngine.Networking.Match.MatchInfo resp)
    {
        base.OnMatchCreate(success, extendedInfo, resp);

        if (!success)
        {
            Debug.LogError("Failed to create Match -> " + extendedInfo);
        }

        m_networkID = (ulong)resp.networkId;
    }
コード例 #2
0
    /// <summary>
    /// ルーム作成通知
    /// </summary>
    public override void OnMatchCreate(bool success, string extendedInfo, UnityEngine.Networking.Match.MatchInfo match)
    {
        base.OnMatchCreate(success, extendedInfo, match);
        IsCreatedMatch = success;

        if (success)
        {
            Debug.Log("Match create succeed");
        }
        else
        {
            Debug.LogWarning("Match create failed");
        }
    }
コード例 #3
0
ファイル: NetworkManager.cs プロジェクト: randomize/VimConfig
 public NetworkClient StartClient(MatchInfo info, ConnectionConfig config)
 {
     this.matchInfo = info;
     if (this.m_RunInBackground)
     {
         Application.runInBackground = true;
     }
     this.isNetworkActive = true;
     this.client = new NetworkClient();
     if (config != null)
     {
         this.client.Configure(config, 1);
     }
     else if (this.m_CustomConfig && (this.m_ConnectionConfig != null))
     {
         this.m_ConnectionConfig.Channels.Clear();
         foreach (QosType type in this.m_Channels)
         {
             this.m_ConnectionConfig.AddChannel(type);
         }
         this.client.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
     }
     this.RegisterClientMessages(this.client);
     if (this.matchInfo != null)
     {
         if (LogFilter.logDebug)
         {
             Debug.Log("NetworkManager StartClient match: " + this.matchInfo);
         }
         this.client.Connect(this.matchInfo);
     }
     else if (this.m_EndPoint != null)
     {
         if (LogFilter.logDebug)
         {
             Debug.Log("NetworkManager StartClient using provided SecureTunnel");
         }
         this.client.Connect(this.m_EndPoint);
     }
     else
     {
         if (string.IsNullOrEmpty(this.m_NetworkAddress))
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("Must set the Network Address field in the manager");
             }
             return null;
         }
         if (LogFilter.logDebug)
         {
             Debug.Log(string.Concat(new object[] { "NetworkManager StartClient address:", this.m_NetworkAddress, " port:", this.m_NetworkPort }));
         }
         if (this.m_UseSimulator)
         {
             this.client.ConnectWithSimulator(this.m_NetworkAddress, this.m_NetworkPort, this.m_SimulatedLatency, this.m_PacketLossPercentage);
         }
         else
         {
             this.client.Connect(this.m_NetworkAddress, this.m_NetworkPort);
         }
     }
     this.OnStartClient(this.client);
     s_Address = this.m_NetworkAddress;
     return this.client;
 }
コード例 #4
0
 public virtual NetworkClient StartHost(MatchInfo info)
 {
     this.OnStartHost();
     this.matchInfo = info;
     if (this.StartServer(info))
     {
         NetworkClient client = this.ConnectLocalClient();
         this.OnStartClient(client);
         return client;
     }
     return null;
 }
コード例 #5
0
 public virtual NetworkClient StartHost(MatchInfo info)
 {
   this.OnStartHost();
   this.matchInfo = info;
   if (!this.StartServer(info))
     return (NetworkClient) null;
   NetworkClient client = this.ConnectLocalClient();
   this.OnServerConnect(client.connection);
   this.OnStartClient(client);
   return client;
 }
コード例 #6
0
 public NetworkClient StartClient(MatchInfo info, ConnectionConfig config)
 {
   this.InitializeSingleton();
   this.matchInfo = info;
   if (this.m_RunInBackground)
     Application.runInBackground = true;
   this.isNetworkActive = true;
   if (this.m_GlobalConfig != null)
     NetworkTransport.Init(this.m_GlobalConfig);
   this.client = new NetworkClient();
   if (config != null)
   {
     if (config.UsePlatformSpecificProtocols && Application.platform != RuntimePlatform.PS4)
       throw new ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
     this.client.Configure(config, 1);
   }
   else if (this.m_CustomConfig && this.m_ConnectionConfig != null)
   {
     this.m_ConnectionConfig.Channels.Clear();
     using (List<QosType>.Enumerator enumerator = this.m_Channels.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         int num = (int) this.m_ConnectionConfig.AddChannel(enumerator.Current);
       }
     }
     if (this.m_ConnectionConfig.UsePlatformSpecificProtocols && Application.platform != RuntimePlatform.PS4)
       throw new ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
     this.client.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
   }
   this.RegisterClientMessages(this.client);
   if (this.matchInfo != null)
   {
     if (LogFilter.logDebug)
       Debug.Log((object) ("NetworkManager StartClient match: " + (object) this.matchInfo));
     this.client.Connect(this.matchInfo);
   }
   else if (this.m_EndPoint != null)
   {
     if (LogFilter.logDebug)
       Debug.Log((object) "NetworkManager StartClient using provided SecureTunnel");
     this.client.Connect(this.m_EndPoint);
   }
   else
   {
     if (string.IsNullOrEmpty(this.m_NetworkAddress))
     {
       if (LogFilter.logError)
         Debug.LogError((object) "Must set the Network Address field in the manager");
       return (NetworkClient) null;
     }
     if (LogFilter.logDebug)
       Debug.Log((object) ("NetworkManager StartClient address:" + this.m_NetworkAddress + " port:" + (object) this.m_NetworkPort));
     if (this.m_UseSimulator)
       this.client.ConnectWithSimulator(this.m_NetworkAddress, this.m_NetworkPort, this.m_SimulatedLatency, this.m_PacketLossPercentage);
     else
       this.client.Connect(this.m_NetworkAddress, this.m_NetworkPort);
   }
   if ((UnityEngine.Object) this.m_MigrationManager != (UnityEngine.Object) null)
     this.m_MigrationManager.Initialize(this.client, this.matchInfo);
   this.OnStartClient(this.client);
   NetworkManager.s_Address = this.m_NetworkAddress;
   return this.client;
 }
コード例 #7
0
 public bool StartServer(MatchInfo info)
 {
   return this.StartServer(info, (ConnectionConfig) null, -1);
 }
コード例 #8
0
        private bool StartServer(MatchInfo info, ConnectionConfig config, int maxConnections)
        {
            this.OnStartServer();

              if (this.m_RunInBackground)
            Application.runInBackground = true;

              // Check if we have been given custom config info and configure server accordingly if so
              if (this.m_CustomConfig && this.m_ConnectionConfig != null && config == null)
              {
            this.m_ConnectionConfig.Channels.Clear();
            using (List<QosType>.Enumerator enumerator = this.m_Channels.GetEnumerator())
            {
              while (enumerator.MoveNext())
              {
            int num = (int) this.m_ConnectionConfig.AddChannel(enumerator.Current);
              }
            }
            NetworkServer.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
              }

              // register server handlers
              this.RegisterServerMessages();

              NetworkServer.sendPeerInfo = this.m_SendPeerInfo; // check if we are to send peer info also

              // if no custom config has been set and a config param was sent in then use that config
              if (config != null)
            NetworkServer.Configure(config, maxConnections);

              // check the MatchInfo param
              if (info != null)
              {
            if (!NetworkServer.Listen(info, this.m_NetworkPort))
            {
              if (LogFilter.logError)
            Debug.LogError((object) "StartServer listen failed.");
              return false;
            }
              }
              else if (!NetworkServer.Listen(this.m_NetworkPort))
              {
            if (LogFilter.logError)
              Debug.LogError((object) "StartServer listen failed.");
            return false;
              }

              if (LogFilter.logDebug)
            Debug.Log((object) ("NetworkManager StartServer port:" + (object) this.m_NetworkPort));

              this.isNetworkActive = true; // set the flag indicating this object is network active
              // transition to the online scene if its name has been set(must be included in build settings before being allowed to be set)
              if (this.m_OnlineScene != string.Empty && this.m_OnlineScene != Application.loadedLevelName && this.m_OnlineScene != this.m_OfflineScene)
            this.ServerChangeScene(this.m_OnlineScene);
              else
            NetworkServer.SpawnObjects();

              return true;
        }
コード例 #9
0
ファイル: NetworkManager.cs プロジェクト: randomize/VimConfig
 public void StopMatchMaker()
 {
     if (this.matchMaker != null)
     {
         UnityEngine.Object.Destroy(this.matchMaker);
         this.matchMaker = null;
     }
     this.matchInfo = null;
     this.matches = null;
 }
コード例 #10
0
 internal NetworkClient BecomeHostInternal(NetworkClient oldClient, int port, MatchInfo matchInfo, int oldConnectionId, PeerInfoMessage[] peers)
 {
     if (s_Active)
     {
         if (LogFilter.logError)
         {
             Debug.LogError("BecomeHost already a server.");
         }
         return null;
     }
     if (!NetworkClient.active)
     {
         if (LogFilter.logError)
         {
             Debug.LogError("BecomeHost NetworkClient not active.");
         }
         return null;
     }
     Configure(hostTopology);
     if (matchInfo == null)
     {
         if (LogFilter.logDev)
         {
             Debug.Log("BecomeHost Listen on " + port);
         }
         if (!Listen(port))
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("BecomeHost bind failed.");
             }
             return null;
         }
     }
     else
     {
         if (LogFilter.logDev)
         {
             Debug.Log("BecomeHost match:" + matchInfo.networkId);
         }
         ListenRelay(matchInfo.address, matchInfo.port, matchInfo.networkId, Utility.GetSourceID(), matchInfo.nodeId);
     }
     foreach (NetworkIdentity identity in ClientScene.objects.Values)
     {
         if ((identity != null) && (identity.gameObject != null))
         {
             NetworkIdentity.AddNetworkId(identity.netId.Value);
             this.m_NetworkScene.SetLocalObject(identity.netId, identity.gameObject, false, false);
             identity.OnStartServer(true);
         }
     }
     if (LogFilter.logDev)
     {
         Debug.Log("NetworkServer BecomeHost done. oldConnectionId:" + oldConnectionId);
     }
     this.RegisterMessageHandlers();
     if (!NetworkClient.RemoveClient(oldClient) && LogFilter.logError)
     {
         Debug.LogError("BecomeHost failed to remove client");
     }
     if (LogFilter.logDev)
     {
         Debug.Log("BecomeHost localClient ready");
     }
     NetworkClient client2 = ClientScene.ReconnectLocalServer();
     ClientScene.Ready(client2.connection);
     ClientScene.SetReconnectId(oldConnectionId, peers);
     ClientScene.AddPlayer(ClientScene.readyConnection, 0);
     return client2;
 }
コード例 #11
0
 public static NetworkClient BecomeHost(NetworkClient oldClient, int port, MatchInfo matchInfo, int oldConnectionId, PeerInfoMessage[] peers)
 {
     return instance.BecomeHostInternal(oldClient, port, matchInfo, oldConnectionId, peers);
 }
コード例 #12
0
 /// <summary>
 /// <para>Callback that happens when a NetworkMatch.JoinMatch request has been processed on the server.</para>
 /// </summary>
 /// <param name="success">Indicates if the request succeeded.</param>
 /// <param name="extendedInfo">A text description for the error if success is false.</param>
 /// <param name="matchInfo">The info for the newly joined match.</param>
 public virtual void OnMatchJoined(bool success, string extendedInfo, MatchInfo matchInfo)
 {
     if (LogFilter.logDebug)
     {
         object[] args = new object[] { success, extendedInfo, matchInfo };
         Debug.LogFormat("NetworkManager OnMatchJoined Success:{0}, ExtendedInfo:{1}, matchInfo:{2}", args);
     }
     if (success)
     {
         this.StartClient(matchInfo);
     }
 }
コード例 #13
0
 /// <summary>
 /// <para>Stops the MatchMaker that the NetworkManager is using.</para>
 /// </summary>
 public void StopMatchMaker()
 {
     if (((this.matchMaker != null) && (this.matchInfo != null)) && ((this.matchInfo.networkId != NetworkID.Invalid) && (this.matchInfo.nodeId != NodeID.Invalid)))
     {
         this.matchMaker.DropConnection(this.matchInfo.networkId, this.matchInfo.nodeId, this.matchInfo.domain, new NetworkMatch.BasicResponseDelegate(this.OnDropConnection));
     }
     if (this.matchMaker != null)
     {
         UnityEngine.Object.Destroy(this.matchMaker);
         this.matchMaker = null;
     }
     this.matchInfo = null;
     this.matches = null;
 }
コード例 #14
0
 private bool StartServer(MatchInfo info, ConnectionConfig config, int maxConnections)
 {
     this.InitializeSingleton();
     this.OnStartServer();
     if (this.m_RunInBackground)
     {
         Application.runInBackground = true;
     }
     NetworkCRC.scriptCRCCheck = this.scriptCRCCheck;
     NetworkServer.useWebSockets = this.m_UseWebSockets;
     if (this.m_GlobalConfig != null)
     {
         NetworkTransport.Init(this.m_GlobalConfig);
     }
     if ((this.m_CustomConfig && (this.m_ConnectionConfig != null)) && (config == null))
     {
         this.m_ConnectionConfig.Channels.Clear();
         for (int i = 0; i < this.m_Channels.Count; i++)
         {
             this.m_ConnectionConfig.AddChannel(this.m_Channels[i]);
         }
         NetworkServer.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
     }
     if (config != null)
     {
         NetworkServer.Configure(config, maxConnections);
     }
     if (info != null)
     {
         if (!NetworkServer.Listen(info, this.m_NetworkPort))
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("StartServer listen failed.");
             }
             return false;
         }
     }
     else if (this.m_ServerBindToIP && !string.IsNullOrEmpty(this.m_ServerBindAddress))
     {
         if (!NetworkServer.Listen(this.m_ServerBindAddress, this.m_NetworkPort))
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("StartServer listen on " + this.m_ServerBindAddress + " failed.");
             }
             return false;
         }
     }
     else if (!NetworkServer.Listen(this.m_NetworkPort))
     {
         if (LogFilter.logError)
         {
             Debug.LogError("StartServer listen failed.");
         }
         return false;
     }
     this.RegisterServerMessages();
     if (LogFilter.logDebug)
     {
         Debug.Log("NetworkManager StartServer port:" + this.m_NetworkPort);
     }
     this.isNetworkActive = true;
     string name = SceneManager.GetSceneAt(0).name;
     if (((this.m_OnlineScene != "") && (this.m_OnlineScene != name)) && (this.m_OnlineScene != this.m_OfflineScene))
     {
         this.ServerChangeScene(this.m_OnlineScene);
     }
     else
     {
         NetworkServer.SpawnObjects();
     }
     return true;
 }
コード例 #15
0
ファイル: NetworkManager.cs プロジェクト: randomize/VimConfig
 public bool StartServer(MatchInfo info)
 {
     return this.StartServer(info, null, -1);
 }
コード例 #16
0
ファイル: NetworkManager.cs プロジェクト: randomize/VimConfig
 private bool StartServer(MatchInfo info, ConnectionConfig config, int maxConnections)
 {
     this.OnStartServer();
     if (this.m_RunInBackground)
     {
         Application.runInBackground = true;
     }
     NetworkCRC.scriptCRCCheck = this.scriptCRCCheck;
     if ((this.m_CustomConfig && (this.m_ConnectionConfig != null)) && (config == null))
     {
         this.m_ConnectionConfig.Channels.Clear();
         foreach (QosType type in this.m_Channels)
         {
             this.m_ConnectionConfig.AddChannel(type);
         }
         NetworkServer.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
     }
     this.RegisterServerMessages();
     NetworkServer.sendPeerInfo = this.m_SendPeerInfo;
     if (config != null)
     {
         NetworkServer.Configure(config, maxConnections);
     }
     if (info != null)
     {
         if (!NetworkServer.Listen(info, this.m_NetworkPort))
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("StartServer listen failed.");
             }
             return false;
         }
     }
     else if (this.m_ServerBindToIP && !string.IsNullOrEmpty(this.m_ServerBindAddress))
     {
         if (!NetworkServer.Listen(this.m_ServerBindAddress, this.m_NetworkPort))
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("StartServer listen on " + this.m_ServerBindAddress + " failed.");
             }
             return false;
         }
     }
     else if (!NetworkServer.Listen(this.m_NetworkPort))
     {
         if (LogFilter.logError)
         {
             Debug.LogError("StartServer listen failed.");
         }
         return false;
     }
     if (LogFilter.logDebug)
     {
         Debug.Log("NetworkManager StartServer port:" + this.m_NetworkPort);
     }
     this.isNetworkActive = true;
     if (((this.m_OnlineScene != string.Empty) && (this.m_OnlineScene != Application.loadedLevelName)) && (this.m_OnlineScene != this.m_OfflineScene))
     {
         this.ServerChangeScene(this.m_OnlineScene);
     }
     else
     {
         NetworkServer.SpawnObjects();
     }
     return true;
 }
コード例 #17
0
 public void Connect(MatchInfo matchInfo)
 {
     this.PrepareForConnect();
       this.ConnectWithRelay(matchInfo);
 }
コード例 #18
0
        // Connections methods return a NetworkClient object, this method connects according to the endpoint being used
        public NetworkClient StartClient(MatchInfo info, ConnectionConfig config)
        {
            this.matchInfo = info;

              if (this.m_RunInBackground)
            Application.runInBackground = true;

              this.isNetworkActive = true;
              this.client = new NetworkClient();
              this.OnStartClient(this.client);

              // if not using a custom config
              if (config != null)
            this.client.Configure(config, 1);
              else if (this.m_CustomConfig && this.m_ConnectionConfig != null) // else using a custom config setup for our clients
              {
            this.m_ConnectionConfig.Channels.Clear();
            using (List<QosType>.Enumerator enumerator = this.m_Channels.GetEnumerator())
            {
              while (enumerator.MoveNext())
              {
            int num = (int) this.m_ConnectionConfig.AddChannel(enumerator.Current);
              }
            }
            this.client.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
              }

              this.RegisterClientMessages(this.client); // register client handlers

              // if a match was sent in then connect to that game
              if (this.matchInfo != null)
              {
            if (LogFilter.logDebug)
              Debug.Log((object) ("NetworkManager StartClient match: " + (object) this.matchInfo));
            this.client.Connect(this.matchInfo);
              }
              else if (this.m_EndPoint != null) // if we are connecting to an endpoint used by something like XboxOne, then connect there
              {
            if (LogFilter.logDebug)
              Debug.Log((object) "NetworkManager StartClient using provided SecureTunnel");
            this.client.Connect(this.m_EndPoint);
              }
              else // we are going to local connect otherwise if address has been set
              {
            if (string.IsNullOrEmpty(this.m_NetworkAddress))
            {
              if (LogFilter.logError)
            Debug.LogError((object) "Must set the Network Address field in the manager");
              return (NetworkClient) null;
            }
            if (LogFilter.logDebug)
            {
              object[] objArray = new object[4];
              int index1 = 0;
              string str1 = "NetworkManager StartClient address:";
              objArray[index1] = (object) str1;
              int index2 = 1;
              string str2 = this.m_NetworkAddress;
              objArray[index2] = (object) str2;
              int index3 = 2;
              string str3 = " port:";
              objArray[index3] = (object) str3;
              int index4 = 3;
              // ISSUE: variable of a boxed type
              __Boxed<int> local = (ValueType) this.m_NetworkPort;
              objArray[index4] = (object) local;
              Debug.Log((object) string.Concat(objArray));
            }

            // if using simulator connect that way, otherwise just complete the local network connect
            if (this.m_UseSimulator)
              this.client.ConnectWithSimulator(this.m_NetworkAddress, this.m_NetworkPort, this.m_SimulatedLatency, this.m_PacketLossPercentage);
            else
              this.client.Connect(this.m_NetworkAddress, this.m_NetworkPort);
              }

              NetworkManager.s_address = this.m_NetworkAddress;

              return this.client;
        }
コード例 #19
0
 private void ConnectWithRelay(MatchInfo info)
 {
     this.m_AsyncConnect = NetworkClient.ConnectState.Connecting;
       this.Update();
       byte error;
       this.m_ClientConnectionId = NetworkTransport.ConnectToNetworkPeer(this.m_ClientId, info.address, info.port, 0, 0, info.networkId, Utility.GetSourceID(), info.nodeId, out error);
       this.m_Connection = new NetworkConnection();
       this.m_Connection.Initialize(info.address, this.m_ClientId, this.m_ClientConnectionId, this.m_hostTopology);
       if (LogFilter.logDebug)
     Debug.Log((object) ("Client Relay Slot Id: " + (object) this.m_RelaySlotId));
       if ((int) error == 0)
     return;
       Debug.LogError((object) ("ConnectToNetworkPeer Error: " + (object) error));
 }
コード例 #20
0
 /// <summary>
 ///   <para>Stops the matchmaker that the NetworkManager is using.</para>
 /// </summary>
 public void StopMatchMaker()
 {
   if ((UnityEngine.Object) this.matchMaker != (UnityEngine.Object) null)
   {
     UnityEngine.Object.Destroy((UnityEngine.Object) this.matchMaker);
     this.matchMaker = (NetworkMatch) null;
   }
   this.matchInfo = (MatchInfo) null;
   this.matches = (List<MatchDesc>) null;
 }
コード例 #21
0
 public static bool Listen(MatchInfo matchInfo, int listenPort)
 {
     if (!matchInfo.usingRelay)
     return NetworkServer.instance.InternalListen(listenPort);
       NetworkServer.instance.InternalListenRelay(matchInfo.address, matchInfo.port, matchInfo.networkId, Utility.GetSourceID(), matchInfo.nodeId, listenPort);
       return true;
 }
コード例 #22
0
 private bool StartServer(MatchInfo info, ConnectionConfig config, int maxConnections)
 {
   this.InitializeSingleton();
   this.OnStartServer();
   if (this.m_RunInBackground)
     Application.runInBackground = true;
   NetworkCRC.scriptCRCCheck = this.scriptCRCCheck;
   NetworkServer.useWebSockets = this.m_UseWebSockets;
   if (this.m_GlobalConfig != null)
     NetworkTransport.Init(this.m_GlobalConfig);
   if (this.m_CustomConfig && this.m_ConnectionConfig != null && config == null)
   {
     this.m_ConnectionConfig.Channels.Clear();
     using (List<QosType>.Enumerator enumerator = this.m_Channels.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         int num = (int) this.m_ConnectionConfig.AddChannel(enumerator.Current);
       }
     }
     NetworkServer.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
   }
   if (config != null)
     NetworkServer.Configure(config, maxConnections);
   if (info != null)
   {
     if (!NetworkServer.Listen(info, this.m_NetworkPort))
     {
       if (LogFilter.logError)
         Debug.LogError((object) "StartServer listen failed.");
       return false;
     }
   }
   else if (this.m_ServerBindToIP && !string.IsNullOrEmpty(this.m_ServerBindAddress))
   {
     if (!NetworkServer.Listen(this.m_ServerBindAddress, this.m_NetworkPort))
     {
       if (LogFilter.logError)
         Debug.LogError((object) ("StartServer listen on " + this.m_ServerBindAddress + " failed."));
       return false;
     }
   }
   else if (!NetworkServer.Listen(this.m_NetworkPort))
   {
     if (LogFilter.logError)
       Debug.LogError((object) "StartServer listen failed.");
     return false;
   }
   this.RegisterServerMessages();
   if (LogFilter.logDebug)
     Debug.Log((object) ("NetworkManager StartServer port:" + (object) this.m_NetworkPort));
   this.isNetworkActive = true;
   string name = SceneManager.GetSceneAt(0).name;
   if (this.m_OnlineScene != string.Empty && this.m_OnlineScene != name && this.m_OnlineScene != this.m_OfflineScene)
     this.ServerChangeScene(this.m_OnlineScene);
   else
     NetworkServer.SpawnObjects();
   return true;
 }
コード例 #23
0
 /// <summary>
 ///   <para>Used to initialize the migration manager with client and match information.</para>
 /// </summary>
 /// <param name="newClient">The NetworkClient being used to connect to the host.</param>
 /// <param name="newMatchInfo">Information about the match being used. This may be null if there is no match.</param>
 public void Initialize(NetworkClient newClient, MatchInfo newMatchInfo)
 {
   if (LogFilter.logDev)
     Debug.Log((object) "NetworkMigrationManager initialize");
   this.m_Client = newClient;
   this.m_MatchInfo = newMatchInfo;
   newClient.RegisterHandlerSafe((short) 11, new NetworkMessageDelegate(this.OnPeerInfo));
   newClient.RegisterHandlerSafe((short) 17, new NetworkMessageDelegate(this.OnPeerClientAuthority));
   NetworkIdentity.clientAuthorityCallback = new NetworkIdentity.ClientAuthorityCallback(this.AssignAuthorityCallback);
 }
コード例 #24
0
 public NetworkClient StartClient(MatchInfo matchInfo)
 {
   return this.StartClient(matchInfo, (ConnectionConfig) null);
 }
コード例 #25
0
ファイル: NetworkManager.cs プロジェクト: randomize/VimConfig
 public NetworkClient StartClient(MatchInfo matchInfo)
 {
     return this.StartClient(matchInfo, null);
 }
コード例 #26
0
ファイル: LobbyManager.cs プロジェクト: thrigby/Bookiboo
 public override void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
 {
     base.OnMatchCreate(success, extendedInfo, matchInfo);
     _currentMatchID = (System.UInt64)matchInfo.networkId;
 }
コード例 #27
0
 public NetworkClient StartClient(MatchInfo info, ConnectionConfig config)
 {
     this.InitializeSingleton();
     this.matchInfo = info;
     if (this.m_RunInBackground)
     {
         Application.runInBackground = true;
     }
     this.isNetworkActive = true;
     if (this.m_GlobalConfig != null)
     {
         NetworkTransport.Init(this.m_GlobalConfig);
     }
     this.client = new NetworkClient();
     if (config != null)
     {
         if ((config.UsePlatformSpecificProtocols && (Application.platform != RuntimePlatform.PS4)) && (Application.platform != RuntimePlatform.PSP2))
         {
             throw new ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
         }
         this.client.Configure(config, 1);
     }
     else if (this.m_CustomConfig && (this.m_ConnectionConfig != null))
     {
         this.m_ConnectionConfig.Channels.Clear();
         for (int i = 0; i < this.m_Channels.Count; i++)
         {
             this.m_ConnectionConfig.AddChannel(this.m_Channels[i]);
         }
         if ((this.m_ConnectionConfig.UsePlatformSpecificProtocols && (Application.platform != RuntimePlatform.PS4)) && (Application.platform != RuntimePlatform.PSP2))
         {
             throw new ArgumentOutOfRangeException("Platform specific protocols are not supported on this platform");
         }
         this.client.Configure(this.m_ConnectionConfig, this.m_MaxConnections);
     }
     this.RegisterClientMessages(this.client);
     if (this.matchInfo != null)
     {
         if (LogFilter.logDebug)
         {
             Debug.Log("NetworkManager StartClient match: " + this.matchInfo);
         }
         this.client.Connect(this.matchInfo);
     }
     else if (this.m_EndPoint != null)
     {
         if (LogFilter.logDebug)
         {
             Debug.Log("NetworkManager StartClient using provided SecureTunnel");
         }
         this.client.Connect(this.m_EndPoint);
     }
     else
     {
         if (string.IsNullOrEmpty(this.m_NetworkAddress))
         {
             if (LogFilter.logError)
             {
                 Debug.LogError("Must set the Network Address field in the manager");
             }
             return null;
         }
         if (LogFilter.logDebug)
         {
             Debug.Log(string.Concat(new object[] { "NetworkManager StartClient address:", this.m_NetworkAddress, " port:", this.m_NetworkPort }));
         }
         if (this.m_UseSimulator)
         {
             this.client.ConnectWithSimulator(this.m_NetworkAddress, this.m_NetworkPort, this.m_SimulatedLatency, this.m_PacketLossPercentage);
         }
         else
         {
             this.client.Connect(this.m_NetworkAddress, this.m_NetworkPort);
         }
     }
     if (this.m_MigrationManager != null)
     {
         this.m_MigrationManager.Initialize(this.client, this.matchInfo);
     }
     this.OnStartClient(this.client);
     s_Address = this.m_NetworkAddress;
     return this.client;
 }