コード例 #1
0
        public override void Unload()
        {
            Audio.StopMusic();

            UIManager.GetGump <LoginBackground>()?.Dispose();
            _currentGump?.Dispose();

            // UnRegistering Packet Events
            // NetClient.Socket.Connected -= NetClient_Connected;
            NetClient.Socket.Disconnected      -= NetClient_Disconnected;
            NetClient.LoginSocket.Connected    -= NetClient_Connected;
            NetClient.LoginSocket.Disconnected -= Login_NetClient_Disconnected;
            NetClient.PacketReceived           -= NetClient_PacketReceived;

            //NOTE: We force the login socket to disconnect in case it hasn't already been disposed
            //This is good practice since the Client can be quit while the socket is still active
            if (NetClient.LoginSocket.IsDisposed == false)
            {
                NetClient.LoginSocket.Disconnect();
            }

            UIManager.GameCursor.IsLoading = false;
            UIManager.Clear();
            base.Unload();
        }
コード例 #2
0
        public void UpdateCharacterList(ref PacketBufferReader p)
        {
            ParseCharacterList(ref p);

            if (CurrentLoginStep != LoginSteps.PopUpMessage)
            {
                PopupMessage = null;
            }
            CurrentLoginStep = LoginSteps.CharacterSelection;
            UIManager.GetGump <CharacterSelectionGump>()?.Dispose();

            _currentGump?.Dispose();

            UIManager.Add(_currentGump = new CharacterSelectionGump());
            if (!string.IsNullOrWhiteSpace(PopupMessage))
            {
                Gump g = null;
                g = new LoadingGump(PopupMessage, LoginButtons.OK, (but) => g.Dispose())
                {
                    IsModal = true
                };
                UIManager.Add(g);
                PopupMessage = null;
            }
        }
コード例 #3
0
        public override void Unload()
        {
            UIManager.GetGump<LoginBackground>()?.Dispose();

            _currentGump?.Dispose();

            // UnRegistering Packet Events           
            // NetClient.Socket.Connected -= NetClient_Connected;
            NetClient.Socket.Disconnected -= NetClient_Disconnected;
            NetClient.LoginSocket.Connected -= NetClient_Connected;
            NetClient.LoginSocket.Disconnected -= Login_NetClient_Disconnected;
            //NetClient.PacketReceived -= NetClient_PacketReceived;

            UIManager.GameCursor.IsLoading = false;
            base.Unload();
        }
コード例 #4
0
ファイル: LoginScene.cs プロジェクト: G0PLY/ClassicUO
        public override void Unload()
        {
            Audio.StopMusic();

            Engine.UI.Remove <LoginBackground>();
            _currentGump?.Dispose();

            // UnRegistering Packet Events
            // NetClient.Socket.Connected -= NetClient_Connected;
            NetClient.Socket.Disconnected      -= NetClient_Disconnected;
            NetClient.LoginSocket.Connected    -= NetClient_Connected;
            NetClient.LoginSocket.Disconnected -= NetClient_Disconnected;
            NetClient.PacketReceived           -= NetClient_PacketReceived;

            Engine.UI.GameCursor.IsLoading = false;

            base.Unload();
        }
コード例 #5
0
        public override void Update(double totalTime, double frameTime)
        {
            base.Update(totalTime, frameTime);

            if (_lastLoginStep != CurrentLoginStep)
            {
                UIManager.GameCursor.IsLoading = false;

                // this trick avoid the flickering
                Gump g = _currentGump;
                UIManager.Add(_currentGump = GetGumpForStep());
                g.Dispose();

                _lastLoginStep = CurrentLoginStep;
            }

            if (Reconnect && (CurrentLoginStep == LoginSteps.PopUpMessage || CurrentLoginStep == LoginSteps.Main) && !NetClient.Socket.IsConnected && !NetClient.LoginSocket.IsConnected)
            {
                if (_reconnectTime < totalTime)
                {
                    if (!string.IsNullOrEmpty(Account))
                    {
                        Connect(Account, Crypter.Decrypt(Settings.GlobalSettings.Password));
                    }
                    else if (!string.IsNullOrEmpty(Settings.GlobalSettings.Username))
                    {
                        Connect(Settings.GlobalSettings.Username, Crypter.Decrypt(Settings.GlobalSettings.Password));
                    }

                    int timeT = Settings.GlobalSettings.ReconnectTime * 1000;

                    if (timeT < 1000)
                    {
                        timeT = 1000;
                    }

                    _reconnectTime = (long)totalTime + timeT;
                    _reconnectTryCounter++;
                }
            }

            if (CurrentLoginStep == LoginSteps.CharacterCreation && Time.Ticks > _pingTime)
            {
                if (NetClient.Socket != null && NetClient.Socket.IsConnected)
                {
                    NetClient.Socket.Statistics.SendPing();
                }
                else if (NetClient.LoginSocket != null && NetClient.LoginSocket.IsConnected)
                {
                    NetClient.LoginSocket.Statistics.SendPing();
                }

                _pingTime = Time.Ticks + 60000;
            }
        }