mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Load different music based on scene
This commit is contained in:
1 parent
7ec24db6bd
commit
13d7d3159b
1 file changed
+19
-3
@@ -1,5 +1,6 @@
|
||||
using BepInEx;
|
||||
using Harmony;
|
||||
using Illusion.Game;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
@@ -69,10 +70,23 @@ namespace ResourceRedirector
|
||||
Manager.Sound.Instance.SetParent(typeObjects[type], script, settingObjects[type]);
|
||||
}
|
||||
|
||||
if (true) //script.clip.StartsWith("bgm"))
|
||||
if (script.clip.name.StartsWith("bgm"))
|
||||
{
|
||||
string path = "file://" + BepInEx.Common.Utility.PluginsDirectory.Replace('\\', '/') + "/music.ogg";
|
||||
Console.WriteLine(path);
|
||||
string path;
|
||||
|
||||
switch ((BGM)int.Parse(script.clip.name.Remove(0, 4)))
|
||||
{
|
||||
case BGM.Title:
|
||||
default:
|
||||
path = "file://" + BepInEx.Common.Utility.PluginsDirectory.Replace('\\', '/') + "/title.wav";
|
||||
break;
|
||||
case BGM.Custom:
|
||||
path = "file://" + BepInEx.Common.Utility.PluginsDirectory.Replace('\\', '/') + "/custom.wav";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine($"Loaded {path}");
|
||||
WWW loadGachi = new WWW(path);
|
||||
|
||||
|
||||
@@ -85,6 +99,8 @@ namespace ResourceRedirector
|
||||
script.audioSource.clip = clip;
|
||||
|
||||
f_clip.SetValue(script, clip, null);
|
||||
|
||||
loadGachi.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user