Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        /// 
        public virtual void AddScreen(Screens.Screen screen, PlayerIndex? controllingPlayer, int indexAt = -1)
        {
            if (input.Kinect.IsEnabled())
            {
                if (screen.KinectDependencies.Contains(Screens.KinectDependency.Skeleton) && !input.Kinect.IsSkeletalTrackingEnabled())
                    input.Kinect.EnableSkeletalTracking();

                if (screen.KinectDependencies.Contains(Screens.KinectDependency.Color) && !input.Kinect.IsColorCaptureEnabled())
                    input.Kinect.EnableColorCapture(GraphicsDevice, Microsoft.Kinect.ColorImageFormat.RgbResolution1280x960Fps12);

                if (screen.KinectDependencies.Contains(Screens.KinectDependency.Depth) && !input.Kinect.IsDepthCaptureEnabled())
                    input.Kinect.EnableDepthCapture(GraphicsDevice);

                if (screen.KinectDependencies.Contains(Screens.KinectDependency.Voice) && !input.Kinect.IsVoiceRecognitionEnabled())
                    input.Kinect.EnableVoiceRecognition();
            }
            // If we have a graphics device, tell the screen to load content.
            if (isInitialized)
            {
                screen.ScreenManager = this;
                screen.ControllingPlayer = controllingPlayer;
                screen.Activate(input);
            }
            if (indexAt == -1 )
                screens.Add(screen);
            else if (indexAt <= screens.Count)
                screens.Insert(indexAt, screen);
        }