當前位置: 首頁>>代碼示例>>C#>>正文


C# NetworkClient.Disconnect方法代碼示例

本文整理匯總了C#中NetworkClient.Disconnect方法的典型用法代碼示例。如果您正苦於以下問題:C# NetworkClient.Disconnect方法的具體用法?C# NetworkClient.Disconnect怎麽用?C# NetworkClient.Disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NetworkClient的用法示例。


在下文中一共展示了NetworkClient.Disconnect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DoStep

        public bool DoStep(NetworkClient networkClient, GameClient client)
        {
            //Get game servers list
            List<object> gameServersList = client.AdditionalData[ObjectPropertyName.GAME_SERVER];

            //If servers list is available
            if (gameServersList != null)
            {
                //Connect to the game server
                while (gameServersList.Count > 0)
                {
                    //Pop a first game server in the list
                    string server = (string) gameServersList[0];
                    gameServersList.Remove(server);

                    //Out log message
                    networkClient.OutLogMessage(string.Format("Connecting to the game server: {0}...", server));

                    //Try to connect
                    bool isConnected = networkClient.ConnectToGameServer(server);
                    if (isConnected)
                    {
                        if (networkClient.DoAuthorization())
                        {
                            return true;
                        }
                    }
                }
            }

            //Connection failed
            networkClient.Disconnect();
            return false;
        }
開發者ID:TimeZeroForever,項目名稱:TZToolz,代碼行數:34,代碼來源:LoginStep2_ConnectToGameServer.cs

示例2: OnLoginFailResponse

        /// <summary>
        /// Occurs when the client was not authenticated by the loginserver.
        /// Called by UILoginDialog.cs.
        /// </summary>
        /// <param name="Client">The client that received the packet.</param>
        /// <param name="Packet">The packet that was received.</param>
        /// <param name="Screen">A UIScreen instance on which to display a messagebox to inform the player of the
        ///                      failure state.</param>
        public static void OnLoginFailResponse(ref NetworkClient Client, ProcessedPacket Packet)
        {
            EventObject Event;

            switch (Packet.ReadByte())
            {
                case 0x01:
                    Event = new EventObject(EventCodes.BAD_USERNAME);
                    EventSink.RegisterEvent(Event);
                    break;
                case 0x02:
                    Event = new EventObject(EventCodes.BAD_PASSWORD);
                    EventSink.RegisterEvent(Event);
                    break;
            }

            Client.Disconnect();
        }
開發者ID:Tranquill6,項目名稱:Project-Dollhouse,代碼行數:26,代碼來源:UIPacketHandlers.cs

示例3: Reconnect

 /// <summary>
 /// Reconnects to a CityServer.
 /// </summary>
 public void Reconnect(ref NetworkClient Client, CityInfo SelectedCity, LoginArgsContainer LoginArgs)
 {
     Client.Disconnect();
     Client.Connect(LoginArgs);
 }
開發者ID:Tranquill6,項目名稱:Project-Dollhouse,代碼行數:8,代碼來源:NetworkController.cs

示例4: OnInvalidVersionResponse

 public static void OnInvalidVersionResponse(ref NetworkClient Client, ProcessedPacket Packet)
 {
     Client.Disconnect();
 }
開發者ID:gamedev1337,項目名稱:Project-Dollhouse,代碼行數:4,代碼來源:UIPacketHandlers.cs

示例5: Reconnect

        /// <summary>
        /// Reconnects to a CityServer.
        /// </summary>
        public void Reconnect(ref NetworkClient Client, CityInfo SelectedCity, LoginArgsContainer LoginArgs)
        {
            Client.Disconnect();

            if (LoginArgs.Enc == null)
            {
                Debug.WriteLine("LoginArgs.Enc was null!");
                LoginArgs.Enc = new GonzoNet.Encryption.AESEncryptor(Convert.ToBase64String(PlayerAccount.Hash));
            }
            else if (LoginArgs.Username == null || LoginArgs.Password == null)
            {
                Debug.WriteLine("LoginArgs.Username or LoginArgs.Password was null!");
                LoginArgs.Username = PlayerAccount.Username;
                LoginArgs.Password = Convert.ToBase64String(PlayerAccount.Hash);
            }

            Client.Connect(LoginArgs);
        }
開發者ID:gamedev1337,項目名稱:Project-Dollhouse,代碼行數:21,代碼來源:NetworkController.cs


注:本文中的NetworkClient.Disconnect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。