Exemplo n.º 1
0
        public static void SetVolume(this SoundComponent soundComponent, string soundGroupName, float volume)
        {
            if (string.IsNullOrEmpty(soundGroupName))
            {
                Log.Warning("Sound group is invalid.");
                return;
            }

            ISoundGroup soundGroup = soundComponent.GetSoundGroup(soundGroupName);

            if (soundGroup == null)
            {
                Log.Warning("Sound group '{0}' is invalid.", soundGroupName);
                return;
            }

            soundGroup.Volume = volume;

            GameEntry.Setting.SetFloat(Utility.Text.Format(Constant.Setting.SoundGroupVolume, soundGroupName), volume);
            GameEntry.Setting.Save();
        }
Exemplo n.º 2
0
    public static void Mute(this SoundComponent soundComponent, string soundGroupName, bool mute)
    {
        if (string.IsNullOrEmpty(soundGroupName))
        {
            Log.Warning("Sound group is invalid.");
            return;
        }

        ISoundGroup soundGroup = soundComponent.GetSoundGroup(soundGroupName);

        if (soundGroup == null)
        {
            Log.Warning("Sound group '{0}' is invalid.", soundGroupName);
            return;
        }

        soundGroup.Mute = mute;

        GameEntry.Setting.SetBool(Utility.Text.Format(Constant.Setting.SoundGroupMuted, soundGroupName), mute);
        GameEntry.Setting.Save();
    }
Exemplo n.º 3
0
    /// <summary>
    /// 设置声音组是否静音
    /// </summary>
    /// <param name="soundComponent"></param>
    /// <param name="soundGroupName"></param>
    /// <param name="isMute"></param>
    public static void SetMute(this SoundComponent soundComponent, string soundGroupName, bool isMute)
    {
        if (string.IsNullOrEmpty(soundGroupName))
        {
            Log.Warning("Sound group name is null or empty.");
            return;
        }

        ISoundGroup soundGroup = soundComponent.GetSoundGroup(soundGroupName);

        if (soundGroup == null)
        {
            Log.Warning("Sound group is invalid.");
            return;
        }

        soundGroup.Mute = isMute;

        GameManager.Setting.SetBool(string.Format(Const.SettingKey.SoundGroupMuted, soundGroupName), isMute);
        GameManager.Setting.Save();
    }