/// <summary> /// The constructor is private: loading screens should /// be activated via the static Load method instead. /// </summary> private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow, GameScreen[] screensToLoad) { this.loadingIsSlow = loadingIsSlow; this.screensToLoad = screensToLoad; TransitionOnTime = TimeSpan.FromSeconds(0.5); // If this is going to be a slow load operation, create a background // thread that will update the network session and draw the load screen // animation while the load is taking place. if (loadingIsSlow) { backgroundThread = new Thread(BackgroundWorkerThread); backgroundThreadExit = new ManualResetEvent(false); graphicsDevice = screenManager.GraphicsDevice; // Look up some services that will be used by the background thread. IServiceProvider services = screenManager.Game.Services; networkSession = (NetworkSession)services.GetService( typeof(NetworkSession)); messageDisplay = (IMessageDisplay)services.GetService( typeof(IMessageDisplay)); } }
public PlayerTank(ParentGame Game, Model ModelObj, Texture2D[] ModelTextures, Vector3 Position, Model MissileModel, Texture2D[] MissileTextures, GameScreen Screen) : base(Game, ModelObj, ModelTextures) { this.Screen = Screen; //LoadPhysicsObject(); missileModel = MissileModel; missileTextures = MissileTextures; position = Position; }
/// <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); // if there is a screen still in the manager, update TouchPanel // to respond to gestures that screen is interested in. if (screens.Count > 0) { //TouchPanel.EnabledGestures = screens[screens.Count - 1].EnabledGestures; } }
/// <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(); } screens.Add(screen); // update the TouchPanel to respond to gestures this screen is interested in //TouchPanel.EnabledGestures = screen.EnabledGestures; }