コード例 #1
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;
        }
コード例 #2
0
        // False meaning, do not load/draw the background.
        public GamePlayState(GameCallback _callback, Map _map, EventBuffer _buffer)
            : base(false)
        {
            map = _map;
            //form = new InGameMenu(ServiceManager.Game.Manager);
            ServiceManager.Game.FormManager.RemoveWindow(
                ServiceManager.Game.FormManager.currentWindow);

            callback = _callback;
            buffer = _buffer;
            prevFrameScrollWheelValue = 0f;
        }
コード例 #3
0
 /// <summary>
 /// Start the game callback. This initially refuses messages until the Ready attribute
 /// is set to 'true'.
 /// </summary>
 /// <param name="_game"></param>
 public GameCallback(GamePlayState _game, EventBuffer _buffer)
 {
     game = _game;
     buffer = _buffer;
     ready = false;
 }
コード例 #4
0
        /// <summary>
        /// Unload any content (textures, fonts, etc) used by this state. Called when the state is removed.
        /// </summary>
        public override void UnloadContent()
        {
            /*try
            {
                ServiceManager.Game.GraphicsDevice.Reset();
                ServiceManager.Game.GraphicsDevice.VertexDeclaration = null;
                ServiceManager.Game.GraphicsDevice.Vertices[0].SetSource(null, 0, 0);
            }
            catch (Exception ex)
            {
                // If the graphics device was disposed already, it throws an exception.
                Console.Error.WriteLine(ex);
            }*/

            if (mouseCursor != null)
            {
                mouseCursor.DisableCustomCursor();
                mouseCursor = null;
            }
            EnvironmentEffects = null;
            Bases = null;
            buffbar = null;
            cd = null;
            hud = null;
            renderer = null;
            fps = null;
            map = null;
            visibleTiles = null;
            Scores = null;
            Players = null;
            Projectiles = null;
            Chat = null;
            buffer = null;
            miniMap.Dispose();
            miniMap = null;

            if (OnGameFinished != null)
            {
                EventArgs args = new EventArgs();
                OnGameFinished.Invoke(this, args);
            }
        }