Example #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;
        }
Example #2
0
        /// <summary>
        /// Attempts to connect with the game server
        /// </summary>
        private void ConnectToGameServer()
        {
            if (ServiceManager.Theater == null)
            {
                ServiceManager.ConnectToTheater(server);

                ServiceManager.Theater.ClearRegisteredCallbacks();

                clientCallback = new GameCallback(null, buffer);
                ClockSync clockCallback = new ClockSync();

                ServiceManager.Theater.RegisterCallback(clientCallback);
                ServiceManager.Theater.RegisterCallback(clockCallback);

                string key = ServiceManager.Echelon.RequestJoinGameServer(server);
                if (!ServiceManager.Theater.JoinServer(key))
                {
                    throw new Exception("Cannot connect to the game server.");
                }
            }
            else
            {
                ServiceManager.Theater.ClearRegisteredCallbacks();

                clientCallback = new GameCallback(null, buffer);
                ClockSync clockCallback = new ClockSync();

                ServiceManager.Theater.RegisterCallback(clientCallback);
                ServiceManager.Theater.RegisterCallback(clockCallback);
            }

            ServiceManager.CurrentServer = server;
            currentMap = ServiceManager.Theater.GetCurrentMapName();
        }
Example #3
0
        public GamePlayState(GameCallback _callback, Map _map, EventBuffer _buffer)
            : base(false) // False meaning, do not load/draw the background.
        {
            map = _map;
            //form = new InGameMenu(ServiceManager.Game.Manager);
            ServiceManager.Game.FormManager.RemoveWindow(
                ServiceManager.Game.FormManager.currentWindow);

            callback = _callback;
            buffer   = _buffer;
            prevFrameScrollWheelValue = 0f;
        }
Example #4
0
 public CallbackMessage(GameCallback callback)
     : base(MessageType.Callback, "callback")
 {
     m_callback = callback;
 }