Exemplo n.º 1
0
        void GameMain_Exiting(object sender, System.EventArgs e)
        {
            if (cue != null && cue.IsPlaying)
            {
                cue.Stop(AudioStopOptions.Immediate);
            }
            while (gameHandler != null && gameHandler.receiveThread != null && gameHandler.receiveThread.IsAlive)
            {
                if (gameHandler.currentState() == GameState.none || gameHandler.currentState() == GameState.map_warp)
                {
                    gameHandler.currentState(GameState.map_backtologin);
                }
                gameHandler.receiveThread.Abort();
            }
            long startExit = DateTime.Now.Ticks;

            network.Send("LOGOUT:0;");
            bool isLoggedOut = false;

            while (!isLoggedOut && network.isConnected())
            {
                String responseLogoutMsg = "";
                while (responseLogoutMsg.Length <= 0)
                {
                    responseLogoutMsg = network.Receive();
                }
                String[] LogoutLine = responseLogoutMsg.Split(';');
                for (int l = 0; l < LogoutLine.Length; ++l)
                {
                    String[] LogoutMsg = LogoutLine[l].Split(':');
                    if (LogoutMsg[0].Equals("LOGOUT") && LogoutMsg.Length == 2)
                    {
                        isLoggedOut = true;
                        break;
                    }
                }
            }
            network.Close();
        }
Exemplo n.º 2
0
 void relogBtn_Click(object sender, TomShane.Neoforce.Controls.EventArgs e)
 {
     this.Visible = false;
     handler.currentState(GameState.map_backtologin);
 }