コード例 #1
0
ファイル: World.cs プロジェクト: DarkRiftNetworking/DarkRift
        /// <summary>
        ///     Handles a server joining a group.
        /// </summary>
        /// <param name="sender">The <see cref="ServerManager"/></param>
        /// <param name="e">The event args.</param>
        /// <param name="serverID">The ID of the server the server connected to.</param>
        private void ServerJoinedGroup(object sender, ServerJoinedEventArgs e, ushort serverID)
        {
            e.RemoteServer.MessageReceived    += (s, a) => ServerMessageReceivedFromServer(s, a, serverID);
            e.RemoteServer.ServerConnected    += (s, a) => ServerConnected(s, a, serverID);
            e.RemoteServer.ServerDisconnected += ServerDisconnected;

            ServerJoined.Invoke(sender, e);
        }
コード例 #2
0
        private void ServerJoined(object sender, ServerJoinedEventArgs e)
        {
#if DEBUG
            // We've just requested a load of objects that wont be returned until we disconnect the servers again
            // UDP receive TCP receive in the connecting server; TCP receive in listening server
            // Only do this once, this event will be fired from both the upstream and downstream server
            if (e.ServerGroup.Direction == ServerConnectionDirection.Downstream)
            {
                performanceSteps.ExpectedUnaccountedForSocketAsyncEventArgs += 3;
            }
#endif
        }
コード例 #3
0
        private static void Networker_Joined(object sender, ServerJoinedEventArgs e)
        {
            if (CupboardApp.Networker.Hosting)
            {
                OldContext.ShowNotification("Success", $"{e.RemoteEndPoint.Address}:{e.RemoteEndPoint.Port} has joined.", duration: 3);
                GameNetworking.Sync(CupboardApp.Networker);
            }
            else
            {
                OldContext.ShowNotification("Success", $"Joined server {e.RemoteEndPoint.Address}:{e.RemoteEndPoint.Port}", duration: 3);

                var joinButton = Scene.Current.FindComponents <Button>().Where(x => x.Command == "Cancel").FirstOrDefault();
                joinButton.Command = "Join";

                Scene.SwitchTo(_gameScene);
            }
        }
コード例 #4
0
 private void _client_Joined(object sender, ServerJoinedEventArgs e)
 {
     Console?.Success.WriteLine($"Joined {e.Server.Name} on {e.Server.EndPoint.Address}:{e.Server.EndPoint.Port}");
 }