public GameplayPresenterImpl(GameplayView view, IGamePlayRepository gamePlayRepository, IAirplanesRepository airplanesRepository, ISessionsRepository sessionRepository) { this.view = view; this.gamePlayRepository = gamePlayRepository; this.airplanesRepository = airplanesRepository; this.sessionRepository = sessionRepository; }
/// <summary> /// Switches to gameplay mode /// </summary> public void GoToGameplay() { MenuModel.Disable(); MenuView.Hide(); GameplayModel.Enable(); GameplayView.Show(); Audio.startMusic(); Controller.Model = GameplayModel; }
/// <summary> /// Go to the menu. Which menu is shown, depends on the menuState parameter. /// </summary> /// <param name="menuState"></param> public void GoToMenu(MenuState menuState) { GameplayModel.Disable(); GameplayView.Hide(); MenuModel.Enable(); MenuView.Show(); MenuModel.setMenuState(menuState); Audio.stopMusic(); Controller.Model = MenuModel; }
private void Awake() { Instance = this; views = GetComponentsInChildren <UIView>(includeInactive: true); for (int i = 0; i < views.Length; i++) { UIView view = views[i]; view.Setup(this); view.gameObject.SetActive(false); } MainMenu = FindView <MainMenuView>(); Gameplay = FindView <GameplayView>(); }
protected override void EnterState(State nextState) { Debug.Log(nextState); StartView?.Toggle(nextState == State.GameStart); GameplayView?.Toggle(nextState == State.InGame); WinnerView?.Toggle(nextState == State.VictoryScreen); switch (nextState) { case State.GameStart: AudioManager.Instance.Mixer.FindSnapshot("Title").TransitionTo(0.2f); PlayerManager.Instance.Reset(); PlayerManager.Instance.Locked = false; RatPlayer.ResetAllPlayers(); AudioManager.Instance.PlaySong(AudioManager.Song.Main); break; case State.InGame: AudioManager.Instance.Mixer.FindSnapshot("Gameplay").TransitionTo(1f); GameTimer = _gameDuration; _timerRunning = false; RatPlayer.SetupPlayersForPlay(ShipDelay); foreach (var go in GameObject.FindGameObjectsWithTag("Item")) { PoolManager.ReleaseObject(go); } StartCoroutine(StartDirectorRoutine()); SpawnManager.Instance.SpawningActive = false; AudioManager.Instance.PlaySound(WelcomeSFX.GetRandom(), this.transform.position, AudioManager.MixerGroup.Announcer, 1f); break; case State.VictoryScreen: AudioManager.Instance.Mixer.FindSnapshot("Title").TransitionTo(0.2f); StartCoroutine(VictoryScreenDelay()); WinnerDirector.gameObject.SetActive(true); AudioManager.Instance.PlaySong(AudioManager.Song.Nothing); AudioManager.Instance.PlaySound(WinnerSFX.GetRandom(), this.transform.position, AudioManager.MixerGroup.Announcer, 1f); break; default: break; } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create the SpriteBatch and add it as a service spriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(typeof(SpriteBatch), spriteBatch); // Initialize graphics device MenuView.InitializeGraphicsDevice(); GameplayView.InitializeGraphicsDevice(); // If the running grphics device supports it, high resolution textures will be used for the // terrain. (Otherwise the terrain will get a random color with some grain for added detail.) bool loadHighresTextures = GraphicsDevice.GraphicsDeviceCapabilities.MaxTextureWidth >= 2560; // Load sprites Sprites.LoadContent(Content, loadHighresTextures); // Load audio Audio.LoadContent(Content); // Set resolution to previously stored setting GameplayView.setInitialResolution(); }
public override void LoadView() { GameplayView = WindowsViewHolder.Instance.GameplayView; }
public static GameplayPresenter injectGameplayPresenter(GameplayView view) { return(new GameplayPresenterImpl(view, injectGamePlayRepository(), injectAirplanesRepository(), injectSessionRepository())); }
public void OnParametersPass(GameplayView.GameplayViewScreen gameplay) { this.gameplay = gameplay; }
/// <summary> /// Default constructor /// </summary> public BunnyGame() { Content.RootDirectory = "Content"; IsFixedTimeStep = false; // Initialize a GraphicsDeviceManager and add it as a Service graphics = new GraphicsDeviceManager(this); Services.AddService(typeof(GraphicsDeviceManager), graphics); // Read settings from settings.ini List <string> settingValues = new List <string>(); List <string> settingsFromFile; try { settingsFromFile = Utility.ReadFromFile("settings.ini"); } catch (FileNotFoundException e) { settingsFromFile = new List <string>(); } if (settingsFromFile.Count < 4) // Settings read from file are wrong. Use standard settings and create new settings.ini file { Settings.Resolution = Resolution.Res_800x600; Settings.FullScreen = false; Settings.EntityLimit = Setting.Medium; Settings.GoreLevel = Setting.Medium; Settings.writeSettingsToIniFile(); } else { for (int i = 0; i < settingsFromFile.Count; i++) { settingValues.Add(settingsFromFile.ElementAt(i).Split('=')[1].Trim()); } // Apply settings Settings.Resolution = (Resolution)Enum.Parse(typeof(Resolution), settingValues[0], true); Settings.FullScreen = Boolean.Parse(settingValues[1]); Settings.EntityLimit = (Setting)Enum.Parse(typeof(Setting), settingValues[2], true); Settings.GoreLevel = (Setting)Enum.Parse(typeof(Setting), settingValues[3], true); } // Initialize model MenuModel = new MenuModel(this); GameplayModel = new GameplayModel(this); // Initialize view MenuView = new MenuView(this, MenuModel); GameplayView = new GameplayView(this, GameplayModel); // Initialize controller Controller = new Controller(this, MenuModel); // Add model components Components.Add(MenuModel); Components.Add(GameplayModel); // Add view components Components.Add(MenuView); Components.Add(GameplayView); // Add controller component Components.Add(Controller); }