예제 #1
0
 void RegisterClientMessages(INetworkPlayer player)
 {
     player.RegisterHandler <SceneMessage>(ClientSceneMessage);
     if (!Client.IsLocalClient)
     {
         player.RegisterHandler <SceneReadyMessage>(ClientSceneReadyMessage);
         player.RegisterHandler <NotReadyMessage>(ClientNotReadyMessage);
     }
 }
예제 #2
0
 private void AddHandlers(NetworkClient client, INetworkPlayer player)
 {
     if (client.IsLocalClient)
     {
         player.RegisterHandler <UpdateVarsMessage>(_ => { });
     }
     else
     {
         player.RegisterHandler <UpdateVarsMessage>(OnUpdateVarsMessage);
     }
 }
예제 #3
0
 /// <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);
     }
 }
예제 #4
0
        public override void OnClientAuthenticate(INetworkPlayer player)
        {
            player.RegisterHandler <AuthResponseMessage>(OnAuthResponseMessage);

            var authRequestMessage = new AuthRequestMessage
            {
                AuthUsername = Username,
                AuthPassword = Password
            };

            player.Send(authRequestMessage);
        }
예제 #5
0
 private void OnServerAuthenticated(INetworkPlayer networkPlayer)
 {
     logger.Log($"[Server][OnServerAuthenticated] {networkPlayer.Connection}");
     _networkPlayers.Add(networkPlayer);
     networkPlayer.RegisterHandler <AddCharacterMessage>(OnServerAddPlayerInternal);
 }
예제 #6
0
 private void OnServerAuthenticated(INetworkPlayer player)
 {
     // wait for client to send us an AddPlayerMessage
     player.RegisterHandler <AddCharacterMessage>(OnServerAddPlayerInternal);
 }
예제 #7
0
 public override void OnServerAuthenticate(INetworkPlayer player)
 {
     // wait for AuthRequestMessage from client
     player.RegisterHandler <AuthRequestMessage>(OnAuthRequestMessage);
 }
예제 #8
0
 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);
 }
예제 #10
0
 public void OnServerAuthenticated(INetworkPlayer player)
 {
     player.RegisterHandler <CreateCharacterMessage>(OnCreatePlayer);
 }