예제 #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            TextureManager.LoadContent(Content);
            ItemCreator.LoadItemData();
            SoundManager.LoadSounds(Content);
            SoundManager.PlayMusic();
            SoundManager.PlayPauseMusic();
            AchievementManager.CreateAchievements();
            Player.Init();
            MainMenuManager.Init();
            OptionsMenu.Init();
            CityManager.Initialize();
            TravelMenu.Init();
            WorldEventManager.Init();
            EventLog.Init();
            WorldMapMenu.LoadCities();
            EncounterManager.Initialize();
            CityInfoMenu.Init();
            CharCreationMenu.Init();
            SkillManager.Init();

            ModifierManager.LoadCityAndCategoryLists();
            ModifierManager.LoadItemModifiers();
            Calendar.PrepareCalendar();

            cityMenu = new CityMenu();
            playerInventoryModule = new PlayerInventoryModule();

            previousGameState2 = GameState.Debug;
            previousGameState  = GameState.Debug;
            gameState          = GameState.MainMenu;

            options   = false;
            activeInv = new Inventory(100);
            random    = new Random();

            CityControlList = new List <string>();
            CityControlList.Add("Carrot Town");
            CityControlList.Add("Cloudspire");
        }
예제 #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);
        }
예제 #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);
        }