Decompiled source of MonsterMoonMashBackground v1.0.3
BepinEx/plugins/Clementinise-CustomSounds/CustomSounds.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using CustomSounds.Networking; using CustomSounds.Patches; using HarmonyLib; using LCSoundTool; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CustomSounds")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CustomSounds")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9e086160-a7fd-4721-ba09-3e8534cb7011")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] internal class <Module> { static <Module>() { } } namespace CustomSounds { [BepInPlugin("CustomSounds", "Custom Sounds", "2.3.2")] public class Plugin : BaseUnityPlugin { public struct SoundData { public string SoundName; public float? RandomPercentage; public string CustomName; public string FilePath; public string FileExtension; public string PackName; public string AudioSource; public string DirectoryPath; public string RelativeDirectoryPath; } public class FolderTree { public Dictionary<string, FolderTree> SubFolders { get; set; } public List<SoundData> Files { get; set; } public FolderTree() { SubFolders = new Dictionary<string, FolderTree>(); Files = new List<SoundData>(); } } public static class SoundDataProcessor { public static FolderTree BuildFolderTree(List<SoundData> soundDataList) { FolderTree folderTree = new FolderTree(); foreach (SoundData soundData in soundDataList) { string relativeDirectoryPath = soundData.RelativeDirectoryPath; string[] array = relativeDirectoryPath.Split(Path.DirectorySeparatorChar, '\u0001'); FolderTree folderTree2 = folderTree; string[] array2 = array; foreach (string key in array2) { if (!folderTree2.SubFolders.ContainsKey(key)) { folderTree2.SubFolders[key] = new FolderTree(); } folderTree2 = folderTree2.SubFolders[key]; } folderTree2.Files.Add(soundData); } return folderTree; } public static string DisplayTree(bool isListing, FolderTree tree, int indent = 0, bool isRoot = true, int soundCount = 0) { StringBuilder stringBuilder = new StringBuilder(); if (isRoot) { soundCount = CountSounds(tree); string text = (isListing ? "Listing all currently loaded custom sounds:" : "Customsounds reloaded."); stringBuilder.AppendLine(text + $" ({soundCount} sounds)"); } foreach (KeyValuePair<string, FolderTree> subFolder in tree.SubFolders) { if (isRoot) { stringBuilder.Append("\n"); } string text2 = subFolder.Key; if (text2.EndsWith("-AS")) { text2 = subFolder.Key.Substring(0, subFolder.Key.Length - 3) + " (AudioSource)"; } stringBuilder.AppendLine(new string(' ', indent * 2) + ((indent > 0) ? "∟ " : "") + text2 + " :"); stringBuilder.Append(DisplayTree(isListing, subFolder.Value, indent + 1, isRoot: false)); } foreach (SoundData file in tree.Files) { string text3 = ((!file.RandomPercentage.HasValue) ? "" : $" (Random: {file.RandomPercentage * 100f}%)"); string text4 = ((file.CustomName == "") ? "" : (" [" + file.CustomName + "]")); stringBuilder.AppendLine(new string(' ', indent * 2) + "- " + file.SoundName + text3 + text4 + " [" + file.FileExtension.ToUpper() + "]"); } return stringBuilder.ToString(); } private static int CountSounds(FolderTree tree) { int num = tree.Files.Count; foreach (KeyValuePair<string, FolderTree> subFolder in tree.SubFolders) { num += CountSounds(subFolder.Value); } return num; } } private const string PLUGIN_GUID = "CustomSounds"; private const string PLUGIN_NAME = "Custom Sounds"; private const string PLUGIN_VERSION = "2.3.2"; public static Plugin Instance; internal ManualLogSource logger; private Harmony harmony; public HashSet<string> currentSounds = new HashSet<string>(); public HashSet<string> oldSounds = new HashSet<string>(); public HashSet<string> modifiedSounds = new HashSet<string>(); public Dictionary<string, string> soundHashes = new Dictionary<string, string>(); public Dictionary<string, string> soundPacks = new Dictionary<string, string>(); public static bool hasAcceptedSync = false; public static List<SoundData> soundDataList = new List<SoundData>(); public static bool Initialized { get; private set; } private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (!((Object)(object)Instance == (Object)null)) { return; } Instance = this; logger = Logger.CreateLogSource("CustomSounds"); harmony = new Harmony("CustomSounds"); harmony.PatchAll(typeof(TerminalParsePlayerSentencePatch)); modifiedSounds = new HashSet<string>(); string customSoundsFolderPath = GetCustomSoundsFolderPath(); if (!Directory.Exists(customSoundsFolderPath)) { logger.LogInfo((object)"\"CustomSounds\" folder not found. Creating it now."); string path = Path.Combine(customSoundsFolderPath, "YourOwnSoundPack"); Directory.CreateDirectory(path); string contents = "If you're interested in creating your own sound pack, please refer to the 'For Sound Packs Creator' section on the CustomSounds Thunderstore page. If you simply wish to replace a few sounds on your own, you can drop the desired sounds into the 'YourOwnSoundPack' folder."; File.WriteAllText(Path.Combine(customSoundsFolderPath, "READ-ME-PLEASE.txt"), contents); } string path2 = Path.Combine(Paths.BepInExConfigPath); try { List<string> list = File.ReadAllLines(path2).ToList(); int num = list.FindIndex((string line) => line.StartsWith("HideManagerGameObject")); if (num != -1 && list[num].Contains("false")) { logger.LogInfo((object)"\"HideManagerGameObject\" value not correctly set. Fixing it now."); list[num] = "HideManagerGameObject = true"; File.WriteAllLines(path2, list); harmony.PatchAll(typeof(MenuPatcher)); } else if (num != -1) { logger.LogInfo((object)"\"HideManagerGameObject\" is correctly set to true."); } } catch (Exception ex) { logger.LogError((object)("Error modifying config file: " + ex.Message)); } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } logger.LogInfo((object)"Plugin CustomSounds is loaded!"); } internal void Start() { Initialize(); } internal void OnDestroy() { Initialize(); } internal void Initialize() { if (!Initialized) { Initialized = true; ReloadSounds(); } } private void OnApplicationQuit() { } public GameObject LoadNetworkPrefabFromEmbeddedResource() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = "CustomSounds.Bundle.audionetworkhandler"; using Stream stream = executingAssembly.GetManifestResourceStream(name); if (stream == null) { Debug.LogError((object)"Asset bundle not found in embedded resources."); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); AssetBundle val = AssetBundle.LoadFromMemory(array); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"Failed to load AssetBundle from memory."); return null; } return val.LoadAsset<GameObject>("audionetworkhandler"); } public string GetCustomSoundsFolderPath() { return Path.Combine(Paths.PluginPath, "CustomSounds"); } public void RevertSounds() { if (currentSounds == null || currentSounds.Count == 0) { logger.LogInfo((object)"No sounds to revert."); return; } HashSet<string> hashSet = new HashSet<string>(); foreach (string currentSound in currentSounds) { string text = currentSound; if (currentSound.Contains("-")) { text = currentSound.Substring(0, currentSound.IndexOf("-")); } if (!hashSet.Contains(text)) { logger.LogInfo((object)(text + " restored.")); SoundTool.RestoreAudioClip(text); hashSet.Add(text); } } logger.LogInfo((object)"Original game sounds restored."); } public void ReloadSounds() { oldSounds = new HashSet<string>(currentSounds); currentSounds.Clear(); modifiedSounds.Clear(); soundDataList.Clear(); string directoryName = Path.GetDirectoryName(Paths.PluginPath); ProcessDirectory(directoryName); } private string GetRelativePathToCustomSounds(string filePath) { Debug.Log((object)("FilePath: " + filePath)); string[] array = filePath.Split(new char[1] { Path.DirectorySeparatorChar }); int num = Array.IndexOf(array, "CustomSounds"); if (num == -1 || num == array.Length - 1) { return ""; } string[] paths = array.Skip(num + 1).ToArray(); return Path.Combine(paths); } private void ProcessDirectory(string directoryPath) { string[] directories = Directory.GetDirectories(directoryPath, "*", SearchOption.AllDirectories); foreach (string text in directories) { string fileName = Path.GetFileName(text); ProcessSoundFiles(text, fileName); } } private void ProcessSoundFiles(string directoryPath, string packName) { string[] array = new string[3] { "*.wav", "*.ogg", "*.mp3" }; string[] array2 = array; foreach (string searchPattern in array2) { string[] files = Directory.GetFiles(directoryPath, searchPattern); foreach (string text in files) { if (text.Contains("CustomSounds")) { ProcessSingleFile(text, packName); } } } } private void ProcessSingleFile(string file, string packName) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); (string soundName, float? percentage, string customName) tuple = ParseSoundFileName(fileNameWithoutExtension); string item = tuple.soundName; float? item2 = tuple.percentage; string item3 = tuple.customName; string fileExtension = Path.GetExtension(file).TrimStart(new char[1] { '.' }).ToLower(); string relativePathToCustomSounds = GetRelativePathToCustomSounds(file); string fileName = Path.GetFileName(Path.GetDirectoryName(file)); string text = (fileName.EndsWith("-AS") ? fileName.Substring(0, fileName.Length - 3) : null); SoundData soundData = default(SoundData); soundData.SoundName = item; soundData.RandomPercentage = item2; soundData.CustomName = item3; soundData.FilePath = file; soundData.FileExtension = fileExtension; soundData.PackName = packName; soundData.AudioSource = text; soundData.DirectoryPath = Path.GetDirectoryName(file); soundData.RelativeDirectoryPath = Path.GetDirectoryName(relativePathToCustomSounds); SoundData item4 = soundData; soundDataList.Add(item4); string text2 = "Sound replaced: " + item; if (item4.RandomPercentage.HasValue) { text2 += $" (Percentage = {item4.RandomPercentage.Value * 100f}%)"; } if (!string.IsNullOrEmpty(item4.CustomName)) { text2 = text2 + " (Custom Name = " + item4.CustomName + ")"; } text2 = text2 + " (File Extension = " + item4.FileExtension + ")"; Debug.Log((object)text2); AudioClip audioClip = SoundTool.GetAudioClip(Path.GetDirectoryName(file), file); ((Object)audioClip).name = fileNameWithoutExtension; currentSounds.Add(item4.SoundName); if (item4.RandomPercentage.HasValue) { if (item4.AudioSource != null) { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip, item4.RandomPercentage.Value, item4.AudioSource); } else { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip, item4.RandomPercentage.Value); } } else if (text != null) { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip, item4.AudioSource); } else { SoundTool.ReplaceAudioClip(item4.SoundName, audioClip); } } private (string soundName, float? percentage, string customName) ParseSoundFileName(string fullSoundName) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullSoundName); string[] array = fileNameWithoutExtension.Split(new char[1] { '-' }); string s = array[^1]; if (int.TryParse(s, out var result)) { string item = array[0]; string item2 = string.Join(" ", array.Skip(1).Take(array.Length - 2)); float value = (float)result / 100f; return (item, value, item2); } return (array[0], null, string.Join(" ", array.Skip(1))); } } } namespace CustomSounds.Patches { [HarmonyPatch] public class NetworkObjectManager { private static GameObject networkPrefab; private static GameObject networkHandlerHost; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPrefix] public static void Init() { if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = Plugin.Instance.LoadNetworkPrefabFromEmbeddedResource(); networkPrefab.AddComponent<AudioNetworkHandler>(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); Plugin.Instance.logger.LogInfo((object)"Created AudioNetworkHandler prefab"); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { Plugin.Instance.logger.LogInfo((object)"Spawning network handler"); networkHandlerHost = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity); if (networkHandlerHost.GetComponent<NetworkObject>().IsSpawned) { Debug.Log((object)"NetworkObject is spawned and active."); } else { Debug.Log((object)"Failed to spawn NetworkObject."); } networkHandlerHost.GetComponent<NetworkObject>().Spawn(true); if ((Object)(object)AudioNetworkHandler.Instance != (Object)null) { Debug.Log((object)"Successfully accessed AudioNetworkHandler instance."); } else { Debug.Log((object)"AudioNetworkHandler instance is null."); } } } catch { Plugin.Instance.logger.LogError((object)"Failed to spawned network handler"); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] private static void DestroyNetworkHandler() { try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { Plugin.Instance.logger.LogInfo((object)"Destroying network handler"); Object.Destroy((Object)(object)networkHandlerHost); networkHandlerHost = null; } } catch { Plugin.Instance.logger.LogError((object)"Failed to destroy network handler"); } } } [HarmonyPatch(typeof(MenuManager))] internal class MenuPatcher { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPostFix(MenuManager __instance) { ((MonoBehaviour)__instance).StartCoroutine(DelayedMainMenuModification()); } private static IEnumerator DelayedMainMenuModification() { yield return (object)new WaitForSeconds(0f); ChangeHostButtonFromMainMenu(); } private static void ChangeHostButtonFromMainMenu() { Debug.Log((object)"Attempting to add a description to the Host button..."); GameObject val = GameObject.Find("MenuContainer"); Transform val2 = ((val != null) ? val.transform.Find("MainButtons") : null); object obj; if (val2 == null) { obj = null; } else { Transform obj2 = val2.Find("HostButton"); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } GameObject val3 = (GameObject)obj; if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !((Object)(object)val3 == (Object)null)) { string text = ((TMP_Text)val3.GetComponentInChildren<TextMeshProUGUI>()).text; ((TMP_Text)val3.GetComponentInChildren<TextMeshProUGUI>()).text = "<line-height=0.28em>" + text + "\n<size=8><color=#B0B0B0> Please restart the game for <color=#E6B800>CustomSounds</color> to work properly!</color></size></line-height>"; } } } [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] public static class TerminalParsePlayerSentencePatch { public static bool Prefix(Terminal __instance, ref TerminalNode __result) { string[] array = __instance.screenText.text.Split(new char[1] { '\n' }); if (array.Length == 0) { return true; } string[] array2 = array.Last().Trim().ToLower() .Split(new char[1] { ' ' }); if (array2.Length == 0 || (array2[0] != "customsounds" && array2[0] != "cs")) { return true; } Plugin.Instance.logger.LogInfo((object)("Received terminal command: " + string.Join(" ", array2))); if (array2.Length > 1 && (array2[0] == "customsounds" || array2[0] == "cs")) { switch (array2[1]) { case "reload": case "rl": Plugin.Instance.RevertSounds(); Plugin.Instance.ReloadSounds(); __result = CreateTerminalNode(Plugin.SoundDataProcessor.DisplayTree(isListing: false, Plugin.SoundDataProcessor.BuildFolderTree(Plugin.soundDataList))); return false; case "revert": case "rv": Plugin.Instance.RevertSounds(); __result = CreateTerminalNode("Game sounds reverted to original.\n\n"); return false; case "list": case "l": __result = CreateTerminalNode(Plugin.SoundDataProcessor.DisplayTree(isListing: true, Plugin.SoundDataProcessor.BuildFolderTree(Plugin.soundDataList))); return false; case "help": case "h": if (NetworkManager.Singleton.IsHost) { __result = CreateTerminalNode("CustomSounds commands \n(Can also be used with 'CS' as an alias).\n\n>CUSTOMSOUNDS LIST/L\nTo display all currently loaded sounds\n\n>CUSTOMSOUNDS RELOAD/RL\nTo reload and apply sounds from the 'CustomSounds' folder and its subfolders.\n\n>CUSTOMSOUNDS REVERT/RV\nTo unload all custom sounds and restore original game sounds\n\n"); } else { __result = CreateTerminalNode("CustomSounds commands \n(Can also be used with 'CS' as an alias).\n\n>CUSTOMSOUNDS LIST/L\nTo display all currently loaded sounds\n\n>CUSTOMSOUNDS RELOAD/RL\nTo reload and apply sounds from the 'CustomSounds' folder and its subfolders.\n\n>CUSTOMSOUNDS REVERT/RV\nTo unload all custom sounds and restore original game sounds\n\n"); } return false; case "sync": case "s": __result = CreateTerminalNode("/!\\ ERROR /!\\ \nThis command is not supported in this version of CustomSounds\n\n"); return false; case "unsync": case "u": __result = CreateTerminalNode("/!\\ ERROR /!\\ \nThis command is not supported in this version of CustomSounds\n\n"); return false; case "fu": case "force-unsync": __result = CreateTerminalNode("/!\\ ERROR /!\\ \nThis command is not supported in this version of CustomSounds\n\n"); return false; default: __result = CreateTerminalNode("Unknown customsounds command.\n\n"); return false; } } return true; } private static TerminalNode CreateTerminalNode(string message) { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = message; val.clearPreviousText = true; return val; } } } namespace CustomSounds.Networking { public class AudioNetworkHandler : NetworkBehaviour { public static AudioNetworkHandler Instance { get; private set; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "AudioNetworkHandler"; } } }
BepinEx/plugins/Darkbrewery-Emblem/Emblem.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Emblem; using Emblem.Components; using Emblem.Managers; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Emblem")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Emblem")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e4927ee1-3a47-4f93-8784-804356949316")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] public class DynamicColorManager : MonoBehaviour { private static DynamicColorManager _instance; public static DynamicColorManager Instance { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance == (Object)null) { _instance = new GameObject("DynamicColorManager").AddComponent<DynamicColorManager>(); } return _instance; } } public SubMenuColor SubMenuColors { get; set; } private void Awake() { if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } public void SetupDynamicColorChange(string parentPath) { AttachObserver(parentPath, SubMenuColors); } public void AttachObserver(string parentPath, SubMenuColor subMenuColors) { Transform val = PathFinder.Probe(parentPath); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Parent path not found: " + parentPath); } else { (((Component)val).gameObject.GetComponent<UIObserver>() ?? ((Component)val).gameObject.AddComponent<UIObserver>()).SetColors(subMenuColors); } } } public class UIObserver : MonoBehaviour { private Dictionary<GameObject, bool> _coloredObjects = new Dictionary<GameObject, bool>(); private SubMenuColor _subMenuColors; public void SetColors(SubMenuColor subMenuColors) { _subMenuColors = subMenuColors; } private void OnTransformChildrenChanged() { ProcessChildren(); } private void ProcessChildren() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in ((Component)this).transform) { Transform child = item; if ((Object)(object)child == (Object)null) { LogWarden.LogError("[UIObserver] Child transform is null in " + ((Object)((Component)this).transform).name); } else if (!(((Object)child).name == "ListHeader (1)") && (((Object)child).name.Contains("LobbyListItem(Clone)") || ((Object)child).name.Contains("LobbyListItemChallenge(Clone)") || ((Object)child).name.Contains("ChallengeLeaderboardSlotItem(Clone)"))) { bool flag = ((Object)child).name.Contains("LobbyListItemChallenge(Clone)") || ((Object)child).name.Contains("ChallengeLeaderboardSlotItem(Clone)"); Color color = (flag ? _subMenuColors.Background7 : _subMenuColors.Background5); ApplyColorToChild(child, color); if (((Object)child).name.Contains("LobbyListItem(Clone)") || ((Object)child).name.Contains("LobbyListItemChallenge(Clone)")) { ApplyChildColors(child, flag); HandleJoinButtonClones(child); } else if (((Object)child).name.Contains("ChallengeLeaderboardSlotItem(Clone)")) { ApplyChallengeColors(child); } DelayHelper.StartDelayedAction(0.01f, delegate { SetupButton(child); }); } } } private void ApplyChildColors(Transform child, bool isChallenge) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) ApplyColors(new List<(string, Color)> { ("Outline", _subMenuColors.BorderColor), ("ServerName", _subMenuColors.TextFontColor), ("NumPlayers", _subMenuColors.SubTextColor), (isChallenge ? "NumPlayers (1)" : null, _subMenuColors.SubTextColor) }, child); } private void ApplyChallengeColors(Transform child) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) ApplyColors(new List<(string, Color)> { ("Outline", _subMenuColors.BorderColor), ("ServerName", _subMenuColors.TextFontColor), ("Collected", _subMenuColors.SubTextColor), ("RankNum", _subMenuColors.TextFontColor) }, child); } private void ApplyColors(List<(string, Color)> colors, Transform parent) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) foreach (var (text, color) in colors) { if (text != null) { CheckAndApplyColor(parent, text, color); } } } private void HandleJoinButtonClones(Transform parent) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Transform val = parent.Find("NumPlayers"); if (!((Object)(object)val != (Object)null)) { return; } foreach (Transform item in val) { Transform val2 = item; if ((Object)(object)val2 != (Object)null && ((Object)val2).name.Contains("JoinButton(Clone)") && (Object)(object)((Component)val2).GetComponent<Button>() != (Object)null) { SetupJoinButton(val2); } } } private void SetupJoinButton(Transform buttonTransform) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) RectTransform component = ((Component)buttonTransform).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.pivot = new Vector2(component.pivot.x, 1f); } Transform val = buttonTransform.Find("SelectionHighlight"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(true); } } private void SetupButton(Transform child) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)child == (Object)null) { return; } foreach (Transform item in child) { Transform val = item; if ((Object)(object)val == (Object)null || !((Object)val).name.Contains("JoinButton")) { continue; } Button component = ((Component)val).GetComponent<Button>(); if ((Object)(object)component != (Object)null) { Image component2 = ((Component)val).GetComponent<Image>(); Transform obj = val.Find("Text (TMP)"); TMP_Text val2 = ((obj != null) ? ((Component)obj).GetComponent<TMP_Text>() : null); if ((Object)(object)component2 != (Object)null && (Object)(object)val2 != (Object)null) { HoverButtonDirect(val, _subMenuColors.ButtonRegText, _subMenuColors.ButtonHoverText, _subMenuColors.Darken, _subMenuColors.ButtonHoverBG); SetupEventTriggers(component, component2, val2, _subMenuColors.Darken, _subMenuColors.ButtonHoverBG, _subMenuColors.ButtonRegText, _subMenuColors.ButtonHoverText); ((Graphic)component2).color = _subMenuColors.Darken; } } } } private void HoverButtonDirect(Transform buttonTransform, Color regularFontColor, Color highlightFontColor, Color regularBGColor, Color highlightBGColor) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown Button component = ((Component)buttonTransform).GetComponent<Button>(); Animator component2 = ((Component)buttonTransform).GetComponent<Animator>(); Image backgroundImage = ((Component)buttonTransform).GetComponent<Image>(); Transform obj = buttonTransform.Find("Text (TMP)"); TMP_Text textComponent = ((obj != null) ? ((Component)obj).GetComponent<TMP_Text>() : null); if ((Object)(object)component != (Object)null && (Object)(object)textComponent != (Object)null && (Object)(object)backgroundImage != (Object)null) { if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } ((Selectable)component).transition = (Transition)0; textComponent.overrideColorTags = true; Color initialTextColor = ((Graphic)textComponent).color; Color initialBGColor = ((Graphic)backgroundImage).color; ((Graphic)textComponent).color = regularFontColor; ((Behaviour)backgroundImage).enabled = true; backgroundImage.pixelsPerUnitMultiplier = 4f; ((Graphic)backgroundImage).color = regularBGColor; RectTransform component3 = ((Component)component).GetComponent<RectTransform>(); component3.anchorMin = new Vector2(component3.anchorMin.x, 0.5f); component3.anchorMax = new Vector2(component3.anchorMax.x, 0.5f); component3.pivot = new Vector2(component3.pivot.x, 0.5f); component3.offsetMax = new Vector2(component3.offsetMax.x, 13f); component3.offsetMin = new Vector2(component3.offsetMin.x, -13f); Transform obj2 = buttonTransform.Find("SelectionHighlight"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = initialBGColor; ((Graphic)textComponent).color = initialTextColor; }); } else { LogWarden.LogError("[HoverButtonDirect] Required components not found on button at '" + ((Object)buttonTransform).name + "'."); } } private void SetupEventTriggers(Button button, Image backgroundImage, TMP_Text textComponent, Color regularBGColor, Color highlightBGColor, Color regularFontColor, Color highlightFontColor) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) EventTrigger obj = ((Component)button).GetComponent<EventTrigger>() ?? ((Component)button).gameObject.AddComponent<EventTrigger>(); obj.triggers.Clear(); Color initialBGColor = ((Graphic)backgroundImage).color; Color initialTextColor = ((Graphic)textComponent).color; AddEventTrigger(obj, (EventTriggerType)0, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = highlightBGColor; ((Graphic)textComponent).color = highlightFontColor; }); AddEventTrigger(obj, (EventTriggerType)1, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = initialBGColor; ((Graphic)textComponent).color = initialTextColor; }); } private static void AddEventTrigger(EventTrigger trigger, EventTriggerType type, UnityAction<BaseEventData> action) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown Entry val = new Entry { eventID = type }; ((UnityEvent<BaseEventData>)(object)val.callback).AddListener(action); trigger.triggers.Add(val); } private void CheckAndApplyColor(Transform parent, string childName, Color color) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) Transform val = parent.Find(childName); if ((Object)(object)val != (Object)null && (!_coloredObjects.TryGetValue(((Component)val).gameObject, out var value) || !value)) { ApplyColorToChild(val, color); } } private void ApplyColorToChild(Transform child, Color color) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)child == (Object)null)) { Graphic component = ((Component)child).GetComponent<Graphic>(); if ((Object)(object)component != (Object)null) { component.color = color; _coloredObjects[((Component)child).gameObject] = true; } else { LogWarden.LogError("[UIObserver] Graphic component not found on " + ((Object)child).name); } } } } public class HoverEffectHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public Image backgroundImage; public TMP_Text textComponent; public Color regularBGColor; public Color highlightBGColor; public Color regularFontColor; public Color highlightFontColor; public void OnPointerEnter(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = highlightBGColor; ((Graphic)textComponent).color = highlightFontColor; } public void OnPointerExit(PointerEventData eventData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = regularBGColor; ((Graphic)textComponent).color = regularFontColor; } } public class SubMenuColor { public struct UIPath { public string Path; public Type ComponentType; public int Index; public UIPath(string path, Type componentType, int index = 0) { Path = path; ComponentType = componentType; Index = index; } } private static readonly UIPath HOST_BUTTON = new UIPath("Canvas/MenuContainer/MainButtons/HostButton/", typeof(Button)); private static readonly UIPath HOST_BG = new UIPath("MenuContainer/LobbyHostSettings/Image", typeof(Image)); private static readonly UIPath HOST_PANEL_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer", typeof(Image)); private static readonly UIPath HOST_BORDER = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/Image", typeof(Image)); private static readonly UIPath HOST_LAN_TITLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/Header", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_TITLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/EnterAName", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_INPUT_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerNameField", typeof(Image)); private static readonly UIPath HOST_ONLINE_PUBLIC = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Public", typeof(Button)); private static readonly UIPath HOST_ONLINE_PUBLIC_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Public", typeof(Image)); private static readonly UIPath HOST_ONLINE_PRIVATE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Private", typeof(Button)); private static readonly UIPath HOST_ONLINE_PRIVATE_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/Private", typeof(Image)); private static readonly UIPath HOST_ONLINE_INVITE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/InviteOnly", typeof(Button)); private static readonly UIPath HOST_ONLINE_INVITE_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/InviteOnly", typeof(Image)); private static readonly UIPath HOST_LAN_REMOTE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/AllowRemote", typeof(Button)); private static readonly UIPath HOST_LAN_REMOTE_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/AllowRemote", typeof(Image)); private static readonly UIPath HOST_LAN_LOCAL = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/Local", typeof(Button)); private static readonly UIPath HOST_LAN_LOCAL_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/LANOptions/Local", typeof(Image)); private static readonly UIPath HOST_ONLINE_TAG_BORDER = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerTagInputField", typeof(Image)); private static readonly UIPath HOST_ONLINE_TAG_PLACE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerTagInputField/Text Area/Placeholder", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_TAG_TEXT = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerTagInputField/Text Area/Text", typeof(TMP_Text)); private static readonly UIPath HOST_CONFIRM = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/Confirm", typeof(Button)); private static readonly UIPath HOST_BACK = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/Back", typeof(Button)); private static readonly UIPath HOST_DESC = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/PrivatePublicDescription", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_IMPROV_ACCESS = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/EnterAccess", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_IMPROV_TAG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/EnterATag", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_IMPROV_NAME_BORDER = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerNameField", typeof(Image)); private static readonly UIPath HOST_ONLINE_IMPROV_NAME_PLACE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerNameField/Text Area/Placeholder", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_IMPROV_NAME_TEXT = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerNameField/Text Area/Text", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown", typeof(TMP_Dropdown)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP_TEXT = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown/Label", typeof(TMP_Text)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP_ARROW = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown/Arrow", typeof(Image)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown/Template", typeof(Image)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP_ITEM_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown/Template/Viewport/Content/Item/Item Background", typeof(Image)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP_ITEM_CHECK = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown/Template/Viewport/Content/Item/Item Checkmark", typeof(Image)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP_ITEM_TEXT = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown/Template/Viewport/Content/Item/Item Label", typeof(Image)); private static readonly UIPath HOST_ONLINE_IMPROV_DROP_ITEM_TOGGLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerAccessDropdown/Template/Viewport/Content/Item", typeof(Toggle)); private static readonly UIPath HOST_IMPROV_PANEL = new UIPath("MenuContainer/LobbyHostSettings/LIPanel_Host", typeof(Image)); private static readonly UIPath HOST_IMPROV_PANEL_TEXT = new UIPath("MenuContainer/LobbyHostSettings/LIPanel_Host", typeof(TMP_Text)); private static readonly UIPath HOST_IMPROV_PANEL_IMAGE = new UIPath("MenuContainer/LobbyHostSettings/LIPanel_Host", typeof(Image)); private static readonly UIPath CREWCOUNT_TITLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/MC_CrewCount/Text (TMP)", typeof(TMP_Text)); private static readonly UIPath CREWCOUNT_INPUT_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/MC_CrewCount", typeof(Image)); private static readonly UIPath COSMO_BUTTON = new UIPath("TestOverlay(Clone)/Canvas/GlobalScale/ActivateButton", typeof(Image)); private static readonly UIPath FILE_PANEL_BG = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel", typeof(Image)); private static readonly UIPath FILE_BORDER = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/Outline", typeof(Image)); private static readonly UIPath FILE_TITLE = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/EnterAName", typeof(TMP_Text)); private static readonly UIPath FILE_TIP = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/ChallengeMoonButton/TipText", typeof(TMP_Text)); private static readonly UIPath FILE_DARK = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel/Darken", typeof(Image)); private static readonly UIPath FILES_BUTTON = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel", typeof(TMP_Text)); private static readonly UIPath FILES_IMAGES = new UIPath("MenuContainer/LobbyHostSettings/FilesPanel", typeof(Image)); private static readonly UIPath LEAD_BORDER = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel", typeof(Image)); private static readonly UIPath LEAD_TITLE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/ListHeader", typeof(TMP_Text)); private static readonly UIPath LEAD_REFRESH = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/RefreshButton", typeof(Button)); private static readonly UIPath LEAD_BACK = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/Back", typeof(Button)); private static readonly UIPath LEAD_REMOVE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/RemoveScore", typeof(Button)); private static readonly UIPath LEAD_PLAY = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Retry", typeof(Button)); private static readonly UIPath LEAD_SCROLL_BAR = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath LEAD_SCROLL_HANDLE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Scroll View/Scrollbar Vertical", typeof(Scrollbar)); private static readonly UIPath LEAD_DROP = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown", typeof(TMP_Dropdown)); private static readonly UIPath LEAD_DROP_TEXT = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Label", typeof(TMP_Text)); private static readonly UIPath LEAD_DROP_ARROW = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Arrow", typeof(Image)); private static readonly UIPath LEAD_DROP_BG = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_BG = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Background", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_CHECK = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Checkmark", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_TEXT = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Label", typeof(Image)); private static readonly UIPath LEAD_DROP_ITEM_TOGGLE = new UIPath("MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Dropdown/Template/Viewport/Content/Item", typeof(Toggle)); private static readonly UIPath LOBBY_BG = new UIPath("MenuContainer/LobbyList/LobbyBackground", typeof(Image)); private static readonly UIPath LOBBY_TITLE = new UIPath("MenuContainer/LobbyList/ListPanel/ListHeader", typeof(TMP_Text)); private static readonly UIPath LOBBY_PANEL_BG = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View", typeof(Image)); private static readonly UIPath LOBBY_BORDER = new UIPath("MenuContainer/LobbyList/ListPanel", typeof(Image)); private static readonly UIPath LOBBY_REFRESH = new UIPath("MenuContainer/LobbyList/ListPanel/RefreshButton", typeof(Button)); private static readonly UIPath LOBBYCOMPAT_REFRESH = new UIPath("MenuContainer/LobbyList/ListPanel/RefreshButton/SelectionHighlight(Clone)", typeof(Image)); private static readonly UIPath LOBBYCOMPAT_REFRESH_HOVER = new UIPath("MenuContainer/LobbyList/ListPanel/RefreshButton/SelectionHighlight", typeof(Image)); private static readonly UIPath LOBBY_BACK = new UIPath("MenuContainer/LobbyList/BackToMenu", typeof(Button)); private static readonly UIPath LOBBY_SCROLL_BAR = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath LOBBY_SCROLL_HANDLE = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View/Scrollbar Vertical", typeof(Scrollbar)); private static readonly UIPath LOBBY_LIST_STATUS = new UIPath("MenuContainer/LobbyList/ListPanel/Scroll View/Viewport/Content/ListHeader (1)", typeof(TMP_Text)); private static readonly UIPath LOBBY_TAG_BORDER = new UIPath("MenuContainer/LobbyList/ListPanel/ServerTagInputField", typeof(Image)); private static readonly UIPath LOBBY_TAG_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/ServerTagInputField/Text Area/Text", typeof(TMP_Text)); private static readonly UIPath LOBBY_TAG_PLACEHOLDER = new UIPath("MenuContainer/LobbyList/ListPanel/ServerTagInputField/Text Area/Placeholder", typeof(TMP_Text)); private static readonly UIPath LOBBY_SORT_CHAL_BORDER = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort", typeof(Image)); private static readonly UIPath LOBBY_SORT_CHAL_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort/Text (TMP)", typeof(TMP_Text)); private static readonly UIPath LOBBY_SORT_CHAL_BOX = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort/Arrow", typeof(Image)); private static readonly UIPath LOBBY_SORT_CHAL_BOX_CHECK = new UIPath("MenuContainer/LobbyList/ListPanel/ToggleChallengeSort/Arrow (1)", typeof(Image)); private static readonly UIPath LOBBY_DROP = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown", typeof(TMP_Dropdown)); private static readonly UIPath LOBBY_DROP_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Label", typeof(TMP_Text)); private static readonly UIPath LOBBY_DROP_ARROW = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Arrow", typeof(Image)); private static readonly UIPath LOBBY_DROP_BG = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_BG = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Background", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_CHECK = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Checkmark", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_TEXT = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item/Item Label", typeof(Image)); private static readonly UIPath LOBBY_DROP_ITEM_TOGGLE = new UIPath("MenuContainer/LobbyList/ListPanel/Dropdown/Template/Viewport/Content/Item", typeof(Toggle)); private static readonly UIPath LANWARN_BG = new UIPath("MenuContainer/LANWarning/Image", typeof(Image)); private static readonly UIPath LANWARN_PANEL_BG = new UIPath("MenuContainer/LANWarning/Panel", typeof(Image)); private static readonly UIPath LANWARN_BORDER = new UIPath("MenuContainer/LANWarning/Panel/Image", typeof(Image)); private static readonly UIPath LANWARN_TEXT = new UIPath("MenuContainer/LANWarning/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath LANWARN_CONFIRM = new UIPath("MenuContainer/LANWarning/Panel/Confirm", typeof(Button)); private static readonly UIPath NOTIFY_BG = new UIPath("MenuContainer/MenuNotification/Image", typeof(Image)); private static readonly UIPath NOTIFY_PANEL_BG = new UIPath("MenuContainer/MenuNotification/Panel", typeof(Image)); private static readonly UIPath NOTIFY_BORDER = new UIPath("MenuContainer/MenuNotification/Panel/Image", typeof(Image)); private static readonly UIPath NOTIFY_TEXT = new UIPath("MenuContainer/MenuNotification/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath NOTIFY_BACK = new UIPath("MenuContainer/MenuNotification/Panel/ResponseButton", typeof(Button)); private static readonly UIPath DELETE_BG = new UIPath("MenuContainer/DeleteFileConfirmation/Image", typeof(Image)); private static readonly UIPath DELETE_PANEL_BG = new UIPath("MenuContainer/DeleteFileConfirmation/Panel", typeof(Image)); private static readonly UIPath DELETE_BORDER = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/Image", typeof(Image)); private static readonly UIPath DELETE_TEXT = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath DELETE_CONFIRM = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/Delete", typeof(Button)); private static readonly UIPath DELETE_BACK = new UIPath("MenuContainer/DeleteFileConfirmation/Panel/Back", typeof(Button)); private static readonly UIPath CREDITS_BG = new UIPath("MenuContainer/CreditsPanel/Image", typeof(Image)); private static readonly UIPath CREDITS_PANEL_BG = new UIPath("MenuContainer/CreditsPanel/Panel", typeof(Image)); private static readonly UIPath CREDITS_BORDER = new UIPath("MenuContainer/CreditsPanel/Panel/Image", typeof(Image), 1); private static readonly UIPath CREDITS_TITLE = new UIPath("MenuContainer/CreditsPanel/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath CREDITS_TITLE_BG = new UIPath("MenuContainer/CreditsPanel/Panel/Image", typeof(Image)); private static readonly UIPath CREDITS_TEXT = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View/Viewport/Content/CreditsText", typeof(TMP_Text)); private static readonly UIPath CREDITS_TEXT_BG = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View", typeof(Image)); private static readonly UIPath CREDITS_BACK = new UIPath("MenuContainer/CreditsPanel/Panel/BackButton", typeof(Button)); private static readonly UIPath CREDITS_SCROLL_BAR = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath CREDITS_SCROLL_HANDLE = new UIPath("MenuContainer/CreditsPanel/Panel/Scroll View/Scrollbar Vertical/Sliding Area/Handle", typeof(Image)); private static readonly UIPath NEWS_BG = new UIPath("MenuContainer/NewsPanel/Image", typeof(Image)); private static readonly UIPath NEWS_PANEL_BG = new UIPath("MenuContainer/NewsPanel/Panel", typeof(Image)); private static readonly UIPath NEWS_BORDER = new UIPath("MenuContainer/NewsPanel/Panel/Image", typeof(Image), 1); private static readonly UIPath NEWS_TITLE = new UIPath("MenuContainer/NewsPanel/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath NEWS_TEXT = new UIPath("MenuContainer/NewsPanel/Panel/DemoText", typeof(TMP_Text)); private static readonly UIPath NEWS_CONFIRM = new UIPath("MenuContainer/NewsPanel/Panel/ResponseButton", typeof(Button)); private static readonly UIPath NEWS_BOX_1 = new UIPath("MenuContainer/NewsPanel/Panel/Image", typeof(Image)); private static readonly UIPath NEWS_BOX_2 = new UIPath("MenuContainer/NewsPanel/Panel/Image (1)", typeof(Image)); private static readonly UIPath NEWS_BOX_3 = new UIPath("MenuContainer/NewsPanel/Panel/Image (2)", typeof(Image)); private static readonly UIPath NEWS_BOX_4 = new UIPath("MenuContainer/NewsPanel/Panel/Image (3)", typeof(Image)); private static readonly UIPath NEWS_BOX_5 = new UIPath("MenuContainer/NewsPanel/Panel/Image (4)", typeof(Image)); private static readonly UIPath NEWS_BOX_6 = new UIPath("MenuContainer/NewsPanel/Panel/Image (5)", typeof(Image)); private static readonly UIPath SETTINGS_CONFIRM = new UIPath("MenuContainer/SettingsPanel/Confirm", typeof(Button)); private static readonly UIPath SETTINGS_BACK = new UIPath("MenuContainer/SettingsPanel/BackButton", typeof(Button)); private static readonly UIPath SETTINGS_DEFAULT = new UIPath("MenuContainer/SettingsPanel/SetToDefault", typeof(Button)); private static readonly UIPath SETTINGS_KEYBINDINGS = new UIPath("MenuContainer/SettingsPanel/KeybindingsButton", typeof(Button)); private static readonly UIPath SETTINGS_KEYS_TITLE = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Controls (1)", typeof(TMP_Text)); private static readonly UIPath KEYS_SCROLL_BAR = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath KEYS_SCROLL_HANDLE = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/Scrollbar Vertical/Sliding Area/Handle", typeof(Image)); private static readonly UIPath SETTINGS_KEYS_REBIND_TEXT = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/Viewport/Content/RemapKeysContainer/KeybindsSectionText(Clone)", typeof(TMP_Text)); private static readonly UIPath SETTINGS_KEYS_BACK = new UIPath("MenuContainer/SettingsPanel/KeybindsPanel/Back", typeof(Button)); private static readonly UIPath SETTINGS_KEYS_DEFAULT = new UIPath("MenuContainer/SettingsPanel/SetDefault", typeof(Button)); private static readonly UIPath CUSTOM_BG = new UIPath("MenuContainer/CustomMenuPanel/Image", typeof(Image)); private static readonly UIPath CUSTOM_PANEL_BG = new UIPath("MenuContainer/CustomMenuPanel/Panel", typeof(Image)); private static readonly UIPath CUSTOM_BORDER = new UIPath("MenuContainer/CustomMenuPanel/Panel/Image", typeof(Image), 1); private static readonly UIPath CUSTOM_TITLE = new UIPath("MenuContainer/CustomMenuPanel/Panel/NotificationText", typeof(TMP_Text)); private static readonly UIPath CUSTOM_TITLE_BG = new UIPath("MenuContainer/CustomMenuPanel/Panel/Image", typeof(Image)); private static readonly UIPath CUSTOM_TEXT = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View/Viewport/Content/CreditsText", typeof(TMP_Text)); private static readonly UIPath CUSTOM_TEXT_BG = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View", typeof(Image)); private static readonly UIPath CUSTOM_BACK = new UIPath("MenuContainer/CustomMenuPanel/Panel/BackButton", typeof(Button)); private static readonly UIPath CUSTOM_SCROLL_BAR = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View/Scrollbar Vertical", typeof(Image)); private static readonly UIPath CUSTOM_SCROLL_HANDLE = new UIPath("MenuContainer/CustomMenuPanel/Panel/Scroll View/Scrollbar Vertical/Sliding Area/Handle", typeof(Image)); private Configurator ConfigManager => Configurator.Instance; public Color ThemeColor { get; set; } public Color Background1 { get; set; } public Color Background2 { get; set; } public Color Background3 { get; set; } public Color Background4 { get; set; } public Color Background5 { get; set; } public Color Background6 { get; set; } public Color Background7 { get; set; } public Color Background8 { get; set; } public Color BorderColor { get; set; } public Color Highlight { get; set; } public Color TextFontColor { get; set; } public Color SubTextColor { get; set; } public Color DarkTextColor { get; set; } public Color ScrollBarColor { get; set; } public Color Darken { get; set; } public Color ButtonRegText { get; set; } public Color ButtonHoverText { get; set; } public Color ButtonHoverBG { get; set; } public void RecolorSubMenus() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (ConfigManager.enableSubMenuColor.Value) { ThemeColor = ColorParser.RGBA(ConfigManager.subMenuColor.Value); InitializeThemeColors(); ApplyColors(); SetupDynamicRecoloring(); } } private void InitializeThemeColors() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) Background1 = AdjustColor(ThemeColor, 0f, 0.7882f); Background2 = AdjustColor(ThemeColor, 1f, 0.4902f); Background3 = AdjustColor(ThemeColor, 0.3396f, 0.7f); Background4 = AdjustColor(ThemeColor, 1f, 0.0353f); Background5 = AdjustColor(ThemeColor, 0.35f, 0.95f); Background6 = AdjustColor(ThemeColor, 0.4f, 0.5f); Background7 = AdjustColor(ThemeColor, 0.5f, 0.8f); Background8 = AdjustColor(ThemeColor, 0f, 0.95f); BorderColor = AdjustColor(ThemeColor, 0.6698f, 1f); Highlight = AdjustColor(ThemeColor, 1f, 0.9451f); TextFontColor = AdjustColor(ThemeColor, 0.9529f, 1f); SubTextColor = AdjustColor(ThemeColor, 1f, 0.4471f); DarkTextColor = AdjustColor(ThemeColor, 0.2f, 0.9f); ScrollBarColor = AdjustColor(ThemeColor, 0.5f, 0.3f); Darken = AdjustColor(ThemeColor, 0f, 0.2f); if (ConfigManager.enableUseMenuColors.Value) { ButtonRegText = ColorParser.RGBA(ConfigManager.menuFontColor.Value); ButtonHoverText = ColorParser.RGBA(ConfigManager.menuRolloverFontColor.Value); ButtonHoverBG = ColorParser.RGBA(ConfigManager.menuRolloverBGColor.Value); } else { ButtonRegText = Highlight; ButtonHoverText = Color.black; ButtonHoverBG = Highlight; } } private Color AdjustColor(Color baseColor, float factor, float alpha) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) return new Color(Mathf.Clamp(baseColor.r * factor, 0f, 1f), Mathf.Clamp(baseColor.g * factor, 0f, 1f), Mathf.Clamp(baseColor.b * factor, 0f, 1f), alpha); } public void ApplyColors() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0745: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07dd: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0821: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_082d: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_086f: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Unknown result type (might be due to invalid IL or missing references) //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08ab: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08b7: Unknown result type (might be due to invalid IL or missing references) //IL_08c7: Unknown result type (might be due to invalid IL or missing references) //IL_08cd: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_08fe: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_091e: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) //IL_093d: Unknown result type (might be due to invalid IL or missing references) //IL_094d: Unknown result type (might be due to invalid IL or missing references) //IL_095d: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_097d: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_0993: Unknown result type (might be due to invalid IL or missing references) //IL_0999: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) SetColor(HOST_BG, Background8); SetColor(HOST_PANEL_BG, Background3); SetColor(HOST_BORDER, BorderColor); SetColor(HOST_LAN_TITLE, TextFontColor); SetColor(HOST_ONLINE_TITLE, TextFontColor); SetColor(HOST_ONLINE_INPUT_BG, Background2); SetColor(HOST_ONLINE_TAG_BORDER, BorderColor); SetColor(HOST_ONLINE_PUBLIC_BG, Background4); SetColor(HOST_ONLINE_PRIVATE_BG, Background4); SetColor(HOST_LAN_LOCAL_BG, Background4); SetColor(HOST_LAN_REMOTE_BG, Background4); SetColor(HOST_ONLINE_TAG_PLACE, TextFontColor); SetColor(HOST_ONLINE_TAG_TEXT, TextFontColor); SetColor(HOST_DESC, Highlight); SetColor(HOST_ONLINE_TAG_TEXT, TextFontColor); if (PluginFinder.LobbyImprov) { DelayHelper.StartDelayedAction(0.3f, delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) SetColor(HOST_ONLINE_IMPROV_ACCESS, TextFontColor); SetColor(HOST_ONLINE_IMPROV_TAG, TextFontColor); SetColor(HOST_ONLINE_IMPROV_NAME_BORDER, BorderColor); SetColor(HOST_ONLINE_IMPROV_NAME_PLACE, TextFontColor); SetColor(HOST_ONLINE_IMPROV_NAME_TEXT, TextFontColor); UpdateDropdownColors(HOST_ONLINE_IMPROV_DROP); SetColor(HOST_ONLINE_IMPROV_DROP_TEXT, TextFontColor); SetColor(HOST_ONLINE_IMPROV_DROP_ARROW, Highlight); SetColor(HOST_ONLINE_IMPROV_DROP_BG, Background5); SetColor(HOST_ONLINE_IMPROV_DROP_ITEM_BG, Background2); SetColor(HOST_ONLINE_IMPROV_DROP_ITEM_CHECK, Background7); SetColor(HOST_ONLINE_IMPROV_DROP_ITEM_TEXT, SubTextColor); UpdateToggleColors(HOST_ONLINE_IMPROV_DROP_ITEM_TOGGLE); SetColor(HOST_IMPROV_PANEL, Background3); SetChildColor(HOST_IMPROV_PANEL_TEXT, TextFontColor); SetChildColor(HOST_IMPROV_PANEL_IMAGE, BorderColor); Dictionary<string, Color> nameColorMap = new Dictionary<string, Color> { { "EnterAPassword", SubTextColor }, { "ServerSecureToggle", SubTextColor }, { "ServerMaxPlayers", SubTextColor } }; SetChildColorsByName(HOST_IMPROV_PANEL_TEXT, nameColorMap); Dictionary<string, Color> nameColorMap2 = new Dictionary<string, Color> { { "Darken", Darken }, { "ServerPasswordField", Highlight }, { "ServerSecureToggle", Highlight }, { "ServerMaxPlayers", Highlight } }; SetChildColorsByName(HOST_IMPROV_PANEL_IMAGE, nameColorMap2); }); } HandleToggleButtons(HOST_ONLINE_PUBLIC, HOST_ONLINE_PRIVATE); HandleToggleButtons(HOST_LAN_REMOTE, HOST_LAN_LOCAL); HoverButton(HOST_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); HoverButton(HOST_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(FILE_PANEL_BG, Background3); SetColor(FILE_BORDER, BorderColor); SetColor(FILE_TITLE, TextFontColor); SetColor(FILE_TIP, Highlight); SetColor(FILE_DARK, Darken); if (!PluginFinder.BetterSaves) { RecolorChildObjects(FILES_IMAGES, "File", "DeleteButton", TextFontColor); SetupHostButton(); } if (PluginFinder.MoreCompany) { if (!PluginFinder.LobbyImprov) { SetupCrewCountListener(); } SetColor(COSMO_BUTTON, Highlight); } SetColor(LEAD_BORDER, BorderColor); SetColor(LEAD_TITLE, TextFontColor); HoverButton(LEAD_REFRESH, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); HoverButton(LEAD_BACK, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); HoverButton(LEAD_REMOVE, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); HoverButton(LEAD_PLAY, ButtonRegText, ButtonHoverText, Color.clear, ButtonHoverBG); SetColor(LEAD_SCROLL_BAR, ScrollBarColor); UpdateScrollbarColors(LEAD_SCROLL_HANDLE); UpdateDropdownColors(LEAD_DROP); SetColor(LEAD_DROP_TEXT, TextFontColor); SetColor(LEAD_DROP_ARROW, Highlight); SetColor(LEAD_DROP_BG, Background5); SetColor(LEAD_DROP_ITEM_BG, Background2); SetColor(LEAD_DROP_ITEM_CHECK, Background7); SetColor(LEAD_DROP_ITEM_TEXT, SubTextColor); UpdateToggleColors(LEAD_DROP_ITEM_TOGGLE); SetColor(LOBBY_BG, Background1); SetColor(LOBBY_PANEL_BG, Background3); SetColor(LOBBY_BORDER, BorderColor); SetColor(LOBBY_TITLE, SubTextColor); if (PluginFinder.LobbyCompat) { DelayHelper.StartDelayedAction(0.3f, delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SetColor(LOBBYCOMPAT_REFRESH, ButtonRegText); }); SetColor(LOBBYCOMPAT_REFRESH_HOVER, ButtonHoverBG); } else { HoverButton(LOBBY_REFRESH, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); } HoverButton(LOBBY_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(LOBBY_SCROLL_BAR, ScrollBarColor); UpdateScrollbarColors(LOBBY_SCROLL_HANDLE); SetColor(LOBBY_LIST_STATUS, Highlight); SetColor(LOBBY_TAG_BORDER, BorderColor); SetColor(LOBBY_TAG_TEXT, TextFontColor); SetColor(LOBBY_TAG_PLACEHOLDER, TextFontColor); SetColor(LOBBY_SORT_CHAL_BORDER, BorderColor); SetColor(LOBBY_SORT_CHAL_TEXT, TextFontColor); SetColor(LOBBY_SORT_CHAL_BOX, BorderColor); SetColor(LOBBY_SORT_CHAL_BOX_CHECK, BorderColor); UpdateDropdownColors(LOBBY_DROP); SetColor(LOBBY_DROP_TEXT, TextFontColor); SetColor(LOBBY_DROP_ARROW, Highlight); SetColor(LOBBY_DROP_BG, Background5); SetColor(LOBBY_DROP_ITEM_BG, Background2); SetColor(LOBBY_DROP_ITEM_CHECK, Background7); SetColor(LOBBY_DROP_ITEM_TEXT, SubTextColor); UpdateToggleColors(LOBBY_DROP_ITEM_TOGGLE); SetColor(LANWARN_BG, Background1); SetColor(LANWARN_PANEL_BG, Background3); SetColor(LANWARN_BORDER, BorderColor); SetColor(LANWARN_TEXT, SubTextColor); HoverButton(LANWARN_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(NOTIFY_BG, Background1); SetColor(NOTIFY_PANEL_BG, Background3); SetColor(NOTIFY_BORDER, BorderColor); SetColor(NOTIFY_TEXT, SubTextColor); HoverButton(NOTIFY_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(DELETE_BG, Background1); SetColor(DELETE_PANEL_BG, Background3); SetColor(DELETE_BORDER, BorderColor); SetColor(DELETE_TEXT, SubTextColor); HoverButton(DELETE_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); HoverButton(DELETE_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(CREDITS_BG, Background1); SetColor(CREDITS_PANEL_BG, Background3); SetColor(CREDITS_BORDER, BorderColor); SetColor(CREDITS_TITLE, TextFontColor); SetColor(CREDITS_TITLE_BG, Color.clear); SetColor(CREDITS_TEXT, TextFontColor); SetColor(CREDITS_TEXT_BG, Background3); SetColor(CREDITS_SCROLL_BAR, ScrollBarColor); SetColor(CREDITS_SCROLL_HANDLE, BorderColor); HoverButton(CREDITS_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(NEWS_BG, Background1); SetColor(NEWS_PANEL_BG, Background5); SetColor(NEWS_BORDER, BorderColor); SetColor(NEWS_TITLE, Highlight); SetColor(NEWS_TEXT, SubTextColor); HoverButton(NEWS_CONFIRM, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); SetColor(NEWS_BOX_1, Background6); SetColor(NEWS_BOX_2, Background6); SetColor(NEWS_BOX_3, Background6); SetColor(NEWS_BOX_4, Background6); SetColor(NEWS_BOX_5, Background6); SetColor(NEWS_BOX_6, Background6); HoverButton(SETTINGS_KEYBINDINGS, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_CONFIRM, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_BACK, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_DEFAULT, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); SetColor(SETTINGS_KEYS_TITLE, Highlight); SetColor(KEYS_SCROLL_BAR, ScrollBarColor); SetColor(KEYS_SCROLL_HANDLE, Highlight); SetColorOnButtonClick(SETTINGS_KEYS_REBIND_TEXT, SETTINGS_KEYBINDINGS, TextFontColor); HoverButton(SETTINGS_KEYS_BACK, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); HoverButton(SETTINGS_KEYS_DEFAULT, ButtonRegText, ButtonHoverText, Background1, ButtonHoverBG); if (ConfigManager.enableCustomMenuItem.Value) { SetColor(CUSTOM_BG, Background1); SetColor(CUSTOM_PANEL_BG, Background3); SetColor(CUSTOM_BORDER, BorderColor); SetColor(CUSTOM_TITLE, TextFontColor); SetColor(CUSTOM_TITLE_BG, Color.clear); SetColor(CUSTOM_TEXT, TextFontColor); SetColor(CUSTOM_TEXT_BG, Background3); SetColor(CUSTOM_SCROLL_BAR, ScrollBarColor); SetColor(CUSTOM_SCROLL_HANDLE, BorderColor); HoverButton(CUSTOM_BACK, ButtonRegText, ButtonHoverText, Darken, ButtonHoverBG); } } public void SetupCrewCountListener() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject obj = GameObject.Find("Canvas/MenuContainer/MainButtons/HostButton"); Button val = ((obj != null) ? obj.GetComponent<Button>() : null); if (val != null) { ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) (string, Color, Type)[] array = new(string, Color, Type)[2] { (CREWCOUNT_TITLE.Path, Highlight, typeof(TMP_Text)), (CREWCOUNT_INPUT_BG.Path, Background2, typeof(Image)) }; for (int i = 0; i < array.Length; i++) { (string, Color, Type) tuple = array[i]; string item = tuple.Item1; Color item2 = tuple.Item2; Type item3 = tuple.Item3; GameObject val2 = GameObject.Find(item); if ((Object)(object)val2 == (Object)null) { LogWarden.LogError("[DynamicColorManager] Path not found: " + item); } else { Component component = val2.GetComponent(item3); Graphic val3 = (Graphic)(object)((component is Graphic) ? component : null); if (val3 != null) { val3.color = item2; } else { LogWarden.LogError("[DynamicColorManager] " + item3.Name + " component not found at path: " + item); } } } }); } else { LogWarden.LogError("HostButton or Button component not found."); } } public void SetupDynamicRecoloring() { if ((Object)(object)DynamicColorManager.Instance == (Object)null) { LogWarden.LogError("DynamicColorManager instance not found."); return; } DynamicColorManager.Instance.SubMenuColors = this; string parentPath = "MenuContainer/LobbyList/ListPanel/Scroll View/Viewport/Content"; DynamicColorManager.Instance.AttachObserver(parentPath, this); string parentPath2 = "MenuContainer/LobbyHostSettings/ChallengeLeaderboard/LobbyList (1)/ListPanel/Scroll View/Viewport/Content/"; DynamicColorManager.Instance.AttachObserver(parentPath2, this); } public void UpdateScrollbarColors(UIPath uiPath) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Scrollbar path not found: " + uiPath.Path); return; } Component component = ((Component)val).GetComponent(uiPath.ComponentType); if ((Object)(object)component == (Object)null || !(component is Scrollbar)) { LogWarden.LogError("[DynamicColorManager] No " + uiPath.ComponentType.Name + " component found at path: " + uiPath.Path); return; } Component obj = ((component is Scrollbar) ? component : null); ColorBlock colors = ((Selectable)obj).colors; ((ColorBlock)(ref colors)).normalColor = Background2; ((ColorBlock)(ref colors)).highlightedColor = BorderColor; ((ColorBlock)(ref colors)).pressedColor = BorderColor; ((Selectable)obj).colors = colors; } public void UpdateDropdownColors(UIPath uiPath) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Dropdown path not found: " + uiPath.Path); return; } Component component = ((Component)val).GetComponent(uiPath.ComponentType); if ((Object)(object)component == (Object)null || !(component is TMP_Dropdown)) { LogWarden.LogError("[DynamicColorManager] No " + uiPath.ComponentType.Name + " component found at path: " + uiPath.Path); return; } Component obj = ((component is TMP_Dropdown) ? component : null); ColorBlock colors = ((Selectable)obj).colors; ((ColorBlock)(ref colors)).normalColor = Background2; ((ColorBlock)(ref colors)).highlightedColor = Highlight; ((ColorBlock)(ref colors)).pressedColor = Highlight; ((Selectable)obj).colors = colors; } public void UpdateToggleColors(UIPath uiPath) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[DynamicColorManager] Toggle path not found: " + uiPath.Path); return; } Component component = ((Component)val).GetComponent(uiPath.ComponentType); if ((Object)(object)component == (Object)null || !(component is Toggle)) { LogWarden.LogError("[DynamicColorManager] No " + uiPath.ComponentType.Name + " component found at path: " + uiPath.Path); return; } Component obj = ((component is Toggle) ? component : null); ColorBlock colors = ((Selectable)obj).colors; ((ColorBlock)(ref colors)).normalColor = Background6; ((ColorBlock)(ref colors)).highlightedColor = Background7; ((ColorBlock)(ref colors)).pressedColor = Background7; ((ColorBlock)(ref colors)).selectedColor = Background7; ((ColorBlock)(ref colors)).disabledColor = Darken; ((Selectable)obj).colors = colors; } public static void SetChildColor(UIPath parentUIPath, Color color) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(parentUIPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[SetChildColor] Parent path '" + parentUIPath.Path + "' not found."); return; } Type componentType = parentUIPath.ComponentType; if (componentType == null) { LogWarden.LogError("[SetChildColor] Component type not defined in UIPath '" + parentUIPath.Path + "'."); return; } Component[] componentsInChildren = ((Component)val).GetComponentsInChildren(componentType, true); if (componentsInChildren == null || componentsInChildren.Length == 0) { LogWarden.LogWarn("[SetChildColor] No components of type '" + componentType.Name + "' found under '" + parentUIPath.Path + "'."); return; } List<string> list = new List<string>(); Component[] array = componentsInChildren; foreach (Component val2 in array) { string text = parentUIPath.Path + "/" + GetRelativePath(val2.transform, val); SetColor(new UIPath(text, componentType), color); list.Add(text); } } public static void SetChildColorsByName(UIPath parentUIPath, Dictionary<string, Color> nameColorMap) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(parentUIPath.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[SetChildColorsByName] Parent path '" + parentUIPath.Path + "' not found."); return; } Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if (nameColorMap.TryGetValue(((Object)val2).name, out var value)) { string text = parentUIPath.Path + "/" + GetRelativePath(val2, val); SetColor(new UIPath(text, typeof(Graphic)), value); LogWarden.LogInfo("[SetChildColorsByName] Applied color to '" + ((Object)val2).name + "' at path '" + text + "'."); } } } private static string GetRelativePath(Transform child, Transform parent) { List<string> list = new List<string>(); Transform val = child; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)parent) { list.Insert(0, ((Object)val).name); val = val.parent; } return string.Join("/", list); } public static void SetColor(UIPath uiPath, Color color) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Transform[] array = PathFinder.ProbeAll(uiPath.Path); if (array == null || array.Length <= uiPath.Index) { return; } Transform val = array[uiPath.Index]; if ((Object)(object)val != (Object)null) { TMP_Text component = ((Component)val).GetComponent<TMP_Text>(); if ((Object)(object)component != (Object)null) { component.overrideColorTags = true; ((Graphic)component).color = color; return; } Graphic component2 = ((Component)val).GetComponent<Graphic>(); if ((Object)(object)component2 != (Object)null) { component2.color = color; } else { LogWarden.LogError($"[SetColor] {uiPath.ComponentType.Name} component not found on object at '{uiPath.Path}' with index {uiPath.Index}."); } } else { LogWarden.LogError($"[SetColor] Object at index {uiPath.Index} not found at '{uiPath.Path}'."); } } private void RecolorChildObjects(UIPath parentUIPath, string parentNamePrefix, string childName, Color color) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(parentUIPath.Path); if ((Object)(object)val != (Object)null) { foreach (Transform item in val) { Transform val2 = item; if (((Object)val2).name.StartsWith(parentNamePrefix)) { Transform val3 = val2.Find(childName); if (Object.op_Implicit((Object)(object)val3)) { Component component = ((Component)val3).GetComponent(parentUIPath.ComponentType); Graphic val4 = (Graphic)(object)((component is Graphic) ? component : null); if (Object.op_Implicit((Object)(object)val4)) { val4.color = color; } else { LogWarden.LogError("[SubMenuColor] " + parentUIPath.ComponentType.Name + " component not found on child '" + childName + "' in parent '" + ((Object)val2).name + "'."); } } else { LogWarden.LogError("[SubMenuColor] Child '" + childName + "' not found in parent '" + ((Object)val2).name + "'."); } } } return; } LogWarden.LogError("[SubMenuColor] Parent path '" + parentUIPath.Path + "' not found."); } public static void HoverButton(UIPath uiPath, Color regularFontColor, Color highlightFontColor, Color regularBGColor, Color highlightBGColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown Transform val = PathFinder.Probe(uiPath.Path); if ((Object)(object)val != (Object)null) { Button component = ((Component)val).GetComponent<Button>(); Animator component2 = ((Component)val).GetComponent<Animator>(); Image backgroundImage = ((Component)val).GetComponent<Image>(); Transform obj = val.Find("Text (TMP)"); TMP_Text textComponent = ((obj != null) ? ((Component)obj).GetComponent<TMP_Text>() : null); if ((Object)(object)component != (Object)null && (Object)(object)textComponent != (Object)null && (Object)(object)backgroundImage != (Object)null) { if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } ((Selectable)component).transition = (Transition)0; textComponent.overrideColorTags = true; ((Graphic)textComponent).color = regularFontColor; ((Behaviour)backgroundImage).enabled = true; backgroundImage.pixelsPerUnitMultiplier = 4f; ((Graphic)backgroundImage).color = regularBGColor; RectTransform component3 = ((Component)backgroundImage).GetComponent<RectTransform>(); if (component3 != null) { component3.SetSizeWithCurrentAnchors((Axis)1, 22f); } ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = regularBGColor; ((Graphic)textComponent).color = regularFontColor; }); EventTrigger component4 = ((Component)component).GetComponent<EventTrigger>(); if ((Object)(object)component4 != (Object)null) { Object.Destroy((Object)(object)component4); } EventTrigger trigger = ((Component)component).gameObject.AddComponent<EventTrigger>(); AddEventTrigger(trigger, (EventTriggerType)0, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = highlightBGColor; ((Graphic)textComponent).color = highlightFontColor; }); AddEventTrigger(trigger, (EventTriggerType)1, delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = regularBGColor; ((Graphic)textComponent).color = regularFontColor; }); Transform obj2 = val.Find("SelectionHighlight"); CanvasRenderer val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<CanvasRenderer>() : null); if ((Object)(object)val2 != (Object)null) { val2.cull = true; } } else { LogWarden.LogError("[HoverButton] Required components not found at '" + uiPath.Path + "'."); } } else { LogWarden.LogError("[HoverButton] Failed to find path '" + uiPath.Path + "'."); } } private static void AddEventTrigger(EventTrigger trigger, EventTriggerType type, UnityAction<BaseEventData> action) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown Entry val = new Entry { eventID = type }; ((UnityEvent<BaseEventData>)(object)val.callback).AddListener(action); trigger.triggers.Add(val); } private void HandleToggleButtons(UIPath buttonPath1, UIPath buttonPath2) { InitializeButtonStates(buttonPath2, buttonPath1); AttachToggleHandler(buttonPath1, buttonPath2); AttachToggleHandler(buttonPath2, buttonPath1); } private void InitializeButtonStates(params UIPath[] buttonPaths) { UIPath[] array = buttonPaths; foreach (UIPath buttonPath in array) { ToggleButton(buttonPath, highlighted: false); } DelayHelper.StartDelayedAction(0.01f, delegate { if (buttonPaths.Length != 0) { ToggleButton(buttonPaths[0], highlighted: true); } }); } private void AttachToggleHandler(UIPath buttonPath, UIPath otherButtonPath1, UIPath? otherButtonPath2 = null) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown Transform obj = PathFinder.Probe(buttonPath.Path); Button val = ((obj != null) ? ((Component)obj).GetComponent<Button>() : null); if (!((Object)(object)val != (Object)null)) { return; } ((UnityEventBase)val.onClick).RemoveAllListeners(); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { ToggleButton(buttonPath, highlighted: true); ToggleButton(otherButtonPath1, highlighted: false); if (otherButtonPath2.HasValue) { ToggleButton(otherButtonPath2.Value, highlighted: false); } }); } private void ToggleButton(UIPath buttonPath, bool highlighted) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(buttonPath.Path); Image val2 = ((val != null) ? ((Component)val).GetComponent<Image>() : null); Animator val3 = ((val != null) ? ((Component)val).GetComponent<Animator>() : null); if ((Object)(object)val3 != (Object)null) { ((Behaviour)val3).enabled = false; } if ((Object)(object)val2 != (Object)null) { ((Behaviour)val2).enabled = true; val2.pixelsPerUnitMultiplier = 4f; ((Graphic)val2).color = (highlighted ? ButtonHoverBG : Color.clear); Transform val4 = val.Find("SelectionHighlight"); if ((Object)(object)val4 != (Object)null) { Image component = ((Component)val4).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } } TMP_Text componentInChildren = ((Component)val).GetComponentInChildren<TMP_Text>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.overrideColorTags = true; ((Graphic)componentInChildren).color = (highlighted ? ButtonHoverText : ButtonRegText); componentInChildren.extraPadding = true; componentInChildren.fontSizeMax = 13f; componentInChildren.fontStyle = (FontStyles)16; RectTransform rectTransform = componentInChildren.rectTransform; Vector3 localScale = ((Transform)rectTransform).localScale; ((Transform)rectTransform).localScale = new Vector3(localScale.x, 1.1f, localScale.z); } { foreach (Transform item in val) { TMP_Text[] componentsInChildren = ((Component)item).GetComponentsInChildren<TMP_Text>(); foreach (TMP_Text val5 in componentsInChildren) { if (((Object)((Component)val5).gameObject).name == "StatsText") { val5.overrideColorTags = true; ((Graphic)val5).color = (highlighted ? ButtonHoverText : ButtonRegText); } } } return; } } LogWarden.LogError("[SubMenuColor] Image component for highlight not found at '" + buttonPath.Path + "'."); } private void SetupHostButton() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown Transform val = PathFinder.Probe(HOST_BUTTON.Path); if ((Object)(object)val != (Object)null) { Button component = ((Component)val).GetComponent<Button>(); if ((Object)(object)component != (Object)null) { ((UnityEvent)component.onClick).RemoveListener(new UnityAction(HandleSaveButtons)); ((UnityEvent)component.onClick).AddListener(new UnityAction(HandleSaveButtons)); LogWarden.LogInfo("Listener added to host button to handle save buttons."); } else { LogWarden.LogError("Host button component not found."); } } else { LogWarden.LogError("Host button path not found."); } } private void HandleSaveButtons() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(FILES_BUTTON.Path); if ((Object)(object)val == (Object)null) { LogWarden.LogError("[SubMenuColor] Parent path '" + FILES_BUTTON.Path + "' not found."); return; } List<Button> list = new List<Button>(); foreach (Transform item in val) { Button component = ((Component)item).GetComponent<Button>(); if ((Object)(object)component != (Object)null) { list.Add(component); } } foreach (Button item2 in list) { if (EmblemPlugin.SaveFileStrings.TryGetValue(((Component)item2).gameObject, out var value)) { bool highlighted = GameNetworkManager.Instance.currentSaveFileName == value; UIPath buttonPath = new UIPath(((Object)item2).name, typeof(Button)); ToggleButton(buttonPath, highlighted); } } AttachToggleHandlerToAll(list.ToArray()); } private void AttachToggleHandlerToAll(Button[] allButtons) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown Button[] array = allButtons; foreach (Button button in array) { ((UnityEventBase)button.onClick).RemoveAllListeners(); ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { Button[] array2 = allButtons; foreach (Button val in array2) { bool highlighted = (Object)(object)val == (Object)(object)button; UIPath buttonPath = new UIPath(((Object)val).name, typeof(Button)); ToggleButton(buttonPath, highlighted); } }); } } private void SetColorOnButtonClick(UIPath targetUIPath, UIPath triggerUIPath, Color color) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.ProbeAll(triggerUIPath.Path)?.ElementAtOrDefault(triggerUIPath.Index); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.AddComponent<ColorSetter>().SetupColorChangeDeferred(targetUIPath, triggerUIPath.ComponentType, color); } else { LogWarden.LogError("[SetColorOnButtonClick] Trigger object not found."); } } } [BepInPlugin("Darkbrewery.Emblem", "Emblem", "1.6.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class EmblemPlugin : BaseUnityPlugin { public static Dictionary<GameObject, string> SaveFileStrings = new Dictionary<GameObject, string>(); private UIComponent uiComponent; private HeaderReplacement headerReplacement; private Boardwalk boardwalk; private BackgroundManager backgroundManager; private LoadingText loadingText; private MenuMoodSetter menuMoodSetter; private Harmony harmony; private CustomMediaManager customMediaManager; private SceneManagerHelper sceneManagerHelper; private InterfaceDecorator interfaceDecorator; private VersionStyler versionStyler; private Slideshow slideshow; private SubMenuColor subMenuColor; private void Awake() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown if (PluginFinder.LobbyCompat) { LobbyCCheck.Init(); } LogWarden.Initialize(((BaseUnityPlugin)this).Logger); LogWarden.LogInfo(" --------------------------------------------------------------------- "); LogWarden.LogInfo(" %% EEEEE M M BBBBB L EEEEE M M %% "); LogWarden.LogInfo("# * == E MM MM B B L E MM MM == * #"); LogWarden.LogInfo(" * * EEEE M M M M BBBBB L EEEE M M M M * * "); LogWarden.LogInfo("# * == E M M M B B L E M M M == * #"); LogWarden.LogInfo(" %% EEEEE M M BBBBB LLLLL EEEEE M M %% "); LogWarden.LogInfo(" ------------------------- BY DARKBREWERY ---------------------------- "); LogWarden.LogInfo("Stirring from darkness..."); try { harmony = new Harmony("com.darkbrewery.emblem.harmony"); Configurator.InitializeInstance(((BaseUnityPlugin)this).Config); customMediaManager = new CustomMediaManager(); uiComponent = new UIComponent(); backgroundManager = new BackgroundManager(); headerReplacement = new HeaderReplacement(); boardwalk = new Boardwalk(); loadingText = new LoadingText(); menuMoodSetter = new MenuMoodSetter(); versionStyler = new VersionStyler(); slideshow = new Slideshow(((Component)this).transform); subMenuColor = new SubMenuColor(); interfaceDecorator = new InterfaceDecorator(uiComponent, backgroundManager, headerReplacement, boardwalk, loadingText, menuMoodSetter, versionStyler, slideshow, subMenuColor); sceneManagerHelper = new SceneManagerHelper(interfaceDecorator); harmony.PatchAll(); LogWarden.LogInfo("Successfully deployed, its intent shrouded"); } catch (Exception arg) { LogWarden.LogError($"Error initializing Emblem plugin: {arg}"); } } } public class ColorSetter : MonoBehaviour { private SubMenuColor.UIPath targetUIPath; private Color newColor; private Type triggerComponentType; private Button button; private void OnDestroy() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if ((Object)(object)button != (Object)null) { ((UnityEvent)button.onClick).RemoveListener(new UnityAction(OnButtonClick)); } } public void SetupColorChangeDeferred(SubMenuColor.UIPath targetPath, Type triggerCompType, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown targetUIPath = targetPath; newColor = color; triggerComponentType = triggerCompType; ref Button reference = ref button; Component component = ((Component)this).GetComponent(triggerComponentType); reference = (Button)(object)((component is Button) ? component : null); if ((Object)(object)button != (Object)null) { ((UnityEvent)button.onClick).RemoveListener(new UnityAction(OnButtonClick)); ((UnityEvent)button.onClick).AddListener(new UnityAction(OnButtonClick)); } else { LogWarden.LogError("[ColorSetter] Trigger component not found on this gameObject."); } } private void OnButtonClick() { ((MonoBehaviour)this).StartCoroutine(WaitForTargetAndApplyColor()); } private IEnumerator WaitForTargetAndApplyColor() { Transform targetTransform = null; while ((Object)(object)targetTransform == (Object)null) { targetTransform = PathFinder.ProbeAll(targetUIPath.Path)?.ElementAtOrDefault(targetUIPath.Index); if ((Object)(object)targetTransform == (Object)null) { yield return (object)new WaitForSeconds(0.5f); } } Component component = ((Component)targetTransform).GetComponent(targetUIPath.ComponentType); Graphic val = (Graphic)(object)((component is Graphic) ? component : null); if ((Object)(object)val != (Object)null) { val.color = newColor; } else { LogWarden.LogError("[ColorSetter] " + targetUIPath.ComponentType.Name + " component not found on target object."); } } } public class DelayHelper : MonoBehaviour { private static DelayHelper instance; private Dictionary<string, Coroutine> coroutineDictionary = new Dictionary<string, Coroutine>(); private Dictionary<TextMeshProUGUI, Coroutine> typingCoroutines = new Dictionary<TextMeshProUGUI, Coroutine>(); private static DelayHelper GetInstance() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might
BepinEx/plugins/no00ob-LCSoundTool/LC_SoundTool.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LCSoundTool.Networking; using LCSoundTool.Patches; using LCSoundTool.Resources; using LCSoundTool.Utilities; using LCSoundToolMod.Properties; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LC_SoundTool")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Various audio related functions. Mainly logs all sounds that are playing and what type of playback they're into the BepInEx console.")] [assembly: AssemblyFileVersion("1.5.1.0")] [assembly: AssemblyInformationalVersion("1.5.1+88559329ca22fd77bccf008b2fc220541ba49b23")] [assembly: AssemblyProduct("LC_SoundTool")] [assembly: AssemblyTitle("LC_SoundTool")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/no00ob/LCSoundTool")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LCSoundToolMod { public static class PluginInfo { public const string PLUGIN_GUID = "LC_SoundTool"; public const string PLUGIN_NAME = "LC_SoundTool"; public const string PLUGIN_VERSION = "1.5.1"; } } namespace LCSoundToolMod.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LCSoundToolMod.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] soundtool { get { object @object = ResourceManager.GetObject("soundtool", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace LCSoundTool { public class AudioSourceExtension : MonoBehaviour { public AudioSource audioSource; public bool playOnAwake = false; public bool loop = false; private bool updateHasBeenLogged = false; private bool hasPlayed = false; private void OnEnable() { if (!((Object)(object)audioSource == (Object)null) && !audioSource.isPlaying) { if (playOnAwake) { audioSource.Play(); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Started playback of {audioSource} with clip {audioSource.clip} in OnEnable function!"); } updateHasBeenLogged = false; hasPlayed = false; } } private void OnDisable() { if (!((Object)(object)audioSource == (Object)null) && audioSource.isPlaying) { if (playOnAwake) { audioSource.Stop(); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Stopped playback of {audioSource} with clip {audioSource.clip} in OnDisable function!"); } updateHasBeenLogged = false; hasPlayed = false; } } private void Update() { if ((Object)(object)audioSource == (Object)null) { return; } if ((Object)(object)audioSource.clip == (Object)null) { hasPlayed = false; } if (audioSource.isPlaying) { updateHasBeenLogged = false; } else if (!((Behaviour)audioSource).isActiveAndEnabled) { hasPlayed = false; } else { if (!playOnAwake) { return; } if ((Object)(object)audioSource.clip != (Object)null && !hasPlayed) { audioSource.Play(); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Started playback of {audioSource} with clip {audioSource.clip} in Update function!"); } updateHasBeenLogged = false; hasPlayed = true; } else if ((Object)(object)audioSource.clip == (Object)null && !updateHasBeenLogged) { updateHasBeenLogged = true; if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"(AudioSourceExtension) Can not start playback of {audioSource} with missing clip in Update function!"); } } } } } public class RandomAudioClip { public AudioClip clip; [Range(0f, 1f)] public float chance = 1f; public RandomAudioClip(AudioClip clip, float chance) { this.clip = clip; this.chance = chance; } } public class ReplacementAudioClip { public List<RandomAudioClip> clips; public string source = string.Empty; public bool canPlay = true; private bool initialized = false; public ReplacementAudioClip(AudioClip clip, float chance, string source) { if (!initialized) { Initialize(); } RandomAudioClip randomAudioClip = new RandomAudioClip(clip, chance); if (!clips.ContainsThisRandomAudioClip(randomAudioClip)) { clips.Add(randomAudioClip); this.source = source; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"RandomAudioClip {randomAudioClip.clip.GetName()} ({Mathf.RoundToInt(chance * 100f)}%) already exists withing this AudioClipContainer!"); SoundTool.Instance.logger.LogDebug((object)"- This AudioClipContainer contains the following clip(s):"); for (int i = 0; i < clips.Count; i++) { SoundTool.Instance.logger.LogDebug((object)$"-- Clip {i + 1} - {clips[i].clip.GetName()} with a chance of {Mathf.RoundToInt(clips[i].chance * 100f)}%"); } } } public ReplacementAudioClip(string source) { Initialize(); this.source = source; } public ReplacementAudioClip() { Initialize(); source = string.Empty; } public void AddClip(AudioClip clip, float chance) { if (!initialized) { Initialize(); } RandomAudioClip randomAudioClip = new RandomAudioClip(clip, chance); if (!clips.ContainsThisRandomAudioClip(randomAudioClip)) { clips.Add(randomAudioClip); } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"RandomAudioClip {randomAudioClip.clip.GetName()} ({Mathf.RoundToInt(chance * 100f)}%) already exists withing this AudioClipContainer!"); SoundTool.Instance.logger.LogDebug((object)"- This AudioClipContainer contains the following clip(s):"); for (int i = 0; i < clips.Count; i++) { SoundTool.Instance.logger.LogDebug((object)$"-- Clip {i + 1} - {clips[i].clip.GetName()} with a chance of {Mathf.RoundToInt(clips[i].chance * 100f)}%"); } } } public bool Full() { if (!initialized) { Initialize(); } float num = 0f; for (int i = 0; i < clips.Count; i++) { num += clips[i].chance; } return num >= 1f; } public bool ContainsClip(AudioClip clip, float chance) { if (!initialized) { Initialize(); } RandomAudioClip thisClip = new RandomAudioClip(clip, chance); return clips.ContainsThisRandomAudioClip(thisClip); } public float TotalChance() { if (!initialized) { Initialize(); } float num = 0f; for (int i = 0; i < clips.Count; i++) { num += clips[i].chance; } return num; } private void Initialize() { clips = new List<RandomAudioClip>(); initialized = true; } } [BepInPlugin("LCSoundTool", "LC Sound Tool", "1.5.1")] public class SoundTool : BaseUnityPlugin { public enum AudioType { wav, ogg, mp3 } private const string PLUGIN_GUID = "LCSoundTool"; private const string PLUGIN_NAME = "LC Sound Tool"; private ConfigEntry<bool> configUseNetworking; private ConfigEntry<bool> configSyncRandomSeed; private ConfigEntry<float> configPlayOnAwakePatchRepeatDelay; private ConfigEntry<bool> configPrintInfoByDefault; private readonly Harmony harmony = new Harmony("LCSoundTool"); public static SoundTool Instance; internal ManualLogSource logger; public static bool debugAudioSources; public static bool indepthDebugging; public static bool infoDebugging; public static bool networkingInitialized { get; private set; } public static bool networkingAvailable { get; private set; } public static Dictionary<string, ReplacementAudioClip> replacedClips { get; private set; } public static Dictionary<string, AudioClip> networkedClips => NetworkHandler.networkedAudioClips; public static event Action ClientNetworkedAudioChanged { add { NetworkHandler.ClientNetworkedAudioChanged += value; } remove { NetworkHandler.ClientNetworkedAudioChanged -= value; } } public static event Action HostNetworkedAudioChanged { add { NetworkHandler.HostNetworkedAudioChanged += value; } remove { NetworkHandler.HostNetworkedAudioChanged -= value; } } public static bool IsDebuggingOn() { if (debugAudioSources || indepthDebugging || infoDebugging) { return true; } return false; } private void Awake() { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) networkingAvailable = true; if ((Object)(object)Instance == (Object)null) { Instance = this; } configUseNetworking = ((BaseUnityPlugin)this).Config.Bind<bool>("Experimental", "EnableNetworking", false, "Whether or not to use the networking built into this plugin. If set to true everyone in the lobby needs LCSoundTool installed and networking enabled to join."); configSyncRandomSeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Experimental", "SyncUnityRandomSeed", false, "Whether or not to sync the default Unity randomization seed with all clients. For this feature, networking has to be set to true. Will send the UnityEngine.Random.seed from the host to all clients automatically upon loading a networked scene."); configPlayOnAwakePatchRepeatDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Experimental", "NewPlayOnAwakePatchRepeatDelay", 90f, "How long to wait between checks for new playOnAwake AudioSources. Runs the same patching that is done when each scene is loaded with this delay between each run. DO NOT set too low or high. Anything below 10 or above 600 can cause issues. This time is in seconds. Set to 0 to disable rerunning the patch, but be warned that this might break runtime initialized playOnAwake AudioSources."); configPrintInfoByDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "PrintInfoByDefault", false, "Whether or not to print additional information logs created by this mod by default. If set to false, informational logs may be toggled on any time with LeftAlt + F5."); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } logger = Logger.CreateLogSource("LCSoundTool"); logger.LogInfo((object)"Plugin LCSoundTool is loaded!"); InputHelper.Initialize(); InputHelper.keybinds.Add("toggleAudioSourceDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[0]), ToggleDebug)); InputHelper.keybinds.Add("toggleIndepthDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), ToggleIndepthDebug)); InputHelper.keybinds.Add("toggleInformationalDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), ToggleInfoDebug)); InputHelper.keybinds.Add("printAllSoundsDebugLog", new Keybind(new KeyboardShortcut((KeyCode)286, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), PrintAllReplacedSounds)); InputHelper.keybinds.Add("printAllCurrentSoundsDebugLog", new Keybind(new KeyboardShortcut((KeyCode)287, (KeyCode[])(object)new KeyCode[0]), PrintAllCurrentSounds)); debugAudioSources = false; indepthDebugging = false; if (configPrintInfoByDefault.Value) { infoDebugging = true; } else { infoDebugging = false; } replacedClips = new Dictionary<string, ReplacementAudioClip>(); } private void Start() { if (!configUseNetworking.Value) { networkingAvailable = false; Instance.logger.LogWarning((object)"Networking disabled. Mod in fully client side mode, but no networked actions can take place! You can safely ignore this if you want the mod to run fully client side."); } else { networkingAvailable = true; } if (configUseNetworking.Value) { logger.LogDebug((object)"Loading SoundTool AssetBundle..."); Assets.bundle = AssetBundle.LoadFromMemory(LCSoundToolMod.Properties.Resources.soundtool); if ((Object)(object)Assets.bundle == (Object)null) { logger.LogError((object)"Failed to load SoundTool AssetBundle!"); } else { logger.LogDebug((object)"Finished loading SoundTool AssetBundle!"); } } harmony.PatchAll(typeof(AudioSourcePatch)); if (configUseNetworking.Value) { harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); } SceneManager.sceneLoaded += OnSceneLoaded; } private void Update() { if (configUseNetworking.Value) { if (!networkingInitialized) { if ((Object)(object)NetworkHandler.Instance != (Object)null) { networkingInitialized = true; } } else if ((Object)(object)NetworkHandler.Instance == (Object)null) { networkingInitialized = false; } } else { networkingInitialized = false; } if (!InputHelper.CheckInput("printAllCurrentSoundsDebugLog") && !InputHelper.CheckInput("printAllSoundsDebugLog") && !InputHelper.CheckInput("toggleInformationalDebugLog") && !InputHelper.CheckInput("toggleIndepthDebugLog") && !InputHelper.CheckInput("toggleAudioSourceDebugLog")) { } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null)) { PatchPlayOnAwakeAudio(scene); OnSceneLoadedNetworking(); if (((Scene)(ref scene)).name.ToLower().Contains("level")) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(PatchPlayOnAwakeDelayed(scene, 1f)); } } } private IEnumerator PatchPlayOnAwakeDelayed(Scene scene, float wait) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (infoDebugging) { logger.LogDebug((object)$"Started playOnAwake patch coroutine with delay of {wait} seconds"); } yield return (object)new WaitForSecondsRealtime(wait); if (infoDebugging) { logger.LogDebug((object)"Running playOnAwake patch coroutine!"); } PatchPlayOnAwakeAudio(scene); float repeatWait = configPlayOnAwakePatchRepeatDelay.Value; if (repeatWait != 0f) { if (repeatWait < 10f) { repeatWait = 10f; } if (repeatWait > 600f) { repeatWait = 600f; } ((MonoBehaviour)this).StartCoroutine(PatchPlayOnAwakeDelayed(scene, repeatWait)); } } private void PatchPlayOnAwakeAudio(Scene scene) { if (infoDebugging) { Instance.logger.LogDebug((object)("Grabbing all playOnAwake AudioSources for loaded scene " + ((Scene)(ref scene)).name)); } AudioSource[] allPlayOnAwakeAudioSources = GetAllPlayOnAwakeAudioSources(); if (infoDebugging) { Instance.logger.LogDebug((object)$"Found a total of {allPlayOnAwakeAudioSources.Length} playOnAwake AudioSource(s)!"); Instance.logger.LogDebug((object)$"Starting setup on {allPlayOnAwakeAudioSources.Length} playOnAwake AudioSource(s)..."); } AudioSource[] array = allPlayOnAwakeAudioSources; AudioSourceExtension audioSourceExtension = default(AudioSourceExtension); foreach (AudioSource val in array) { val.Stop(); if (((Component)((Component)val).transform).TryGetComponent<AudioSourceExtension>(ref audioSourceExtension)) { audioSourceExtension.audioSource = val; audioSourceExtension.playOnAwake = true; audioSourceExtension.loop = val.loop; val.playOnAwake = false; if (infoDebugging) { Instance.logger.LogDebug((object)$"-Set- {Array.IndexOf(allPlayOnAwakeAudioSources, val) + 1} {val} done!"); } continue; } AudioSourceExtension audioSourceExtension2 = ((Component)val).gameObject.AddComponent<AudioSourceExtension>(); audioSourceExtension2.audioSource = val; audioSourceExtension2.playOnAwake = true; audioSourceExtension2.loop = val.loop; val.playOnAwake = false; if (infoDebugging) { Instance.logger.LogDebug((object)$"-Add- {Array.IndexOf(allPlayOnAwakeAudioSources, val) + 1} {val} done!"); } } if (infoDebugging) { Instance.logger.LogDebug((object)$"Done setting up {allPlayOnAwakeAudioSources.Length} playOnAwake AudioSources!"); } } private void OnSceneLoadedNetworking() { if (networkingAvailable && networkingInitialized && configSyncRandomSeed.Value) { int num = (int)DateTime.Now.Ticks; Random.InitState(num); SendUnityRandomSeed(num); } } public AudioSource[] GetAllPlayOnAwakeAudioSources() { AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true); List<AudioSource> list = new List<AudioSource>(); for (int i = 0; i < array.Length; i++) { if (array[i].playOnAwake) { list.Add(array[i]); } } return list.ToArray(); } public static void ReplaceAudioClip(string originalName, AudioClip newClip) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else { ReplaceAudioClipInternal(originalName, newClip, 1f, string.Empty); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, 1f, string.Empty); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, float chance) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalName, newClip, chance, string.Empty); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, float chance) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, chance, string.Empty); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, string source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Plugin LCSoundTool is trying to replace an audio clip without new clip specified! This is not allowed."); } else { ReplaceAudioClipInternal(originalName, newClip, 1f, source); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, string source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Plugin LCSoundTool is trying to replace an audio clip without new clip specified! This is not allowed."); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, 1f, source); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, string[] source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalName, newClip, 1f, string.Join(",", list)); } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, string[] source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalClip.GetName(), newClip, 1f, string.Join(",", list)); } public static void ReplaceAudioClip(string originalName, AudioClip newClip, float chance, string source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalName, newClip, chance, source); } } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, float chance, string source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or the specified original clip has no name! This is not allowed"); } else if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { ReplaceAudioClipInternal(originalClip.GetName(), newClip, chance, source); } } public static void ReplaceAudioClip(string originalName, AudioClip newClip, float chance, string[] source) { if (string.IsNullOrEmpty(originalName)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalName, newClip, chance, string.Join(",", list)); } public static void ReplaceAudioClip(AudioClip originalClip, AudioClip newClip, float chance, string[] source) { if ((Object)(object)originalClip == (Object)null || string.IsNullOrEmpty(originalClip.GetName())) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified or original clip's name is empty! This is not allowed."); return; } if ((Object)(object)newClip == (Object)null) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without new clip specified! This is not allowed."); return; } if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } ReplaceAudioClipInternal(originalClip.GetName(), newClip, chance, string.Join(",", list)); } private static void ReplaceAudioClipInternal(string originalName, AudioClip newClip, float chance, string source) { string text = originalName; string name = newClip.GetName(); if (!string.IsNullOrEmpty(source)) { text = originalName + "#" + source; } if (replacedClips.ContainsKey(text)) { replacedClips[text].AddClip(newClip, chance); } else { replacedClips.Add(text, new ReplacementAudioClip(newClip, chance, source)); } float num = 0f; for (int i = 0; i < replacedClips[text].clips.Count(); i++) { num += replacedClips[text].clips[i].chance; } int num2 = Mathf.RoundToInt(num * 100f); if (infoDebugging) { Instance.logger.LogDebug((object)$"The current total combined chance for replaced {replacedClips[text].clips.Count()} random audio clips for audio clip {text} does not equal 100%. Currently {num2}% (at least yet?)"); } } public static void RemoveRandomAudioClip(string name, float chance) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to restore an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); } else { RemoveRandomAudioClipInternal(name, chance, string.Empty); } } public static void RemoveRandomAudioClip(string name, float chance, string source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else { RemoveRandomAudioClipInternal(name, chance, source); } } public static void RemoveRandomAudioClip(string name, float chance, string[] source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to replace an audio clip without original clip specified! This is not allowed"); return; } if (chance < 0f || chance > 1f) { Instance.logger.LogWarning((object)$"Trying to replace an audio clip with an invalid chance of {chance}! Chance has to be between 0 - 1.0"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } RemoveRandomAudioClipInternal(name, chance, string.Join(",", list)); } private static void RemoveRandomAudioClipInternal(string name, float chance, string source) { if (!string.IsNullOrEmpty(source)) { name = name + "#" + source; } if (!(chance > 0f)) { return; } for (int i = 0; i < replacedClips[name].clips.Count(); i++) { if (replacedClips[name].clips[i].chance == chance) { replacedClips[name].clips.RemoveAt(i); if (replacedClips[name].clips.Count <= 0) { Instance.logger.LogDebug((object)("Removed replaced AudioClip " + name + " completely as all of it's random clips have been removed.")); replacedClips.Remove(name); } break; } } } public static void RestoreAudioClip(string name) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else { RestoreAudioClipInternal(name, string.Empty); } } public static void RestoreAudioClip(string name, string source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); } else if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); } else { RestoreAudioClipInternal(name, source); } } public static void RestoreAudioClip(string name, string[] source) { if (string.IsNullOrEmpty(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without original clip specified! This is not allowed"); return; } if (!replacedClips.ContainsKey(name)) { Instance.logger.LogWarning((object)"Trying to restore an audio clip that does not exist! This is not allowed"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } RestoreAudioClipInternal(name, string.Join(",", list)); } public static void RestoreAudioClip(AudioClip clip) { if ((Object)(object)clip == (Object)null || string.IsNullOrEmpty(clip.GetName())) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without vanilla clip specified or specified clip's name is empty! This is not allowed"); } else { RestoreAudioClipInternal(clip.GetName(), string.Empty); } } public static void RestoreAudioClip(AudioClip clip, string source) { if ((Object)(object)clip == (Object)null || string.IsNullOrEmpty(clip.GetName())) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without vanilla clip specified or specified clip's name is empty! This is not allowed"); } else { RestoreAudioClipInternal(clip.GetName(), source); } } public static void RestoreAudioClip(AudioClip clip, string[] source) { if ((Object)(object)clip == (Object)null || string.IsNullOrEmpty(clip.GetName())) { Instance.logger.LogWarning((object)"Trying to restore an audio clip without vanilla clip specified or specified clip's name is empty! This is not allowed"); return; } List<string> list = source.ToList(); for (int i = 0; i < list.Count; i++) { if (string.IsNullOrEmpty(list[i])) { list.RemoveAt(i); i--; } } RestoreAudioClipInternal(clip.GetName(), string.Join(",", list)); } private static void RestoreAudioClipInternal(string name, string source) { if (!string.IsNullOrEmpty(source)) { name = name + "#" + source; } replacedClips.Remove(name); } public static AudioClip GetAudioClip(string modFolder, string soundName) { return GetAudioClip(modFolder, string.Empty, soundName); } public static AudioClip GetAudioClip(string modFolder, string subFolder, string soundName) { AudioType audioType = AudioType.wav; string[] array = soundName.Split('.'); if (array[^1].ToLower().Contains("wav")) { audioType = AudioType.wav; if (infoDebugging) { Instance.logger.LogDebug((object)"File detected as a PCM WAVE file!"); } } else if (array[^1].ToLower().Contains("ogg")) { audioType = AudioType.ogg; if (infoDebugging) { Instance.logger.LogDebug((object)"File detected as an Ogg Vorbis file!"); } } else if (array[^1].ToLower().Contains("mp3")) { audioType = AudioType.mp3; if (infoDebugging) { Instance.logger.LogDebug((object)"File detected as a MPEG MP3 file!"); } } else { audioType = AudioType.wav; Instance.logger.LogWarning((object)("Failed to detect file type of a sound file! This may cause issues with other mod functionality. Sound defaulted to WAV. Sound: " + soundName)); } return GetAudioClip(modFolder, subFolder, soundName, audioType); } public static AudioClip GetAudioClip(string modFolder, string soundName, AudioType audioType) { return GetAudioClip(modFolder, string.Empty, soundName, audioType); } public static AudioClip GetAudioClip(string modFolder, string subFolder, string soundName, AudioType audioType) { bool flag = true; bool flag2 = false; string text = " "; string text2 = Path.Combine(Paths.PluginPath, modFolder, subFolder, soundName); string text3 = Path.Combine(Paths.PluginPath, modFolder, soundName); string path = Path.Combine(Paths.PluginPath, modFolder, subFolder); string text4 = Path.Combine(Paths.PluginPath, subFolder, soundName); string path2 = Path.Combine(Paths.PluginPath, subFolder); if (!Directory.Exists(path)) { if (!string.IsNullOrEmpty(subFolder)) { Instance.logger.LogWarning((object)("Requested directory at BepInEx/Plugins/" + modFolder + "/" + subFolder + " does not exist!")); } else { Instance.logger.LogWarning((object)("Requested directory at BepInEx/Plugins/" + modFolder + " does not exist!")); if (!modFolder.Contains("-")) { Instance.logger.LogWarning((object)"This sound mod might not be compatable with mod managers. You should contact the sound mod's author."); } } flag = false; } else { if (infoDebugging) { Instance.logger.LogDebug((object)"Skipping legacy path check..."); } flag2 = true; } if (!File.Exists(text2)) { Instance.logger.LogWarning((object)("Requested audio file does not exist at path " + text2 + "!")); flag = false; Instance.logger.LogDebug((object)("Looking for audio file from mod root instead at " + text3 + "...")); if (File.Exists(text3)) { Instance.logger.LogDebug((object)("Found audio file at path " + text3 + "!")); text2 = text3; flag = true; if (infoDebugging) { Instance.logger.LogDebug((object)"Skipping legacy path check..."); } flag2 = true; } else { Instance.logger.LogWarning((object)("Requested audio file does not exist at mod root path " + text3 + "!")); } } else { if (infoDebugging) { Instance.logger.LogDebug((object)"Skipping legacy path check..."); } flag2 = true; } if (Directory.Exists(path2) && !flag2) { if (!string.IsNullOrEmpty(subFolder)) { Instance.logger.LogWarning((object)("Legacy directory location at BepInEx/Plugins/" + subFolder + " found!")); } else if (!modFolder.Contains("-")) { Instance.logger.LogWarning((object)"Legacy directory location at BepInEx/Plugins found!"); } } if (File.Exists(text4) && !flag2) { Instance.logger.LogWarning((object)("Legacy path contains the requested audio file at path " + text4 + "!")); text = " legacy "; text2 = text4; flag = true; } switch (audioType) { case AudioType.wav: if (infoDebugging) { Instance.logger.LogDebug((object)"File defined as a WAV file!"); } break; case AudioType.ogg: if (infoDebugging) { Instance.logger.LogDebug((object)"File defined as an Ogg Vorbis file!"); } break; case AudioType.mp3: if (infoDebugging) { Instance.logger.LogDebug((object)"File defined as a MPEG MP3 file!"); } break; default: if (infoDebugging) { Instance.logger.LogDebug((object)"File type not defined and was defaulted to WAV file!"); } break; } AudioClip val = null; if (flag) { Instance.logger.LogDebug((object)("Loading AudioClip " + soundName + " from" + text + "path: " + text2)); switch (audioType) { case AudioType.wav: val = AudioUtility.LoadFromDiskToAudioClip(text2, (AudioType)20); break; case AudioType.ogg: val = AudioUtility.LoadFromDiskToAudioClip(text2, (AudioType)14); break; case AudioType.mp3: val = AudioUtility.LoadFromDiskToAudioClip(text2, (AudioType)13); break; } Instance.logger.LogDebug((object)$"Finished loading AudioClip {soundName} with length of {val.length}!"); } else { Instance.logger.LogWarning((object)("Failed to load AudioClip " + soundName + " from invalid" + text + "path at " + text2 + "!")); } if (string.IsNullOrEmpty(val.GetName())) { string empty = string.Empty; string[] array = new string[0]; switch (audioType) { case AudioType.wav: empty = soundName.Replace(".wav", ""); if (infoDebugging) { Instance.logger.LogDebug((object)("soundName " + soundName + ", finalName " + empty)); } array = empty.Split('/'); if (infoDebugging) { Instance.logger.LogDebug((object)$"nameParts length {array.Length}"); } if (array.Length <= 1) { array = empty.Split('\\'); } empty = array[^1]; if (infoDebugging) { Instance.logger.LogDebug((object)("finalName from nameParts array " + empty)); } ((Object)val).name = empty; break; case AudioType.ogg: empty = soundName.Replace(".ogg", ""); if (infoDebugging) { Instance.logger.LogDebug((object)("soundName " + soundName + ", finalName " + empty)); } array = empty.Split('/'); if (infoDebugging) { Instance.logger.LogDebug((object)$"nameParts length {array.Length}"); } if (array.Length <= 1) { array = empty.Split('\\'); } empty = array[^1]; if (infoDebugging) { Instance.logger.LogDebug((object)("finalName from nameParts array " + empty)); } ((Object)val).name = empty; break; case AudioType.mp3: empty = soundName.Replace(".mp3", ""); if (infoDebugging) { Instance.logger.LogDebug((object)("soundName " + soundName + ", finalName " + empty)); } array = empty.Split('/'); if (infoDebugging) { Instance.logger.LogDebug((object)$"nameParts length {array.Length}"); } if (array.Length <= 1) { array = empty.Split('\\'); } empty = array[^1]; if (infoDebugging) { Instance.logger.LogDebug((object)("finalName from nameParts array " + empty)); } ((Object)val).name = empty; break; } } if ((Object)(object)val != (Object)null) { string name = val.GetName(); } return val; } public static void SendNetworkedAudioClip(AudioClip audioClip) { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)$"Networking disabled! Failed to send {audioClip}!"); } else if ((Object)(object)audioClip == (Object)null) { Instance.logger.LogWarning((object)$"audioClip variable of SendAudioClip not assigned! Failed to send {audioClip}!"); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)$"Instance of SoundTool not found or networking has not finished initializing. Failed to send {audioClip}! If you're sending things in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked audio runs only after the player setups a networked connection!"); } else { NetworkHandler.Instance.SendAudioClipServerRpc(audioClip.GetName(), AudioUtility.AudioClipToByteArray(audioClip, out var _), audioClip.channels, audioClip.frequency); } } public static void RemoveNetworkedAudioClip(AudioClip audioClip) { RemoveNetworkedAudioClip(audioClip.GetName()); } public static void RemoveNetworkedAudioClip(string audioClip) { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)("Networking disabled! Failed to remove " + audioClip + "!")); } else if (string.IsNullOrEmpty(audioClip)) { Instance.logger.LogWarning((object)("audioClip variable of RemoveAudioClip not assigned! Failed to remove " + audioClip + "!")); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)("Instance of SoundTool not found or networking has not finished initializing. Failed to remove " + audioClip + "! If you're removing things in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked audio runs only after the player setups a networked connection!")); } else { NetworkHandler.Instance.RemoveAudioClipServerRpc(audioClip); } } public static void SyncNetworkedAudioClips() { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)"Networking disabled! Failed to sync audio clips!"); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)"Instance of SoundTool not found or networking has not finished initializing. Failed to sync networked audio! If you're syncing things in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked audio runs only after the player setups a networked connection!"); } else { NetworkHandler.Instance.SyncAudioClipsServerRpc(); } } public static void SendUnityRandomSeed(int seed) { if (!Instance.configUseNetworking.Value) { Instance.logger.LogWarning((object)"Networking disabled! Failed to send Unity random seed!"); } else if ((Object)(object)Instance == (Object)null || (Object)(object)GameNetworkManagerPatch.networkHandlerHost == (Object)null || (Object)(object)NetworkHandler.Instance == (Object)null) { Instance.logger.LogWarning((object)"Instance of SoundTool not found or networking has not finished initializing. Failed to send Unity Random seed! If you're sending the seed in Awake or in a scene such as the main menu it might be too early, please try some of the other built-in Unity methods and make sure your networked methods run only after the player setups a networked connection!"); } else { NetworkHandler.Instance.SendSeedToClientsServerRpc(seed); } } public void ToggleDebug() { debugAudioSources = !debugAudioSources; if (indepthDebugging && !debugAudioSources) { indepthDebugging = false; } Instance.logger.LogDebug((object)$"Toggling AudioSource debug logs {debugAudioSources}!"); } public void ToggleIndepthDebug() { debugAudioSources = !debugAudioSources; indepthDebugging = debugAudioSources; infoDebugging = debugAudioSources; Instance.logger.LogDebug((object)$"Toggling in-depth AudioSource debug logs {debugAudioSources}!"); } public void ToggleInfoDebug() { infoDebugging = !infoDebugging; Instance.logger.LogDebug((object)$"Toggling informational debug logs {infoDebugging}!"); } public void PrintAllReplacedSounds() { Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Printing all currently replaced sounds..."); Instance.logger.LogDebug((object)" "); string[] array = replacedClips.Keys.ToArray(); for (int i = 0; i < replacedClips.Count; i++) { ReplacementAudioClip replacementAudioClip = replacedClips[array[i]]; Instance.logger.LogDebug((object)$"Clip named {array[i]} with {replacementAudioClip.clips.Count} replacement clip(s)"); Instance.logger.LogDebug((object)$"- Clip can play? {replacementAudioClip.canPlay}"); Instance.logger.LogDebug((object)("- Clip audio source(s)? " + replacementAudioClip.source)); Instance.logger.LogDebug((object)$"- All {replacementAudioClip.clips.Count} clip(s):"); for (int j = 0; j < replacementAudioClip.clips.Count; j++) { Instance.logger.LogDebug((object)$"-- Clip {j + 1} - {replacementAudioClip.clips[j].clip.GetName()} with chance of {Mathf.RoundToInt(replacementAudioClip.clips[j].chance * 100f)}%"); } Instance.logger.LogDebug((object)$"-- Total - All clips combined chance {Mathf.RoundToInt(replacementAudioClip.TotalChance() * 100f)}%"); } Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Finished printing all currently replaced sounds!"); Instance.logger.LogDebug((object)" "); } private void PrintAllCurrentSounds() { //IL_01a3: Unknown result type (might be due to invalid IL or missing references) Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Printing all sounds in currently loaded scenes..."); Instance.logger.LogDebug((object)" "); AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true); AudioSourceExtension audioSourceExtension = default(AudioSourceExtension); for (int i = 0; i < array.Length; i++) { Instance.logger.LogDebug((object)$"AudioSource {array[i]} with clip {array[i].clip}"); Instance.logger.LogDebug((object)$"- Volume: {array[i].volume}"); Instance.logger.LogDebug((object)$"- Priority: {array[i].priority}"); Instance.logger.LogDebug((object)$"- Plays on awake? {array[i].playOnAwake}"); Instance.logger.LogDebug((object)$"- Loops? {array[i].loop}"); Instance.logger.LogDebug((object)$"- Needs custom LCSoundTool component? {array[i].playOnAwake}"); Instance.logger.LogDebug((object)$"- Contains custom LCSoundTool component? {((Component)((Component)array[i]).transform).TryGetComponent<AudioSourceExtension>(ref audioSourceExtension)}"); Instance.logger.LogDebug((object)$"- Used by PlayAudioAnimationEvent component? {array[i].UsedByAnimationEventScript()}"); Instance.logger.LogDebug((object)$"- Located in Scene: {((Component)array[i]).gameObject.scene}"); Instance.logger.LogDebug((object)"- Located on the following GameObject:"); Transform val = ((Component)array[i]).transform; Instance.logger.LogDebug((object)$"-- (This) {val}"); while ((Object)(object)val != (Object)(object)((Component)array[i]).transform.root) { val = val.parent; Instance.logger.LogDebug((object)$"-- {val}"); } } Instance.logger.LogDebug((object)" "); Instance.logger.LogDebug((object)"Finished printing all sounds in currently loaded scenes!"); Instance.logger.LogDebug((object)" "); } } } namespace LCSoundTool.Utilities { public static class AudioUtility { public static byte[] AudioClipToByteArray(AudioClip audioClip, out float[] samples) { samples = new float[audioClip.samples * audioClip.channels]; audioClip.GetData(samples, 0); byte[] array = new byte[samples.Length * 2]; int num = 32767; for (int i = 0; i < samples.Length; i++) { short value = (short)(samples[i] * (float)num); BitConverter.GetBytes(value).CopyTo(array, i * 2); } return array; } public static AudioClip LoadFromMemory(byte[] fileData, string clipName) { int channels = BitConverter.ToInt16(fileData, 22); int frequency = BitConverter.ToInt32(fileData, 24); int num = BitConverter.ToInt16(fileData, 34); byte[] array = new byte[fileData.Length - 44]; Array.Copy(fileData, 44, array, 0, array.Length); return ByteArrayToAudioClip(array, clipName, channels, frequency); } public static AudioClip ByteArrayToAudioClip(byte[] byteArray, string clipName, int channels, int frequency) { if (frequency < 1 || frequency > 48000) { frequency = 44100; } if (channels < 1 || channels > 2) { channels = 1; } int num = 16; int num2 = num / 8; AudioClip val = AudioClip.Create(clipName, byteArray.Length / num2, channels, frequency, false); val.SetData(ConvertByteArrayToFloatArray(byteArray), 0); return val; } private static float[] ConvertByteArrayToFloatArray(byte[] byteArray) { float[] array = new float[byteArray.Length / 2]; int num = 32767; for (int i = 0; i < array.Length; i++) { short num2 = BitConverter.ToInt16(byteArray, i * 2); array[i] = (float)num2 / (float)num; } return array; } public static AudioClip LoadFromDiskToAudioClip(string path, AudioType type) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 AudioClip result = null; UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(path, type); try { audioClip.SendWebRequest(); try { while (!audioClip.isDone) { } if ((int)audioClip.result != 1) { SoundTool.Instance.logger.LogError((object)("Failed to load WAV AudioClip from path: " + path + " Full error: " + audioClip.error)); } else { result = DownloadHandlerAudioClip.GetContent(audioClip); } } catch (Exception ex) { SoundTool.Instance.logger.LogError((object)(ex.Message + ", " + ex.StackTrace)); } } finally { ((IDisposable)audioClip)?.Dispose(); } return result; } } public static class Extensions { public static bool ContainsThisRandomAudioClip(this List<RandomAudioClip> list, RandomAudioClip thisClip) { for (int i = 0; i < list.Count; i++) { if (list[i].chance == thisClip.chance && list[i].clip.GetName() == thisClip.clip.GetName()) { return true; } } return false; } public static bool UsedByAnimationEventScript(this AudioSource source) { PlayAudioAnimationEvent componentInChildren = ((Component)((Component)source).transform.root).GetComponentInChildren<PlayAudioAnimationEvent>(); if ((Object)(object)componentInChildren != (Object)null) { return (Object)(object)componentInChildren.audioToPlay == (Object)(object)source || (Object)(object)componentInChildren.audioToPlayB == (Object)(object)source; } return false; } } public static class InputHelper { public static Dictionary<string, Keybind> keybinds; public static void Initialize() { keybinds = new Dictionary<string, Keybind>(); } public static bool CheckInput(string keybind) { if (keybinds.ContainsKey(keybind) && ((KeyboardShortcut)(ref keybinds[keybind].shortcut)).IsDown() && !keybinds[keybind].wasPressed) { keybinds[keybind].wasPressed = true; } return CheckInputResult(keybind); } private static bool CheckInputResult(string keybind) { if (keybinds.ContainsKey(keybind) && ((KeyboardShortcut)(ref keybinds[keybind].shortcut)).IsUp() && keybinds[keybind].wasPressed) { keybinds[keybind].wasPressed = false; keybinds[keybind].onPress(); return true; } return false; } } [Serializable] public class Keybind { public KeyboardShortcut shortcut; public Action onPress; public bool wasPressed; public Keybind(KeyboardShortcut shortcut, Action onPress, bool wasPressed = false) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) this.shortcut = shortcut; this.onPress = onPress; this.wasPressed = wasPressed; } } } namespace LCSoundTool.Patches { [HarmonyPatch(typeof(AudioSource))] internal class AudioSourcePatch { private static Dictionary<string, AudioClip> originalClips = new Dictionary<string, AudioClip>(); [HarmonyPatch("Play", new Type[] { })] [HarmonyPrefix] public static void Play_Patch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayMethod(__instance); } [HarmonyPatch("Play", new Type[] { typeof(ulong) })] [HarmonyPrefix] public static void Play_UlongPatch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayMethod(__instance); } [HarmonyPatch("Play", new Type[] { typeof(double) })] [HarmonyPrefix] public static void Play_DoublePatch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayMethod(__instance); } [HarmonyPatch("PlayDelayed", new Type[] { typeof(float) })] [HarmonyPrefix] public static void PlayDelayed_Patch(AudioSource __instance) { RunDynamicClipReplacement(__instance); DebugPlayDelayedMethod(__instance); } [HarmonyPatch("PlayClipAtPoint", new Type[] { typeof(AudioClip), typeof(Vector3), typeof(float) })] [HarmonyPrefix] public static bool PlayClipAtPoint_Patch(AudioClip clip, Vector3 position, float volume) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject($"ClipAtPoint_{clip}"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.clip = clip; val2.spatialBlend = 1f; val2.volume = volume; val2.Play(); DebugPlayClipAtPointMethod(val2, position); Object.Destroy((Object)(object)val, clip.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale)); return false; } [HarmonyPatch("PlayOneShotHelper", new Type[] { typeof(AudioSource), typeof(AudioClip), typeof(float) })] [HarmonyPrefix] public static void PlayOneShotHelper_Patch(AudioSource source, ref AudioClip clip, float volumeScale) { clip = ReplaceClipWithNew(clip, source); DebugPlayOneShotMethod(source, clip); } private static void DebugPlayMethod(AudioSource instance) { if ((Object)(object)instance == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} at {((Component)instance).transform.root} is playing {((Object)instance.clip).name}"); } else if (SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} is playing {((Object)instance.clip).name} at"); Transform val = ((Component)instance).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)instance).transform.root}"); } } } private static void DebugPlayDelayedMethod(AudioSource instance) { if ((Object)(object)instance == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} at {((Component)instance).transform.root} is playing {((Object)instance.clip).name} with delay"); } else if (SoundTool.indepthDebugging && (Object)(object)instance != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{instance} is playing {((Object)instance.clip).name} with delay at"); Transform val = ((Component)instance).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)instance).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)instance).transform.root}"); } } } private static void DebugPlayClipAtPointMethod(AudioSource audioSource, Vector3 position) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)audioSource == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)audioSource != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{audioSource} at {((Component)audioSource).transform.root} is playing {((Object)audioSource.clip).name} at point {position}"); } else if (SoundTool.indepthDebugging && (Object)(object)audioSource != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{audioSource} is playing {((Object)audioSource.clip).name} located at point {position} within "); Transform val = ((Component)audioSource).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)audioSource).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)audioSource).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)audioSource).transform.root}"); } } } private static void DebugPlayOneShotMethod(AudioSource source, AudioClip clip) { if ((Object)(object)source == (Object)null || (Object)(object)clip == (Object)null) { return; } if (SoundTool.debugAudioSources && !SoundTool.indepthDebugging && (Object)(object)source != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{source} at {((Component)source).transform.root} is playing one shot {((Object)clip).name}"); } else if (SoundTool.indepthDebugging && (Object)(object)source != (Object)null) { SoundTool.Instance.logger.LogDebug((object)$"{source} is playing one shot {((Object)clip).name} at"); Transform val = ((Component)source).transform; while ((Object)(object)val.parent != (Object)null || (Object)(object)val != (Object)(object)((Component)source).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {val.parent}"); val = val.parent; } if ((Object)(object)val == (Object)(object)((Component)source).transform.root) { SoundTool.Instance.logger.LogDebug((object)$"--- {((Component)source).transform.root}"); } } } private static void RunDynamicClipReplacement(AudioSource instance) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"instance {instance} instance.clip {instance.clip}"); } if ((Object)(object)instance == (Object)null || (Object)(object)instance.clip == (Object)null) { return; } string name = ((Object)((Component)instance).gameObject).name; bool flag = true; string name2 = instance.clip.GetName(); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sourceName {((Object)((Component)instance).gameObject).name} clipName {name2} replaceClip {flag}"); } string text = name2; if (SoundTool.replacedClips.Keys.Count > 0) { string[] array = SoundTool.replacedClips.Keys.ToArray(); if (array.Length != 0) { for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split("#"); if (array2.Length == 2 && array2[0].Contains(name2) && array2[1].Contains(((Object)((Component)instance).gameObject).name)) { text = name2 + "#" + array2[1]; } } } } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("finalName after splitName operation " + text)); } if (SoundTool.replacedClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips contained finalName"); } if (SoundTool.replacedClips[text].canPlay) { if (!originalClips.ContainsKey(name)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("originalClips did not contain sourceName, adding sourceName " + name)); } originalClips.Add(name, instance.clip); } if (!string.IsNullOrEmpty(SoundTool.replacedClips[text].source)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source " + SoundTool.replacedClips[text].source + " was not null or empty")); } flag = false; string[] array3 = SoundTool.replacedClips[text].source.Split(','); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sources array {array3.Length} {array3}"); } if ((Object)(object)instance != (Object)null && ((Object)((Component)instance).gameObject).name != null) { if (array3.Length > 1) { for (int j = 0; j < array3.Length; j++) { if (array3[j] == ((Object)((Component)instance).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " matches instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " does not match instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } } } else if (array3[0] == ((Object)((Component)instance).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " matches instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " does not match instance.gameObject.name " + ((Object)((Component)instance).gameObject).name)); } } } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source was empty or null '" + SoundTool.replacedClips[text].source + "'")); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replaceClip {flag}"); } List<RandomAudioClip> clips = SoundTool.replacedClips[text].clips; float num = 0f; foreach (RandomAudioClip item in clips) { num += item.chance; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"totalChance {num}"); } float num2 = Random.Range(0f, num); { foreach (RandomAudioClip item2 in clips) { if (num2 <= item2.chance) { if (flag) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip replaced with {item2.clip}"); } instance.clip = item2.clip; break; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was not replaced with {item2.clip}"); } if (originalClips.ContainsKey(name)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"originalClips.ContainsKey(sourceName), clip was restored to {originalClips[name]}"); } instance.clip = originalClips[name]; originalClips.Remove(name); } break; } num2 -= item2.chance; } return; } } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replacedClips[finalName].canPlay {SoundTool.replacedClips[text].canPlay}"); } } else if (originalClips.ContainsKey(name)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips did not contain finalName but originalClips contained sourceName"); } instance.clip = originalClips[name]; originalClips.Remove(name); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was restored to {originalClips[name]}"); } } } private static AudioClip ReplaceClipWithNew(AudioClip original, AudioSource source = null) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"original {original} source {source}"); } if ((Object)(object)original == (Object)null) { return original; } string name = original.GetName(); bool flag = true; string text = name; if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sourceName {((Object)((Component)source).gameObject).name} clipName {name} replaceClip {flag}"); } if ((Object)(object)source != (Object)null) { if (SoundTool.replacedClips.Keys.Count > 0) { string[] array = SoundTool.replacedClips.Keys.ToArray(); if (array.Length != 0) { for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split("#"); if (array2.Length == 2 && array2[0].Contains(name) && array2[1].Contains(((Object)((Component)source).gameObject).name)) { text = name + "#" + array2[1]; } } } } } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"source was null, this means we can't check for sourceName for this sound!"); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("finalName after splitName operation " + text)); } if (SoundTool.replacedClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips contained finalName"); } if (!SoundTool.replacedClips[text].canPlay) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replacedClips[finalName].canPlay {SoundTool.replacedClips[text].canPlay}"); } return original; } if (!originalClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("originalClips did not contain finalName, adding finalName " + text)); } originalClips.Add(text, original); } if (!string.IsNullOrEmpty(SoundTool.replacedClips[text].source)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source " + SoundTool.replacedClips[text].source + " was not null or empty")); } flag = false; string[] array3 = SoundTool.replacedClips[text].source.Split(','); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"sources array {array3.Length} {array3}"); } if ((Object)(object)source != (Object)null && ((Object)((Component)source).gameObject).name != null) { if (array3.Length > 1) { for (int j = 0; j < array3.Length; j++) { if (array3[j] == ((Object)((Component)source).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " matches instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[i] " + array3[j] + " does not match instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } } } else if (array3[0] == ((Object)((Component)source).gameObject).name) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " matches instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } flag = true; } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("sources[0] " + array3[0] + " does not match instance.gameObject.name " + ((Object)((Component)source).gameObject).name)); } } } else if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)("replacedClips[finalName].source was empty or null '" + SoundTool.replacedClips[text].source + "'")); } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"replaceClip {flag}"); } List<RandomAudioClip> clips = SoundTool.replacedClips[text].clips; float num = 0f; foreach (RandomAudioClip item in clips) { num += item.chance; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"totalChance {num}"); } float num2 = Random.Range(0f, num); foreach (RandomAudioClip item2 in clips) { if (num2 <= item2.chance) { if (flag) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip replaced with {item2.clip}"); } return item2.clip; } if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was not replaced with {item2.clip}"); } if (originalClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"originalClips.ContainsKey(finalName), clip was restored to {originalClips[text]}"); } AudioClip result = originalClips[text]; originalClips.Remove(text); return result; } return original; } num2 -= item2.chance; } } else if (originalClips.ContainsKey(text)) { if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)"replacedClips did not contain finalName but originalClips contained finalName"); } AudioClip result2 = originalClips[text]; originalClips.Remove(text); if (SoundTool.infoDebugging) { SoundTool.Instance.logger.LogDebug((object)$"clip was restored to {originalClips[text]}"); } return result2; } return original; } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { public static GameObject networkPrefab; public static GameObject networkHandlerHost; [HarmonyPatch("Start")] [HarmonyPrefix] public static void Start_Patch() { if (!((Object)(object)networkPrefab != (Object)null)) { SoundTool.Instance.logger.LogDebug((object)"Loading NetworkHandler prefab..."); networkPrefab = Assets.bundle.LoadAsset<GameObject>("SoundToolNetworkHandler.prefab"); if ((Object)(object)networkPrefab == (Object)null) { SoundTool.Instance.logger.LogError((object)"Failed to load NetworkHandler prefab!"); } if ((Object)(object)networkPrefab != (Object)null) { NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); SoundTool.Instance.logger.LogDebug((object)"Registered NetworkHandler prefab!"); } else { SoundTool.Instance.logger.LogWarning((object)"Failed to registered NetworkHandler prefab! No networking can take place."); } } } [HarmonyPatch("StartDisconnect")] [HarmonyPostfix] private static void StartDisconnect_Patch() { try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { SoundTool.Instance.logger.LogDebug((object)"Destroying NetworkHandler prefab!"); Object.Destroy((Object)(object)networkHandlerHost); networkHandlerHost = null; } } catch { SoundTool.Instance.logger.LogError((object)"Failed to destroy NetworkHandler prefab!"); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void SpawnNetworkHandler() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) try { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { SoundTool.Instance.logger.LogDebug((object)"Spawning NetworkHandler prefab!"); GameNetworkManagerPatch.networkHandlerHost = Object.Instantiate<GameObject>(GameNetworkManagerPatch.networkPrefab, Vector3.zero, Quaternion.identity); GameNetworkManagerPatch.networkHandlerHost.GetComponent<NetworkObject>().Spawn(true); } } catch { SoundTool.Instance.logger.LogError((object)"Failed to spawn NetworkHandler prefab!"); } } } } namespace LCSoundTool.Networking { public class NetworkHandler : NetworkBehaviour { public static NetworkHandler Instance { get; private set; } public static Dictionary<string, AudioClip> networkedAudioClips { get; private set; } public static event Action ClientNetworkedAudioChanged; public static event Action HostNetworkedAudioChanged; public override void OnNetworkSpawn() { Debug.Log((object)"LCSoundTool - NetworkHandler created!"); NetworkHandler.ClientNetworkedAudioChanged = null; NetworkHandler.HostNetworkedAudioChanged = null; networkedAudioClips = new Dictionary<string, AudioClip>(); Instance = this; } [ClientRpc] public void ReceiveAudioClipClientRpc(string clipName, byte[] audioData, int channels, int frequency) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(292212293u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } bool flag2 = audioData != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(audioData, default(ForPrimitives)); } BytePacker.WriteValueBitPacked(val2, channels); BytePacker.WriteValueBitPacked(val2, frequency); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 292212293u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (!networkedAudioClips.ContainsKey(clipName)) { AudioClip val3 = null; val3 = AudioUtility.ByteArrayToAudioClip(audioData, clipName, channels, frequency); networkedAudioClips.Add(clipName, val3); NetworkHandler.ClientNetworkedAudioChanged?.Invoke(); } else { SoundTool.Instance.logger.LogDebug((object)("Sound " + clipName + " already exists for this client! Skipping addition of this sound for this client.")); } } } [ClientRpc] public void RemoveAudioClipClientRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1355469546u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1355469546u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && networkedAudioClips.ContainsKey(clipName)) { networkedAudioClips.Remove(clipName); NetworkHandler.ClientNetworkedAudioChanged?.Invoke(); } } [ClientRpc] public void SyncAudioClipsClientRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2611915412u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2611915412u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !networkedAudioClips.ContainsKey(clipName)) { SendExistingAudioClipServerRpc(clipName); } } [ClientRpc] public void ReceiveSeedClientRpc(int seed) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1556253924u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, seed); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1556253924u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Random.InitState(seed); SoundTool.Instance.logger.LogDebug((object)$"Client received a new Unity Random seed of {seed}!"); } } } [ServerRpc(RequireOwnership = false)] public void SendAudioClipServerRpc(string clipName, byte[] audioData, int channels, int frequency) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2399630547u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } bool flag2 = audioData != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(audioData, default(ForPrimitives)); } BytePacker.WriteValueBitPacked(val2, channels); BytePacker.WriteValueBitPacked(val2, frequency); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2399630547u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ReceiveAudioClipClientRpc(clipName, audioData, channels, frequency); NetworkHandler.HostNetworkedAudioChanged?.Invoke(); } } [ServerRpc(RequireOwnership = false)] public void RemoveAudioClipServerRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3103497155u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3103497155u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { RemoveAudioClipClientRpc(clipName); NetworkHandler.HostNetworkedAudioChanged?.Invoke(); } } [ServerRpc(RequireOwnership = false)] public void SyncAudioClipsServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(178607916u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 178607916u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } string[] array = networkedAudioClips.Keys.ToArray(); if (array.Length < 1) { SoundTool.Instance.logger.LogDebug((object)"No sounds found in networkedClips. Syncing process cancelled!"); return; } for (int i = 0; i < array.Length; i++) { SyncAudioClipsClientRpc(array[i]); } } [ServerRpc(RequireOwnership = false)] public void SendExistingAudioClipServerRpc(string clipName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4006259189u, val, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4006259189u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { if (networkedAudioClips.ContainsKey(clipName)) { byte[] array = null; array = AudioUtility.AudioClipToByteArray(networkedAudioClips[clipName], out var _); ReceiveAudioClipClientRpc(clipName, array, networkedAudioClips[clipName].channels, networkedAudioClips[clipName].frequency); } else { SoundTool.Instance.logger.LogWarning((object)"Trying to obtain and sync a sound from the host that does not exist in the host's game!"); } } } [ServerRpc(RequireOwnership = false)] public void SendSeedToClientsServerRpc(int seed) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4286510828u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, seed); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4286510828u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviour)this).IsHost) { ReceiveSeedClientRpc(seed); SoundTool.Instance.logger.LogDebug((object)$"Sending a new Unity random seed of {seed} to all clients..."); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NetworkHandler() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(292212293u, new RpcReceiveHandler(__rpc_handler_292212293)); NetworkManager.__rpc_func_table.Add(1355469546u, new RpcReceiveHandler(__rpc_handler_1355469546)); NetworkManager.__rpc_func_table.Add(2611915412u, new RpcReceiveHandler(__rpc_handler_2611915412)); NetworkManager.__rpc_func_table.Add(1556253924u, new RpcReceiveHandler(__rpc_handler_1556253924)); NetworkManager.__rpc_func_table.Add(2399630547u, new RpcReceiveHandler(__rpc_handler_2399630547)); NetworkManager.__rpc_func_table.Add(3103497155u, new RpcReceiveHandler(__rpc_handler_3103497155)); NetworkManager.__rpc_func_table.Add(178607916u, new RpcReceiveHandler(__rpc_handler_178607916)); NetworkManager.__rpc_func_table.Add(4006259189u, new RpcReceiveHandler(__rpc_handler_4006259189)); NetworkManager.__rpc_func_table.Add(4286510828u, new RpcReceiveHandler(__rpc_handler_4286510828)); } private static void __rpc_handler_292212293(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string clipName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref clipName, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); byte[] audioData = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref audioData, default(ForPrimitives)); } int channels = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref channels); int frequency = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref frequency); target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).ReceiveAudioClipClientRpc(clipName, audioData, channels, frequency); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1355469546(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && net