Decompiled source of Lethal Apocalypse v1.4.4
plugins/Darkbrewery-Emblem/Emblem.dll
Decompiled 4 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_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 CREWCOUNT_TITLE = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/CrewCountField(Clone)/Text (TMP)", typeof(TMP_Text)); private static readonly UIPath CREWCOUNT_INPUT_BG = new UIPath("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/CrewCountField(Clone)", 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.9f); 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_079d: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_07fb: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0845: Unknown result type (might be due to invalid IL or missing references) //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08a1: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08c9: Unknown result type (might be due to invalid IL or missing references) //IL_08cf: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_0904: Unknown result type (might be due to invalid IL or missing references) //IL_0914: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0963: Unknown result type (might be due to invalid IL or missing references) //IL_0973: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0995: 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); 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); if (PluginFinder.MoreCompany) { SetColor(CREWCOUNT_TITLE, Highlight); SetColor(CREWCOUNT_INPUT_BG, Background2); SetColor(COSMO_BUTTON, Highlight); } 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(); } 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 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 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) { 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}'."); } } else { LogWarden.LogError($"[SetColor] Not enough objects found at '{uiPath.Path}'. Expected at least {uiPath.Index + 1}, found {array.Length}."); } } 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) { ToggleButton(buttonPath1, highlighted: false); ToggleButton(buttonPath2, highlighted: true); AttachToggleHandler(buttonPath1, buttonPath2); AttachToggleHandler(buttonPath2, buttonPath1); } private void AttachToggleHandler(UIPath buttonPath, UIPath otherButtonPath) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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) { ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { ToggleButton(buttonPath, highlighted: true); }); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { ToggleButton(otherButtonPath, highlighted: false); }); } else { LogWarden.LogError("[SubMenuColor] Button component not found at '" + buttonPath.Path + "'."); } } 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."); } } public void RecolorCosmoButton() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (PluginFinder.MoreCompany) { InitializeThemeColors(); SetColor(COSMO_BUTTON, Highlight); } } } [BepInPlugin("Darkbrewery.Emblem", "Emblem", "1.5.3")] [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 be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("GlobalDelayHelper"); instance = val.AddComponent<DelayHelper>(); Object.DontDestroyOnLoad((Object)val); } return instance; } public static void StopAll() { foreach (Coroutine value in GetInstance().coroutineDictionary.Values) { ((MonoBehaviour)GetInstance()).StopCoroutine(value); } GetInstance().coroutineDictionary.Clear(); } public static void StartDelayedAction(float delayInSeconds, Action action) { GetInstance().DelayedAction(delayInSeconds, action); } private void DelayedAction(float delayInSeconds, Action action) { ((MonoBehaviour)this).StartCoroutine(DelayCoroutine(delayInSeconds, action)); } private IEnumerator DelayCoroutine(float delayInSeconds, Action action) { yield return (object)new WaitForSeconds(delayInSeconds); action?.Invoke(); } public static void StartRepeatingAction(string name, float intervalInSeconds, Action action) { StopRepeatingAction(name); Coroutine value = ((MonoBehaviour)GetInstance()).StartCoroutine(GetInstance().RepeatingActionCoroutine(intervalInSeconds, action)); GetInstance().coroutineDictionary[name] = value; } public static void StopRepeatingAction(string name) { if ((Object)(object)instance != (Object)null && instance.coroutineDictionary.TryGetValue(name, out var value)) { ((MonoBehaviour)instance).StopCoroutine(value); instance.coroutineDictionary.Remove(name); } } private IEnumerator RepeatingActionCoroutine(float intervalInSeconds, Action action) { while (true) { yield return (object)new WaitForSeconds(intervalInSeconds); action?.Invoke(); } } public static void StartFadeAction(Image image, float duration, Action onComplete = null) { GetInstance().FadeImageCoroutine(image, duration, onComplete); } private void FadeImageCoroutine(Image image, float duration, Action onComplete) { ((MonoBehaviour)this).StartCoroutine(FadeImage(image, duration, onComplete)); } private IEnumerator FadeImage(Image image, float duration, Action onComplete) { float currentTime = 0f; Color startColor = ((Graphic)image).color; Color endColor = new Color(startColor.r, startColor.g, startColor.b, 0f); while (currentTime < duration) { currentTime += Time.deltaTime; ((Graphic)image).color = Color.Lerp(startColor, endColor, currentTime / duration); yield return null; } ((Graphic)image).color = endColor; onComplete?.Invoke(); } public static void StartTypingText(TextMeshProUGUI textComponent, string text, float typingSpeed, float flashDuration = 0.3f, int flashCount = 2) { GetInstance().TypingTextCoroutine(textComponent, text, typingSpeed, flashDuration, flashCount); } private void TypingTextCoroutine(TextMeshProUGUI textComponent, string text, float typingSpeed, float flashDuration, int flashCount) { if (typingCoroutines.TryGetValue(textComponent, out var value)) { ((MonoBehaviour)this).StopCoroutine(value); typingCoroutines.Remove(textComponent); } Coroutine value2 = ((MonoBehaviour)this).StartCoroutine(TypeTextWithCursorFlash(textComponent, text, typingSpeed, flashDuration, flashCount)); typingCoroutines[textComponent] = value2; } private IEnumerator TypeTextWithCursorFlash(TextMeshProUGUI textComponent, string text, float typingSpeed, float flashDuration, int flashCount) { StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < flashCount; j++) { ((TMP_Text)textComponent).text = "_"; yield return (object)new WaitForSeconds(flashDuration); ((TMP_Text)textComponent).text = ""; yield return (object)new WaitForSeconds(flashDuration); } foreach (char value in text) { stringBuilder.Append(value); ((TMP_Text)textComponent).text = stringBuilder.ToString() + "_"; yield return (object)new WaitForSeconds(typingSpeed); ((TMP_Text)textComponent).text = stringBuilder.ToString(); } } } public class EmblemFolder { private readonly string basePluginsPath; private readonly Dictionary<string, string> fullPathCache = new Dictionary<string, string>(); private readonly Dictionary<string, IEnumerable<string>> validPathsCache = new Dictionary<string, IEnumerable<string>>(); private readonly Lazy<IEnumerable<string>> emblemDirectories; public EmblemFolder() { basePluginsPath = Path.Combine(Paths.BepInExRootPath, "plugins"); emblemDirectories = new Lazy<IEnumerable<string>>(() => FindEmblemDirectories()); } private IEnumerable<string> FindEmblemDirectories() { try { return (from dir in Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories) where Path.GetFileName(dir).Equals("Emblem", StringComparison.OrdinalIgnoreCase) select dir).ToList(); } catch (Exception ex) { LogWarden.LogError("[EmblemFolder] Error finding Emblem directories: " + ex.Message); return new List<string>(); } } public string FindFullPath(string inputPath) { if (fullPathCache.TryGetValue(inputPath, out var value)) { return value; } string path = ExtractRelativePathFromEmblem(inputPath); string[] directories = Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories); foreach (string text in directories) { if (text.EndsWith("Emblem", StringComparison.OrdinalIgnoreCase)) { string text2 = Path.Combine(text, path); if (File.Exists(text2) || Directory.Exists(text2)) { fullPathCache[inputPath] = text2; return text2; } } } LogWarden.LogError("[EmblemFolder] Could not find a valid path for: " + inputPath); return null; } public IEnumerable<string> FindAllValidPaths(string inputPathPattern) { if (validPathsCache.TryGetValue(inputPathPattern, out var value)) { return value; } string path = ExtractRelativePathFromEmblem(inputPathPattern); string[] directories = Directory.GetDirectories(basePluginsPath, "*", SearchOption.AllDirectories); List<string> list = new List<string>(); string[] array = directories; foreach (string text in array) { if (text.EndsWith("Emblem", StringComparison.OrdinalIgnoreCase)) { string searchPattern = Path.Combine(text, path); list.AddRange(Directory.GetFiles(text, searchPattern, SearchOption.AllDirectories)); } } validPathsCache[inputPathPattern] = list; return list; } private string ExtractRelativePathFromEmblem(string path) { string[] array = path.Split(new char[2] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries); int num = Array.FindIndex(array, (string segment) => segment.Equals("Emblem", StringComparison.OrdinalIgnoreCase)); if (num != -1 && num < array.Length - 1) { return Path.Combine(array.Skip(num + 1).ToArray()); } return path; } } public class ImageFilters { private readonly Configurator configManager; public ImageFilters(Configurator configManager) { this.configManager = configManager; } public void Blend(string targetImagePath, Color vignetteColor) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) Transform val = PathFinder.Probe(targetImagePath); if ((Object)(object)val == (Object)null) { LogWarden.LogError("ImageFilters.Blend: Image with path '" + targetImagePath + "' not found."); return; } GameObject gameObject = ((Component)val).gameObject; Transform val2 = gameObject.transform.Find("VignetteOverlay"); if (!configManager.enableRadiantTaper.Value) { if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); LogWarden.LogInfo("ImageFilters.Blend: Vignette effect removed from '" + targetImagePath + "'."); } return; } GameObject val3; if ((Object)(object)val2 != (Object)null) { val3 = ((Component)val2).gameObject; } else { val3 = new GameObject("VignetteOverlay"); RectTransform obj = val3.AddComponent<RectTransform>(); ((Transform)obj).SetParent(gameObject.transform, false); ((Transform)obj).SetAsLastSibling(); Rect rect = gameObject.GetComponent<RectTransform>().rect; float width = ((Rect)(ref rect)).width; rect = gameObject.GetComponent<RectTransform>().rect; obj.sizeDelta = new Vector2(width, ((Rect)(ref rect)).height); } Image obj2 = val3.GetComponent<Image>() ?? val3.AddComponent<Image>(); Texture2D val4 = CreateVignetteTexture(((Texture)gameObject.GetComponent<Image>().sprite.texture).width, ((Texture)gameObject.GetComponent<Image>().sprite.texture).height, vignetteColor); obj2.sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f)); ((Graphic)obj2).raycastTarget = false; } private Texture2D CreateVignetteTexture(int width, int height, Color vignetteColor) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); Color val2 = default(Color); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { float distance2 = j; float distance3 = width - j; float distance4 = height - i; float distance5 = i; float num = Mathf.Max(CalculateExponentialBlend(distance2, width), CalculateExponentialBlend(distance3, width)); float num2 = Mathf.Max(CalculateExponentialBlend(distance4, height), CalculateExponentialBlend(distance5, height)); float num3 = Mathf.Max(num, num2); ((Color)(ref val2))..ctor(vignetteColor.r, vignetteColor.g, vignetteColor.b, num3); val.SetPixel(j, i, val2); } } val.Apply(); return val; static float CalculateExponentialBlend(floa
plugins/loaforc-loaforcsSoundAPI/me.loaforc.soundapi.dll
Decompiled 4 months agousing System; using System.Collections.Concurrent; 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.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks.CompilerServices; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using loaforcsSoundAPI.API; using loaforcsSoundAPI.Behaviours; using loaforcsSoundAPI.Data; using loaforcsSoundAPI.LethalCompany; using loaforcsSoundAPI.LethalCompany.Conditions; using loaforcsSoundAPI.Providers.Conditions; using loaforcsSoundAPI.Providers.Formats; using loaforcsSoundAPI.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("me.loaforc.soundapi")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.4.0")] [assembly: AssemblyInformationalVersion("1.1.4+9a4b6c5898a610993a4d4ce2c24e1b5966e15ec9")] [assembly: AssemblyProduct("loaforcsSoundAPI")] [assembly: AssemblyTitle("me.loaforc.soundapi")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 loaforcsSoundAPI { public static class SoundLoader { public static bool GetAudioClip(string packName, string folder, string soundName, out AudioClip clip) { SoundPlugin.logger.LogLosingIt("Loading sound: " + packName + "/" + folder + "/" + soundName); clip = null; if (!GetAudioPath(packName, folder, soundName, out var path)) { ((ManualLogSource)SoundPlugin.logger).LogError((object)"Failed getting path, check above for more detailed error!"); return false; } clip = SoundAPI.FileFormats[Path.GetExtension(path).ToLower()].LoadAudioClip(path); if ((Object)(object)clip == (Object)null) { ((ManualLogSource)SoundPlugin.logger).LogError((object)"Failed getting clip from disk, check above for more detailed error!"); return false; } if (string.IsNullOrEmpty(clip.GetName())) { ((Object)clip).name = soundName; } return true; } private static bool GetAudioPath(string packName, string folder, string soundName, out string path) { string text = Path.Combine(Paths.PluginPath, packName, "sounds", folder); path = Path.Combine(text, soundName); if (!Directory.Exists(text)) { ((ManualLogSource)SoundPlugin.logger).LogError((object)(text + " doesn't exist! (failed loading: " + soundName + ")")); path = null; return false; } if (!File.Exists(path)) { ((ManualLogSource)SoundPlugin.logger).LogError((object)(path + " is a valid folder but the sound contained doesn't exist!")); path = null; return false; } return true; } } [BepInPlugin("me.loaforc.soundapi", "loaforcsSoundAPI", "1.1.4")] public class SoundPlugin : BaseUnityPlugin { internal static List<SoundPack> SoundPacks = new List<SoundPack>(); internal List<UniTask> loadingTasks = new List<UniTask>(); public static SoundPlugin Instance { get; private set; } internal static LoafLogger logger { get; private set; } [Obsolete] internal static ManualLogSource Logger => (ManualLogSource)(object)logger; private void Awake() { //IL_0224: Unknown result type (might be due to invalid IL or missing references) logger = new LoafLogger("me.loaforc.soundapi"); Logger.Sources.Add((ILogSource)(object)logger); Instance = this; ((ManualLogSource)logger).LogInfo((object)"Patching..."); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.loaforc.soundapi"); ((ManualLogSource)logger).LogInfo((object)"Setting up config..."); new SoundPluginConfig(((BaseUnityPlugin)this).Config); ((ManualLogSource)logger).LogInfo((object)("Logging Level at: " + SoundPluginConfig.LOGGING_LEVEL.Value)); ((ManualLogSource)logger).LogInfo((object)"Searching for soundpacks..."); string[] directories = Directory.GetDirectories(Paths.PluginPath); ((ManualLogSource)logger).LogInfo((object)"Beginning Bindings"); ((ManualLogSource)logger).LogInfo((object)"Bindings => General => Audio Formats"); SoundAPI.RegisterAudioFormatProvider(".mp3", new Mp3AudioFormat()); SoundAPI.RegisterAudioFormatProvider(".ogg", new OggAudioFormat()); SoundAPI.RegisterAudioFormatProvider(".wav", new WavAudioFormat()); ((ManualLogSource)logger).LogInfo((object)"Bindings => General => Conditions"); SoundAPI.RegisterConditionProvider("config", new ConfigCondition()); SoundAPI.RegisterConditionProvider("mod_installed", new ModInstalledConditionProvider()); SoundAPI.RegisterConditionProvider("and", new AndCondition()); SoundAPI.RegisterConditionProvider("not", new NotCondition()); SoundAPI.RegisterConditionProvider("or", new OrCondition()); LethalCompanyBindings.Bind(); string[] array = directories; foreach (string text in array) { string[] directories2 = Directory.GetDirectories(text); foreach (string text2 in directories2) { string path = Path.Combine(text2, "sound_pack.json"); ((ManualLogSource)logger).LogDebug((object)text2); if (File.Exists(path)) { SoundPacks.Add(new SoundPack(text2)); break; } } string path2 = Path.Combine(text, "sound_pack.json"); if (File.Exists(path2)) { SoundPacks.Add(new SoundPack(text)); } } ((ManualLogSource)logger).LogInfo((object)"Starting up JoinableThreadPool."); foreach (SoundPack soundPack in SoundPacks) { if (SoundPluginConfig.ENABLE_MULTITHREADING.Value) { loadingTasks.Add(soundPack.AsyncQueueLoad()); } else { soundPack.QueueLoad(); } } logger.LogLosingIt($"Created {loadingTasks.Count} loading tasks!"); ((ManualLogSource)logger).LogInfo((object)"Registering onSceneLoaded"); SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode __) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) logger.LogLosingIt("NEW SCENE LOADED! Scanning for inital playOnAwake sounds..."); logger.LogLosingIt("scene.name: " + ((Scene)(ref scene)).name); AudioSource[] array2 = Object.FindObjectsOfType<AudioSource>(true); foreach (AudioSource val in array2) { if (!(((Component)val).gameObject.scene != scene)) { if (val.playOnAwake) { logger.LogLosingIt($"source: {val}"); logger.LogLosingIt($"source.gameObject: {((Component)val).gameObject}"); logger.LogLosingIt($"source.clip: {(Object)(object)val.clip == (Object)null}"); logger.LogLosingIt(((Object)((Component)val).gameObject).name + ":" + (((Object)(object)val.clip == (Object)null) ? "null" : ((Object)val.clip).name) + " calling Stop() because its play on awake."); val.Stop(); } AudioSourceReplaceHelper audioSourceReplaceHelper = ((Component)val).gameObject.AddComponent<AudioSourceReplaceHelper>(); audioSourceReplaceHelper.source = val; } } }; ((ManualLogSource)logger).LogInfo((object)"me.loaforc.soundapi:1.1.4 has loaded!"); } internal void EnsureSoundsAreLoaded() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) if (!SoundPluginConfig.ENABLE_MULTITHREADING.Value) { return; } ((ManualLogSource)logger).LogInfo((object)"Ensuring all sounds are loaded..."); foreach (UniTask loadingTask in loadingTasks) { UniTask current = loadingTask; int num = 0; while (!UniTaskStatusExtensions.IsCompleted(((UniTask)(ref current)).Status)) { Thread.Sleep(100); num++; logger.LogLosingIt("Still waiting..."); if (num > 100) { ((ManualLogSource)logger).LogWarning((object)"AAAAAAAAAAAAAAAAAAAAAAA ITS BEEN LONGER THAN 10 SECONDS THIS ISN'T GOODD!!"); } if (num % 10 == 0) { ((ManualLogSource)logger).LogInfo((object)"Things are still happening don't worry."); } } } ((ManualLogSource)logger).LogInfo((object)"it's all good :3"); } } internal class SoundPluginConfig { internal enum LoggingLevel { NORMAL, EXTENDED, IM_GOING_TO_LOSE_IT } internal static ConfigEntry<bool> ENABLE_MULTITHREADING; internal static ConfigEntry<int> THREADPOOL_MAX_THREADS; internal static ConfigEntry<bool> SKIP_LOADING_UNUSED_SOUNDS; internal static ConfigEntry<LoggingLevel> LOGGING_LEVEL; private static ConfigEntry<int> CONFIG_VERSION; internal SoundPluginConfig(ConfigFile config) { ENABLE_MULTITHREADING = config.Bind<bool>("SoundLoading", "Multithreading", true, "Whether or not to use multithreading when loading a sound pack. If you haven't been told that you should disable multithreading, you probably don't need to!\nThis setting may not be needed with the new 1.0.0 rewrite of multithreading."); THREADPOOL_MAX_THREADS = config.Bind<int>("SoundLoading", "MaxThreadsInThreadPool", 4, "Max amount of threads the loading thread pool can create at once.\nIncreasing this number will decrease loading of non-startup packs but may be unsupported by your CPU."); SKIP_LOADING_UNUSED_SOUNDS = config.Bind<bool>("SoundLoading", "SkipLikelyUnusedSounds", true, "When using only a config loaforcsSoundAPI will be able to skip loading some sounds. This means mods that let you change config mid-game will not take affect until a restart."); LOGGING_LEVEL = config.Bind<LoggingLevel>("Logging", "LoggingLevel", LoggingLevel.NORMAL, "What level should sound api log at?"); CONFIG_VERSION = config.Bind<int>("INTERNAL_DO_NOT_TOUCH", "CONFIG_VERSION_DO_NOT_TOUCH", 1, "Don't touch this. This is for internal use only."); if (CONFIG_VERSION.Value == 1) { CONFIG_VERSION.Value = 2; if (THREADPOOL_MAX_THREADS.Value == 32) { THREADPOOL_MAX_THREADS.Value = 4; ((ManualLogSource)SoundPlugin.logger).LogInfo((object)"Migrated config info."); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "me.loaforc.soundapi"; public const string PLUGIN_NAME = "loaforcsSoundAPI"; public const string PLUGIN_VERSION = "1.1.4"; } } namespace loaforcsSoundAPI.Utils { public static class ExtensionMethods { public static T GetValueOrDefault<T>(this JObject jsonObject, string key, T defaultValue = default(T)) { JToken val = ((jsonObject != null) ? jsonObject.GetValue(key, StringComparison.OrdinalIgnoreCase) : null); if (val == null) { return defaultValue; } return val.ToObject<T>(); } public static TValue GetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue) { if (!dictionary.TryGetValue(key, out var value)) { return defaultValue; } return value; } public static TValue GetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, Func<TValue> defaultValueProvider) { if (!dictionary.TryGetValue(key, out var value)) { return defaultValueProvider(); } return value; } public static bool IsNumber(this object @object) { if (@object is int || @object is double || @object is float) { return true; } return false; } } internal class LoafLogger : ManualLogSource { public LoafLogger(string sourceName) : base(sourceName) { } internal void LogExtended(object message) { if (SoundPluginConfig.LOGGING_LEVEL.Value == SoundPluginConfig.LoggingLevel.EXTENDED || SoundPluginConfig.LOGGING_LEVEL.Value == SoundPluginConfig.LoggingLevel.IM_GOING_TO_LOSE_IT) { ((ManualLogSource)this).LogDebug((object)$"[EXTENDED] {message}"); } } internal void LogLosingIt(object message) { if (SoundPluginConfig.LOGGING_LEVEL.Value == SoundPluginConfig.LoggingLevel.IM_GOING_TO_LOSE_IT) { ((ManualLogSource)this).LogDebug((object)$"[IM_GOING_TO_LOSE_IT] {message}"); } } internal void LogTraceback() { LogLosingIt(new StackTrace().ToString()); } } } namespace loaforcsSoundAPI.Providers.Formats { internal class Mp3AudioFormat : AudioFormatProvider { public override AudioClip LoadAudioClip(string path) { return LoadFromUWR(path, (AudioType)24); } } internal class OggAudioFormat : AudioFormatProvider { public override AudioClip LoadAudioClip(string path) { return LoadFromUWR(path, (AudioType)14); } } internal class WavAudioFormat : AudioFormatProvider { public override AudioClip LoadAudioClip(string path) { return LoadFromUWR(path, (AudioType)20); } } } namespace loaforcsSoundAPI.Providers.Conditions { internal class AndCondition : ConditionProvider { public override bool Evaluate(SoundReplaceGroup pack, JObject conditionDef) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown foreach (JObject item in (IEnumerable<JToken>)conditionDef["conditions"]) { JObject val = item; if (!SoundAPI.ConditionProviders[(string)val["type"]].Evaluate(pack, val)) { return false; } } return true; } } internal class ConfigCondition : ConditionProvider { public override bool Evaluate(SoundReplaceGroup group, JObject conditionDef) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 if (!conditionDef.ContainsKey("value")) { return group.pack.GetConfigOption<bool>((string)conditionDef["config"]); } if ((int)conditionDef["value"].Type == 9) { return group.pack.GetConfigOption<bool>((string)conditionDef["config"]) == (bool)conditionDef["value"]; } object rawConfigOption = group.pack.GetRawConfigOption((string)conditionDef["config"]); if ((int)conditionDef["value"].Type == 8) { if (rawConfigOption is ConfigEntry<float>) { return EvaluateRangeOperator((rawConfigOption as ConfigEntry<float>).Value, (string)conditionDef["value"]); } return (string)rawConfigOption == (string)conditionDef["value"]; } return false; } } internal class ModInstalledConditionProvider : ConditionProvider { public override bool Evaluate(SoundReplaceGroup group, JObject conditionDef) { return Chainloader.PluginInfos.ContainsKey((string)conditionDef["value"]); } } internal class NotCondition : ConditionProvider { public override bool Evaluate(SoundReplaceGroup pack, JObject conditionDef) { ConditionProvider conditionProvider = SoundAPI.ConditionProviders[(string)conditionDef["condition"][(object)"type"]]; JToken obj = conditionDef["condition"]; return !conditionProvider.Evaluate(pack, (JObject)(object)((obj is JObject) ? obj : null)); } } internal class OrCondition : ConditionProvider { public override bool Evaluate(SoundReplaceGroup pack, JObject conditionDef) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown foreach (JObject item in (IEnumerable<JToken>)conditionDef["conditions"]) { JObject val = item; if (SoundAPI.ConditionProviders[(string)val["type"]].Evaluate(pack, val)) { return true; } } return false; } } } namespace loaforcsSoundAPI.Patches { [HarmonyPatch(typeof(AudioSource))] internal static class AudioSourcePatch { private const int TOKEN_PARENT_NAME = 0; private const int TOKEN_OBJECT_NAME = 1; private const int TOKEN_CLIP_NAME = 2; [HarmonyPrefix] [HarmonyPatch("Play", new Type[] { })] [HarmonyPatch("Play", new Type[] { typeof(ulong) })] [HarmonyPatch("Play", new Type[] { typeof(double) })] private static bool Play(AudioSource __instance) { if (TryReplaceAudio(__instance, __instance.clip, out var replacement)) { if ((Object)(object)replacement == (Object)null) { return false; } __instance.clip = replacement; } if (AudioSourceReplaceHelper.helpers.TryGetValue(__instance, out var value)) { value._isPlaying = true; } return true; } [HarmonyPrefix] [HarmonyPatch("PlayOneShot", new Type[] { typeof(AudioClip), typeof(float) })] private static bool PlayOneShot(AudioSource __instance, ref AudioClip clip) { if (TryReplaceAudio(__instance, clip, out var replacement)) { if ((Object)(object)replacement == (Object)null) { return false; } clip = replacement; } return true; } [HarmonyPostfix] [HarmonyPatch("Stop", new Type[] { typeof(bool) })] private static void UpdateIsPlayingForHelper(AudioSource __instance) { if (AudioSourceReplaceHelper.helpers.TryGetValue(__instance, out var value) && value._isPlaying) { value._isPlaying = false; SoundPlugin.logger.LogLosingIt(".Stop() updated ._isPlaying to false"); } } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static bool SetAudioSourceLooping(AudioSource __instance, bool value) { if (AudioSourceReplaceHelper.helpers.TryGetValue(__instance, out var value2)) { SoundPlugin.logger.LogLosingIt($"updating looping for {((Component)__instance).gameObject}, value: {value}"); value2.Loop = value; return false; } return true; } [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static void GetAudioSourceLooping(AudioSource __instance, ref bool __result) { if (AudioSourceReplaceHelper.helpers.TryGetValue(__instance, out var value)) { SoundPlugin.logger.LogLosingIt("swapping out result of AudioSource.loop :3"); __result = value.Loop; } } internal static bool TryReplaceAudio(AudioSource __instance, AudioClip clip, out AudioClip replacement) { replacement = null; if ((Object)(object)((Component)__instance).gameObject == (Object)null) { ((ManualLogSource)SoundPlugin.logger).LogWarning((object)"AudioSource has no GameObject!!"); return false; } if (AudioSourceReplaceHelper.helpers.TryGetValue(__instance, out var value) && value.DisableReplacing) { return false; } if (!TryGetReplacementClip(ProcessName(__instance, clip), out var collection, out var clip2)) { return false; } if ((Object)(object)value == (Object)null) { if (__instance.playOnAwake) { __instance.Stop(); } value = ((Component)__instance).gameObject.AddComponent<AudioSourceReplaceHelper>(); value.source = __instance; } ((Object)clip2).name = ((Object)clip).name; replacement = clip2; value.replacedWith = collection; return true; } private static string TrimGameObjectName(GameObject gameObject) { StringBuilder stringBuilder = new StringBuilder(((Object)gameObject).name); stringBuilder.Replace("(Clone)", ""); string text = ((Object)gameObject).name.Replace("(Clone)", ""); for (int i = 0; i < 10; i++) { stringBuilder.Replace("(" + i + ")", ""); } SoundPlugin.logger.LogLosingIt("trimmed `" + ((Object)gameObject).name + "` to `" + stringBuilder.ToString().Trim() + "`"); return stringBuilder.ToString().Trim(); } private static string[] ProcessName(AudioSource source, AudioClip clip) { if ((Object)(object)clip == (Object)null) { return null; } if (!((Object)(object)((Component)source).transform.parent == (Object)null)) { return new string[3] { TrimGameObjectName(((Component)((Component)source).transform.parent).gameObject), TrimGameObjectName(((Component)source).gameObject), ((Object)clip).name }; } return new string[3] { "*", TrimGameObjectName(((Component)source).gameObject), ((Object)clip).name }; } private static bool TryGetReplacementClip(string[] name, out SoundReplacementCollection collection, out AudioClip clip) { collection = null; clip = null; if (name == null) { return false; } SoundPlugin.logger.LogExtended("Getting replacement for: " + string.Join(":", name)); if (!SoundAPI.SoundReplacements.TryGetValue(name[2], out var value)) { return false; } value = (from x in value where x.MatchesWith(name) where x.TestCondition() select x).ToList(); if (value.Count == 0) { return false; } collection = value[Random.Range(0, value.Count)]; List<SoundReplacement> list = collection.replacements.Where((SoundReplacement x) => x.TestCondition()).ToList(); if (list.Count == 0) { return false; } int totalWeight = 0; list.ForEach(delegate(SoundReplacement replacement) { totalWeight += replacement.Weight; }); int num = Random.Range(0, totalWeight); int index = 0; while (num > 0) { index = Random.Range(0, list.Count); num -= Random.Range(1, list[index].Weight); } clip = list[index].Clip; return true; } } [HarmonyPatch(typeof(GameObject))] internal class GameObjectPatch { [HarmonyPostfix] [HarmonyPatch("AddComponent", new Type[] { typeof(Type) })] internal static void NewAudioSource(GameObject __instance, ref Component __result) { if (__result is AudioSource) { Component obj = __result; AudioSource val = (AudioSource)(object)((obj is AudioSource) ? obj : null); if (val.playOnAwake) { val.Stop(); } AudioSourceReplaceHelper audioSourceReplaceHelper = __instance.AddComponent<AudioSourceReplaceHelper>(); audioSourceReplaceHelper.source = val; SoundPlugin.logger.LogLosingIt("Handled AudioSource created via .AddComponent()"); } } } [HarmonyPatch(typeof(Logger))] internal static class LoggerPatch { [HarmonyPrefix] [HarmonyPatch("LogMessage")] private static void ReenableAndSaveConfigs(object data) { if (data is string text && text == "Chainloader startup complete") { SoundPlugin.Instance.EnsureSoundsAreLoaded(); } } } [HarmonyPatch(typeof(Object))] internal static class UnityObjectPatch { [HarmonyPostfix] [HarmonyPatch("Instantiate", new Type[] { typeof(Object) })] [HarmonyPatch("Instantiate", new Type[] { typeof(Object), typeof(Transform), typeof(bool) })] [HarmonyPatch("Instantiate", new Type[] { typeof(Object), typeof(Vector3), typeof(Quaternion) })] [HarmonyPatch("Instantiate", new Type[] { typeof(Object), typeof(Vector3), typeof(Quaternion), typeof(Transform) })] internal static void FixPlayOnAwake(ref Object __result) { if (__result is GameObject) { Object obj = __result; CheckGameObject((GameObject)(object)((obj is GameObject) ? obj : null)); } } private static void CheckGameObject(GameObject @object) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown AudioSourceReplaceHelper audioSourceReplaceHelper = default(AudioSourceReplaceHelper); if (@object.TryGetComponent<AudioSourceReplaceHelper>(ref audioSourceReplaceHelper)) { return; } AudioSource[] components = @object.GetComponents<AudioSource>(); AudioSource[] array = components; foreach (AudioSource val in array) { if (val.playOnAwake) { val.Stop(); } AudioSourceReplaceHelper audioSourceReplaceHelper2 = @object.AddComponent<AudioSourceReplaceHelper>(); audioSourceReplaceHelper2.source = val; SoundPlugin.logger.LogLosingIt("Handled AudioSource created via prefab instantiate"); } foreach (Transform item in @object.transform) { Transform val2 = item; CheckGameObject(((Component)val2).gameObject); } } } } namespace loaforcsSoundAPI.LethalCompany { internal static class LethalCompanyBindings { internal static void Bind() { SoundAPI.RegisterConditionProvider("LethalCompany:dungeon_name", new DungeonConditionProvider()); SoundAPI.RegisterConditionProvider("LethalCompany:moon_name", new MoonConditionProvider()); SoundAPI.RegisterConditionProvider("LethalCompany:player_health", new PlayerHealthConditionProvider()); SoundAPI.RegisterConditionProvider("LethalCompany:time_of_day", new TimeOfDayConditionProvider()); SoundAPI.RegisterConditionProvider("LethalCompany:player_location", new PlayerLocationTypeConditionProvider()); } } } namespace loaforcsSoundAPI.LethalCompany.Conditions { internal class DungeonConditionProvider : ConditionProvider { public override bool Evaluate(SoundReplaceGroup group, JObject conditionDef) { SoundPlugin.logger.LogExtended("LethalCompany:dungeon_name value: " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name); return Extensions.Value<string>((IEnumerable<JToken>)conditionDef["value"]) == ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name; } } internal class MoonConditionProvider : ConditionProvider { public override bool Evaluate(SoundReplaceGroup group, JObject conditionDef) { SoundPlugin.logger.LogExtended("LethalCompany:moon_name value: " + ((Object)StartOfRound.Instance.currentLevel).name); return Extensions.Value<string>((IEnumerable<JToken>)conditionDef["value"]) == ((Object)StartOfRound.Instance.currentLevel).name; } } internal class PlayerHealthConditionProvider : ConditionProvider { public override bool Evaluate(SoundReplaceGroup group, JObject conditionDef) { return EvaluateRangeOperator(GameNetworkManager.Instance.localPlayerController.health, Extensions.Value<string>((IEnumerable<JToken>)conditionDef["value"])); } } internal class PlayerLocationTypeConditionProvider : ConditionProvider { public override bool Evaluate(SoundReplaceGroup group, JObject varDef) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (GameNetworkManager.Instance.localPlayerController.isPlayerDead) { return false; } if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { return Extensions.Value<string>((IEnumerable<JToken>)varDef["value"]) == "inside"; } Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)GameNetworkManager.Instance.localPlayerController).transform.position)) { return Extensions.Value<string>((IEnumerable<JToken>)varDef["value"]) == "on_ship"; } return Extensions.Value<string>((IEnumerable<JToken>)varDef["value"]) == "outside"; } } internal class TimeOfDayConditionProvider : ConditionProvider { public override bool Evaluate(SoundReplaceGroup group, JObject varDef) { return Extensions.Value<string>((IEnumerable<JToken>)varDef["value"]) == ((object)(DayMode)(ref TimeOfDay.Instance.dayMode)).ToString().ToLower(); } } } namespace loaforcsSoundAPI.Data { public class SoundPack { [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <AsyncParseReplacer>d__18 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public SoundPack <>4__this; public string replacer; private Awaiter <>u__1; private void MoveNext() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0019: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SoundPack soundPack = <>4__this; try { Awaiter awaiter; if (num != 0) { SwitchToTaskPoolAwaitable val = UniTask.SwitchToTaskPool(); awaiter = ((SwitchToTaskPoolAwaitable)(ref val)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <AsyncParseReplacer>d__18>(ref awaiter, ref this); return; } } else { awaiter = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); } ((Awaiter)(ref awaiter)).GetResult(); Thread.Sleep(new Random().Next(100, 500)); soundPack.ParseReplacer(replacer); } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <AsyncQueueLoad>d__17 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public SoundPack <>4__this; private Stopwatch <loadTime>5__2; private Awaiter <>u__1; private Awaiter <>u__2; private void MoveNext() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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) //IL_0119: 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) //IL_001d: 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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_003a: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SoundPack soundPack = <>4__this; try { Awaiter awaiter; Awaiter awaiter2; if (num != 0) { if (num == 1) { awaiter = <>u__2; <>u__2 = default(Awaiter); num = (<>1__state = -1); goto IL_0128; } SwitchToTaskPoolAwaitable val = UniTask.SwitchToTaskPool(); awaiter2 = ((SwitchToTaskPoolAwaitable)(ref val)).GetAwaiter(); if (!((Awaiter)(ref awaiter2)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <AsyncQueueLoad>d__17>(ref awaiter2, ref this); return; } } else { awaiter2 = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); } ((Awaiter)(ref awaiter2)).GetResult(); string[] array = Directory.GetFiles(Path.Combine(soundPack.PackPath, "replacers")).Select(Path.GetFileName).ToArray(); <loadTime>5__2 = Stopwatch.StartNew(); UniTask val2 = UniTask.WhenAll(EnumerableAsyncExtensions.Select<string>((IEnumerable<string>)array, (Func<string, UniTask>)soundPack.AsyncParseReplacer)); awaiter = ((UniTask)(ref val2)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 1); <>u__2 = awaiter; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <AsyncQueueLoad>d__17>(ref awaiter, ref this); return; } goto IL_0128; IL_0128: ((Awaiter)(ref awaiter)).GetResult(); <loadTime>5__2.Stop(); ((ManualLogSource)SoundPlugin.logger).LogInfo((object)$"Loaded {soundPack.Name}(sound-loading) in {<loadTime>5__2.ElapsedMilliseconds}ms."); } catch (Exception exception) { <>1__state = -2; <loadTime>5__2 = null; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; <loadTime>5__2 = null; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } private static List<SoundPack> LoadedSoundPacks = new List<SoundPack>(); private List<SoundReplaceGroup> replaceGroups = new List<SoundReplaceGroup>(); private Dictionary<string, object> Config = new Dictionary<string, object>(); public string Name { get; private set; } public string PackPath { get; private set; } public IReadOnlyCollection<SoundReplaceGroup> ReplaceGroups => replaceGroups.AsReadOnly(); public T GetConfigOption<T>(string configID) { return ((ConfigEntry<T>)Config[configID]).Value; } internal object GetRawConfigOption(string configID) { return Config[configID]; } public SoundPack(string folder) { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected I4, but got Unknown //IL_0365: Unknown result type (might be due to invalid IL or missing references) ((ManualLogSource)SoundPlugin.logger).LogDebug((object)("Soundpack `" + folder + "` is being loaded.")); Stopwatch stopwatch = Stopwatch.StartNew(); PackPath = Path.Combine(Paths.PluginPath, folder); string text = File.ReadAllText(Path.Combine(PackPath, "sound_pack.json")); object obj = JsonConvert.DeserializeObject(text); JObject val = (JObject)((obj is JObject) ? obj : null); Name = (string)val["name"]; if (string.IsNullOrEmpty(Name)) { ((ManualLogSource)SoundPlugin.logger).LogError((object)("`name` is missing or empty in `" + folder + "/sound_pack.json`")); return; } if (!Directory.Exists(Path.Combine(PackPath, "replacers"))) { ((ManualLogSource)SoundPlugin.logger).LogInfo((object)"You've succesfully made a Sound-Pack! Continue with the tutorial to learn how to begin replacing sounds."); } else if (val.ContainsKey("load_on_startup")) { ((ManualLogSource)SoundPlugin.logger).LogWarning((object)("Soundpack '" + Name + "' is using 'load_on_startup' which is deprecated and doesn't do anything! (If you're the creator, you can safely delete that from your sound_pack.json)")); } if (val.ContainsKey("config")) { Stopwatch stopwatch2 = Stopwatch.StartNew(); ConfigFile val2 = new ConfigFile(Utility.CombinePaths(new string[2] { Paths.ConfigPath, "soundpack." + Name + ".cfg" }), false, MetadataHelper.GetMetadata((object)SoundPlugin.Instance)); foreach (JProperty item in (IEnumerable<JToken>)val["config"]) { JProperty val3 = item; JToken value = val3.Value; JObject val4 = (JObject)(object)((value is JObject) ? value : null); if (!val4.ContainsKey("default")) { ((ManualLogSource)SoundPlugin.logger).LogError((object)("`" + val3.Name + " doesn't have a default value!")); continue; } if (!val4.ContainsKey("description")) { ((ManualLogSource)SoundPlugin.logger).LogWarning((object)("`" + val3.Name + " doesn't have a description, consider adding one!")); } JTokenType type = val4["default"].Type; switch (type - 6) { case 3: Config.Add(val3.Name, val2.Bind<bool>(val3.Name.Split(":")[0], val3.Name.Split(":")[1], (bool)val4["default"], val4.GetValueOrDefault("description", "[no description was provided]"))); break; case 2: Config.Add(val3.Name, val2.Bind<string>(val3.Name.Split(":")[0], val3.Name.Split(":")[1], (string)val4["default"], val4.GetValueOrDefault("description", "[no description was provided]"))); break; case 0: case 1: Config.Add(val3.Name, val2.Bind<float>(val3.Name.Split(":")[0], val3.Name.Split(":")[1], (float)val4["default"], val4.GetValueOrDefault("description", "[no description was provided]"))); break; default: ((ManualLogSource)SoundPlugin.logger).LogError((object)string.Format("`{0} configtype is currently unsupported! Supported values: bool, float, int, string", val4["default"].Type)); break; } } stopwatch2.Stop(); ((ManualLogSource)SoundPlugin.logger).LogInfo((object)$"Loaded {Name}(config) in {stopwatch2.ElapsedMilliseconds}ms."); } LoadedSoundPacks.Add(this); stopwatch.Stop(); ((ManualLogSource)SoundPlugin.logger).LogInfo((object)$"Loaded {Name}(init) in {stopwatch.ElapsedMilliseconds}ms."); } internal void QueueLoad() { if (Directory.Exists(Path.Combine(PackPath, "replacers"))) { string[] array = Directory.GetFiles(Path.Combine(PackPath, "replacers")).Select(Path.GetFileName).ToArray(); Stopwatch stopwatch = Stopwatch.StartNew(); string[] array2 = array; foreach (string replacer in array2) { ParseReplacer(replacer); } stopwatch.Stop(); ((ManualLogSource)SoundPlugin.logger).LogInfo((object)$"Loaded {Name}(sound-loading) in {stopwatch.ElapsedMilliseconds}ms."); } } [AsyncStateMachine(typeof(<AsyncQueueLoad>d__17))] internal UniTask AsyncQueueLoad() { //IL_0002: 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_0031: Unknown result type (might be due to invalid IL or missing references) <AsyncQueueLoad>d__17 <AsyncQueueLoad>d__ = default(<AsyncQueueLoad>d__17); <AsyncQueueLoad>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); <AsyncQueueLoad>d__.<>4__this = this; <AsyncQueueLoad>d__.<>1__state = -1; ((AsyncUniTaskMethodBuilder)(ref <AsyncQueueLoad>d__.<>t__builder)).Start<<AsyncQueueLoad>d__17>(ref <AsyncQueueLoad>d__); return ((AsyncUniTaskMethodBuilder)(ref <AsyncQueueLoad>d__.<>t__builder)).Task; } [AsyncStateMachine(typeof(<AsyncParseReplacer>d__18))] private UniTask AsyncParseReplacer(string replacer) { //IL_0002: 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_0039: Unknown result type (might be due to invalid IL or missing references) <AsyncParseReplacer>d__18 <AsyncParseReplacer>d__ = default(<AsyncParseReplacer>d__18); <AsyncParseReplacer>d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); <AsyncParseReplacer>d__.<>4__this = this; <AsyncParseReplacer>d__.replacer = replacer; <AsyncParseReplacer>d__.<>1__state = -1; ((AsyncUniTaskMethodBuilder)(ref <AsyncParseReplacer>d__.<>t__builder)).Start<<AsyncParseReplacer>d__18>(ref <AsyncParseReplacer>d__); return ((AsyncUniTaskMethodBuilder)(ref <AsyncParseReplacer>d__.<>t__builder)).Task; } private void ParseReplacer(string replacer) { string path = Path.Combine(PackPath, "replacers", replacer); ((ManualLogSource)SoundPlugin.logger).LogDebug((object)("Parsing `" + Path.GetFileName(path) + "` as a sound replacer")); object obj = JsonConvert.DeserializeObject(File.ReadAllText(path)); JObject data = (JObject)((obj is JObject) ? obj : null); SoundPlugin.logger.LogLosingIt("JSON data desrialized!"); new SoundReplaceGroup(this, data); } } public class SoundReplaceGroup : Conditonal { public SoundPack pack { get; private set; } internal JObject RandomSettings { get; private set; } internal bool UpdateEveryFrame { get; private set; } internal bool IgnoreLooping { get; private set; } public SoundReplaceGroup(SoundPack pack, JObject data) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown this.pack = pack; if (data.ContainsKey("condition")) { JToken obj = data["condition"]; Setup(this, (JObject)(object)((obj is JObject) ? obj : null)); if ((string)data["condition"][(object)"type"] == "config" && SoundPluginConfig.SKIP_LOADING_UNUSED_SOUNDS.Value && !TestCondition()) { SoundPlugin.logger.LogLosingIt("Skipping loading SoundReplaceGroup because the config is disabled.."); return; } } SoundPlugin.logger.LogLosingIt("Loading audio"); foreach (JObject item in (IEnumerable<JToken>)data["replacements"]) { JObject data2 = item; new SoundReplacementCollection(this, data2); } SoundPlugin.logger.LogLosingIt("Done loading audio"); if (data.ContainsKey("update_every_frame")) { UpdateEveryFrame = (bool)data["update_every_frame"]; } if (data.ContainsKey("ignore_looping")) { UpdateEveryFrame = (bool)data["ignore_looping"]; } if (data.ContainsKey("randomnesss")) { ((ManualLogSource)SoundPlugin.logger).LogWarning((object)("Found deprecated value `randomness` for pack `" + pack.Name + "`")); } } } internal class SoundReplacementCollection : Conditonal { internal readonly List<SoundReplacement> replacements = new List<SoundReplacement>(); private readonly List<string> matchers = new List<string>(); internal readonly SoundReplaceGroup group; internal SoundReplacementCollection(SoundReplaceGroup group, JObject data) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Invalid comparison between Unknown and I4 this.group = group; JToken val = default(JToken); if (data.TryGetValue("condition", ref val)) { Setup(group, (JObject)(object)((val is JObject) ? val : null)); } if (((object)data["matches"]).GetType() == typeof(JValue)) { RegisterWithMatch((string)data["matches"]); } else { foreach (JToken item in (IEnumerable<JToken>)data["matches"]) { string matchString = (string)item; RegisterWithMatch(matchString); } } foreach (JObject item2 in (IEnumerable<JToken>)data["sounds"]) { JObject val2 = item2; if ((int)val2["sound"].Type == 10) { SoundPlugin.logger.LogExtended("Adding null sound, will remove the sound when chosen"); replacements.Add(new SoundReplacement(group, val2) { Weight = val2.GetValueOrDefault("weight", 1) }); continue; } SoundReplacement soundReplacement = new SoundReplacement(group, val2) { Weight = val2.GetValueOrDefault("weight", 1) }; SoundLoader.GetAudioClip(group.pack.PackPath, Path.GetDirectoryName((string)val2["sound"]), Path.GetFileName((string)val2["sound"]), out var clip); if ((Object)(object)clip == (Object)null) { ((ManualLogSource)SoundPlugin.logger).LogError((object)"Failed to get audio clip, check above more detailed error"); continue; } soundReplacement.Clip = clip; replacements.Add(soundReplacement); } } internal bool MatchesWith(string[] a) { foreach (string matcher in matchers) { if (SoundAPI.MatchStrings(a, matcher)) { return true; } } return false; } private void RegisterWithMatch(string matchString) { string key = SoundAPI.FormatMatchString(matchString).Split(":")[2]; List<SoundReplacementCollection> valueOrDefault = SoundAPI.SoundReplacements.GetValueOrDefault(key, new List<SoundReplacementCollection>()); valueOrDefault.Add(this); matchers.Add(SoundAPI.FormatMatchString(matchString)); SoundAPI.SoundReplacements[key] = valueOrDefault; } public override bool TestCondition() { if (base.TestCondition()) { return group.TestCondition(); } return false; } } internal class SoundReplacement : Conditonal { public int Weight = 1; public AudioClip Clip { get; set; } public SoundReplacement(SoundReplaceGroup group, JObject data) { if (data.ContainsKey("condition")) { JToken obj = data["condition"]; Setup(group, (JObject)(object)((obj is JObject) ? obj : null)); } } } } namespace loaforcsSoundAPI.Behaviours { public class AudioSourceReplaceHelper : MonoBehaviour { internal AudioSource source; internal SoundReplacementCollection replacedWith; internal static Dictionary<AudioSource, AudioSourceReplaceHelper> helpers = new Dictionary<AudioSource, AudioSourceReplaceHelper>(); private bool _loop; internal bool _isPlaying; public bool DisableReplacing { get; private set; } public bool Loop { get { return _loop; } set { SoundPlugin.logger.LogLosingIt($"AudioSourceReplaceHelper looping is now at: {value}"); _loop = value; } } private void Start() { if ((Object)(object)source == (Object)null) { ((ManualLogSource)SoundPlugin.logger).LogWarning((object)("AudioSource (on gameobject: " + ((Object)((Component)this).gameObject).name + ") became null between the OnSceneLoaded callback and Start.")); return; } string text = (((Object)(object)source.clip == (Object)null) ? "null" : ((Object)source.clip).name); SoundPlugin.logger.LogLosingIt("AudioSourceReplaceHelper.Start(), gameObject: " + ((Object)((Component)this).gameObject).name + ", audioClip.name: " + text); if (source.playOnAwake) { if (((Behaviour)source).enabled) { if ((Object)(object)source.clip != (Object)null) { source.Play(); SoundPlugin.logger.LogLosingIt(((Object)((Component)this).gameObject).name + ":" + text + " calling source.Play() because its playOnAwake and enabled."); _isPlaying = true; } SoundPlugin.logger.LogLosingIt(((Object)((Component)this).gameObject).name + ":" + text + " play on awake + enabled + null audio clip. WHYYYYYYY"); } else { SoundPlugin.logger.LogLosingIt(((Object)((Component)this).gameObject).name + ":" + text + " not calling Play() because its playOnAwake but not enabled."); } } Loop = source.loop; source.loop = false; SoundPlugin.logger.LogLosingIt($"{((Object)((Component)this).gameObject).name}:{text}, Looping? {Loop}"); helpers[source] = this; } private void OnEnable() { if (!((Object)(object)source == (Object)null)) { helpers[source] = this; } } private void OnDestroy() { if (!((Object)(object)source == (Object)null) && helpers.ContainsKey(source)) { helpers.Remove(source); } } private void LateUpdate() { if ((Object)(object)source == (Object)null || !((Behaviour)source).enabled) { return; } if (_isPlaying) { if ((Object)(object)source.clip == (Object)null) { SoundPlugin.logger.LogLosingIt(((Object)((Component)this).gameObject).name + ":" + (((Object)(object)source.clip == (Object)null) ? "null" : ((Object)source.clip).name) + " has a null clipp!!!!!"); _isPlaying = false; return; } if (!source.isPlaying) { if (Loop) { source.Play(); SoundPlugin.logger.LogLosingIt(((Object)((Component)this).gameObject).name + ":" + (((Object)(object)source.clip == (Object)null) ? "null" : ((Object)source.clip).name) + " succesfully looped!"); } else { _isPlaying = false; } } } if (replacedWith == null) { return; } DisableReplacing = replacedWith.group.UpdateEveryFrame || replacedWith.group.IgnoreLooping; if (!replacedWith.group.UpdateEveryFrame) { return; } float time = source.time; SoundReplacement soundReplacement = replacedWith.replacements.Where((SoundReplacement x) => x.TestCondition()).ToList()[0]; if (!((Object)(object)soundReplacement.Clip == (Object)(object)source.clip)) { source.clip = soundReplacement.Clip; source.Play(); source.time = time; if (!source.isPlaying) { SoundPlugin.logger.LogExtended("Sound ended, resetting update_every_frame"); DisableReplacing = false; replacedWith = null; } } } } } namespace loaforcsSoundAPI.API { public abstract class AudioFormatProvider { public abstract AudioClip LoadAudioClip(string path); protected AudioClip LoadFromUWR(string path, AudioType type) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) { ((ManualLogSource)SoundPlugin.logger).LogError((object)"============"); ((ManualLogSource)SoundPlugin.logger).LogError((object)("UnityWebRequest failed while trying to get " + path + ". Full error below")); ((ManualLogSource)SoundPlugin.logger).LogError((object)audioClip.error); ((ManualLogSource)SoundPlugin.logger).LogError((object)"============"); } else { result = DownloadHandlerAudioClip.GetContent(audioClip); } } catch (Exception ex) { ((ManualLogSource)SoundPlugin.logger).LogError((object)(ex.Message + ", " + ex.StackTrace)); } } finally { ((IDisposable)audioClip)?.Dispose(); } return result; } } public abstract class ConditionProvider { public abstract bool Evaluate(SoundReplaceGroup group, JObject conditionDef); public bool EvaluateRangeOperator(JToken number, string condition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)number.Type == 7) { return EvaluateRangeOperator(Extensions.Value<float>((IEnumerable<JToken>)number), condition); } return EvaluateRangeOperator(Extensions.Value<int>((IEnumerable<JToken>)number), condition); } public bool EvaluateRangeOperator(int number, string condition) { return EvaluateRangeOperator((double)number, condition); } public bool EvaluateRangeOperator(float number, string condition) { return EvaluateRangeOperator((double)number, condition); } public bool EvaluateRangeOperator(double number, string condition) { string[] array = condition.Split(".."); if (array.Length == 1) { if (double.TryParse(array[0], out var result)) { return number == result; } return false; } if (array.Length == 2) { double result2; if (array[0] == "") { result2 = double.MinValue; } else if (!double.TryParse(array[0], out result2)) { return false; } double result3; if (array[1] == "") { result3 = double.MaxValue; } else if (!double.TryParse(array[1], out result3)) { return false; } if (number >= result2) { return number <= result3; } return false; } return false; } } public abstract class Conditonal { private ConditionProvider GroupCondition; private SoundReplaceGroup group; internal JObject ConditionSettings { get; private set; } protected void Setup(SoundReplaceGroup group, JObject settings) { this.group = group; if (settings != null) { ConditionSettings = settings; GroupCondition = SoundAPI.ConditionProviders[(string)ConditionSettings["type"]]; } } public virtual bool TestCondition() { if (GroupCondition == null) { return true; } return GroupCondition.Evaluate(group, ConditionSettings); } } public static class SoundAPI { internal static Dictionary<string, AudioFormatProvider> FileFormats = new Dictionary<string, AudioFormatProvider>(); internal static Dictionary<string, ConditionProvider> ConditionProviders = new Dictionary<string, ConditionProvider>(); internal static ConcurrentDictionary<string, List<SoundReplacementCollection>> SoundReplacements = new ConcurrentDictionary<string, List<SoundReplacementCollection>>(); public static void RegisterAudioFormatProvider(string extension, AudioFormatProvider provider) { FileFormats.Add(extension, provider); } public static void RegisterConditionProvider(string extension, ConditionProvider provider) { ConditionProviders.Add(extension, provider); } public static string FormatMatchString(string input) { if (input.Split(":").Length == 2) { input = "*:" + input; } return input; } public static bool MatchStrings(string[] a, string b) { string[] array = b.Split(":"); if (array[0] != "*" && array[0] != a[0]) { return false; } if (array[1] != "*" && array[1] != a[1]) { return false; } return a[2] == array[2]; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }