Initial commit

This commit is contained in:
Rendo 2026-09-10 20:49:41 +05:00
commit e95bbff8de
12 changed files with 133 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
bin/
obj/

BIN
Audio/Death.wav Normal file

Binary file not shown.

BIN
Audio/Fostral.wav Normal file

Binary file not shown.

BIN
Audio/Glorx.wav Normal file

Binary file not shown.

BIN
Audio/Infernals.wav Normal file

Binary file not shown.

BIN
Audio/MainTheme.wav Normal file

Binary file not shown.

BIN
Audio/Necross.wav Normal file

Binary file not shown.

BIN
Audio/OuterWorlds.wav Normal file

Binary file not shown.

BIN
Audio/VangersForever.wav Normal file

Binary file not shown.

BIN
Audio/Xplo.wav Normal file

Binary file not shown.

93
Plugin.cs Normal file
View file

@ -0,0 +1,93 @@
using System.IO;
using System.Collections;
using System.Collections.Generic;
using BepInEx;
using BepInEx.Logging;
using UnityEngine;
using HarmonyLib;
using CUCoreLib.Helpers;
namespace VangersMusic;
[BepInPlugin(MOD_CUSTOM_ID, MOD_CUSTOM_NAME, MOD_CUSTOM_VER)]
[BepInDependency("net.cucorelib", BepInDependency.DependencyFlags.HardDependency)]
public class Plugin : BaseUnityPlugin
{
internal static new ManualLogSource Logger;
private readonly Harmony _harmony = new(MOD_CUSTOM_ID);
const string MOD_CUSTOM_ID = "org.rendo.vangersmusic";
const string MOD_CUSTOM_NAME = "VangersMusic";
const string MOD_CUSTOM_VER = "0.1";
private AudioClip _mainMenu;
private AudioClip[] _location;
private AudioClip _death;
private AudioClip _dying;
private AudioClip _infernals;
private SongList GenerateSongList(AudioClip forClip) {
SongList list = new SongList();
list.songs = new AudioClip[] {forClip};
return list;
}
private void Awake()
{
// Plugin startup logic
Logger = base.Logger;
_mainMenu = AssetLoader.LoadEmbeddedAudio("Audio.MainTheme.wav");
_location = new AudioClip[] {
AssetLoader.LoadEmbeddedAudio("Audio.Fostral.wav"),
AssetLoader.LoadEmbeddedAudio("Audio.Necross.wav"),
AssetLoader.LoadEmbeddedAudio("Audio.Glorx.wav"),
AssetLoader.LoadEmbeddedAudio("Audio.Xplo.wav"),
AssetLoader.LoadEmbeddedAudio("Audio.OuterWorlds.wav"),
};
_death = AssetLoader.LoadEmbeddedAudio("Audio.Death.wav");
_dying = AssetLoader.LoadEmbeddedAudio("Audio.VangersForever.wav");
_infernals = AssetLoader.LoadEmbeddedAudio("Audio.Infernals.wav");
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
StartCoroutine(OverrideMenuMusic());
StartCoroutine(OverrideMusicManager());
}
private void Start() {
PreRunScript.instance.menuSongs = new List<AudioClip>(){_mainMenu};
}
private IEnumerator OverrideMusicManager() {
while (true) {
Logger.LogInfo("Waiting for music player to load");
yield return new WaitUntil(()=> MusicManager.main != null);
Logger.LogInfo("Started overriding music");
MusicManager.main.deadClip = _death;
MusicManager.main.dyingClip = _dying;
MusicManager.main.biomeMusic = new SongList[] {
GenerateSongList(_location[0]),
GenerateSongList(_location[1]),
GenerateSongList(_location[2]),
GenerateSongList(_location[3]),
GenerateSongList(_location[4]),
};
foreach(var droneTrack in MusicManager.main.droneTracks) {
droneTrack.clip = _infernals;
}
Logger.LogInfo("Ended overriding music");
yield return new WaitUntil(()=> MusicManager.main == null);
}
}
private IEnumerator OverrideMenuMusic() {
while (true) {
yield return new WaitUntil(()=> PreRunScript.instance != null);
PreRunScript.instance.menuSongs = new List<AudioClip>(){_mainMenu};
yield return new WaitUntil(()=> PreRunScript.instance == null);
}
}
}

38
VangersMusic.csproj Normal file
View file

@ -0,0 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>VangersMusic</AssemblyName>
<Product>VangersMusic</Product>
<Version>1.0.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json;
https://nuget.samboy.dev/v3/index.json
</RestoreAdditionalProjectSources>
<RootNamespace>VangersMusic</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
<Reference Include="Assembly-CSharp">
<HintPath>../../../CasualtiesUnknown_Data/Managed/Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="CUCoreLib">
<HintPath>../CUCoreLib.dll</HintPath>
</Reference>
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Audio\**\*" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>
</Project>