コード例 #1
0
        /// <summary>
        /// Start the loading screen state, which initializes some basic form components.
        /// </summary>
        /// <param name="gameServer">Server to connect to.</param>
        public LoadingScreenState(GameServerInfo gameServer)
        {
            server = gameServer;
            if (ServiceManager.Game.IsMouseVisible == false)
            {
                ServiceManager.Game.IsMouseVisible = true;
            }

            form = new LoadingScreen(ServiceManager.Game.Manager);
            ServiceManager.Game.FormManager.SwitchWindows(form.Window);
            form.Cancel.Click += new TomShane.Neoforce.Controls.EventHandler(Cancel_Click);

            State = LoadingState.LOADING;
            thread = new Thread(new ThreadStart(Start));
        }
コード例 #2
0
        /// <summary>
        /// Unloads content.
        /// </summary>
        public override void UnloadContent()
        {
            if (thread.IsAlive)
            {
                try
                {
                    thread.Interrupt();
                }
                catch (Exception e)
                {
                    ServiceManager.Game.Console.DebugPrint(
                        "[ERROR] At LoadingScreenState#UnloadContent(): {0}",
                        e.Message);
                }
            }

            if (futureGame != null)
            {
                ServiceManager.Game.BackgroundMovie.Pause();
                ServiceManager.MP3Player.Stop();
                ServiceManager.MP3Player.PlayPlaylist();
                futureGame.OnGameFinished += new GamePlayState.GameFinishHandler(OnGameFinished);
            }

            currentMap = null;
            currentMapInstance = null;
            thread = null;
            server = null;
            form = null;
            futureGame = null;
            clientCallback = null;
            buffer = null;
        }