protected Sample(Microsoft.Xna.Framework.Game game) : base(game) { // Get services from the global service container. var services = (ServiceContainer)ServiceLocator.Current; SampleFramework = services.GetInstance <SampleFramework>(); ContentManager = services.GetInstance <ContentManager>(); UIContentManager = services.GetInstance <ContentManager>("UIContent"); InputService = services.GetInstance <IInputService>(); AnimationService = services.GetInstance <IAnimationService>(); Simulation = services.GetInstance <Simulation>(); ParticleSystemService = services.GetInstance <IParticleSystemService>(); GraphicsService = services.GetInstance <IGraphicsService>(); GameObjectService = services.GetInstance <IGameObjectService>(); UIService = services.GetInstance <IUIService>(); // Create a local service container which can be modified in samples: // The local service container is a child container, i.e. it inherits the // services of the global service container. Samples can add new services // or override existing entries without affecting the global services container // or other samples. Services = services.CreateChildContainer(); // Store a copy of the original graphics screens. _originalGraphicsScreens = GraphicsService.Screens.ToArray(); // Mouse is visible by default. SampleFramework.IsMouseVisible = true; }
protected Sample(Microsoft.Xna.Framework.Game game) : base(game) { // Enable mouse centering and hide mouse by default. EnableMouseCentering = true; // Get services from the global service container. var services = (ServiceContainer)ServiceLocator.Current; ContentManager = services.GetInstance <ContentManager>(); UIContentManager = services.GetInstance <ContentManager>("UIContent"); InputService = services.GetInstance <IInputService>(); AnimationService = services.GetInstance <IAnimationService>(); Simulation = services.GetInstance <Simulation>(); ParticleSystemService = services.GetInstance <IParticleSystemService>(); GraphicsService = services.GetInstance <IGraphicsService>(); GameObjectService = services.GetInstance <IGameObjectService>(); UIService = services.GetInstance <IUIService>(); // Create a local service container which can be modified in samples: // The local service container is a child container, i.e. it inherits the // services of the global service container. Samples can add new services // or override existing entries without affecting the global services container // or other samples. Services = services.CreateChildContainer(); }
protected Sample(Microsoft.Xna.Framework.Game game) : base(game) { // Get services from the global service container. var services = (ServiceContainer)ServiceLocator.Current; SampleFramework = services.GetInstance<SampleFramework>(); ContentManager = services.GetInstance<ContentManager>(); UIContentManager = services.GetInstance<ContentManager>("UIContent"); InputService = services.GetInstance<IInputService>(); AnimationService = services.GetInstance<IAnimationService>(); Simulation = services.GetInstance<Simulation>(); ParticleSystemService = services.GetInstance<IParticleSystemService>(); GraphicsService = services.GetInstance<IGraphicsService>(); GameObjectService = services.GetInstance<IGameObjectService>(); UIService = services.GetInstance<IUIService>(); // Create a local service container which can be modified in samples: // The local service container is a child container, i.e. it inherits the // services of the global service container. Samples can add new services // or override existing entries without affecting the global services container // or other samples. Services = services.CreateChildContainer(); // Store a copy of the original graphics screens. _originalGraphicsScreens = GraphicsService.Screens.ToArray(); // Mouse is visible by default. SampleFramework.IsMouseVisible = true; }