Ejemplo n.º 1
0
        // System Constructor, performs initialization
        public SystemMain()
        {
            Height = 720; Width = 1280;
            //Height = 600; Width = 800;

            // graphics initializer Also initialize the height and width to 720p
            //_graphics = new GraphicsDeviceManager(this);
            _graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = Width, PreferredBackBufferHeight = Height
            };
            //content location
            Content.RootDirectory = "Content";

            GamerServicesDispatcher.Initialize(Services);

            // initialize font package and texture package
            FontPackage    = new Dictionary <String, SpriteFont>();
            TexturePackage = new Dictionary <String, Texture2D>();

            // create the stack
            _menuStack = new Stack <IScreen>();

            // create the DataManager and load name list
            _dataManager = new DataManager();

            // create a list of booklets the system can run off of
            Booklets = _dataManager.LoadBooklets(0);
        }
Ejemplo n.º 2
0
        private void ExecuteRemoteCommand(IDebugCommandHost host, string command,
                                          IList <string> arguments)
        {
            if (NetworkSession == null)
            {
                try
                {
                    GamerServicesDispatcher.WindowHandle = Game.Window.Handle;
                    GamerServicesDispatcher.Initialize(Game.Services);
                }
                catch { }

                if (SignedInGamer.SignedInGamers.Count > 0)
                {
                    commandHost.Echo("Finding available sessions...");

                    asyncResult = NetworkSession.BeginFind(
                        NetworkSessionType.SystemLink, 1, null, null, null);

                    phase = ConnectionPahse.FindSessions;
                }
                else
                {
                    host.Echo("Please signed in.");
                    phase = ConnectionPahse.EnsureSignedIn;
                }
            }
            else
            {
                ConnectedToRemote();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new instance
        /// </summary>
        public LiveSessionManager(Application application) : base(Application.SunBurn)
        {
            if (!GamerServicesDispatcher.IsInitialized)
            {
                GamerServicesDispatcher.Initialize(application.Services);
            }

            GamerServicesDispatcher.WindowHandle = application.Window.Handle;

            SignedInGamer.SignedIn  += OnLiveGamerSignedIn;
            SignedInGamer.SignedOut += OnLiveGamerSignedOut;
        }
Ejemplo n.º 4
0
        } // EngineManager

        #endregion

        #region Initialize

        /// <summary>
        /// Initialize.
        /// </summary>
        protected override void Initialize()
        {
            // Intercept events //
            GraphicsDeviceManager.PreparingDeviceSettings += OnPreparingDeviceSettings;
            GraphicsDeviceManager.DeviceReset             += OnDeviceReset;
            Window.ClientSizeChanged                      += OnWindowClientSizeChanged;

            // Reset to take new parameters //
            GraphicsDevice.Reset(GraphicsDevice.PresentationParameters);

            // In classes that derive from Game, you need to call base.Initialize in Initialize,
            // which will automatically enumerate through any game components that have been added to Game.Components and call their Initialize methods.
            base.Initialize();

            if (UseGamerServices)
            {
                try
                {
                    // Initialize Gamer Services Dispatcher
                    if (!GamerServicesDispatcher.IsInitialized)
                        GamerServicesDispatcher.Initialize(Services);
                    GamerServicesDispatcher.WindowHandle = Window.Handle;
                }
                catch (GamerServicesNotAvailableException)
                {
                    throw new InvalidOperationException("Engine Manager: Games for Windows - LIVE is unavailable. Please install it and try again.");
                }
            }

            #region Maximize

            // If we put 0,0 to window size then we need to maximize. This has to be done here and not before.
            #if (WINDOWS)
                if (oldScreenWidth <= 0 || oldScreenHeight <= 0)
                {
                    Form form = (Form)Control.FromHandle(Window.Handle);
                    form.Location = new Point(0, 0);
                    form.Size = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size;
                    form.WindowState = FormWindowState.Maximized;
                }
            #endif

            #endregion

        } // Initialize
Ejemplo n.º 5
0
        public override void Initialize()
        {
            if (IsHost)
            {
                commandHost.RegisterEchoListner(this);

                // Create network session if NetworkSession is not set.
                if (NetworkSession == null)
                {
                    GamerServicesDispatcher.WindowHandle = Game.Window.Handle;
                    GamerServicesDispatcher.Initialize(Game.Services);
                    NetworkSession =
                        NetworkSession.Create(NetworkSessionType.SystemLink, 1, 2);

                    OwnsNetworkSession = true;
                }
            }

            base.Initialize();
        }
Ejemplo n.º 6
0
        public static void initializeGamerServices(BeatShift mainGame)
        {
#if (XBOX || DEBUG)
            // Console.Write("Initializing networking (GamerServicesDispatcher)... ");
            //This block of code needs to be uncommented somewhere
            //Unfortunately it is very slow (5s) on my PC and delays
            //Startup significantly.
            try
            {
                GamerServicesDispatcher.WindowHandle = mainGame.Window.Handle;
                if (!GamerServicesDispatcher.IsInitialized)
                {
                    GamerServicesDispatcher.Initialize(mainGame.Services);
                }
            }
            catch (Exception e)
            {
                //DO SOMTHING SENSIBLE HERE.
                //triggered if live services not running
                Console.WriteLine("Unable to initialize GamerServicesDispatcher.");
            }
            // Console.WriteLine("   ...done.");
#endif
        }
Ejemplo n.º 7
0
 public override void Initialize()
 {
     GamerServicesDispatcher.WindowHandle = Game.Window.Handle;
     GamerServicesDispatcher.Initialize(Game.Services);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes the XNA GamerServicesDispatcher
 /// </summary>
 public void Initialize()
 {
     GamerServicesDispatcher.WindowHandle = (IntPtr)_window["WINDOW"];
     GamerServicesDispatcher.Initialize(_renderSystem);
     _engine.FrameStarted += Update;
 }