mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
dc9756e423
@ -12,16 +12,26 @@ namespace NewHorizons.Builder.Body
|
||||
var radius = module.radius;
|
||||
|
||||
AudioClip clip = null;
|
||||
if (module.audioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(module.audioClip);
|
||||
else if (module.audioFilePath != null)
|
||||
if (!string.IsNullOrEmpty(module.audioClip))
|
||||
{
|
||||
clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(module.audioClip);
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Utility.Logger.LogError($"Couldn't get audio from clip [{module.audioClip}]");
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(module.audioFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + module.audioFilePath);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch { }
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Utility.Logger.LogError($"Couldn't load audio file {module.audioFilePath} : {e.Message}");
|
||||
Utility.Logger.LogError($"Couldn't get audio from file [{module.audioFilePath}]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,17 +153,14 @@ namespace NewHorizons.Builder.Props
|
||||
var name = StringToSignalName(info.name);
|
||||
|
||||
AudioClip clip = null;
|
||||
if (info.audioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(info.audioClip);
|
||||
else if (info.audioFilePath != null)
|
||||
if (!string.IsNullOrEmpty(info.audioClip)) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(info.audioClip);
|
||||
else if (!string.IsNullOrEmpty(info.audioFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + info.audioFilePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load audio file {info.audioFilePath} : {e.Message}");
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
if (clip == null)
|
||||
|
||||
@ -54,12 +54,15 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (clip != null)
|
||||
{
|
||||
var travelSource = Locator.GetGlobalMusicController()._travelSource;
|
||||
travelSource._audioLibraryClip = AudioType.None;
|
||||
travelSource._clipArrayIndex = 0;
|
||||
travelSource._clipArrayLength = 0;
|
||||
travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL;
|
||||
travelSource.clip = clip;
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() =>
|
||||
{
|
||||
var travelSource = Locator.GetGlobalMusicController()._travelSource;
|
||||
travelSource._audioLibraryClip = AudioType.None;
|
||||
travelSource._clipArrayIndex = 0;
|
||||
travelSource._clipArrayLength = 0;
|
||||
travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL;
|
||||
travelSource.clip = clip;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user