High level UNET client.
public static void OnStartClient(NetworkClient client) { client.RegisterHandler(VoiceChatMsgType.Packet, OnClientPacketReceived); client.RegisterHandler(VoiceChatMsgType.SpawnProxy, OnProxySpawned); var prefab = Resources.Load<GameObject>(ProxyPrefabPath); ClientScene.RegisterPrefab(prefab); }
// Create a client and connect to the server port public void SetupClient() { ClientScene.RegisterPrefab(Prefab); client = new NetworkClient(); client.RegisterHandler(MsgType.Connect, OnConnected); client.Connect("127.0.0.1", 4444); }
private void Start() { var appManager = ApplicationManager.Instance; _messageBus = appManager.GetService<IMessageBus>(); _client = NetworkManager.singleton.client; _editorController = new EditorController(appManager.GetService<ITileModelEditor>()); SubscribeToLocalEvents(); SubscribeToNetworkEvents(); }
public static void RegisterClientPacketHandlers(NetworkClient client) { client.RegisterHandler((short)PacketType.SetPlayerID, PHSetPlayerID); client.RegisterHandler((short)PacketType.SendMapInfo, PHReceiveMap); client.RegisterHandler((short)PacketType.PlayerNotReady, PHPlayerNotReady); client.RegisterHandler((short)PacketType.BroadcastPlayerName, PHBroadcastPlayerName); client.RegisterHandler((short)PacketType.BroadcastPlayerTeam, PHBroadcastPlayerTeam); client.RegisterHandler((short)PacketType.PlayerPrepared, PHPlayerPrepared); Debug.Log("Client Packet Handlers registered"); }
public static void OnManagerStartClient(NetworkClient client, GameObject customPrefab = null) { client.RegisterHandler(VoiceChatMsgType.Packet, OnClientPacketReceived); client.RegisterHandler(VoiceChatMsgType.SpawnProxy, OnProxySpawned); if (customPrefab == null) { proxyPrefab = Resources.Load<GameObject>(ProxyPrefabPath); } else { proxyPrefab = customPrefab; } ClientScene.RegisterPrefab(proxyPrefab); }
// CONSTRUCTOR public Client(NetworkingInfo netinfo) { networkingInfo = netinfo; if(networkingInfo.port == -1) networkingInfo.port = NetworkingInfo.defaultPort; if(networkingInfo.address == "") networkingInfo.address = NetworkingInfo.defaultAddress; // TODO: Add some kind of DNS pre check for IP? connectedPlayers = new List<Player>(); config = new ConnectionConfig(); Channels.priority = config.AddChannel(QosType.AllCostDelivery); Channels.reliable = config.AddChannel(QosType.ReliableSequenced); Channels.unreliable = config.AddChannel(QosType.UnreliableSequenced); Channels.fragmented = config.AddChannel(QosType.ReliableFragmented); Channels.update = config.AddChannel(QosType.StateUpdate); hostconfig = new HostTopology(config, maxConcurrentConnectedUsers); if(networkingInfo.isServer) { myClient = ClientScene.ConnectLocalServer(); myClient.Configure(hostconfig); myClient.RegisterHandler(MsgType.Connect, OnConnected); myClient.RegisterHandler(MsgType.Disconnect, ConnectionFailed); registerAllCallbacks(myClient, cbClientHandler); } else { myClient = new NetworkClient(); myClient.Configure(hostconfig); myClient.RegisterHandler(MsgType.Connect, OnConnected); myClient.RegisterHandler(MsgType.Error, ConnectionError); myClient.RegisterHandler(MsgType.Disconnect, ConnectionFailed); registerAllCallbacks(myClient, cbClientHandler); common.printConsole (tag, "Setup complete", true); myClient.Connect(networkingInfo.address, networkingInfo.port); common.printConsole (tag, "Connecting to " + networkingInfo.address + ":" + networkingInfo.port, true); } }
/// <summary> /// /// <para> /// This is called on the client when a client is started. /// </para> /// /// </summary> /// <param name="client"/> public virtual void OnLobbyStartClient(NetworkClient client) { }
/// <summary> /// <para>Stops the client that the manager is using.</para> /// </summary> public void StopClient() { this.OnStopClient(); if (LogFilter.logDebug) Debug.Log((object) "NetworkManager StopClient"); this.isNetworkActive = false; if (this.client != null) { this.client.Disconnect(); this.client.Shutdown(); this.client = (NetworkClient) null; } this.StopMatchMaker(); ClientScene.DestroyAllClientObjects(); if (!(this.m_OfflineScene != string.Empty)) return; this.ClientChangeScene(this.m_OfflineScene, false); }
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; }
internal void RegisterClientMessages(NetworkClient client) { client.RegisterHandler((short) 32, new NetworkMessageDelegate(this.OnClientConnectInternal)); client.RegisterHandler((short) 33, new NetworkMessageDelegate(this.OnClientDisconnectInternal)); client.RegisterHandler((short) 36, new NetworkMessageDelegate(this.OnClientNotReadyMessageInternal)); client.RegisterHandler((short) 34, new NetworkMessageDelegate(this.OnClientErrorInternal)); client.RegisterHandler((short) 39, new NetworkMessageDelegate(this.OnClientSceneInternal)); if ((UnityEngine.Object) this.m_PlayerPrefab != (UnityEngine.Object) null) ClientScene.RegisterPrefab(this.m_PlayerPrefab); using (List<GameObject>.Enumerator enumerator = this.m_SpawnPrefabs.GetEnumerator()) { while (enumerator.MoveNext()) { GameObject current = enumerator.Current; if ((UnityEngine.Object) current != (UnityEngine.Object) null) ClientScene.RegisterPrefab(current); } } }
private NetworkClient ConnectLocalClient() { if (LogFilter.logDebug) Debug.Log((object) ("NetworkManager StartHost port:" + (object) this.m_NetworkPort)); this.m_NetworkAddress = "localhost"; this.client = ClientScene.ConnectLocalServer(); this.RegisterClientMessages(this.client); return this.client; }
/// <summary> /// /// <para> /// Stops the client that the manager is using. /// </para> /// /// </summary> public void StopClient() { this.OnStopClient(); if (LogFilter.logDebug) Debug.Log((object) "NetworkManager StopClient"); this.isNetworkActive = false; if (this.client != null) { this.client.Disconnect(); this.client.Shutdown(); this.client = (NetworkClient) null; } this.StopMatchMaker(); ClientScene.DestroyAllClientObjects(); // cleans up all network objects on this clients game, not just this clients objects if (this.m_OfflineScene != string.Empty) this.ClientChangeScene(this.m_OfflineScene, false); NetworkClient.ShutdownAll(); }
private void OnClientStart(NetworkClient client) { client.RegisterHandler(MessageIDs.PlayerInfoRequest, OnPlayerInfoRequest); client.RegisterHandler(MessageIDs.PlayerInfoUpdate, OnPlayerInfoUpdate); _net_mgr.ClientConnect += OnClientConnect; _net_mgr.ClientDisconnect += OnClientDisconnect; }
internal static void RegisterSystemHandlers(NetworkClient client, bool localClient) { if (localClient) { client.RegisterHandlerSafe((short) 1, new NetworkMessageDelegate(ClientScene.OnLocalClientObjectDestroy)); client.RegisterHandlerSafe((short) 13, new NetworkMessageDelegate(ClientScene.OnLocalClientObjectHide)); client.RegisterHandlerSafe((short) 3, new NetworkMessageDelegate(ClientScene.OnLocalClientObjectSpawn)); client.RegisterHandlerSafe((short) 10, new NetworkMessageDelegate(ClientScene.OnLocalClientObjectSpawnScene)); client.RegisterHandlerSafe((short) 15, new NetworkMessageDelegate(ClientScene.OnClientAuthority)); } else { client.RegisterHandlerSafe((short) 3, new NetworkMessageDelegate(ClientScene.OnObjectSpawn)); client.RegisterHandlerSafe((short) 10, new NetworkMessageDelegate(ClientScene.OnObjectSpawnScene)); client.RegisterHandlerSafe((short) 12, new NetworkMessageDelegate(ClientScene.OnObjectSpawnFinished)); client.RegisterHandlerSafe((short) 1, new NetworkMessageDelegate(ClientScene.OnObjectDestroy)); client.RegisterHandlerSafe((short) 13, new NetworkMessageDelegate(ClientScene.OnObjectDestroy)); client.RegisterHandlerSafe((short) 8, new NetworkMessageDelegate(ClientScene.OnUpdateVarsMessage)); client.RegisterHandlerSafe((short) 4, new NetworkMessageDelegate(ClientScene.OnOwnerMessage)); client.RegisterHandlerSafe((short) 9, new NetworkMessageDelegate(ClientScene.OnSyncListMessage)); client.RegisterHandlerSafe((short) 40, new NetworkMessageDelegate(NetworkAnimator.OnAnimationClientMessage)); client.RegisterHandlerSafe((short) 41, new NetworkMessageDelegate(NetworkAnimator.OnAnimationParametersClientMessage)); client.RegisterHandlerSafe((short) 15, new NetworkMessageDelegate(ClientScene.OnClientAuthority)); } client.RegisterHandlerSafe((short) 2, new NetworkMessageDelegate(ClientScene.OnRPCMessage)); client.RegisterHandlerSafe((short) 7, new NetworkMessageDelegate(ClientScene.OnSyncEventMessage)); client.RegisterHandlerSafe((short) 42, new NetworkMessageDelegate(NetworkAnimator.OnAnimationTriggerClientMessage)); }
// =========================================================================== // ========================= UTILITY FUNCTIONS ========================= // =========================================================================== void registerAllCallbacks ( NetworkClient nc, NetworkMessageDelegate nmd ) { foreach (Message.ID MsgId in System.Enum.GetValues(typeof(Message.ID))) // Register all the callbacks nc.RegisterHandler((short)MsgId, nmd); }
private static void RegisterClientPrefabsNStuff(On.RoR2.Networking.GameNetworkManager.orig_OnStartClient orig, RoR2.Networking.GameNetworkManager self, UnityEngine.Networking.NetworkClient newClient) { orig(self, newClient); foreach (HashStruct h in thingsToHash) { if (h.prefab.HasComponent <NetworkIdentity>()) { h.prefab.GetComponent <NetworkIdentity>().SetFieldValue <NetworkHash128>("m_AssetId", nullHash); } ClientScene.RegisterPrefab(h.prefab, NetworkHash128.Parse(MakeHash(h.goName + h.callPath + h.callMember + h.callLine.ToString()))); } }
// 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; }
void OnStartClient(NetworkClient client) { networkManager.OnStartClient (client); joining = true; }
// This provided NetManager accounts for a client, server, or host. Register handlers for a client here using the NetworkClient field internal void RegisterClientMessages(NetworkClient client) { client.RegisterHandler((short) 32, new NetworkMessageDelegate(this.OnClientConnectInternal)); client.RegisterHandler((short) 33, new NetworkMessageDelegate(this.OnClientDisconnectInternal)); client.RegisterHandler((short) 36, new NetworkMessageDelegate(this.OnClientNotReadyMessageInternal)); client.RegisterHandler((short) 34, new NetworkMessageDelegate(this.OnClientErrorInternal)); client.RegisterHandler((short) 39, new NetworkMessageDelegate(this.OnClientSceneInternal)); // handle the registering of the clients prefab also so it doesnt need to be done manually from separate client code if ((UnityEngine.Object) this.m_PlayerPrefab != (UnityEngine.Object) null) ClientScene.RegisterPrefab(this.m_PlayerPrefab); // Also register any prefabs added in the inspector so they are included in the game for the client, no manual client code also needed using (List<GameObject>.Enumerator enumerator = this.m_SpawnPrefabs.GetEnumerator()) { while (enumerator.MoveNext()) { GameObject current = enumerator.Current; if ((UnityEngine.Object) current != (UnityEngine.Object) null) ClientScene.RegisterPrefab(current); } } }
/// <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); }
// used in Update to complete loading of a scene private void FinishLoadScene() { if (this.client == null) { if (LogFilter.logDebug) Debug.LogWarning((object) "FinishLoadScene client is null"); if (NetworkClient.allClients.Count > 0) this.client = NetworkClient.allClients[0]; } if (this.client != null) { if (NetworkManager.s_ClientReadyConnection != null) { this.OnClientConnect(NetworkManager.s_ClientReadyConnection); NetworkManager.s_ClientReadyConnection = (NetworkConnection) null; } } else if (LogFilter.logDev) Debug.Log((object) "FinishLoadScene client is STILL null"); if (NetworkServer.active) { NetworkServer.SpawnObjects(); this.OnServerSceneChanged(NetworkManager.networkSceneName); } if (!NetworkClient.active || NetworkServer.active) ; if (!NetworkClient.active) return; this.RegisterClientMessages(this.client); this.OnClientSceneChanged(this.client.connection); }
// Client Message Handlers override public void OnStartClient(NetworkClient client) { base.OnStartClient(client); ClientStarted(client); _is_singleplayer = false; _is_client = true; }
/// <summary> /// <para>This allows the NetworkManager to use a client object created externally to the NetworkManager instead of using StartClient().</para> /// </summary> /// <param name="externalClient">The NetworkClient object to use.</param> public void UseExternalClient(NetworkClient externalClient) { if (this.m_RunInBackground) Application.runInBackground = true; if (externalClient != null) { this.client = externalClient; this.isNetworkActive = true; this.RegisterClientMessages(this.client); this.OnStartClient(this.client); } else { this.OnStopClient(); ClientScene.DestroyAllClientObjects(); ClientScene.HandleClientDisconnect(this.client.connection); this.client = (NetworkClient) null; if (this.m_OfflineScene != string.Empty) this.ClientChangeScene(this.m_OfflineScene, false); } NetworkManager.s_Address = this.m_NetworkAddress; }
internal void RegisterClientMessages(NetworkClient client) { client.RegisterHandler(0x20, new NetworkMessageDelegate(this.OnClientConnectInternal)); client.RegisterHandler(0x21, new NetworkMessageDelegate(this.OnClientDisconnectInternal)); client.RegisterHandler(0x24, new NetworkMessageDelegate(this.OnClientNotReadyMessageInternal)); client.RegisterHandler(0x22, new NetworkMessageDelegate(this.OnClientErrorInternal)); client.RegisterHandler(0x27, new NetworkMessageDelegate(this.OnClientSceneInternal)); if (this.m_PlayerPrefab != null) { ClientScene.RegisterPrefab(this.m_PlayerPrefab); } foreach (GameObject obj2 in this.m_SpawnPrefabs) { if (obj2 != null) { ClientScene.RegisterPrefab(obj2); } } }
private NetworkClient ConnectLocalClient() { if (LogFilter.logDebug) Debug.Log((object) ("NetworkManager StartHost port:" + (object) this.m_NetworkPort)); this.m_NetworkAddress = "localhost"; this.client = ClientScene.ConnectLocalServer(); this.RegisterClientMessages(this.client); if ((UnityEngine.Object) this.m_MigrationManager != (UnityEngine.Object) null) this.m_MigrationManager.Initialize(this.client, this.matchInfo); return this.client; }
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; }
/// <summary> /// Called on every client after connecting to a server. /// </summary> /// <param name="client"></param> public override void OnStartClient(NetworkClient client) { base.OnStartClient(client); // Register our custom game player prefabs with the client scene foreach (var prefab in playerPrefabs) ClientScene.RegisterPrefab(prefab); }
public override void OnStartClient(NetworkClient lobbyClient) { if (this.lobbySlots.Length == 0) { this.lobbySlots = new NetworkLobbyPlayer[this.maxPlayers]; } if ((this.m_LobbyPlayerPrefab == null) || (this.m_LobbyPlayerPrefab.gameObject == null)) { if (LogFilter.logError) { Debug.LogError("NetworkLobbyManager no LobbyPlayer prefab is registered. Please add a LobbyPlayer prefab."); } } else { ClientScene.RegisterPrefab(this.m_LobbyPlayerPrefab.gameObject); } if (this.m_GamePlayerPrefab == null) { if (LogFilter.logError) { Debug.LogError("NetworkLobbyManager no GamePlayer prefab is registered. Please add a GamePlayer prefab."); } } else { ClientScene.RegisterPrefab(this.m_GamePlayerPrefab); } lobbyClient.RegisterHandler(0x2b, new NetworkMessageDelegate(this.OnClientReadyToBegin)); lobbyClient.RegisterHandler(0x2d, new NetworkMessageDelegate(this.OnClientAddPlayerFailedMessage)); this.OnLobbyStartClient(lobbyClient); }
public override void OnStartClient(NetworkClient client) { if (this.lobbySlots.Length == 0) this.lobbySlots = new NetworkLobbyPlayer[this.maxPlayers]; if ((UnityEngine.Object) this.m_LobbyPlayerPrefab == (UnityEngine.Object) null || (UnityEngine.Object) this.m_LobbyPlayerPrefab.gameObject == (UnityEngine.Object) null) { if (LogFilter.logError) Debug.LogError((object) "NetworkLobbyManager no LobbyPlayer prefab is registered. Please add a LobbyPlayer prefab."); } else ClientScene.RegisterPrefab(this.m_LobbyPlayerPrefab.gameObject); if ((UnityEngine.Object) this.m_GamePlayerPrefab == (UnityEngine.Object) null) { if (LogFilter.logError) Debug.LogError((object) "NetworkLobbyManager no GamePlayer prefab is registered. Please add a GamePlayer prefab."); } else ClientScene.RegisterPrefab(this.m_GamePlayerPrefab); client.RegisterHandler((short) 43, new NetworkMessageDelegate(this.OnClientReadyToBegin)); client.RegisterHandler((short) 45, new NetworkMessageDelegate(this.OnClientAddPlayerFailedMessage)); this.OnLobbyStartClient(client); }
public override void OnStartClient(NetworkClient client) { VoiceChatNetworkProxy.OnManagerStartClient(client); gameObject.AddComponent<VoiceChatUi>(); }
void Start() { NetworkManager netManager = FindObjectOfType<NetworkManager>(); if (netManager == null) return; Debug.Log("found netManager"); client = netManager.client; if (client.isConnected) client.RegisterHandler(CHAT_MSG, ClientReceiveChatMessage); if (isServer) NetworkServer.RegisterHandler(CHAT_MSG, ServerReceiveChatMessage); }
public virtual void OnLobbyStartClient(NetworkClient lobbyClient) { }