mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-12 22:44:35 +01:00
49 lines
2.4 KiB
C#
49 lines
2.4 KiB
C#
using MoleMole.Config;
|
|
using UnityEngine;
|
|
|
|
namespace MoleMole
|
|
{
|
|
public static class AudioSettingData
|
|
{
|
|
private static float _volumeThreshold = 0.01f;
|
|
|
|
public static void ApplySettingConfig()
|
|
{
|
|
ConfigAudioSetting personalAudioSetting = Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting;
|
|
if (personalAudioSetting.IsUserDefined)
|
|
{
|
|
Singleton<WwiseAudioManager>.Instance.SetParam("Vol_BGM", personalAudioSetting.BGMVolume);
|
|
Singleton<WwiseAudioManager>.Instance.SetParam("Vol_SE", personalAudioSetting.SoundEffectVolume);
|
|
Singleton<WwiseAudioManager>.Instance.SetParam("Vol_Voice", personalAudioSetting.VoiceVolume);
|
|
Singleton<WwiseAudioManager>.Instance.SetLanguage(personalAudioSetting.CVLanguage);
|
|
}
|
|
}
|
|
|
|
public static void CopyPersonalAudioConfig(ref ConfigAudioSetting to)
|
|
{
|
|
ConfigAudioSetting personalAudioSetting = Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting;
|
|
to.BGMVolume = personalAudioSetting.BGMVolume;
|
|
to.SoundEffectVolume = personalAudioSetting.SoundEffectVolume;
|
|
to.VoiceVolume = personalAudioSetting.VoiceVolume;
|
|
to.CVLanguage = personalAudioSetting.CVLanguage;
|
|
}
|
|
|
|
public static bool IsValueEqualToPersonalAudioConfig(ConfigAudioSetting to)
|
|
{
|
|
ConfigAudioSetting personalAudioSetting = Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting;
|
|
return Mathf.Abs(personalAudioSetting.BGMVolume - to.BGMVolume) <= _volumeThreshold && Mathf.Abs(personalAudioSetting.SoundEffectVolume - to.SoundEffectVolume) <= _volumeThreshold && Mathf.Abs(personalAudioSetting.VoiceVolume - to.VoiceVolume) <= _volumeThreshold && personalAudioSetting.CVLanguage == to.CVLanguage;
|
|
}
|
|
|
|
public static void SavePersonalConfig(ConfigAudioSetting settingConfig)
|
|
{
|
|
Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting.BGMVolume = settingConfig.BGMVolume;
|
|
Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting.SoundEffectVolume = settingConfig.SoundEffectVolume;
|
|
Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting.VoiceVolume = settingConfig.VoiceVolume;
|
|
Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting.CVLanguage = settingConfig.CVLanguage;
|
|
Singleton<MiHoYoGameData>.Instance.GeneralLocalData.PersonalAudioSetting.IsUserDefined = true;
|
|
Singleton<MiHoYoGameData>.Instance.SaveGeneralData();
|
|
ApplySettingConfig();
|
|
}
|
|
}
|
|
}
|