示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Guarantees that the storage device will be not be null before continuing
            //while(Storage == null)
            //{
            // Console.Write("Getting Storage...");
            // To avoid GuideAlreadyVisibleException
            while (LiveServices.GuideIsVisible())
            {
            }
            StorageDevice.BeginShowSelector(getStorage, "Get initial StorageDevice");
            // Console.Write("   ..."+Storage+"... ");
            // Console.Write("Call Started...");
            //}

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            GameTextures.load(Content);
            GameVideos.load(Content);
            PostProcessFx.LoadContent();
            //MapManager.tempMap.LoadContent(Content);
            font = Content.Load <SpriteFont>("FontA");
            //newfont = Content.Load<SpriteFont>("fontfile");
            newfont         = Content.Load <SpriteFont>("dotsfontfile");
            volterfont      = Content.Load <SpriteFont>("font-volter");
            newfontgreen    = Content.Load <SpriteFont>("fontfile-green");
            blueNumbersFont = Content.Load <SpriteFont>("bluenumbersfont");
            buttonsFont     = Content.Load <SpriteFont>("xboxControllerSpriteFont");
            ButtonDraw.initialize(buttonsFont);
            GC.Collect();
        }
示例#2
0
 void UpdateLobbyScreen()
 {
     if (mainGame.IsActive)
     {
         if (Gamer.SignedInGamers.Count == 0)
         {
             // If there are no profiles signed in and guide has been dismissed, return to menu.
             if (!LiveServices.GuideIsVisible())
             {
                 returnToMenu();
             }
         }
         else if (started == false)
         {
             started = true;
             if (sessionType == SessionType.Create)
             {
                 // Create a new session?
                 CreateSession();
             }
             else if (sessionType == SessionType.Join)
             {
                 // Join an existing session?
                 JoinSession();
             }
         }
     }
 }
示例#3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //set up content
            Content.RootDirectory = "Content";
            // Now with static constuctor so auto initalized on first access.
            //Viewports.setupViewports();

            SimpleRNG.SetSeedFromSystemTime();

#if DEBUG
            DebugSystem.Initialize(this, "FontA");
            //DebugSystem.Instance.FpsCounter.Visible = false;
            //DebugSystem.Instance.TimeRuler.Visible = false;
            DebugSystem.Instance.TimeRuler.ShowLog = true;
#endif

            MenuManager.Initialize();

            // MapManager.Initialize();

            shipSelect = new ShipSelect();

            //networkedGame = new NetworkedGame(this);
            //networkedGame.Enabled = false;
            //networkedGame.Visible = false;
            //networkedGame.Initialize();

            LiveServices.initializeGamerServices(this);

            Physics.Initialize();

            GameLoop.setGameStateAndResetPlayers(GameState.Menu);
            engine            = new AudioEngine("Content/XACT/BeatShift.xgs");
            GameLoop.menuBank = new SoundBank(engine, "Content\\XACT\\MusicTracks.xsb");
            GameLoop.wavBank  = new WaveBank(engine, "Content\\XACT\\SpaceMap.xwb");
            GameLoop.playTitle();
            bgm = new SoundTrack(140);
            bgm.LoadContent(Content, "bgm2");
            sfx = new SoundManager();
            sfx.LoadContent(Content);

            base.Initialize();

            LiveServices.gamerServices         = new GamerServicesComponent((Game)this);
            LiveServices.gamerServices.Enabled = false; //Updating manually
            Components.Add(LiveServices.gamerServices);

            //Disable bloom on Reach as it causes a texture-clamp/powerOfTwo error
            if (graphics.GraphicsProfile.Equals(GraphicsProfile.Reach))
            {
                Globals.PostProcess = false;
            }

            GC.Collect();
            //gamerServices.Initialize();

            //base.Initialize();
        }
示例#4
0
        public static void Draw(GameTime gameTime)
        {
            BeatShift.graphics.GraphicsDevice.Viewport = Viewports.fullViewport;
            Rectangle viewArea = new Rectangle(0, 0, BeatShift.graphics.GraphicsDevice.Viewport.Width, BeatShift.graphics.GraphicsDevice.Viewport.Height);

            //Clear screen to black
            BeatShift.graphics.GraphicsDevice.Clear(Color.Black);
            if (Globals.PostProcess)
            {
                PostProcessFx.BeginDraw();                    //Set RenderTarget to bloom target instead of buffer
            }
            if (BeatShift.shipSelect.Visible && !(paused || LiveServices.GuideIsVisible()))
            {
                BeatShift.shipSelect.Draw(gameTime);
            }

            //Draw Main menu system if active, before drawing ship-selection ships
            if (MenuManager.mainMenuSystem.isActive)
            {
                MenuManager.Draw(gameTime);
            }

            //Begin 3D drawing region

            //Draw map
            if (Race.Visible)
            {
                Race.DrawMap(gameTime);
            }

            //Draw ships/racers and HUD
            if (Race.Visible)
            {
                Race.DrawShips(gameTime);
                Race.DrawHUD(gameTime);
            }

            //Begin glow pass
            if (Globals.PostProcess)
            {
                Race.DrawGlow(gameTime);
                //Race.DrawShips(gameTime);//Fake bit of geometry
                PostProcessFx.Draw(gameTime); //Apply bloom on 3D elements and draw to backbuffer.
            }


            //Draw any other menu systems (Pause/PostGame) which are active
            if (!MenuManager.mainMenuSystem.isActive)
            {
                MenuManager.Draw(gameTime);
            }



            //if (networkedGame.Visible) networkedGame.Draw(gameTime);
        }
