void RegisterClientMessages(INetworkPlayer player) { player.RegisterHandler <SceneMessage>(ClientSceneMessage); if (!Client.IsLocalClient) { player.RegisterHandler <SceneReadyMessage>(ClientSceneReadyMessage); player.RegisterHandler <NotReadyMessage>(ClientNotReadyMessage); } }
private void AddHandlers(NetworkClient client, INetworkPlayer player) { if (client.IsLocalClient) { player.RegisterHandler <UpdateVarsMessage>(_ => { }); } else { player.RegisterHandler <UpdateVarsMessage>(OnUpdateVarsMessage); } }
/// <summary> /// <para>This accepts a network connection and adds it to the server.</para> /// <para>This connection will use the callbacks registered with the server.</para> /// </summary> /// <param name="player">Network connection to add.</param> public void AddConnection(INetworkPlayer player) { if (!Players.Contains(player)) { // connection cannot be null here or conn.connectionId // would throw NRE Players.Add(player); player.RegisterHandler <NetworkPingMessage>(Time.OnServerPing); } }
public override void OnClientAuthenticate(INetworkPlayer player) { player.RegisterHandler <AuthResponseMessage>(OnAuthResponseMessage); var authRequestMessage = new AuthRequestMessage { AuthUsername = Username, AuthPassword = Password }; player.Send(authRequestMessage); }
private void OnServerAuthenticated(INetworkPlayer networkPlayer) { logger.Log($"[Server][OnServerAuthenticated] {networkPlayer.Connection}"); _networkPlayers.Add(networkPlayer); networkPlayer.RegisterHandler <AddCharacterMessage>(OnServerAddPlayerInternal); }
private void OnServerAuthenticated(INetworkPlayer player) { // wait for client to send us an AddPlayerMessage player.RegisterHandler <AddCharacterMessage>(OnServerAddPlayerInternal); }
public override void OnServerAuthenticate(INetworkPlayer player) { // wait for AuthRequestMessage from client player.RegisterHandler <AuthRequestMessage>(OnAuthRequestMessage); }
internal void RegisterMessageHandlers(INetworkPlayer player) { player.RegisterHandler <ReadyMessage>(OnClientReadyMessage); player.RegisterHandler <ServerRpcMessage>(OnServerRpcMessage); }
private void OnServerAuthenticated(INetworkPlayer player) { player.RegisterHandler <AddCharacterMessage>(OnServerAddPlayerInternal); player.RegisterHandler <CustomMessage>(OnServerHandleCustomMessage); }
public void OnServerAuthenticated(INetworkPlayer player) { player.RegisterHandler <CreateCharacterMessage>(OnCreatePlayer); }