public void LoadOption() { option = OptionsManager._Instance.soundOption; MusicSlider.value = option.MusicVolume; VoiceSlider.value = option.VoiceVolume; UISlider.value = option.UIVolume; ChangeText(); }
public OptionsManager() { var xPos = 550; var yPos = 300; var text = new Text(xPos - 200, yPos + 7, 35, "Mute all?", Raylib.Color.RAYWHITE); muteAllOption = new MuteOption(SoundManager.Instance.MuteAll, SoundManager.Instance.UnMuteAll, text, xPos, yPos, 50, 50); buttonSounds = new SoundOption("Click sounds", 1, SoundManager.Instance.MuteSounds, SoundManager.Instance.UnMuteSounds); musicSounds = new SoundOption("Music sounds", 2, SoundManager.Instance.MuteMusic, SoundManager.Instance.UnMuteMusic); }
public void SaveSoundOption(SoundOption tmp) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/optionsInfo.dat"); SoundOption data = new SoundOption(); data = tmp; bf.Serialize(file, data); file.Close(); SoundManager._Instance.LoadSoundOption(); }
private void PopulateSoundDropdown() { foreach (var option in BounceSoundOptions) { soundDropdown.options.Add(new Dropdown.OptionData(option.DisplayName)); } selectedSound = editPlayer.player.bounceSound; soundDropdown.value = BounceSoundOptions.IndexOf( BounceSoundOptions.FirstOrDefault(b => b.DisplayName == selectedSound?.DisplayName) ); soundDropdown.onValueChanged.AddListener(value => selectedSound = BounceSoundOptions[value]); soundDropdown.onValueChanged.AddListener(value => audioSource.PlayOneShot(BounceSoundOptions[value].Sound)); }
public void LoadSoundOption() { Debug.Log("Path : " + Application.persistentDataPath + "/optionsInfo.dat"); if (File.Exists(Application.persistentDataPath + "/optionsInfo.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/optionsInfo.dat", FileMode.Open); SoundOption data = (SoundOption)bf.Deserialize(file); file.Close(); soundOption = data; } else { SoundOption tmp = new SoundOption(); tmp.MusicVolume = 1; tmp.VoiceVolume = 1; tmp.UIVolume = 1; soundOption = tmp; SaveSoundOption(tmp); } }
public BlinkLinkEyeClickData( ClickAction shortLeftWinkAction, ClickAction shortRightWinkAction, ClickAction longLeftWinkAction, ClickAction longRightWinkAction, ClickAction blinkAction, float shortWinkTime, float longWinkTime, SoundOption soundOption, EyeStatusWindowOption eyeStatusWindowOption, bool switchEyes) { mutex = new object(); ShortLeftWinkAction = shortLeftWinkAction; ShortRightWinkAction = shortRightWinkAction; LongLeftWinkAction = longLeftWinkAction; LongRightWinkAction = longRightWinkAction; ShortWinkTime = shortWinkTime; LongWinkTime = longWinkTime; SoundOption = soundOption; BlinkAction = blinkAction; SwitchEyes = switchEyes; EyeStatusWindowOption = eyeStatusWindowOption; }
private void PopulateOptions(IStateOwner pOwner) { int DesiredFontPixelHeight = (int)(pOwner.GameArea.Height * (23d / 644d)); Font standardFont = TetrisGame.GetRetroFont(DesiredFontPixelHeight, 1.0f); Font ItemFont = TetrisGame.GetRetroFont(DesiredFontPixelHeight * .75f, 1.0); MenuStateTextMenuItem ReturnItem = new MenuStateTextMenuItem() { Text = "Return" }; StateHeader = "Options (" + _SettingsTitle + ")"; HeaderTypeface = TetrisGame.GetRetroFont(14, 1.0f).FontFamily.Name; HeaderTypeSize = DesiredFontPixelHeight * .75f; MenuItemActivated += (obj, e) => { if (e.MenuElement == ReturnItem) { _AlterSet.Save(); pOwner.CurrentState = _OriginalState; } }; //add the sound options label. MenuStateLabelMenuItem SoundLabel = new MenuStateLabelMenuItem() { Text = "--Sound--" }; var useMusicOptions = new SoundOption[] { new SoundOption("TDM_A_THEME", "Classic"), new SoundOption("tetris_a_theme_techno", "Korotechno"), new SoundOption("tetris_a_theme_techno_A", "Korotechno - Alt"), new SoundOption("tetris_theme_A", "NES A Theme"), new SoundOption("tetris_theme_B", "NES B Theme"), new SoundOption("tetris_theme_C", "NES C Theme"), new SoundOption("tetris_2", "Tetris 2"), new SoundOption("smb3_tetris", "Tetris DS-SMB3"), new SoundOption("tetrisds", "Tetris DS"), new SoundOption("kirbysand", "Kirby Sand"), new SoundOption("silius1", "Silius"), new SoundOption("journey3", "Journey 3"), new SoundOption("tetris_nes_theme", "NES"), new SoundOption("tetris_gb_theme", "GB"), new SoundOption("DrMarioFever", "Fever"), new SoundOption("DrMarioFever_Rock", "Fever Rock"), new SoundOption("DrMarioChill", "Chill"), new SoundOption("DrMarioChill_Rock", "Chill Rock"), new SoundOption("<RANDOM>", "Random") }; var ThemeArray = (from s in AudioTheme.AvailableSoundThemes select new SoundOption(s.Item1, s.Item2)).ToArray(); int startIndex = 0; String CurrentTheme = _AlterSet.SoundScheme; for (int i = 0; i < ThemeArray.Length; i++) { if (ThemeArray[i].Equals(CurrentTheme)) { startIndex = i; break; } } int startMusicIndex = 0; String CurrentMusic = pOwner.Settings.std.MusicOption; for (int i = 0; i < useMusicOptions.Length; i++) { if (useMusicOptions[i].SoundKey.Equals(CurrentMusic, StringComparison.OrdinalIgnoreCase)) { startMusicIndex = i; } } MultiOptionManagerList <SoundOption> SoundOptions = new MultiOptionManagerList <SoundOption>(useMusicOptions, startMusicIndex); MultiOptionManagerList <SoundOption> SoundThemeOptions = new MultiOptionManagerList <SoundOption>( ThemeArray, startIndex); MenuStateMultiOption <SoundOption> MusicOptionItem = new MenuStateMultiOption <SoundOption>(SoundOptions); MenuStateMultiOption <SoundOption> SoundThemeOptionItem = new MenuStateMultiOption <SoundOption>(SoundThemeOptions); MusicOptionItem.Text = "Music"; SoundThemeOptionItem.Text = "Sound Theme"; MusicOptionItem.OnChangeOption += MusicOptionItem_OnActivateOption; SoundThemeOptionItem.OnChangeOption += SoundThemeOptionItem_OnChangeOption; ReturnItem.FontFace = SoundLabel.FontFace = MusicOptionItem.FontFace = SoundThemeOptionItem.FontFace = ItemFont.FontFamily.Name; ReturnItem.FontSize = SoundLabel.FontSize = MusicOptionItem.FontSize = SoundThemeOptionItem.FontSize = ItemFont.Size; MenuElements.Add(ReturnItem); MenuElements.Add(SoundLabel); MenuElements.Add(MusicOptionItem); MenuElements.Add(SoundThemeOptionItem); }
public void ChangePlayerSound(SoundOption option) { player.bounceSound = option; }
// Update is called once per frame void Update() { DemonOn = Trap01.GetComponent <DemonTrap>().DemonTrapOn; GhostOn = Trap02.GetComponent <GhostTrap>().GhostTrapOn; LoadOn = Trap03.GetComponent <LoadTrap>().LoadTrapOn; if (DemonOn && GhostOn && LoadOn /*|| Input.GetKey(KeyCode.B)*/) { Diablo.SetActive(true); if (!TrapOn) { StartCoroutine(DiabloSummon()); DiabloSound.GetComponent <AudioSource>().Play(); TrapOn = true; } } if (player_c.die) { GameOver.SetActive(true); } if (Input.GetKeyDown(KeyCode.Q)) { GameObject.Find("Vol").GetComponent <AudioSource>().Play(); if (!Quest.active) { if (status.active) { status.SetActive(false); } Quest.SetActive(true); cam.GetComponent <CameraSize>().Button01(); //cam.transform.position -= new Vector3(2, 0, 0); } else { Quest.SetActive(false); cam.GetComponent <CameraSize>().Button01(); player_c.wait = true; //cam.transform.position += new Vector3(2, 0, 0); } } if (Input.GetKeyDown(KeyCode.I)) { GameObject.Find("Vol").GetComponent <AudioSource>().Play(); if (!Inven.active) { if (skill.active) { skill.SetActive(false); } PlayerControl.DontMove = true; Inven.SetActive(true); cam.GetComponent <CameraSize>().Button02(); //cam.transform.position += new Vector3(2, 0, 0); } else { PlayerControl.DontMove = false; Inven.SetActive(false); cam.GetComponent <CameraSize>().Button02(); player_c.wait = true; //cam.transform.position -= new Vector3(2, 0, 0); } } if (Input.GetKeyDown(KeyCode.Escape)) { if (player_c.die) { SceneManager.LoadScene("Title"); } else { GameObject.Find("Vol").GetComponent <AudioSource>().Play(); if (skill.active) { skill.SetActive(false); player_c.wait = true; cam.transform.position -= new Vector3(2, 0, 0); cam.GetComponent <CameraSize>().status = false; } else if (skill_right.active) { skill_right.SetActive(false); player_c.wait = true; } else if (skill_left.active) { skill_left.SetActive(false); player_c.wait = true; } else if (status.active) { status.SetActive(false); player_c.wait = true; cam.transform.position += new Vector3(2, 0, 0); cam.GetComponent <CameraSize>().skill = false; } else if (Inven.active) { Inven.SetActive(false); PlayerControl.DontMove = false; player_c.wait = true; cam.transform.position -= new Vector3(2, 0, 0); cam.GetComponent <CameraSize>().status = false; } else if (Quest.active) { Quest.SetActive(false); player_c.wait = true; cam.transform.position += new Vector3(2, 0, 0); cam.GetComponent <CameraSize>().skill = false; } else if (NPC_menu01.active) { NPC_menu01.SetActive(false); player_c.Play(); } else if (NPC_menu02.active) { NPC_menu02.SetActive(false); player_c.Play(); } else if (Talk.active) { Talk.SetActive(false); if (NPCTalk.Intro || NPCTalk.Gossip) { NPC_menu02.SetActive(true); NPCTalk.Intro = false; NPCTalk.Gossip = false; } } else if (!skill.active && !Inven.active && !skill_left.active && !skill_right.active && !status.active && !Quest.active && !NPC_menu01.active && !NPC_menu02.active && !Talk.active && !player_c.die) { OnOff.Play(); state++; if (state % 2 == 1) { player_m.isRun = false; player_m.isWalk = false; player_m.animator.SetBool("Walk", false); player_m.animator.SetBool("Run", false); //Time.timeScale = 0f; Option.SetActive(true); if (Option.activeSelf) { player_c.wait = false; } } else { player_c.wait = true; for (int i = 0; i < Focus_d.Length; i++) { Focus_d[i].SetActive(false); } Option.SetActive(false); SeOption.SetActive(false); SoundOption.SetActive(false); VideoOption.SetActive(false); //Time.timeScale = 1f; state = 0; } } } } }