//Loads the content to game engine. Most instances will be moved to the menu classes in iteration 3 private void LoadContent() { //engine.ContentNames = contentManager.LoadContent ("Content/"); engine.ContentNames = contentManager.LoadGameContent(); engine.SoundContentNames = contentManager.LoadContent("Content/Sound/"); //Creates observers entityObserver = new EntityObserver(engine, generatedPortions); contentObserver = new ContentObserver(engine); //Subscribes the observers to the engine and sends a disposable to the observers. IDisposable dis = engine.Subscribe(entityObserver); entityObserver.AddDisposableObserver(dis); dis = engine.Subscribe(contentObserver); contentObserver.AddDisposableObserver(dis); engine.KeyBind.AddRange(contentManager.MenuKeyBindSetup()); PlayGameMenu playGameMenu = new PlayGameMenu(engine); playGameMenu.AddPlayBtnListener(LoadGame); playGameMenu.AddPlayerBtnsListeners(AddPlayer); StartMenu startMenu = new StartMenu(engine); OptionMenu optionMenu = new OptionMenu(engine); MenuController menuController = new MenuController(startMenu, optionMenu, playGameMenu, ref currentState, engine); }
public MenuController(StartMenu startMenu, OptionMenu optionMenu, PlayGameMenu PlayGameMenu, ref GameState state, GameEngine engine) { this.engine = engine; engine.ViewPositions.Add(new Tuple <Vector3, Viewport, Entity> (new Vector3(0, 0, 0), engine.GraphicsDevice.Viewport, null)); this.currentState = state; currentState = GameState.StartMenu; SMenu = startMenu; SMenu.AddExitButtonListener(exitButton); SMenu.AddOptionsButtonListener(optionsButton); SMenu.AddPlayButtonListener(playButton); OMenu = optionMenu; OMenu.AddBackBtnListener(goBackButton); PGMenu = PlayGameMenu; PGMenu.AddBackBtnListener(goBackButton); engine.SetMouseVisibility(true); SMenu.CreateStartMenu(); }