Beispiel #1
0
 protected override void Initialize()
 {
     base.Initialize();
     graphics.PreferredBackBufferWidth  = 1920;
     graphics.PreferredBackBufferHeight = 1080;
     EndCredits.Initialize();
     //graphics.IsFullScreen = true;
     //väldigt svårt att debugga i fullscreen så rekomenderar att lämna det av förutom när det behövs /My
     graphics.ApplyChanges();
     IsMouseVisible = true;
 }
Beispiel #2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();

            if (gameState != GameState.MainMenu && !TravelMenu.travelling)
            {
                DrawBackground(spriteBatch);
            }


            if (gameState == GameState.CityMenu)
            {
                cityMenu.Draw(spriteBatch, WorldMapMenu.Cities);
            }
            else if (gameState == GameState.MapMenu)
            {
                WorldMapMenu.Draw(spriteBatch);
            }
            else if (gameState == GameState.TradeMenu)
            {
                Trading.Draw(spriteBatch);
            }
            else if (gameState == GameState.InventoryMenu)
            {
                playerInventoryModule.Draw(spriteBatch);
            }
            else if (gameState == GameState.TravelMenu)
            {
                TravelMenu.Draw(spriteBatch);
            }
            else if (gameState == GameState.MainMenu)
            {
                MainMenuManager.Draw(spriteBatch);
            }
            else if (gameState == GameState.CharacterCreationMenu)
            {
                CharCreationMenu.Draw(spriteBatch);
            }
            else if (gameState == GameState.Debug)
            {
                spriteBatch.DrawString(TextureManager.font32, "Press F1 for City Menu, F2 for Map Menu, F3 for Inv. Menu,\nF4 for Trading Menu or F5 for Travelling Menu \nand you can always press F6 to return here\nF11 loads and F12 saves", new Vector2(200, 200), Color.White);
            }
            if (gameState != GameState.MainMenu && gameState != GameState.InventoryMenu)
            {
                Calendar.Draw(spriteBatch);
            }

            CityInfoMenu.Draw(spriteBatch);

            if (eventLog)
            {
                EventLog.Draw(spriteBatch);
            }

            OptionsMenu.Draw(spriteBatch, options);

            EndCredits.Draw(spriteBatch); //////////////////////////////
            LevelUp.Draw(spriteBatch);    /////////////////////////////////
            spriteBatch.End();

            //Window.Title = "Press F6 for debug menu          " + Player.SkillLevels[0].ToString() + Player.SkillLevels[1].ToString() + Player.SkillLevels[2].ToString() + "    " + OptionsMenu.selectedSkill;
            Window.Title = "Project Travelling Merchant";
            //if (test)
            //{
            //    Window.Title = "WAAAAR";
            //}


            base.Draw(gameTime);
        }
Beispiel #3
0
        //========================================================================
        //OM DU SKA ÄNDRA GAMESTATE ANVÄND METODERNA SOM FINNS EFTER DRAW METODEN
        //========================================================================
        protected override void Update(GameTime gameTime) // Too long
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Back))
            {
                Exit();
            }

            EndCredits.Update(gameTime.ElapsedGameTime.TotalMilliseconds); //////////////////////////////////////
            LevelUp.Update(gameTime.ElapsedGameTime.TotalMilliseconds);    ///////////////////////////////////////

            AchievementManager.Update();

            if (WorldEventManager.Update(random))
            {
                test = true;
            }
            else
            {
                test = false;
            }

            KMReader.Update();
            Calendar.Update();
            if (Calendar.CheckEventClick())
            {
                eventLog = !eventLog;
            }

            if (gameState == GameState.CityMenu)
            {
                UpdateCityMenu(gameTime);
            }
            else if (gameState == GameState.MapMenu)
            {
                UpdateMapMenu(gameTime);
            }
            else if (gameState == GameState.TradeMenu)
            {
                UpdateTradeMenu();
            }
            else if (gameState == GameState.InventoryMenu)
            {
                UpdateInventoryMenu(gameTime);
            }
            else if (gameState == GameState.TravelMenu)
            {
                UpdateTravelMenu(gameTime);
            }
            else if (gameState == GameState.MainMenu)
            {
                UpdateMainMenu();
            }
            else if (gameState == GameState.CharacterCreationMenu)
            {
                UpdateCharacterCreationMenu();
            }
            else if (gameState == GameState.Debug)
            {
                UpdateDebugMenu();
            }

            if (KMReader.prevKeyState.IsKeyUp(Keys.F6) && KMReader.keyState.IsKeyDown(Keys.F6))
            {
                ChangeGameState(GameState.Debug);
            }
            if (KMReader.prevKeyState.IsKeyUp(Keys.F11) && KMReader.keyState.IsKeyDown(Keys.F11))
            {
                LoadSave();
            }
            if (KMReader.prevKeyState.IsKeyUp(Keys.F12) && KMReader.keyState.IsKeyDown(Keys.F12))
            {
                SaveGame();
            }

            if (options)
            {
                UpdateOptionsMenu();
            }
            if (OptionsMenu.CheckMenuToggle())
            {
                options = !options;
            }

            WorldMapMenu.CheckPlayerEventLog();
            WorldMapMenu.UpdateCities();
            Player.Update();
            if (CityInfoMenu.Update())
            {
                CityInfoMenu.Active = false;
                ChangeGameState(GameState.TravelMenu);
            }

            base.Update(gameTime);
        }