Esempio n. 1
0
        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            try
            {
                BackgroundMovie.UnloadContent();
            }
            catch (Exception) { }

            ServiceManager.StateManager.CurrentState.UnloadContent();
            base.UnloadContent();
        }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            IsRunningSlowly = gameTime.IsRunningSlowly;

            BackgroundMovie.Update();

            while (invocationBuffer.Count > 0)
            {
                invocationBuffer.InvokeNext();
            }

            long currentTimeStamp = Network.Util.Clock.GetTimeMilliseconds();
            long elapsed          = currentTimeStamp - lastTimeStamp;

            DeltaTime     = ((double)elapsed) / 1000.0;
            lastTimeStamp = currentTimeStamp;

            if (DeltaTime > 1.0)
            {
                return;
            }

            if (ServiceManager.MP3Player != null)
            {
                ServiceManager.MP3Player.Update();
            }

            GraphicOptions.FrameLength = (float)DeltaTime;

            ServiceManager.StateManager.CurrentState.Update();

            Console.Update();

            try
            {
                base.Update(gameTime);
            }
            catch (Exception e)
            {
                // Ignore messages relating to NeoForce.
                // TODO: Figure out why NeoForce throws exceptions.
                if (!e.StackTrace.ToString().ToLower().Contains("neoforce"))
                {
                    System.Console.Error.WriteLine(e);
                }
            }
        }