public void bgMusicVolumeChangeCallBack(SettingViewScript script,float percent) { bool isMute = false; if (Convert.ToInt32(Math.Abs(percent)) == 0) isMute = true; VolumeStorageHelper.setBgMusicVolume(percent); VolumeStorageHelper.setBgMusicMute(isMute); BgMusicHelper.setBgVolume(percent); }
public void bgMusicMuteSwitchCallBack(SettingViewScript script, bool isMute) { Debug.Log("isMute " + isMute); float volume = 0f; VolumeStorageHelper.setBgMusicMute(isMute); if (!isMute) { volume = VolumeStorageHelper.getBgMusicVolume(); } BgMusicHelper.setBgVolume(volume); }
//设置界面 public void settingViewInitCallBack(SettingViewScript script) { float bgMusicVolume = VolumeStorageHelper.getBgMusicVolume(); SettingViewHelper.setBgMusicVolume(bgMusicVolume); float soundVolume = VolumeStorageHelper.getSoundVolume(); SettingViewHelper.setSoundVolume(soundVolume); bool isBgMusicMute = VolumeStorageHelper.getBgMusicMute(); SettingViewHelper.setBgMusicMute(isBgMusicMute); if (isBgMusicMute) BgMusicHelper.setBgVolume(0); bool isSoundMute = VolumeStorageHelper.getSoundMute(); SettingViewHelper.setSoundMute(isSoundMute); if (isSoundMute) SoundHelper.setVolume(0); }
public static void addSettingView( SettingViewScript.InitCallBack initCallBack, SettingViewScript.VolumeChangeCallBack bgMusicVolumeChangeCallBack, SettingViewScript.VolumeChangeCallBack soundVolumeChangeCallBack, SettingViewScript.ToggleSwitchCallBack bgMusicMuteSwitchCallBack, SettingViewScript.ToggleSwitchCallBack soundMuteSwitchCallBack, SettingViewScript.TouchCallBack touchCallBack ) { if (null != GameObject.Find(SpriteNameConst.SETTING_VIEW_NAME)) return; Transform prefab = Resources.Load<Transform>("prefab/settingView/settingView"); Transform transform = Instantiate(prefab, new Vector3(0,1, 1), Quaternion.identity) as Transform; transform.gameObject.name = SpriteNameConst.SETTING_VIEW_NAME; SettingViewScript settingViewScript = transform.GetComponent<SettingViewScript>(); CanvasHelper.setOtherCanvasTouchEnabled(transform, false); settingViewScript.setInitCallBack(initCallBack); settingViewScript.setBgMusicVolumeChangeCallBack(bgMusicVolumeChangeCallBack); settingViewScript.setSoundVolumeChangeCallBack(soundVolumeChangeCallBack); settingViewScript.setBgMusicMuteSwitchCallBack(bgMusicMuteSwitchCallBack); settingViewScript.setSoundMuteSwitchCallBack(soundMuteSwitchCallBack); settingViewScript.setTouchCallBack(touchCallBack); }
public void settingViewCloseTapped(SettingViewScript script) { SettingViewHelper.removeSettingView(); }
public void soundVolumeChangeCallBack(SettingViewScript script, float percent) { bool isMute = false; if (Convert.ToInt32(Math.Abs(percent)) == 0) isMute = true; VolumeStorageHelper.setSoundVolume(percent); VolumeStorageHelper.setSoundMute(isMute); SoundHelper.setVolume(percent); }
public void soundMuteSwitchCallBack(SettingViewScript script, bool isMute) { float volume = 0f; VolumeStorageHelper.setSoundMute(isMute); if (!isMute) { volume = VolumeStorageHelper.getSoundVolume(); } SoundHelper.setVolume(volume); }