示例#1
0
        public void UpdateSeVolume(IVolumeUpdatable volumeUpdatable)
        {
            seMuteOnButton.image.color = volumeUpdatable.IsMute() ? _positiveColor : _negativeColor;
            seMuteOnButton
            .OnClickAsObservable()
            .Subscribe(_ =>
            {
                volumeUpdatable.SetMute(true);
                seMuteOnButton.image.color  = _positiveColor;
                seMuteOffButton.image.color = _negativeColor;
            })
            .AddTo(this);

            seMuteOffButton.image.color = volumeUpdatable.IsMute() ? _negativeColor : _positiveColor;
            seMuteOffButton
            .OnClickAsObservable()
            .Subscribe(_ =>
            {
                volumeUpdatable.SetMute(false);
                seMuteOnButton.image.color  = _negativeColor;
                seMuteOffButton.image.color = _positiveColor;
            })
            .AddTo(this);

            seVolumeSlider.value = volumeUpdatable.GetVolume();
            seVolumeSlider
            .OnValueChangedAsObservable()
            .Subscribe(volumeUpdatable.SetVolume)
            .AddTo(this);
        }
示例#2
0
        public void SaveSound(IVolumeUpdatable bgm, IVolumeUpdatable se)
        {
            UnityEngine.Debug.Log("save!!!");
            ES3.Save(SaveKey.BGM_VOLUME, bgm.GetVolume());
            ES3.Save(SaveKey.BGM_MUTE, bgm.IsMute());

            ES3.Save(SaveKey.SE_VOLUME, se.GetVolume());
            ES3.Save(SaveKey.SE_MUTE, se.IsMute());
        }
示例#3
0
        public void LoadSound(IVolumeUpdatable bgm, IVolumeUpdatable se)
        {
            var bgmVolume = ES3.Load(SaveKey.BGM_VOLUME, bgm.GetVolume());

            bgm.SetVolume(bgmVolume);
            var bgmMute = ES3.Load(SaveKey.BGM_MUTE, bgm.IsMute());

            bgm.SetMute(bgmMute);

            var seVolume = ES3.Load(SaveKey.SE_VOLUME, se.GetVolume());

            se.SetVolume(seVolume);
            var seMute = ES3.Load(SaveKey.SE_MUTE, se.IsMute());

            se.SetMute(seMute);
        }
 private void SetSliderValue(IVolumeUpdatable bgm, IVolumeUpdatable se)
 {
     bgmSlider.value = bgm.GetVolume();
     seSlider.value  = se.GetVolume();
 }