Esempio n. 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");
        }
Esempio n. 2
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);
        }