示例#5
0
        private static void checkPauseGuide()
        {
            // Pause if the Guide is up
            if (!paused && LiveServices.GuideIsVisible())// && currentState == GameState.LocalGame)
            {
                BeginPause(false);
                //Console.Write("Game Paused \n");
            }
            // If we paused for the guide, unpause if the guide
            // went away
            else if (paused && pausedForGuide && !LiveServices.GuideIsVisible())// && currentState == GameState.LocalGame)
            {
                pausedForGuide = false;

                if (MenuManager.pausedSystem.isActive == false) //Checks that the game wasn't double-paused with both guide+pauseMenu
                {
                    EndPause();
                }
                //Console.Write("Game Resumed \n");
            }
        }
示例#6
0
        private void signIn(int i)
        {
            Race.getFullListOfRacerIDsFromSignedInPeople();
            Array.Clear(signedInPlayers, 0, signedInPlayers.Length);
            foreach (SignedInGamer gamer in Gamer.SignedInGamers)
            {
                signedInPlayers[(int)gamer.PlayerIndex] = 1;
            }

            if (!LiveServices.GuideIsVisible())
            {
                if (ssarea[i].isActive && (Race.humanRacers[i].shipDrawing.isVisible == false))
                {
                    if (signedInPlayers[i] == 1)
                    {
                        Race.humanRacers[i].shipDrawing.isVisible = true;
                    }
                    else
                    {
                        ssarea[i].setActive(false);
                    }
                }
            }
        }
示例#7
0
        public static void Update(GameTime gameTime)
        {
#if DEBUG
            DebugSystem.Instance.TimeRuler.StartFrame();
#endif
            using (new ProfileSection("Background", Color.Blue))
            {
                // Check to see if the user has paused or unpaused
                BeatShift.bgm.Update();
                // Task music = Parallel.Start();
                if (currentState == GameState.LocalGame || currentState == GameState.NetworkedGame)
                {
                    checkPauseKey(gameTime);
                }

                checkPauseGuide();

#if XBOX
                checkControllers(gameTime);
#endif

                // If the user hasn't paused, Update normally

                LiveServices.Update(gameTime);

                //Update mainGameInput
                if (!LiveServices.GuideIsVisible())
                {
                    mainGameinput.Update(gameTime);
                }
            }

            if (!pausedForGuide)
            {
                MenuManager.Update(gameTime);
            }

            if (!paused)
            {
                Boolean raceUpdated = false;
                if (GameLoop.getCurrentState() == GameState.LocalGame)
                {
                    //IWork pudate = new IWork();
                    //particles = Parallel.Start(()=>BeatShift.particleManager.UpdateAllParticleSystems((float)gameTime.ElapsedGameTime.TotalSeconds));
                    //BeatShift.particleManager.UpdateAllParticleSystems((float)gameTime.ElapsedGameTime.TotalSeconds);
                }

                //Update all managed timers.
                RunningTimer.Update(gameTime);

                if (BeatShift.shipSelect.Enabled)
                {
                    BeatShift.shipSelect.Update(gameTime);
                }

                //if (networkedGame.Enabled) networkedGame.Update(gameTime);

                using (new ProfileSection("Physics", Color.Red))
                {
                    if (Physics.Enabled)
                    {
                        Physics.Update(gameTime);
                    }
                }


                using (new ProfileSection("Race", Color.Yellow))
                {
                    if (Race.Enabled)
                    {
                        Race.Update(gameTime);
                        raceUpdated = true;
                        HeadsUpDisplay.Update(gameTime);
                    }
                }


                //What??
                if (MapManager.Enabled && !raceUpdated)
                {
                    Race.Update(gameTime);
                }
            }


            //full screen option
#if WINDOWS
            //F4 press triggers fullscreen
            if (Keyboard.GetState().IsKeyDown(Keys.F4))
            {
                wasF4pressed = true;
            }
            if (wasF4pressed)
            {
                if (Keyboard.GetState().IsKeyUp(Keys.F4))
                {
                    wasF4pressed = false;
                    BeatShift.graphics.ToggleFullScreen();
                }
            }
#endif

#if DEBUG
            //Insert repeats last debug command if debug window shut
            if (DebugSystem.Instance.DebugCommandUI.isClosed())
            {
                if (Keyboard.GetState().IsKeyDown(Keys.Insert))
                {
                    wasInsertPressed = true;
                }

                if (wasInsertPressed)
                {
                    if (Keyboard.GetState().IsKeyUp(Keys.Insert))
                    {
                        wasInsertPressed = false;
                        DebugSystem.Instance.DebugCommandUI.RepeatLastCommand();
                    }
                }
            }
#endif
            //music.Wait();


            BeatShift.engine.Update();
        }