void musicButton_Selected(object sender, EventArgs e) { TempleMain.Player.MusicActive = !TempleMain.Player.MusicActive; if (TempleMain.Player.MusicActive) { musicButton.SourceRectangle = new Rectangle(576, 576, 64, 64); SoundBoard.MusicControl("UnSilence"); } else { musicButton.SourceRectangle = new Rectangle(576, 640, 64, 64); SoundBoard.MusicControl("Silence"); } }
protected override void OnResume() { base.OnResume(); SoundBoard.MusicControl("UnSilence"); }
public void ScreenControl(Screens screen, string command) { switch (screen) { case Screens.TitleScreen: if (command == "Next") { titleScreen.ScreenState = ScreenStates.FINISHED; } else if (command == "Begin") { mainMenuScreen = new MainMenuScreen(stateManager, titleScreen.Tiling, Screens.MainMenuScreen); stateManager.AddScreen(mainMenuScreen); PieceTemplate.SetColorFamilies(Player.ColorPreference); } else if (command == "NewUser") { InitUser("Player"); } break; case Screens.ClassicScreen: if (command == "Lost") { var seasonz = (gamePlayScreen.Year - 1) * 4; seasonz += (int)gamePlayScreen.Season + 1; endStageScreen = new EndStageScreen(stateManager, Screens.EndStageScreen, command, gamePlayScreen.Score, gamePlayScreen.TotalMatches); stateManager.AddScreen(endStageScreen); endStageScreen.EndSeason = seasonz; gamePlayScreen.ScreenState = ScreenStates.FINISHED; SaveUser(); } else if (command == "Save") { SaveUser(); } else if (command == "Pause") { pauseScreen.ScreenState = ScreenStates.ACTIVE_DRAW; pauseScreen.Caller = "Classic"; gamePlayScreen.ScreenState = ScreenStates.IDLE_NODRAW; } else if (command == "Won") { var seasonz = (gamePlayScreen.Year - 1) * 4; seasonz += (int)gamePlayScreen.Season + 1; endStageScreen = new EndStageScreen(stateManager, Screens.EndStageScreen, command, gamePlayScreen.Score, gamePlayScreen.TotalMatches); stateManager.AddScreen(endStageScreen); endStageScreen.EndSeason = seasonz; gamePlayScreen.ScreenState = ScreenStates.FINISHED; SaveUser(); } else if (command == "InterSave") { gamePlayScreen.FinalizeGamePlay(Player); SaveUser(); } break; case Screens.OptionsScreen: if (command == "Back") { optionsScreen.ScreenState = ScreenStates.FINISHED; mainMenuScreen.ScreenState = ScreenStates.ACTIVE_DRAW; optionsScreen = null; SaveUser(); } else if (command == "Tiles") { Player.SetData(); SaveUser(); } else if (command == "BackPause") { optionsScreen.ScreenState = ScreenStates.FINISHED; pauseScreen.ScreenState = ScreenStates.ACTIVE_DRAW; SaveUser(); optionsScreen = null; } else if (command == "Reset") { Player.TutorialPlayed = false; SaveUser(); } else { PieceTemplate.SetColorFamilies(command); Player.SetData(command); SaveUser(); } break; case Screens.EndStageScreen: if (command == "Back") { endStageScreen.ScreenState = ScreenStates.FINISHED; mainMenuScreen.ScreenState = ScreenStates.ACTIVE_DRAW; Player.UpdateUser(endStageScreen.FullXPPool, endStageScreen.XPForThisLevel, endStageScreen.CurrentLvl); SaveUser(); endStageScreen = null; gamePlayScreen = null; pauseScreen = null; SoundBoard.MusicControl("ToMenu"); } break; case Screens.MainMenuScreen: if (command == "Exit") { Exit(); } else if (command == "Endurance") { mainMenuScreen.ScreenState = ScreenStates.IDLE_NODRAW; pauseScreen = new PauseScreen(stateManager, Screens.PauseScreen); pauseScreen.ScreenState = ScreenStates.IDLE_NODRAW; stateManager.AddScreen(pauseScreen); gamePlayScreen = new GamePlayScreen(stateManager, Screens.EnduranceScreen); stateManager.AddScreen(gamePlayScreen); SoundBoard.MusicControl("ToPlay"); } else if (command == "Classic") { mainMenuScreen.ScreenState = ScreenStates.IDLE_NODRAW; pauseScreen = new PauseScreen(stateManager, Screens.PauseScreen); pauseScreen.ScreenState = ScreenStates.IDLE_NODRAW; stateManager.AddScreen(pauseScreen); if (Player.ZenSavedScore == 0) { gamePlayScreen = new GamePlayScreen(stateManager, Screens.ClassicScreen); stateManager.AddScreen(gamePlayScreen); } else { gamePlayScreen = new GamePlayScreen(stateManager, Screens.ClassicScreen); stateManager.AddScreen(gamePlayScreen); gamePlayScreen.IntroduceSaveData(Player); } SoundBoard.MusicControl("ToPlay"); } else if (command == "Stats") { mainMenuScreen.ScreenState = ScreenStates.IDLE_NODRAW; statsScreen = new StatsScreen(stateManager, Screens.StatsScreen); stateManager.AddScreen(statsScreen); //tutorialScreen = new TutorialScreen(stateManager, Screens.TutorialScreen); //stateManager.AddScreen(tutorialScreen); } else if (command == "Options") { optionsScreen = new OptionsScreen(stateManager, Screens.OptionsScreen, "Menu"); stateManager.AddScreen(optionsScreen); mainMenuScreen.ScreenState = ScreenStates.IDLE_NODRAW; } break; //case Screens.TutorialScreen: // if (command == "Done") // { // tutorialScreen.ScreenState = ScreenStates.FINISHED; // mainMenuScreen.ScreenState = ScreenStates.ACTIVE_DRAW; // } //break; case Screens.EnduranceScreen: if (command == "Won") { var seasonz = (gamePlayScreen.Year - 1) * 4; seasonz += (int)gamePlayScreen.Season + 1; endStageScreen = new EndStageScreen(stateManager, Screens.EndStageScreen, command, gamePlayScreen.Score, gamePlayScreen.TotalMatches); stateManager.AddScreen(endStageScreen); endStageScreen.EndSeason = seasonz; gamePlayScreen.ScreenState = ScreenStates.FINISHED; Player.BoardRocks = null; Player.CurrentZenSeason = 0; Player.SavedZenPieces.Clear(); Player.UsedPieceCount = null; Player.ZenSavedScore = 0; SaveUser(); } else if (command == "Lost") { var seasonz = (gamePlayScreen.Year - 1) * 4; seasonz += (int)gamePlayScreen.Season + 1; endStageScreen = new EndStageScreen(stateManager, Screens.EndStageScreen, command, gamePlayScreen.Score, gamePlayScreen.TotalMatches); stateManager.AddScreen(endStageScreen); endStageScreen.EndSeason = seasonz; gamePlayScreen.ScreenState = ScreenStates.FINISHED; SaveUser(); } else if (command == "Pause") { pauseScreen.ScreenState = ScreenStates.ACTIVE_DRAW; pauseScreen.Caller = "Zen"; gamePlayScreen.ScreenState = ScreenStates.IDLE_NODRAW; } break; case Screens.PauseScreen: if (command == "ClassicUn") { pauseScreen.ScreenState = ScreenStates.IDLE_NODRAW; gamePlayScreen.ScreenState = ScreenStates.ACTIVE_DRAW; } else if (command == "ZenUn") { pauseScreen.ScreenState = ScreenStates.IDLE_NODRAW; gamePlayScreen.ScreenState = ScreenStates.ACTIVE_DRAW; } else if (command == "ZenEnd") { var seasonz = (gamePlayScreen.Year - 1) * 4; seasonz += (int)gamePlayScreen.Season + 1; pauseScreen.ScreenState = ScreenStates.FINISHED; gamePlayScreen.ScreenState = ScreenStates.FINISHED; endStageScreen = new EndStageScreen(stateManager, Screens.EndStageScreen, command, gamePlayScreen.Score, gamePlayScreen.TotalMatches); stateManager.AddScreen(endStageScreen); endStageScreen.EndSeason = seasonz; SaveUser(); } else if (command == "ClassicEnd") { pauseScreen.ScreenState = ScreenStates.FINISHED; gamePlayScreen.FinalizeGamePlay(Player); SaveUser(); gamePlayScreen.ScreenState = ScreenStates.FINISHED; mainMenuScreen.ScreenState = ScreenStates.ACTIVE_DRAW; gamePlayScreen = null; SoundBoard.MusicControl("ToMenu"); } else if (command == "OptionsGame") { pauseScreen.ScreenState = ScreenStates.IDLE_NODRAW; optionsScreen = new OptionsScreen(stateManager, Screens.OptionsScreen, "GamePaused"); stateManager.AddScreen(optionsScreen); } break; case Screens.StatsScreen: if (command == "Back") { mainMenuScreen.ScreenState = ScreenStates.ACTIVE_DRAW; statsScreen.ScreenState = ScreenStates.FINISHED; } break; } }
protected override void OnPause() { base.OnPause(); SoundBoard.MusicControl("Silence"); }