void MoveFocusTo( PauseMenuButton newFocusedButton ) { if (newFocusedButton != null) { focusedButton = newFocusedButton; } }
void Start() { points = 200; maxCircleSize = false; cs = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CircleSpawner>(); gc = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ACGameContrl>(); pmb = GameObject.FindGameObjectWithTag("PauseArrow").GetComponent <PauseMenuButton>(); }
private void switchPauseOption(PauseMenuButton next) { currentOptionButton.BroadcastMessage("SelectedChanged", false, SendMessageOptions.RequireReceiver); next.BroadcastMessage("SelectedChanged", true, SendMessageOptions.RequireReceiver); currentOptionButton = next; /* * Count frames (calls to update) in future, because Time.timeScale is zero, and we need button selection cooldown. */ nextButtonSelectionFrame = frame + (int)(buttonSelectionCooldownTime * fps); }
public void LoadContent(ContentManager content) { fontBold42 = content.Load <SpriteFont>("Fonts/bold42"); mmButton = new PauseMenuButton(Game1.gameHeight / 2, "Главное меню"); quitButton = new PauseMenuButton(Game1.gameHeight / 2 + 50, "Выйти из игры"); deathTheme = content.Load <Song> ("Sounds/deathTheme"); victoryTheme = content.Load <Song>("Sounds/victoryTheme"); mmButton.LoadContent(content); quitButton.LoadContent(content); }
private void pauseGame() { paused = true; nextButtonSelectionFrame = frame + (int)(buttonSelectionCooldownTime * fps); masterVolumeObject.BroadcastMessage("SetMaster", pauseMenuSoundMultiplier, SendMessageOptions.RequireReceiver); graphics.SetActive(true); Time.timeScale = 0; /* * Select the default first button, and deselect the rest. */ currentOptionButton = firstButton; currentOptionButton.BroadcastMessage("SelectedChanged", true, SendMessageOptions.RequireReceiver); foreach(var button in pauseOptions.Where(g => g != firstButton)) { button.BroadcastMessage("SelectedChanged", false, SendMessageOptions.RequireReceiver); } }
//THE GRAPHICS SETTINGS < OH MY GOD WHY!!! > *ALL UPDATED BY PLAYERPREF* void Awake() { //Get the native width and height nativeWidth = Screen.width; nativeHeight = Screen.height; //Get Main Menu Button component mainMenuButton = GetComponent <MainMenuButton>(); //If the main menu button compnent was not found find the pause menu script if(!mainMenuButton) { pauseMenuButton = GetComponent <PauseMenuButton>(); } menuText = GetComponent <MenuText>(); //Gameplay Options Initialise //Difficulty if(!PlayerPrefs.HasKey ("Difficulty")) { PlayerPrefs.SetInt ("Difficulty", defaultDifficulty); difficulty = defaultDifficulty; } else { difficulty = PlayerPrefs.GetInt ("Difficulty"); } //Damage Text if(!PlayerPrefs.HasKey ("DamageText")) { PlayerPrefs.SetInt ("DamageText", defaultDamageText); if(damageTextToggle) { damageTextToggle.isOn = true; } } else { if(damageTextToggle) { int currentDamageText = PlayerPrefs.GetInt ("DamageText"); if(currentDamageText == 0) { damageTextToggle.isOn = false; } else { damageTextToggle.isOn = true; } } } //Invert X if(!PlayerPrefs.HasKey ("InvertX")) { PlayerPrefs.SetInt ("InvertX", defaultInvertX); if(invertXToggle) { invertXToggle.isOn = false; } } else { if(invertXToggle) { int currentInvertX = PlayerPrefs.GetInt ("InvertX"); if(currentInvertX == 0) { invertXToggle.isOn = false; } else { invertXToggle.isOn = true; } } } //Invert Y if(!PlayerPrefs.HasKey ("InvertY")) { PlayerPrefs.SetInt ("InvertY", defaultInvertY); if(invertYToggle) { invertYToggle.isOn = false; } } else { if(invertYToggle) { int currentInvertY = PlayerPrefs.GetInt ("InvertY"); if(currentInvertY == 0) { invertYToggle.isOn = false; } else { invertYToggle.isOn = true; } } } //Mouse Swap Toggle if(!PlayerPrefs.HasKey ("MouseSwap")) { PlayerPrefs.SetInt ("MouseSwap", defaultSwapMouseButton); if(mouseSwapToggle) { mouseSwapToggle.isOn = false; } } else { if(mouseSwapToggle) { int currentMouseSwap = PlayerPrefs.GetInt ("MouseSwap"); if(currentMouseSwap == 0) { mouseSwapToggle.isOn = false; } else { mouseSwapToggle.isOn = true; } } } //Mouse Sensitivity if(mouseSensitivityScrollbar) { if(!PlayerPrefs.HasKey ("MouseSensitivity")) { PlayerPrefs.SetFloat ("MouseSensitivity", defaultMouseSensitivity); mouseSensitivityScrollbar.value = defaultMouseSensitivity / 10f; } else { mouseSensitivityScrollbar.value = PlayerPrefs.GetFloat ("MouseSensitivity") / 10f; } } //Mouse Smooth X if(mouseSmoothXScrollbar) { if(!PlayerPrefs.HasKey ("MouseSmoothX")) { PlayerPrefs.SetFloat ("MouseSmoothX", defaultMouseSmoothX); mouseSmoothXScrollbar.value = defaultMouseSmoothX; } else { mouseSmoothXScrollbar.value = PlayerPrefs.GetFloat ("MouseSmoothX"); } } //Mouse Smooth Y if(mouseSmoothYScrollbar) { if(!PlayerPrefs.HasKey ("MouseSmoothY")) { PlayerPrefs.SetFloat ("MouseSmoothY", defaultMouseSmoothY); mouseSmoothYScrollbar.value = defaultMouseSmoothY; } else { mouseSmoothYScrollbar.value = PlayerPrefs.GetFloat ("MouseSmoothY"); } } //Master Volume if(masterVolumeScrollbar) { if(!PlayerPrefs.HasKey ("MasterVolume")) { PlayerPrefs.SetFloat ("MasterVolume", defaultMasterVolume); masterVolumeScrollbar.value = defaultMasterVolume; masterVolume = defaultMasterVolume; AudioListener.volume = defaultMasterVolume; } else { float currentMasterVolume = PlayerPrefs.GetFloat ("MasterVolume"); masterVolumeScrollbar.value = currentMasterVolume; masterVolume = currentMasterVolume; AudioListener.volume = currentMasterVolume; } } //SFX Volume if(sfxVolumeScrollbar) { if(!PlayerPrefs.HasKey ("SFXVolume")) { PlayerPrefs.SetFloat ("SFXVolume", defaultSFXVolume); sfxVolumeScrollbar.value = defaultSFXVolume; sfxVolume = defaultSFXVolume * masterVolume; } else { float currentSFXVolume = PlayerPrefs.GetFloat ("SFXVolume"); sfxVolumeScrollbar.value = currentSFXVolume; sfxVolume = currentSFXVolume * masterVolume; } } //Music Volume if(musicVolumeScrollbar) { if(!PlayerPrefs.HasKey ("MusicVolume")) { PlayerPrefs.SetFloat ("MusicVolume", defaultMusicVolume); musicVolumeScrollbar.value = defaultMusicVolume; musicVolume = defaultMusicVolume * masterVolume; } else { float currentMusicVolume = PlayerPrefs.GetFloat ("MusicVolume"); musicVolumeScrollbar.value = currentMusicVolume; musicVolume = currentMusicVolume * masterVolume; } } //Speaker Mode if(!PlayerPrefs.HasKey ("SpeakerMode")) { PlayerPrefs.SetInt ("SpeakerMode", defaultSpeakerMode); } //Resolution if(width) { width.text = Screen.width.ToString(); } if(height) { height.text = Screen.height.ToString(); } //V Sync if(!PlayerPrefs.HasKey ("VSync")) { PlayerPrefs.SetInt ("VSync", defaultVSync); QualitySettings.vSyncCount = defaultVSync; } else { QualitySettings.vSyncCount = PlayerPrefs.GetInt ("VSync"); } //Brightness if(brightnessScrollbar) { if(!PlayerPrefs.HasKey ("Brightness")) { PlayerPrefs.SetFloat ("Brightness", defaultBrightness); brightnessScrollbar.value = defaultBrightness; } else { brightnessScrollbar.value = PlayerPrefs.GetFloat ("Brightness"); } } //Contrast if(contrastScrollbar) { if(!PlayerPrefs.HasKey ("Contrast")) { PlayerPrefs.SetFloat ("Contrast", defaultContrast); contrastScrollbar.value = defaultContrast; } else { contrastScrollbar.value = PlayerPrefs.GetFloat ("Contrast"); } } //Mouse Cursor Size if(mouseCursorSizeScrollbar) { if(!PlayerPrefs.HasKey ("MouseCursorSize")) { PlayerPrefs.SetFloat ("MouseCursorSize", defaultMouseCursorSize); mouseCursorSizeScrollbar.value = defaultMouseCursorSize; } else { mouseCursorSizeScrollbar.value = PlayerPrefs.GetFloat ("MouseCursorSize"); } } //Graphics //Motion Blur if(!PlayerPrefs.HasKey ("MotionBlur")) { PlayerPrefs.SetFloat ("MotionBlur", defaultMotionBlur); } //Bloom if(!PlayerPrefs.HasKey ("Bloom")) { PlayerPrefs.SetFloat ("Bloom", defaultBloom); } //Sun Shafts if(!PlayerPrefs.HasKey ("SunShaft")) { PlayerPrefs.SetFloat ("SunShaft", defaultSunShaft); } //Graphics Quality: 0 = Low, 1 = Medium, 2 = High, 3 = Ultra, 4 = Custom if(!PlayerPrefs.HasKey ("GraphicsQuality")) { GraphicsMediumQuality (); //Set Everything to Medium Quality on default } else { int currentGraphics = PlayerPrefs.GetInt ("GraphicsQuality"); switch (currentGraphics) { case 0: GraphicsLowQuality (); break; case 1: GraphicsMediumQuality (); break; case 2: GraphicsHighQuality (); break; case 3: GraphicsUltraQuality (); break; case 4: menuText.UpdateAllGraphicsText (); break; } } }
public void Pause() { m_currentButton = m_panels[0].m_buttons[0]; ControllerManager.Instance.OnMenuInput += OnMenuInput; }
public override void Draw() { switch (NogardGame.GameState) { case NogardGame.GameStateEnum.MainMenu: PlayButton.DrawStandardButton(5, "Play", 1); ScoreButton.DrawStandardButton(5, " Highscore", 0.5f); AboutNogardButton.DrawStandardButton(5, "About Nogard", 0.4f); InstuctionsButton.DrawStandardButton(5, " How to play", 0.4f); ExitButton.DrawStandardButton(5, " Exit", 0.4f); MapButton.DrawStandardButton(5, " MapMaker", 0.4f); break; case NogardGame.GameStateEnum.Story: if (StoryMode.IntroStory) { BackButton.DrawStandardButton(5, " Back", 0.5f); } else { ContinueButton.DrawStandardButton(5, " Continue", 0.5f); } break; case NogardGame.GameStateEnum.GameActive: break; case NogardGame.GameStateEnum.HighScoreView: BackButton.DrawStandardButton(5, " Back", 0.5f); break; case NogardGame.GameStateEnum.Pause: ResumeButton.DrawStandardButton(5, "Resume", 0.5f); PauseMenuButton.DrawStandardButton(5, "MainMenu", 0.5f); break; case NogardGame.GameStateEnum.GameOver: if (GameOverManager.ScoreForm.GameSaved == false) { SaveScoreButton.DrawStandardButton(5, "Save Score", 0.5f); } else { SaveScoreButton.DrawStandardButton(5, "Score saved", 0.45f); } MainMenuButton.DrawStandardButton(5, " MainMenu", 0.4f); QuitButton.DrawStandardButton(5, " Quit Game", 0.4f); break; case NogardGame.GameStateEnum.MapMaker: break; case NogardGame.GameStateEnum.LevelSelector: LevelOneButton.DrawStandardButton(5, " Level One", 0.5f); LevelTwoButton.DrawStandardButton(5, " Level Two", 0.5f); LevelThreeButton.DrawStandardButton(5, " Level Three", 0.5f); SelectorBackButton.DrawStandardButton(5, " Back", 0.4f); break; default: throw new ArgumentOutOfRangeException(); } }