Esempio n. 1
0
        private LoadingScreen( ScreenManager screenManager, bool loadingIsSlow,
            GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
              this.screensToLoad = screensToLoad;
              doneLoading = false;

              TransitionOnTime = TimeSpan.FromSeconds( 0.5 );

              if ( loadingIsSlow )
              {
            backgroundThread = new Thread( BackgroundWorkerThread );
            backgroundThreadExit = new ManualResetEvent( false );

            graphicsDevice = screenManager.GraphicsDevice;

            screenScale = graphicsDevice.Viewport.Height / 1080f;

            ContentManager content = GameCore.Instance.Content;

            howToPlay = new Texture2D[3];
            for ( int i = 0; i < 3; ++i )
              howToPlay[i] = content.Load<Texture2D>( "Textures/howtoplay" + ( i + 1 ).ToString() );

            loadingText = content.Load<Texture2D>( "Textures/loadingText" );
            pressStartText = content.Load<Texture2D>( "Textures/pressStartText" );
            hamsterBall = content.Load<CustomModel>( "Models/hamsterBall" );
            foreach ( CustomModel.ModelPart part in hamsterBall.ModelParts )
            {
              part.Effect.CurrentTechnique = part.Effect.Techniques["DiffuseColor"];
              part.EffectParamColor.SetValue( new Vector4( .8f, .7f, 1f, .5f ) );
              part.Effect.Parameters["SpecularPower"].SetValue( 400 );
            }
            Viewport viewport = screenManager.GraphicsDevice.Viewport;
            Vector2 viewportSize = new Vector2( viewport.Width, viewport.Height );
            textPosition = new Vector2( viewportSize.X / 2, .93f * viewportSize.Y );
            howToPlayScale = viewportSize.Y / 1080f;
            howToPlayPosition = viewportSize / 2;
            howToPlayOrigin = new Vector2( howToPlay[0].Width, howToPlay[0].Height ) / 2;
              }
        }
Esempio n. 2
0
        /// <summary>
        /// Removes a screen from the screen manager. You should normally
        /// use GameScreen.ExitScreen instead of calling this directly, so
        /// the screen can gradually transition off rather than just being
        /// instantly removed.
        /// </summary>
        public void RemoveScreen( GameScreen screen )
        {
            // If we have a graphics device, tell the screen to unload content.
              if ( isInitialized )
              {
            screen.UnloadContent();
              }

              screens.Remove( screen );
              screensToUpdate.Remove( screen );
        }
Esempio n. 3
0
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        public void AddScreen( GameScreen screen, PlayerIndex? controllingPlayer )
        {
            screen.ControllingPlayer = controllingPlayer;
              screen.ScreenManager = this;
              screen.IsExiting = false;

              // If we have a graphics device, tell the screen to load content.
              if ( isInitialized )
              {
            screen.LoadContent();
              }

              if ( screens.Count == 0 || screens.Last() != screen )
              {
            screens.Add( screen );
              }
        }