using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; 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.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using FFmpeg.AutoGen; using GameConsole; using GameConsole.CommandTree; using GreyAnnouncer.AnnouncerCore; using GreyAnnouncer.AudioLoading; using GreyAnnouncer.AudioSourceComponent; using GreyAnnouncer.Base; using GreyAnnouncer.Config; using GreyAnnouncer.FrontEnd; using GreyAnnouncer.Util; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using PluginConfig.API; using PluginConfig.API.Decorators; using PluginConfig.API.Fields; using PluginConfig.API.Functionals; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; using plog; using plog.Models; [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("Assembly-CSharp")] [assembly: AssemblyCompany("GreyAnnouncer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.4.1.0")] [assembly: AssemblyInformationalVersion("1.4.1+f4bd37883942b0db524b1d306d3f22e8c0839333")] [assembly: AssemblyProduct("GreyAnnouncer")] [assembly: AssemblyTitle("GreyAnnouncer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.1.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; } } } public class StreamedAudioData { private const int _CHUNK_SIZE = 8192; private readonly LinkedList _chunks = new LinkedList(); private float[] _currentChunk = new float[8192]; private int _currentPos; public int Channels { get; set; } public int SampleRate { get; set; } public int TotalSamples { get; private set; } public void AddSamples(float[] samples) { int num = 0; int num2 = samples.Length; while (num2 > 0) { int num3 = Math.Min(8192 - _currentPos, num2); Array.Copy(samples, num, _currentChunk, _currentPos, num3); _currentPos += num3; num += num3; num2 -= num3; TotalSamples += num3; if (_currentPos >= 8192) { _chunks.AddLast(_currentChunk); _currentChunk = new float[8192]; _currentPos = 0; } } } public float[] GetAllSamples() { float[] array = new float[TotalSamples]; int num = 0; foreach (float[] chunk in _chunks) { Array.Copy(chunk, 0, array, num, chunk.Length); num += chunk.Length; } if (_currentPos > 0) { Array.Copy(_currentChunk, 0, array, num, _currentPos); } return array; } } public class Category : MonoBehaviour { public Toggle enabledToggle; public Slider volumeSlider; public Slider cooldownSlider; private TextMeshProUGUI _titleText; private TextMeshProUGUI _volumeLabel; private TextMeshProUGUI _cooldownLabel; public void Awake() { //IL_001f: 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_0070: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) ((Graphic)((Component)this).gameObject.AddComponent()).color = new Color(0.12f, 0.12f, 0.12f, 1f); HorizontalLayoutGroup obj = ((Component)this).gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((LayoutGroup)obj).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj).spacing = 6f; ((LayoutGroup)obj).padding = new RectOffset(8, 8, 3, 3); ((Component)this).gameObject.AddComponent().preferredHeight = 28f; _titleText = UIBuilder.AddLabel(((Component)this).transform, "Category", 13, new Color(0f, 1f, 1f), -1f, 110f, 0f, (TextAlignmentOptions)4097); UIBuilder.AddLabel(((Component)this).transform, "En", 12, Color.white, -1f, 18f, 0f, (TextAlignmentOptions)4097); enabledToggle = UIBuilder.AddToggle(((Component)this).transform); UIBuilder.AddLabel(((Component)this).transform, "Vol", 12, Color.white, -1f, 24f, 0f, (TextAlignmentOptions)4097); volumeSlider = AddSteppedSlider("VolumeSlider", 0f, 5f, 0.1f); _volumeLabel = UIBuilder.AddLabel(((Component)this).transform, "1.0", 12, Color.white, -1f, 32f, 0f, (TextAlignmentOptions)4097); ((UnityEvent)(object)volumeSlider.onValueChanged).AddListener((UnityAction)delegate(float v) { ((TMP_Text)_volumeLabel).text = v.ToString("F1"); }); UIBuilder.AddLabel(((Component)this).transform, "CD", 12, Color.white, -1f, 22f, 0f, (TextAlignmentOptions)4097); cooldownSlider = AddSteppedSlider("CooldownSlider", 0f, 10f, 0.1f); _cooldownLabel = UIBuilder.AddLabel(((Component)this).transform, "3.0", 12, Color.white, -1f, 32f, 0f, (TextAlignmentOptions)4097); ((UnityEvent)(object)cooldownSlider.onValueChanged).AddListener((UnityAction)delegate(float v) { ((TMP_Text)_cooldownLabel).text = v.ToString("F1"); }); } public void SetName(string name) { ((TMP_Text)_titleText).text = name; } public void SetVolume(float v) { volumeSlider.SetValueWithoutNotify(v); ((TMP_Text)_volumeLabel).text = v.ToString("F1"); } public void SetCooldown(float v) { cooldownSlider.SetValueWithoutNotify(v); ((TMP_Text)_cooldownLabel).text = v.ToString("F1"); } private Slider AddSteppedSlider(string name, float min, float max, float step) { Slider s = UIBuilder.AddSlider(((Component)this).transform, min, min, max); ((Object)((Component)s).gameObject).name = name; s.wholeNumbers = false; ((UnityEvent)(object)s.onValueChanged).AddListener((UnityAction)delegate(float v) { s.SetValueWithoutNotify(Mathf.Round(v / step) * step); }); return s; } } internal static class LogHelper { internal static ManualLogSource log { get; set; } public static void LogInfo(object data, [CallerMemberName] string member = "") { ManualLogSource obj = log; if (obj != null) { obj.LogInfo((object)$"[{member}] {data}"); } } public static void LogWarning(object data, [CallerMemberName] string member = "") { ManualLogSource obj = log; if (obj != null) { obj.LogWarning((object)$"[{member}] {data}"); } } public static void LogError(object data, [CallerMemberName] string member = "") { ManualLogSource obj = log; if (obj != null) { obj.LogError((object)$"[{member}] {data}"); } } public static void LogDebug(object data, [CallerMemberName] string member = "") { ManualLogSource obj = log; if (obj != null) { obj.LogDebug((object)$"[{member}] {data}"); } } private static string GetClassName(string path) { return Path.GetFileNameWithoutExtension(path); } } namespace GreyAnnouncer { public enum AudioLoadOptions { Load_then_Play, Preload_and_Play } public enum AudioPlayOptions { Override_Last, Independent } [PublicAPI] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method, Inherited = false)] public sealed class EntryPointAttribute : Attribute { } [PublicAPI] [AttributeUsage(AttributeTargets.Class, Inherited = false)] internal sealed class PatchOnEntryAttribute : Attribute { } [BepInPlugin("greycsont.ultrakill.GreyAnnouncer", "Grey Announcer", "1.4.1")] [BepInProcess("ULTRAKILL.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private void Awake() { ((Object)((Component)this).gameObject).hideFlags = (HideFlags)4; LogHelper.log = ((BaseUnityPlugin)this).Logger; LogHelper.LogInfo("Plugin greycsont.ultrakill.GreyAnnouncer is loaded!", "Awake"); LoadMainModule(); LoadOptionalModule(); } private void LoadMainModule() { PluginSettings.Initialize(); } private void LoadOptionalModule() { LoadPatches(); } private void LoadPatches() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Harmony val = new Harmony("greycsont.ultrakill.GreyAnnouncer"); List list = new List(); Type[] types = typeof(Plugin).Assembly.GetTypes(); foreach (Type type in types) { if (type.GetCustomAttribute() != null) { try { val.PatchAll(type); } catch (Exception arg) { LogHelper.LogError($"FUCK PATCHING {type.Name}, {arg}", "LoadPatches"); throw; } } if (type.GetCustomAttribute() == null) { continue; } MethodInfo[] array = (from mi in type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where mi.GetCustomAttribute() != null select mi).ToArray(); int num = array.Length; if (num <= 1) { switch (num) { case 0: LogHelper.LogError("Type " + type.FullName + " is marked as an entry point but has no methods marked with EntryPointAttribute.", "LoadPatches"); break; case 1: if (array[0].GetParameters().Length != 0) { LogHelper.LogError("Entry point method " + type.FullName + "." + array[0].Name + " must have no parameters.", "LoadPatches"); } else { list.Add(array[0]); } break; } } else { LogHelper.LogError("Type " + type.FullName + " has multiple entry points defined. Only one is allowed.", "LoadPatches"); } } foreach (MethodInfo item in list) { LogHelper.LogInfo("Invoking entry point: " + item.DeclaringType?.FullName + "." + item.Name, "LoadPatches"); try { item.Invoke(null, null); } catch (Exception data) { LogHelper.LogError(data, "LoadPatches"); } } } } [EntryPoint] internal static class PluginDependencies { public const string PLUGINCONFIGURATOR_GUID = "com.eternalUnion.pluginConfigurator"; public static void LoadIfPluginExists(string guid, string moduleName, Action loader) { if (!Chainloader.PluginInfos.ContainsKey(guid)) { LogHelper.LogWarning("Plugin " + guid + " not loaded, skipping " + moduleName, "LoadIfPluginExists"); return; } try { loader?.Invoke(); LogHelper.LogInfo("Loaded optional module: " + moduleName, "LoadIfPluginExists"); } catch (Exception ex) { LogHelper.LogError("Exception while loading " + moduleName + ": " + ex.Message, "LoadIfPluginExists"); } } [EntryPoint] public static void CheckPluginLoaded() { LoadIfPluginExists("com.eternalUnion.pluginConfigurator", "PluginConfiguratorEntry", delegate { LoadByReflection("GreyAnnouncer.FrontEnd.PluginConfiguratorEntry", "Initialize"); }); } public static void LoadByReflection(string assemblyName, string methodName, object[] parameter = null) { try { Assembly.GetExecutingAssembly().GetType(assemblyName).GetMethod(methodName, BindingFlags.Static | BindingFlags.Public)?.Invoke(null, parameter); } catch (Exception arg) { LogHelper.LogError($"Failed to load {assemblyName}'s {methodName} by : {arg}", "LoadByReflection"); } } } internal static class PluginInfo { public const string PLUGIN_GUID = "greycsont.ultrakill.GreyAnnouncer"; public const string PLUGIN_NAME = "Grey Announcer"; public const string PLUGIN_VERSION = "1.4.1"; } } namespace GreyAnnouncer.Util { public sealed class CoroutineRunner : MonoBehaviour { [CompilerGenerated] private static CoroutineRunner k__BackingField; public static CoroutineRunner Instance { get { //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)k__BackingField == (Object)null) { GameObject val = new GameObject("CoroutineRunner"); k__BackingField = val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } return k__BackingField; } } } public static class FileSystemUtil { public static void ValidateAndPrepareDirectory(string directoryPath) { if (!Directory.Exists(directoryPath)) { LogHelper.LogWarning("Directory not found: " + directoryPath, "ValidateAndPrepareDirectory"); Directory.CreateDirectory(directoryPath); } } public static void EnsureDirectoryExists(string filePath) { string directoryName = Path.GetDirectoryName(filePath); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } } public static void CopyDirectoryParallel(string source, string targetRoot) { try { string fileName = Path.GetFileName(source.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)); string item = Path.Combine(targetRoot, fileName); Stack<(string, string)> stack = new Stack<(string, string)>(); stack.Push((source, item)); while (stack.Count > 0) { var (path, currDest) = stack.Pop(); if (!Directory.Exists(currDest)) { Directory.CreateDirectory(currDest); } Parallel.ForEach(Directory.GetFiles(path), new ParallelOptions { MaxDegreeOfParallelism = 8 }, delegate(string file) { string fileName3 = Path.GetFileName(file); string destFileName = Path.Combine(currDest, fileName3); File.Copy(file, destFileName, overwrite: true); }); string[] directories = Directory.GetDirectories(path); foreach (string text in directories) { string fileName2 = Path.GetFileName(text); stack.Push((text, Path.Combine(currDest, fileName2))); } } } catch (Exception ex) { LogHelper.LogError("failed to copy: " + ex.Message, "CopyDirectoryParallel"); } } } public static class GuidPrefixAdder { private const string Prefix = "GreyAnnouncer_"; public static string AddPrefixToGUID(params string[] GUIDs) { if (GUIDs == null || GUIDs.Length == 0) { throw new ArgumentException("At least one key must be provided.", "GUIDs"); } string text = string.Join("_", GUIDs).ToUpper(); return "GreyAnnouncer_" + text; } } public static class JsonManager { public static T ReadJson(string path) where T : class { if (!File.Exists(path)) { return null; } return DeserializeJson(path); } public static T WriteJson(string path, T data) where T : class { string directoryName = Path.GetDirectoryName(path); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } return SerializeAndSaveJson(path, data); } private static T DeserializeJson(string path) where T : class { try { return JsonConvert.DeserializeObject(File.ReadAllText(path)) ?? throw new InvalidOperationException("Failed to deserialize JSON at '" + path + "' into type " + typeof(T).Name); } catch (FileNotFoundException) { return null; } catch (Exception ex2) { LogHelper.LogError("Error reading JSON '" + path + "': " + ex2.Message, "DeserializeJson"); throw; } } private static T SerializeAndSaveJson(string path, T data) where T : class { try { string contents = JsonConvert.SerializeObject((object)data, (Formatting)1); File.WriteAllText(path, contents); return data; } catch (Exception ex) { LogHelper.LogError("Error writing JSON '" + path + "': " + ex.Message, "SerializeAndSaveJson"); throw; } } } public static class PathHelper { public static string GetCurrentPluginPath(params string[] paths) { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); return CleanPath((paths == null || paths.Length == 0) ? directoryName : Path.Combine(directoryName, Path.Combine(paths))); } public static string GetGamePath(string filePath) { return CleanPath(Path.Combine(Paths.GameRootPath, filePath)); } [Description("Reference : (因win程序员想偷懒! 竟在剪切板插入隐藏字符) https://www.bilibili.com/video/BV1ebLczjEWZ (Accessed in 24/4/2025)")] public static string CleanPath(string path) { if (string.IsNullOrEmpty(path)) { return path; } char[] trimChars = new char[5] { '\u202a', '\u202b', '\u202c', '\u202d', '\u202e' }; string text = path.TrimStart(trimChars); if (!path.Equals(text)) { LogHelper.LogInfo("[CleanPath] Path cleaned: Original='" + path + "', Cleaned='" + text + "'", "CleanPath"); } return text; } public static string GetFile(string filePath, string fileName) { string text = Path.Combine(filePath, fileName); if (File.Exists(text)) { return text; } return null; } public static bool TryGetExtension(string filePath, out string foundExtension, params string[] extensions) { foundExtension = null; if (string.IsNullOrWhiteSpace(filePath)) { return false; } string[] source = (from e in extensions.SelectMany((string e) => e.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)) select e.Trim()).ToArray(); string text = filePath.Trim(); while (!string.IsNullOrEmpty(text)) { string ext = Path.GetExtension(text)?.Trim(); if (string.IsNullOrEmpty(ext)) { break; } if (source.Any((string e) => e.Equals(ext, StringComparison.OrdinalIgnoreCase))) { foundExtension = ext; return true; } text = Path.Combine(Path.GetDirectoryName(text) ?? "", Path.GetFileNameWithoutExtension(text)); } return false; } } public static class ProcessHelper { [Description("Reference : (C# 判断操作系统是 Windows 还是 Linux - 青叶煮酒 - 博客园, 11/1/2022) https://www.cnblogs.com/dhqy/p/15787463.html (Accessed in 25/4/2025)")] public static void OpenDirectory(string path) { if (!string.IsNullOrEmpty(path) && Directory.Exists(path)) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Process.Start("explorer.exe", path); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Process.Start("xdg-open", path); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Process.Start("open", path); } else { LogHelper.LogWarning("Unsupported OS platform.", "OpenDirectory"); } } else { LogHelper.LogWarning("The path is not valid or the directory does not exist.", "OpenDirectory"); } } internal static string FindExecutable(string executableName, string fallbackPath = null) { bool num = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); string path = (num ? (executableName + ".exe") : executableName); char separator = (num ? ';' : ':'); string environmentVariable = Environment.GetEnvironmentVariable(executableName); if (!string.IsNullOrEmpty(environmentVariable) && Directory.Exists(environmentVariable) && File.Exists(Path.Combine(environmentVariable, path))) { return environmentVariable; } string environmentVariable2 = Environment.GetEnvironmentVariable("PATH"); if (!string.IsNullOrEmpty(environmentVariable2)) { string[] array = environmentVariable2.Split(separator); foreach (string text in array) { if (!string.IsNullOrWhiteSpace(text) && File.Exists(Path.Combine(text, path))) { return text; } } } if (!string.IsNullOrEmpty(fallbackPath) && Directory.Exists(fallbackPath)) { return fallbackPath; } return null; } } public static class UnityPathManager { public static Canvas FindCanvas() { //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) Scene activeScene = SceneManager.GetActiveScene(); GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { Canvas component = rootGameObjects[i].GetComponent(); if ((Object)(object)component != (Object)null) { return component; } } return null; } public static async Task LoadTextureFromFileAsync(string path) { UnityWebRequest request = UnityWebRequestTexture.GetTexture("file:///" + path); try { TaskCompletionSource tcs = new TaskCompletionSource(); ((AsyncOperation)request.SendWebRequest()).completed += delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)request.result == 1) { tcs.SetResult(DownloadHandlerTexture.GetContent(request)); } else { tcs.SetResult(null); } }; return await tcs.Task; } finally { if (request != null) { ((IDisposable)request).Dispose(); } } } } } namespace GreyAnnouncer.FrontEnd { public class AnnouncerConfigFields { public BoolField RandomizeAudioField; public Dictionary CategoryFields; } public class CategoryFields { public BoolField Enabled; public FloatField Volume; public FloatSliderField Cooldown; public BoolField ExcludeFromRandom; } [Description("This object is loaded via reflection from Plugin.cs")] public static class PluginConfiguratorEntry { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static OnValueChangeEventDelegate <>9__25_0; public static OnValueChangeEventDelegate <>9__25_1; public static EnumValueChangeEventDelegate <>9__25_2; public static EnumValueChangeEventDelegate <>9__25_3; public static OnClick <>9__25_4; public static OnClick <>9__25_5; public static OnClick <>9__25_6; public static BoolValueChangeEventDelegate <>9__26_0; public static BoolValueChangeEventDelegate <>9__26_1; public static OnClick <>9__26_2; public static Action <>9__29_0; internal void b__25_0(FloatSliderValueChangeEvent e) { Setting.audioSourceVolume = e.newValue; } internal void b__25_1(FloatSliderValueChangeEvent e) { Setting.spatialBlend = e.newValue; } internal void b__25_2(EnumValueChangeEvent e) { Setting.audioPlayOptions = (int)e.value; } internal void b__25_3(EnumValueChangeEvent e) { Setting.audioLoadingStrategy = (int)e.value; } internal void b__25_4() { AnnouncerManager.ReloadAllAnnouncers(); } internal void b__25_5() { advancedPanel.OpenPanel(); } internal void b__25_6() { creditPanel.OpenPanel(); } internal void b__26_0(BoolValueChangeEvent e) { Setting.isLowPassFilterEnabled = e.value; } internal void b__26_1(BoolValueChangeEvent e) { Setting.isFFmpegSupportEnabled = e.value; } internal void b__26_2() { AudioSourceManager.StopAllAudioSource(); } internal void b__29_0(string log) { audioLoaderLogHeader.text = log + "\n"; } } private static readonly Color m_greyColour = new Color(0.85f, 0.85f, 0.85f, 1f); private static readonly Color m_CyanColour = new Color(0f, 1f, 1f, 1f); private static readonly Color m_OrangeColour = new Color(1f, 0.6f, 0.2f, 1f); private static readonly Color m_RedColour = new Color(1f, 0f, 0f, 1f); private static readonly Color m_PurpleColour = new Color(1f, 0f, 1f, 1f); [CompilerGenerated] private static PluginConfigurator k__BackingField; public static ConfigHeader audioLoaderLogHeader; private static ConfigPanel advancedPanel; private static ConfigPanel creditPanel; private static List _pages = new List(); private static FloatSliderField volumeSlider; private static FloatSliderField spatialBlendSlider; private static EnumField playOption; private static EnumField loadOption; private static BoolField lowpassToggle; private static BoolField ffmpegToggle; public static PluginConfigurator config { get { return k__BackingField; } private set { k__BackingField = value; } } public static void Initialize() { CreatePluginPages(); Build(); } private static void CreatePluginPages() { config = PluginConfigurator.Create("Grey Announcer", "greycsont.ultrakill.GreyAnnouncer"); config.SetIconWithURL(PathHelper.GetCurrentPluginPath("./../../icon.png")); } public static void Build() { CreateMainSettingSectionTitle(); CreateAnnouncerPage(); CreateAudioControls(); CreateAdvancedOptionPanel(); CreateCreditsPanel(); CreateAnnouncerSection(); CreateDelegateTextFromBackEnd(); AnnouncerManager.OnRegistered += AddAnnouncerPage; Setting.syncUI = (Action)Delegate.Combine(Setting.syncUI, new Action(SyncUI)); } public static void SyncUI() { volumeSlider.value = Setting.audioSourceVolume; playOption.value = (AudioPlayOptions)Setting.audioPlayOptions; loadOption.value = (AudioLoadOptions)Setting.audioLoadingStrategy; lowpassToggle.value = Setting.isLowPassFilterEnabled; ffmpegToggle.value = Setting.isFFmpegSupportEnabled; } public static void CreateAnnouncerPage() { foreach (IAnnouncer announcer in AnnouncerManager.announcers) { RegistedAnnouncerPage item = new RegistedAnnouncerPage(announcer); _pages.Add(item); } } private static void CreateMainSettingSectionTitle() { //IL_000f: 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_002b: Unknown result type (might be due to invalid IL or missing references) new ConfigSpace(config.rootPanel, 15f); new ConfigHeader(config.rootPanel, "Main Settings", 24).textColor = m_CyanColour; } private static void CreateAudioControls() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //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) //IL_0067: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0256: 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_0261: Expected O, but got Unknown volumeSlider = new FloatSliderField(config.rootPanel, "Master Volume", "Audio_Volume", Tuple.Create(0f, 1f), 1f, 2, false); volumeSlider.value = Setting.audioSourceVolume; FloatSliderField obj = volumeSlider; object obj2 = <>c.<>9__25_0; if (obj2 == null) { OnValueChangeEventDelegate val = delegate(FloatSliderValueChangeEvent e) { Setting.audioSourceVolume = e.newValue; }; <>c.<>9__25_0 = val; obj2 = (object)val; } obj.onValueChange += (OnValueChangeEventDelegate)obj2; spatialBlendSlider = new FloatSliderField(config.rootPanel, "Spatial Blend", "Spatial_Blend", Tuple.Create(0f, 1f), 1f, 2, false); spatialBlendSlider.value = Setting.spatialBlend; FloatSliderField obj3 = spatialBlendSlider; object obj4 = <>c.<>9__25_1; if (obj4 == null) { OnValueChangeEventDelegate val2 = delegate(FloatSliderValueChangeEvent e) { Setting.spatialBlend = e.newValue; }; <>c.<>9__25_1 = val2; obj4 = (object)val2; } obj3.onValueChange += (OnValueChangeEventDelegate)obj4; playOption = new EnumField(config.rootPanel, "Audio Play Strategy", "Audio_Play_Strategy", AudioPlayOptions.Override_Last, false); playOption.value = (AudioPlayOptions)Setting.audioPlayOptions; playOption.onValueChange += delegate(EnumValueChangeEvent e) { Setting.audioPlayOptions = (int)e.value; }; loadOption = new EnumField(config.rootPanel, "Audio Load Strategy", "Audio_Load_Strategy", AudioLoadOptions.Load_then_Play, false); loadOption.value = (AudioLoadOptions)Setting.audioLoadingStrategy; loadOption.onValueChange += delegate(EnumValueChangeEvent e) { Setting.audioLoadingStrategy = (int)e.value; }; new ConfigSpace(config.rootPanel, 7f); ButtonArrayField val3 = new ButtonArrayField(config.rootPanel, "audio_button_array", 3, new float[3] { 0.4f, 0.4f, 0.2f }, new string[3] { "Reload", "Advance", "Credit" }, 5f); ButtonClickEvent obj5 = val3.OnClickEventHandler(0); object obj6 = <>c.<>9__25_4; if (obj6 == null) { OnClick val4 = delegate { AnnouncerManager.ReloadAllAnnouncers(); }; <>c.<>9__25_4 = val4; obj6 = (object)val4; } obj5.onClick += (OnClick)obj6; ButtonClickEvent obj7 = val3.OnClickEventHandler(1); object obj8 = <>c.<>9__25_5; if (obj8 == null) { OnClick val5 = delegate { advancedPanel.OpenPanel(); }; <>c.<>9__25_5 = val5; obj8 = (object)val5; } obj7.onClick += (OnClick)obj8; ButtonClickEvent obj9 = val3.OnClickEventHandler(2); object obj10 = <>c.<>9__25_6; if (obj10 == null) { OnClick val6 = delegate { creditPanel.OpenPanel(); }; <>c.<>9__25_6 = val6; obj10 = (object)val6; } obj9.onClick += (OnClick)obj10; } private static void CreateAdvancedOptionPanel() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0033: 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_0054: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00eb: 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_00fb: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown advancedPanel = new ConfigPanel(config.rootPanel, "Advanced", "Advanced_Option"); ((ConfigField)advancedPanel).hidden = true; new ConfigSpace(advancedPanel, 15f); lowpassToggle = new BoolField(advancedPanel, "LowPassFilter when under water", "LowPassFilter_Enabled", true, false); lowpassToggle.value = Setting.isLowPassFilterEnabled; BoolField obj = lowpassToggle; object obj2 = <>c.<>9__26_0; if (obj2 == null) { BoolValueChangeEventDelegate val = delegate(BoolValueChangeEvent e) { Setting.isLowPassFilterEnabled = e.value; }; <>c.<>9__26_0 = val; obj2 = (object)val; } obj.onValueChange += (BoolValueChangeEventDelegate)obj2; ffmpegToggle = new BoolField(advancedPanel, "Use FFmpeg to load unknown format", "FFmpeg_Support", false, false); ffmpegToggle.value = Setting.isFFmpegSupportEnabled; BoolField obj3 = ffmpegToggle; object obj4 = <>c.<>9__26_1; if (obj4 == null) { BoolValueChangeEventDelegate val2 = delegate(BoolValueChangeEvent e) { Setting.isFFmpegSupportEnabled = e.value; }; <>c.<>9__26_1 = val2; obj4 = (object)val2; } obj3.onValueChange += (BoolValueChangeEventDelegate)obj4; new ConfigHeader(advancedPanel, "this will try to load unknown format to AudioClip via FFmpeg\n makesure there's a executable in environment path `ffmpeg` or `PATH`\n\n ", 24) { tmpAnchor = (TextAlignmentOptions)258, textSize = 12, textColor = m_greyColour }; new ConfigSpace(config.rootPanel, 15f); new ConfigHeader(advancedPanel, "Emergency", 24).textColor = m_RedColour; ButtonField val3 = new ButtonField(advancedPanel, "Stop All Audio Source", "Stop_All_Audio_Source"); object obj5 = <>c.<>9__26_2; if (obj5 == null) { OnClick val4 = delegate { AudioSourceManager.StopAllAudioSource(); }; <>c.<>9__26_2 = val4; obj5 = (object)val4; } val3.onClick += (OnClick)obj5; } private static void CreateCreditsPanel() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) creditPanel = new ConfigPanel(config.rootPanel, "Credits", "Credits"); ((ConfigField)creditPanel).hidden = true; new ConfigSpace(creditPanel, 15f); new ConfigHeader(creditPanel, "Credits", 24).textColor = m_PurpleColour; new ConfigSpace(creditPanel, 20f); ConfigHeader val = new ConfigHeader(creditPanel, "", 24) { tmpAnchor = (TextAlignmentOptions)257, textSize = 20 }; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Thanks:\nhttps://unsplash.com/photos/white-textile-on-brown-wooden-table-_kUxT8WkoeY?utm_source=unsplash&utm_medium=referral&utm_content=creditShareLink"); stringBuilder.AppendLine("\n- OSU! \n(https://osu.ppy.sh/) some UX are copied from lazer(YES EDIT EXTERNALLY), use .ini as config cuz `skin.ini` is pretty easy to edit"); stringBuilder.AppendLine("\n- Artless Games \n(https://space.bilibili.com/1237125233) 14 Minesweeper variants"); stringBuilder.AppendLine("\n- Announcer Mod \n(https://www.nexusmods.com/ultrakill/mods/54) I started of this project is just because the mod isn't update in the few days after revamp"); stringBuilder.AppendLine("\n- PluginConfigurator doc \n(https://github.com/eternalUnion/UKPluginConfigurator/wiki) Easy to use tbh (except changing font)"); stringBuilder.AppendLine("\n- ULTRASTATS \n(https://thunderstore.io/c/ultrakill/p/AtomSmasher/ULTRASTATS/)\n Great mod, Goat dev"); stringBuilder.AppendLine("\n- Maxwell's puzzling demon \n(https://store.steampowered.com/app/2770160/) Fun puzzle game"); stringBuilder.AppendLine("\n- A mod that currently WIP \n(Advert Placeholder) Pretty FUN I would say"); stringBuilder.AppendLine("\n- HappySKZC, jamcame, ZHU!."); stringBuilder.AppendLine("\n"); stringBuilder.AppendLine("\n- Everyone who used this mod."); stringBuilder.AppendLine("\n\n\n\n"); stringBuilder.AppendLine("\n- FUCK YOU UNITY."); stringBuilder.AppendLine("\n\n\n\n\n\n\n\n\n"); stringBuilder.AppendLine("Turn up the bass!\nTHWWWWOOOOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB BWOBWOBWOBWOB BWOBWOBWOBWOBWOB BWAHH BWAHH BWAHH HMRMRMRMRMRMRMRMMR WOH WOH WOH- H H H HHHHH THWWOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB.. BWOBWOBWOBWOB.. BWOBWOBWOBWOBWOB.... HRMMMMMMMMMMMMMMMMRRR- HRRRRRRR HRRRRRRRR HRRRRRR HRRRRRRRR HRRR HR-YOOOH!!!!!!\n\n- shadow of cats"); val.text = stringBuilder.ToString(); } private static void CreateAnnouncerSection() { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) new ConfigHeader(config.rootPanel, "Announcer Section", 24).textColor = m_OrangeColour; audioLoaderLogHeader = new ConfigHeader(config.rootPanel, "", 24); audioLoaderLogHeader.tmpAnchor = (TextAlignmentOptions)257; audioLoaderLogHeader.textSize = 12; audioLoaderLogHeader.textColor = m_CyanColour; } private static void CreateDelegateTextFromBackEnd() { AudioLoader.onPluginConfiguratorLogUpdated = delegate(string log) { audioLoaderLogHeader.text = log + "\n"; }; } private static void AddAnnouncerPage(IAnnouncer announcer) { RegistedAnnouncerPage item = new RegistedAnnouncerPage(announcer); _pages.Add(item); } } public class RegistedAnnouncerPage { private string _title; private IAnnouncer _announcer; private StringListField _announcerField; private ConfigPanel _panel; private AnnouncerConfigFields _fields = new AnnouncerConfigFields { CategoryFields = new Dictionary() }; private ConfigHeader _mismatchHeader; private static readonly Color HeaderColor = new Color(0.85f, 0.85f, 0.85f, 1f); private PluginConfigurator _pluginConfigurator => PluginConfiguratorEntry.config; public RegistedAnnouncerPage(IAnnouncer announcer) { Build(announcer); } public void Build(IAnnouncer announcer) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_0102: 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_0118: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown _title = announcer.title; _announcer = announcer; _panel = new ConfigPanel(_pluginConfigurator.rootPanel, _title, _title); new ConfigSpace(_panel, 15f); new ConfigHeader(_panel, _title, 30).textColor = HeaderColor; List availablePacks = AudioAnnouncer.GetAvailablePacks(_announcer.title); _announcerField = new StringListField(_panel, "Selected Announcer", _announcer.title + "_Selected_Announcer", availablePacks, availablePacks.FirstOrDefault() ?? "default", false); _announcerField.value = Path.GetFileName(_announcer.announcerPath); _announcerField.onValueChange += (StringListValueChangeEventDelegate)delegate(StringListValueChangeEvent e) { _announcer.announcerPath = Path.Combine(Setting.announcersPath, _announcer.title, e.value); }; new ButtonField(_panel, "Open Current Announcer Folder", _announcer.title + "_Open_Current_Announcer_Folder").onClick += (OnClick)delegate { _announcer.EditExternally(); }; _mismatchHeader = new ConfigHeader(_panel, "", 24) { textColor = new Color(1f, 0.4f, 0.4f), textSize = 14 }; if (_announcer.isConfigLoaded) { BuildConfigSection(); } IAnnouncer announcer2 = _announcer; announcer2.syncUI = (Action)Delegate.Combine(announcer2.syncUI, new Action(ApplyConfigToUI)); } private void BuildConfigSection() { //IL_000b: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00dc: 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) new ConfigSpace(_panel, 15f); new ConfigHeader(_panel, "Configuration", 24); _fields.RandomizeAudioField = new BoolField(_panel, "Randomize Audio On Play", _announcer.title + "_RandomizeAudioOnPlay", false, false); _fields.RandomizeAudioField.defaultValue = false; _fields.RandomizeAudioField.value = _announcer.announcerConfig.RandomizeAudioOnPlay; _fields.RandomizeAudioField.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { _announcer.announcerConfig.RandomizeAudioOnPlay = e.value; }; foreach (KeyValuePair item in _announcer.announcerConfig.CategorySetting) { string key = item.Key; new ConfigHeader(_panel, item.Key, 24).textColor = new Color(0f, 1f, 1f); CategoryFields value = new CategoryFields { Enabled = CreateEnabledField(_panel, key, defaultValue: true), Volume = CreateVolumeField(_panel, key, 1f), Cooldown = CreateCooldownField(_panel, key, 3f), ExcludeFromRandom = CreateExcludeFromRandomField(_panel, key, defaultValue: false) }; _fields.CategoryFields[key] = value; } } private BoolField CreateEnabledField(ConfigPanel panel, string guid, bool defaultValue) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0094: Expected O, but got Unknown string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "Enabled"); BoolField val = new BoolField(panel, "Enabled", text, defaultValue, false) { defaultValue = defaultValue, value = _announcer.announcerConfig.CategorySetting[guid].Enabled }; val.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { _announcer.announcerConfig.CategorySetting[guid].Enabled = e.value; }; return val; } private FloatField CreateVolumeField(ConfigPanel panel, string guid, float defaultValue) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0094: Expected O, but got Unknown string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "VolumeMultiplier"); FloatField val = new FloatField(panel, "Volume", text, defaultValue, false) { defaultValue = defaultValue, value = _announcer.announcerConfig.CategorySetting[guid].VolumeMultiplier }; val.onValueChange += (FloatValueChangeEventDelegate)delegate(FloatValueChangeEvent e) { _announcer.announcerConfig.CategorySetting[guid].VolumeMultiplier = e.value; }; return val; } private FloatSliderField CreateCooldownField(ConfigPanel panel, string guid, float defaultValue) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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: Expected O, but got Unknown //IL_00a4: Expected O, but got Unknown string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "Cooldown"); FloatSliderField val = new FloatSliderField(panel, "Cooldown", text, Tuple.Create(0.2f, 6f), defaultValue, 1, false) { defaultValue = defaultValue, value = _announcer.announcerConfig.CategorySetting[guid].Cooldown }; val.onValueChange += (OnValueChangeEventDelegate)delegate(FloatSliderValueChangeEvent e) { _announcer.announcerConfig.CategorySetting[guid].Cooldown = e.newValue; }; return val; } private BoolField CreateExcludeFromRandomField(ConfigPanel panel, string guid, bool defaultValue) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown string text = _announcer.title + "_" + GuidPrefixAdder.AddPrefixToGUID(guid, "ExcludeFromRandom"); BoolField val = new BoolField(panel, "Exclude From Random Selection", text, defaultValue, false) { defaultValue = defaultValue, value = _announcer.announcerConfig.CategorySetting[guid].ExcludeFromRandom }; val.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { _announcer.announcerConfig.CategorySetting[guid].ExcludeFromRandom = e.value; }; ((ConfigField)val).hidden = !_announcer.announcerConfig.RandomizeAudioOnPlay; return val; } public void ApplyConfigToUI() { LogHelper.LogDebug("ApplyConfigToUI called", "ApplyConfigToUI"); string fileName = Path.GetFileName(_announcer.announcerPath); _announcerField.value = fileName; if (!_announcer.isConfigLoaded) { _mismatchHeader.text = (string.IsNullOrEmpty(_announcer.configMismatchInfo) ? "Config not loaded." : ("Config mismatch — " + _announcer.configMismatchInfo)); return; } _mismatchHeader.text = ""; PackConfig announcerConfig = _announcer.announcerConfig; if (_fields.RandomizeAudioField == null) { BuildConfigSection(); } _fields.RandomizeAudioField.value = announcerConfig.RandomizeAudioOnPlay; foreach (KeyValuePair categoryField in _fields.CategoryFields) { string key = categoryField.Key; CategoryFields value = categoryField.Value; if (announcerConfig.CategorySetting.TryGetValue(key, out var value2)) { value.Enabled.value = value2.Enabled; value.Volume.value = value2.VolumeMultiplier; value.Cooldown.value = value2.Cooldown; value.ExcludeFromRandom.value = value2.ExcludeFromRandom; ((ConfigField)value.ExcludeFromRandom).hidden = !announcerConfig.RandomizeAudioOnPlay; } } } } public class AdvancedPanel : MonoBehaviour { [CompilerGenerated] private static class <>O { public static UnityAction <0>__StopAllAudioSource; } private Toggle _lpToggle; private Toggle _ffToggle; public void SyncUI() { _lpToggle.SetIsOnWithoutNotify(Setting.isLowPassFilterEnabled); _ffToggle.SetIsOnWithoutNotify(Setting.isFFmpegSupportEnabled); } public void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown UIBuilder.SetFullStretch(((Component)this).GetComponent() ?? ((Component)this).gameObject.AddComponent()); Transform item = UIBuilder.BuildScrollView(((Component)this).transform, new RectOffset(12, 12, 12, 12)).content; UIBuilder.AddLabel(item, "Advanced", 26, new Color(0.5f, 0.8f, 1f), 23f, -1f, -1f, (TextAlignmentOptions)513); UIBuilder.AddSeparator(item); UIBuilder.AddSpace(item, 6f); Transform transform = UIBuilder.AddRow(item, "LowPass_Row", 28f).transform; UIBuilder.AddLabel(transform, "LowPass Filter when under water", 13, Color.white, -1f, -1f, 1f, (TextAlignmentOptions)513); _lpToggle = UIBuilder.AddToggle(transform, 30f); _lpToggle.isOn = Setting.isLowPassFilterEnabled; ((UnityEvent)(object)_lpToggle.onValueChanged).AddListener((UnityAction)delegate(bool v) { Setting.isLowPassFilterEnabled = v; }); UIBuilder.AddSpace(item, 4f); Transform transform2 = UIBuilder.AddRow(item, "FFmpeg_Row", 28f).transform; UIBuilder.AddLabel(transform2, "FFmpeg Support", 13, Color.white, -1f, -1f, 1f, (TextAlignmentOptions)513); _ffToggle = UIBuilder.AddToggle(transform2, 30f); _ffToggle.isOn = Setting.isFFmpegSupportEnabled; ((UnityEvent)(object)_ffToggle.onValueChanged).AddListener((UnityAction)delegate(bool v) { Setting.isFFmpegSupportEnabled = v; }); UIBuilder.AddLabel(item, "Enables loading unknown audio/video via FFmpeg.\nMake sure 'ffmpeg' is available in PATH.", 11, UIBuilder.SubLabelColor, 38f, -1f, -1f, (TextAlignmentOptions)513); UIBuilder.AddSpace(item, 10f); UIBuilder.AddSeparator(item); UIBuilder.AddSpace(item, 4f); UIBuilder.AddLabel(item, "Emergency", 13, new Color(1f, 0.3f, 0.3f), 20f, -1f, -1f, (TextAlignmentOptions)513); ButtonClickedEvent onClick = UIBuilder.AddButton(item, "Stop All Audio Sources", 13).onClick; object obj = <>O.<0>__StopAllAudioSource; if (obj == null) { UnityAction val = AudioSourceManager.StopAllAudioSource; <>O.<0>__StopAllAudioSource = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); Setting.syncUI = (Action)Delegate.Combine(Setting.syncUI, new Action(SyncUI)); } private void OnDestroy() { Setting.syncUI = (Action)Delegate.Remove(Setting.syncUI, new Action(SyncUI)); } } public class AnnouncerPanel : MonoBehaviour { private IAnnouncer _announcer; private Transform _content; private Dropdown _announcerDropdown; private Toggle _randomizeToggle; private TextMeshProUGUI _mismatchLabel; private readonly Dictionary _categories = new Dictionary(); public void Initialize(IAnnouncer announcer) { _announcer = announcer; IAnnouncer announcer2 = _announcer; announcer2.syncUI = (Action)Delegate.Combine(announcer2.syncUI, new Action(Refresh)); Build(); } public void Refresh() { if (_announcer == null) { return; } string currentPack = Path.GetFileName(_announcer.announcerPath); int num = _announcerDropdown.options.FindIndex((OptionData o) => o.text == currentPack); if (num >= 0) { _announcerDropdown.SetValueWithoutNotify(num); } if (!_announcer.isConfigLoaded) { ((TMP_Text)_mismatchLabel).text = (string.IsNullOrEmpty(_announcer.configMismatchInfo) ? "Config not loaded." : ("Config mismatch — " + _announcer.configMismatchInfo)); return; } ((TMP_Text)_mismatchLabel).text = ""; PackConfig announcerConfig = _announcer.announcerConfig; if ((Object)(object)_randomizeToggle == (Object)null) { BuildConfigSection(announcerConfig); } Toggle randomizeToggle = _randomizeToggle; if (randomizeToggle != null) { randomizeToggle.SetIsOnWithoutNotify(announcerConfig.RandomizeAudioOnPlay); } foreach (KeyValuePair category in _categories) { if (announcerConfig.CategorySetting.TryGetValue(category.Key, out var value)) { category.Value.enabledToggle.SetIsOnWithoutNotify(value.Enabled); category.Value.SetVolume(value.VolumeMultiplier); category.Value.SetCooldown(value.Cooldown); } } } private void Build() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) UIBuilder.SetFullStretch(((Component)this).GetComponent() ?? ((Component)this).gameObject.AddComponent()); Transform parent = (_content = UIBuilder.BuildScrollView(((Component)this).transform).content); UIBuilder.AddLabel(parent, _announcer.title, 26, Color.white, 36f, -1f, -1f, (TextAlignmentOptions)513); UIBuilder.AddSpace(parent, 3f); UIBuilder.AddLabel(parent, "Selected Announcer", 13, UIBuilder.SubLabelColor, 22f, -1f, -1f, (TextAlignmentOptions)513); List availablePacks = AudioAnnouncer.GetAvailablePacks(_announcer.title); _announcerDropdown = UIBuilder.AddDropdown(parent, availablePacks); string fileName = Path.GetFileName(_announcer.announcerPath); int num = availablePacks.IndexOf(fileName); if (num >= 0) { _announcerDropdown.SetValueWithoutNotify(num); } ((UnityEvent)(object)_announcerDropdown.onValueChanged).AddListener((UnityAction)delegate(int idx) { string text = _announcerDropdown.options[idx].text; _announcer.announcerPath = Path.Combine(Setting.announcersPath, _announcer.title, text); }); UIBuilder.AddSpace(parent, 3f); ((UnityEvent)UIBuilder.AddButton(parent, "Open Current Announcer Folder").onClick).AddListener((UnityAction)delegate { _announcer.EditExternally(); }); UIBuilder.AddSpace(parent, 3f); _mismatchLabel = UIBuilder.AddLabel(parent, "", 14, new Color(1f, 0.4f, 0.4f), 22f, -1f, -1f, (TextAlignmentOptions)513); if (_announcer.isConfigLoaded) { BuildConfigSection(_announcer.announcerConfig); } } private void BuildConfigSection(PackConfig cfg) { //IL_0028: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) Transform transform = UIBuilder.AddRow(_content, "RandomizeRow").transform; UIBuilder.AddLabel(transform, "Randomize Audio On Play", 14, Color.white, -1f, 200f, 1f, (TextAlignmentOptions)513); _randomizeToggle = UIBuilder.AddToggle(transform, 30f); _randomizeToggle.isOn = cfg.RandomizeAudioOnPlay; ((UnityEvent)(object)_randomizeToggle.onValueChanged).AddListener((UnityAction)delegate(bool v) { _announcer.announcerConfig.RandomizeAudioOnPlay = v; }); UIBuilder.AddSpace(_content, 3f); UIBuilder.AddLabel(_content, "Configuration", 20, new Color(0.85f, 0.85f, 0.85f), 30f, -1f, -1f, (TextAlignmentOptions)513); foreach (KeyValuePair item in cfg.CategorySetting) { string key = item.Key; GameObject val = new GameObject("Category_" + key, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_content, false); Category category = val.AddComponent(); category.SetName(key); category.enabledToggle.isOn = item.Value.Enabled; ((UnityEvent)(object)category.enabledToggle.onValueChanged).AddListener((UnityAction)delegate(bool v) { if (_announcer.announcerConfig.CategorySetting.TryGetValue(key, out var value3)) { value3.Enabled = v; } }); category.SetVolume(item.Value.VolumeMultiplier); ((UnityEvent)(object)category.volumeSlider.onValueChanged).AddListener((UnityAction)delegate(float v) { if (_announcer.announcerConfig.CategorySetting.TryGetValue(key, out var value2)) { value2.VolumeMultiplier = v; } }); category.SetCooldown(item.Value.Cooldown); ((UnityEvent)(object)category.cooldownSlider.onValueChanged).AddListener((UnityAction)delegate(float v) { if (_announcer.announcerConfig.CategorySetting.TryGetValue(key, out var value)) { value.Cooldown = v; } }); _categories[key] = category; UIBuilder.AddSpace(_content, 3f); } } } public class CreditsPanel : MonoBehaviour { public void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_004f: 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) UIBuilder.SetFullStretch(((Component)this).GetComponent() ?? ((Component)this).gameObject.AddComponent()); Transform item = UIBuilder.BuildScrollView(((Component)this).transform, new RectOffset(12, 12, 12, 12)).content; UIBuilder.AddLabel(item, "Credits", 26, new Color(1f, 0.3f, 1f), 23f, -1f, -1f, (TextAlignmentOptions)513); UIBuilder.AddSeparator(item); UIBuilder.AddSpace(item, 6f); UIBuilder.AddLabel(item, BuildCreditText(), 13, Color.white, -1f, -1f, -1f, (TextAlignmentOptions)257); } private static string BuildCreditText() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Thanks:"); stringBuilder.AppendLine("https://unsplash.com/photos/white-textile-on-brown-wooden-table-_kUxT8WkoeY"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- OSU!"); stringBuilder.AppendLine(" (https://osu.ppy.sh/) some UX are copied from lazer (YES EDIT EXTERNALLY),"); stringBuilder.AppendLine(" use .ini as config cuz `skin.ini` is pretty easy to edit"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- Artless Games"); stringBuilder.AppendLine(" (https://space.bilibili.com/1237125233) 14 Minesweeper variants"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- Announcer Mod"); stringBuilder.AppendLine(" (https://www.nexusmods.com/ultrakill/mods/54) I started this project just"); stringBuilder.AppendLine(" because the mod wasn't updated a few days after revamp"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- PluginConfigurator doc"); stringBuilder.AppendLine(" (https://github.com/eternalUnion/UKPluginConfigurator/wiki)"); stringBuilder.AppendLine(" Easy to use tbh (except changing font)"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- Maxwell's puzzling demon"); stringBuilder.AppendLine(" (https://store.steampowered.com/app/2770160/)"); stringBuilder.AppendLine(" Fun puzzle game"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- A mod that currently WIP"); stringBuilder.AppendLine(" (Advert Placeholder)"); stringBuilder.AppendLine(" Pretty FUN I would say"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- 快乐萨卡兹厨, jamcame, 夕柱."); stringBuilder.AppendLine(); stringBuilder.AppendLine("- Everyone who used this mod."); stringBuilder.AppendLine(); stringBuilder.AppendLine(); stringBuilder.AppendLine("- FUCK YOU UNITY."); stringBuilder.AppendLine(); stringBuilder.AppendLine(); stringBuilder.AppendLine("Turn up the bass!"); stringBuilder.AppendLine("THWWWWOOOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB BWOBWOBWOBWOB BWOBWOBWOBWOBWOB"); stringBuilder.AppendLine("BWAHH BWAHH BWAHH HMRMRMRMRMRMRMRMMR WOH WOH WOH- H H H HHHHH"); stringBuilder.AppendLine("THWWOOMPPPP DHGDHGDHGDHGDHGDHG BWOBWOBWOBWOB.. BWOBWOBWOBWOB.."); stringBuilder.AppendLine("BWOBWOBWOBWOBWOB.... HRMMMMMMMMMMMMMMMMRRR- HRRRRRRR HRRRRRRRR HRRRRRR HRRRRRRRR"); stringBuilder.AppendLine("HRRR HR-YOOOH!!!!!!"); stringBuilder.AppendLine(); stringBuilder.AppendLine("- shadow of cats"); return stringBuilder.ToString(); } } public class MainPanel : MonoBehaviour { [CompilerGenerated] private static class <>O { public static UnityAction <0>__ReloadAllAnnouncers; } private Transform _navContent; private Transform _rightPanelRoot; private readonly List _panels = new List(); private readonly List _navButtons = new List(); private GameObject _advancedPanelObj; private GameObject _creditsPanelObj; private Slider _volumeSlider; private Dropdown _playDd; private Dropdown _loadDd; public void Awake() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) UIBuilder.SetFullStretch(((Component)this).GetComponent() ?? ((Component)this).gameObject.AddComponent()); Transform item = UIBuilder.BuildScrollView(CreatePanel("LeftPanel", 0f, 0.4f, new Color(0.18f, 0.18f, 0.18f, 0.95f)).transform, new RectOffset(8, 8, 8, 8), addScrollbar: false).content; _navContent = item; BuildGlobalSettings(_navContent); GameObject val = CreatePanel("RightPanel", 0.4f, 1f, new Color(0.1f, 0.1f, 0.1f, 1f)); _rightPanelRoot = val.transform; _advancedPanelObj = CreateSpecialPanel("AdvancedPanel"); _creditsPanelObj = CreateSpecialPanel("CreditsPanel"); foreach (IAnnouncer allAnnouncer in AnnouncerManager.GetAllAnnouncers()) { AddAnnouncerPanel(allAnnouncer); } AnnouncerManager.OnRegistered += AddAnnouncerPanel; Setting.syncUI = (Action)Delegate.Combine(Setting.syncUI, new Action(SyncUI)); } private void OnDestroy() { AnnouncerManager.OnRegistered -= AddAnnouncerPanel; Setting.syncUI = (Action)Delegate.Remove(Setting.syncUI, new Action(SyncUI)); } private void SyncUI() { _volumeSlider.SetValueWithoutNotify(Setting.audioSourceVolume); _playDd.SetValueWithoutNotify(Setting.audioPlayOptions); _loadDd.SetValueWithoutNotify(Setting.audioLoadingStrategy); } private void BuildGlobalSettings(Transform parent) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown UIBuilder.AddLabel(parent, "Settings", 15, new Color(0.5f, 0.8f, 1f), 23f, -1f, -1f, (TextAlignmentOptions)513); UIBuilder.AddLabel(parent, "Master Volume", 12, UIBuilder.SubLabelColor, 20f, -1f, -1f, (TextAlignmentOptions)513); _volumeSlider = UIBuilder.AddSlider(parent, Setting.audioSourceVolume, 0f, 1f); ((UnityEvent)(object)_volumeSlider.onValueChanged).AddListener((UnityAction)delegate(float v) { Setting.audioSourceVolume = v; }); UIBuilder.AddLabel(parent, "Play Strategy", 12, UIBuilder.SubLabelColor, 20f, -1f, -1f, (TextAlignmentOptions)513); _playDd = UIBuilder.AddDropdown(parent, (from s in Enum.GetNames(typeof(AudioPlayOptions)) select s.Replace('_', ' ')).ToList(), 30f); _playDd.value = Setting.audioPlayOptions; ((UnityEvent)(object)_playDd.onValueChanged).AddListener((UnityAction)delegate(int v) { Setting.audioPlayOptions = v; }); UIBuilder.AddLabel(parent, "Load Strategy", 12, UIBuilder.SubLabelColor, 20f, -1f, -1f, (TextAlignmentOptions)513); _loadDd = UIBuilder.AddDropdown(parent, (from s in Enum.GetNames(typeof(AudioLoadOptions)) select s.Replace('_', ' ')).ToList(), 30f); _loadDd.value = Setting.audioLoadingStrategy; ((UnityEvent)(object)_loadDd.onValueChanged).AddListener((UnityAction)delegate(int v) { Setting.audioLoadingStrategy = v; }); Transform transform = UIBuilder.AddRow(parent, "ActionRow", 36f).transform; Button obj = UIBuilder.AddButton(transform, "Reload", 12); ((Component)obj).GetComponent().flexibleWidth = 1f; ButtonClickedEvent onClick = obj.onClick; object obj2 = <>O.<0>__ReloadAllAnnouncers; if (obj2 == null) { UnityAction val = AnnouncerManager.ReloadAllAnnouncers; <>O.<0>__ReloadAllAnnouncers = val; obj2 = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj2); Button obj3 = UIBuilder.AddButton(transform, "Advanced", 12); ((Component)obj3).GetComponent().flexibleWidth = 1f; ((UnityEvent)obj3.onClick).AddListener(new UnityAction(ShowAdvanced)); Button obj4 = UIBuilder.AddButton(transform, "Credits", 12); ((Component)obj4).GetComponent().flexibleWidth = 1f; ((UnityEvent)obj4.onClick).AddListener(new UnityAction(ShowCredits)); UIBuilder.AddSeparator(parent); UIBuilder.AddLabel(parent, "Announcers", 13, new Color(1f, 0.7f, 0.3f), 21f, -1f, -1f, (TextAlignmentOptions)513); } private void AddAnnouncerPanel(IAnnouncer announcer) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) int index = _panels.Count; Button val = UIBuilder.AddButton(_navContent, announcer.title, 14, 44f); UIBuilder.StyleButton(((Component)val).gameObject, index == 0); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { ShowPanel(index); }); GameObject val2 = new GameObject("AnnouncerPanel_" + announcer.title, new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(_rightPanelRoot, false); UIBuilder.SetFullStretch(val2.GetComponent()); AnnouncerPanel announcerPanel = val2.AddComponent(); announcerPanel.Initialize(announcer); val2.SetActive(index == 0); _panels.Add(announcerPanel); _navButtons.Add(((Component)val).gameObject); } private void ShowPanel(int index) { _advancedPanelObj.SetActive(false); _creditsPanelObj.SetActive(false); for (int i = 0; i < _panels.Count; i++) { ((Component)_panels[i]).gameObject.SetActive(i == index); UIBuilder.StyleButton(_navButtons[i], i == index); } } private void ShowAdvanced() { foreach (AnnouncerPanel panel in _panels) { ((Component)panel).gameObject.SetActive(false); } foreach (GameObject navButton in _navButtons) { UIBuilder.StyleButton(navButton, active: false); } _advancedPanelObj.SetActive(true); _creditsPanelObj.SetActive(false); } private void ShowCredits() { foreach (AnnouncerPanel panel in _panels) { ((Component)panel).gameObject.SetActive(false); } foreach (GameObject navButton in _navButtons) { UIBuilder.StyleButton(navButton, active: false); } _advancedPanelObj.SetActive(false); _creditsPanelObj.SetActive(true); } private GameObject CreateSpecialPanel(string name) where T : MonoBehaviour { //IL_0014: 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_002b: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_rightPanelRoot, false); UIBuilder.SetFullStretch(val.GetComponent()); val.AddComponent(); val.SetActive(false); return val; } private GameObject CreatePanel(string name, float xMin, float xMax, Color color) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0083: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(((Component)this).transform, false); RectTransform component = val.GetComponent(); component.anchorMin = new Vector2(xMin, 0f); component.anchorMax = new Vector2(xMax, 1f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)val.GetComponent()).color = color; return val; } } public static class UIBuilder { public static readonly Color NavActive = new Color(0.25f, 0.45f, 0.65f); public static readonly Color NavInactive = new Color(0.22f, 0.22f, 0.22f); public static readonly Color SeparatorColor = new Color(0.4f, 0.4f, 0.4f); public static readonly Color SubLabelColor = new Color(0.7f, 0.7f, 0.7f); public static void SetFullStretch(RectTransform rt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0022: 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; ((Transform)rt).localScale = Vector3.one; } public static GameObject AddRow(Transform parent, string name, float height = 30f, float spacing = 8f) { //IL_0014: 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_0026: 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_005b: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); HorizontalLayoutGroup obj = val.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing; val.AddComponent().preferredHeight = height; return val; } public static TextMeshProUGUI AddLabel(Transform parent, string text, int fontSize, Color color, float preferredHeight = -1f, float preferredWidth = -1f, float flexibleWidth = -1f, TextAlignmentOptions alignment = 513) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0093: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Label_" + text, new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val.transform.SetParent(parent, false); LayoutElement val2 = val.AddComponent(); if (preferredHeight >= 0f) { val2.preferredHeight = preferredHeight; } if (preferredWidth >= 0f) { val2.preferredWidth = preferredWidth; } if (flexibleWidth >= 0f) { val2.flexibleWidth = flexibleWidth; } TextMeshProUGUI component = val.GetComponent(); ((TMP_Text)component).text = text; ((TMP_Text)component).fontSize = fontSize; ((Graphic)component).color = color; ((TMP_Text)component).alignment = alignment; return component; } public static Button AddButton(Transform parent, string label, int fontSize = 14, float height = 36f) { //IL_0002: 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) GameObject obj = DefaultControls.CreateButton(default(Resources)); ((Object)obj).name = "Btn_" + label; obj.transform.SetParent(parent, false); obj.AddComponent().preferredHeight = height; SetButtonLabel(obj, label, fontSize); return obj.GetComponent