using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using MelonLoader; using MelonLoader.Preferences; using SledNameStyler; using SledNameStyler.Menu; using SledNameStyler.Util; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SledNameStyler")] [assembly: AssemblyFileVersion("0.2.0")] [assembly: MelonInfo(typeof(Mod), "SledNameStyler", "0.2.0", "Natebag", null)] [assembly: MelonGame("The Sledding Corporation", "Sledding Game")] [assembly: MelonColor(255, 255, 102, 204)] [assembly: MelonAuthorColor(255, 80, 160, 255)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyVersion("0.2.0.0")] namespace SledNameStyler { public sealed class Mod : MelonMod { public enum ApplyStatus { Disabled, WaitingForLobby, Applied } public const string Name = "SledNameStyler"; public const string Version = "0.2.0"; public const string Author = "Natebag"; private static MelonPreferences_Category _cat; private static MelonPreferences_Entry _enabled; private static MelonPreferences_Entry _name; private static MelonPreferences_Entry _style; private static MelonPreferences_Entry _bold; private static MelonPreferences_Entry _italic; private static MelonPreferences_Entry _underline; private static MelonPreferences_Entry _strike; private static MelonPreferences_Entry _sizePct; private static MelonPreferences_Entry _animSpeed; private static MelonPreferences_Entry _transform; private static MelonPreferences_Entry _decoration; private static MelonPreferences_Entry _glow; private static MelonPreferences_Entry _hotkeyEnabled; private static MelonPreferences_Entry _menuKey; private static MelonPreferences_Entry _toggleKey; private static Type _ctrlType; private static Type _gameInfoType; private static PropertyInfo _giInstanceProp; private static PropertyInfo _giNameProp; private static string _originalName = ""; private static bool _hasOriginal; private static bool _hookInstalled; private static bool _wasDisabledLastFrame; private static string _lastWrittenPreview = ""; private static int _wroteThisSecond; private static int _lastWriteSecond; private static bool _prefDirty; private static float _lastSaveTime; private const float SaveDebounceSeconds = 1.5f; public static ApplyStatus Status { get; private set; } = ApplyStatus.WaitingForLobby; public static string OriginalName => _originalName ?? ""; public static bool HasOriginal => _hasOriginal; public static string LastWrittenPreview => _lastWrittenPreview; public static bool IsEnabled { get { return _enabled?.Value ?? true; } set { if (_enabled != null && _enabled.Value != value) { _enabled.Value = value; MarkDirty(); } } } public static string NameOverride { get { return _name?.Value ?? ""; } set { if (_name != null && _name.Value != value) { _name.Value = value ?? ""; MarkDirty(); } } } public static string CurrentStyle { get { return _style?.Value ?? "rainbow-wave"; } set { if (_style != null && _style.Value != value) { _style.Value = value; MarkDirty(); } } } public static bool Bold { get { return _bold?.Value ?? false; } set { if (_bold != null && _bold.Value != value) { _bold.Value = value; MarkDirty(); } } } public static bool Italic { get { return _italic?.Value ?? false; } set { if (_italic != null && _italic.Value != value) { _italic.Value = value; MarkDirty(); } } } public static bool Underline { get { return _underline?.Value ?? false; } set { if (_underline != null && _underline.Value != value) { _underline.Value = value; MarkDirty(); } } } public static bool Strike { get { return _strike?.Value ?? false; } set { if (_strike != null && _strike.Value != value) { _strike.Value = value; MarkDirty(); } } } public static int SizePct { get { return _sizePct?.Value ?? 100; } set { if (_sizePct != null && _sizePct.Value != value) { _sizePct.Value = value; MarkDirty(); } } } public static float AnimSpeed { get { return _animSpeed?.Value ?? 1f; } set { if (_animSpeed != null && Math.Abs(_animSpeed.Value - value) > 0.001f) { _animSpeed.Value = value; MarkDirty(); } } } public static string Transform { get { return _transform?.Value ?? "none"; } set { if (_transform != null && _transform.Value != value) { _transform.Value = value; MarkDirty(); } } } public static string Decoration { get { return _decoration?.Value ?? "none"; } set { if (_decoration != null && _decoration.Value != value) { _decoration.Value = value; MarkDirty(); } } } public static string Glow { get { return _glow?.Value ?? "none"; } set { if (_glow != null && _glow.Value != value) { _glow.Value = value; MarkDirty(); } } } public static void SaveNow() { try { MelonPreferences.Save(); _prefDirty = false; _lastSaveTime = Time.time; } catch { } } private static string MigrateStyle(string s) { if (1 == 0) { } string result = s switch { "rainbow-wave" => "rainbow", "rainbow-cycle" => "rainbow", "pulse-red" => "red", "pulse-blue" => "blue", "pulse-green" => "green", "pulse-pink" => "pink", "marquee" => "chrome", "marquee-gold" => "gold", "breathe" => "pink", "party" => "rainbow", "bounce" => "ocean", "wave-blue" => "ocean", "shake" => "matrix", "flicker" => "confetti", "chrome-shimmer" => "chrome", "fire-anim" => "fire", "typewriter" => "white", "mystery" => "grayscale", "scramble" => "confetti", _ => s, }; if (1 == 0) { } return result; } private static void MarkDirty() { _prefDirty = true; } public override void OnInitializeMelon() { //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Expected O, but got Unknown //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Expected O, but got Unknown SafeLog.Bind(((MelonBase)this).LoggerInstance); try { _cat = MelonPreferences.CreateCategory("SledNameStyler", "SledNameStyler"); _enabled = _cat.CreateEntry("Enabled", true, "Enabled", "Master switch. Set false to restore your real name and disable styling.", false, false, (ValueValidator)null, (string)null); _name = _cat.CreateEntry("Name", "", "Name", "Optional base name override. Empty = use your normal username.", false, false, (ValueValidator)null, (string)null); _style = _cat.CreateEntry("Style", "rainbow-wave", "Style", "Active style preset. Press the menu hotkey to pick from the full list.", false, false, (ValueValidator)null, (string)null); _bold = _cat.CreateEntry("Bold", false, "Bold", "", false, false, (ValueValidator)null, (string)null); _italic = _cat.CreateEntry("Italic", false, "Italic", "", false, false, (ValueValidator)null, (string)null); _underline = _cat.CreateEntry("Underline", false, "Underline", "", false, false, (ValueValidator)null, (string)null); _strike = _cat.CreateEntry("Strikethrough", false, "Strikethrough", "", false, false, (ValueValidator)null, (string)null); _sizePct = _cat.CreateEntry("SizePercent", 100, "SizePercent", "Font size as a percent (50-250 typical). 100 = normal.", false, false, (ValueValidator)null, (string)null); _animSpeed = _cat.CreateEntry("AnimationSpeed", 1f, "AnimationSpeed", "Speed multiplier (kept for compatibility — animated styles were removed in 0.2 because the game freezes the nameplate after the first frame).", false, false, (ValueValidator)null, (string)null); _transform = _cat.CreateEntry("Transform", "none", "Transform", "Letter transform: none, uppercase, lowercase, fullwidth, bubble, smallcaps.", false, false, (ValueValidator)null, (string)null); _decoration = _cat.CreateEntry("Decoration", "none", "Decoration", "Wraps your name with chars. Options: none, stars, sparkles, hearts, diamonds, crowns, swords, skulls, music, brackets, squarebrackets, parens, chevrons, arrows, waves, dots, vip, pro, mvp, god.", false, false, (ValueValidator)null, (string)null); _glow = _cat.CreateEntry("Glow", "none", "Glow", "Background highlight glow color. Options: none, red, orange, yellow, green, cyan, blue, purple, pink, white, black.", false, false, (ValueValidator)null, (string)null); _hotkeyEnabled = _cat.CreateEntry("HotkeyEnabled", true, "HotkeyEnabled", "Allow the menu/toggle hotkeys.", false, false, (ValueValidator)null, (string)null); _menuKey = _cat.CreateEntry("MenuHotkeyKeyCode", 292, "MenuHotkeyKeyCode", "UnityEngine.KeyCode integer for the open-menu hotkey. F11 = 292. F9 = 290, F10 = 291, F12 = 293, End = 279.", false, false, (ValueValidator)null, (string)null); _toggleKey = _cat.CreateEntry("ToggleHotkeyKeyCode", 293, "ToggleHotkeyKeyCode", "UnityEngine.KeyCode integer for the on/off-toggle hotkey.", false, false, (ValueValidator)null, (string)null); string text = MigrateStyle(_style.Value); if (text != _style.Value) { SafeLog.Info($"SledNameStyler: migrated style '{_style.Value}' -> '{text}' (animated styles removed)"); _style.Value = text; _prefDirty = true; } _ctrlType = Refl.FindType("Assembly-CSharp", "PlayerUsernameController"); if (_ctrlType == null) { SafeLog.Warn("SledNameStyler: PlayerUsernameController not found at init — will retry per frame"); } _gameInfoType = Refl.FindType("Assembly-CSharp", "_Scripts.Managers.GameInfo"); if (_gameInfoType != null) { _giInstanceProp = _gameInfoType.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); _giNameProp = _gameInfoType.GetProperty("PlayerName", BindingFlags.Instance | BindingFlags.Public); } if (!_hookInstalled) { ((MelonEventBase)(object)MelonEvents.OnUpdate).Subscribe(new LemonAction(OnFrame), 0, false); ((MelonEventBase)(object)MelonEvents.OnGUI).Subscribe(new LemonAction(OnGui), 0, false); _hookInstalled = true; } SafeLog.Info($"SledNameStyler v{"0.2.0"} ready — {NameStyler.StyleNames.Count} styles. Style='{_style.Value}', menu={_menuKey.Value}, toggle={_toggleKey.Value}."); } catch (Exception value) { ((MelonBase)this).LoggerInstance.Error($"SledNameStyler init failed: {value}"); } } private static void OnFrame() { if (_enabled == null) { return; } try { if (_hotkeyEnabled.Value) { if (Input.GetKeyDown((KeyCode)_menuKey.Value)) { StyleMenu.Instance.Toggle(); } if (Input.GetKeyDown((KeyCode)_toggleKey.Value)) { ToggleEnabled(); } } if (_prefDirty && Time.time - _lastSaveTime > 1.5f) { SaveNow(); } if (!_enabled.Value) { Status = ApplyStatus.Disabled; if (!_wasDisabledLastFrame && _hasOriginal) { WriteEverywhere(_originalName); } _wasDisabledLastFrame = true; return; } _wasDisabledLastFrame = false; if (!_hasOriginal) { string text = ReadGameInfoName(); if (string.IsNullOrEmpty(text)) { text = ReadSyncUsername(); } if (!string.IsNullOrEmpty(text)) { _originalName = NameStyler.StripMarkup(text); _hasOriginal = true; SafeLog.Info("SledNameStyler: captured original name '" + _originalName + "'"); } } string text2 = (_name.Value ?? "").Trim(); if (string.IsNullOrEmpty(text2)) { if (!_hasOriginal) { Status = ApplyStatus.WaitingForLobby; return; } text2 = _originalName; } else { text2 = NameStyler.StripMarkup(text2); } if (string.IsNullOrEmpty(text2)) { Status = ApplyStatus.WaitingForLobby; return; } string s = TextTransform.Apply(text2, _transform.Value); string baseName = NameDecoration.Apply(s, _decoration.Value); float time = Time.time * Mathf.Max(_animSpeed.Value, 0.01f); string content = NameStyler.Render(baseName, _style.Value, time); string s2 = NameGlow.Wrap(content, _glow.Value); string text3 = NameStyler.Decorate(s2, _bold.Value, _italic.Value, _underline.Value, _strike.Value, _sizePct.Value); WriteEverywhere(text3); _lastWrittenPreview = text3; Status = ApplyStatus.Applied; } catch { } } public static void ForceApply() { try { string text = ReadGameInfoName(); if (string.IsNullOrEmpty(text)) { text = ReadSyncUsername(); } if (!string.IsNullOrEmpty(text)) { _originalName = NameStyler.StripMarkup(text); _hasOriginal = true; SafeLog.Info("SledNameStyler.ForceApply: captured original '" + _originalName + "'"); } else if (!_hasOriginal) { SafeLog.Warn("SledNameStyler.ForceApply: couldn't read a name from GameInfo or PlayerUsernameController"); } SaveNow(); } catch (Exception ex) { SafeLog.Error("Mod.ForceApply", ex); } } public static void RecaptureOriginal() { _hasOriginal = false; _originalName = ""; SafeLog.Info("SledNameStyler: cleared captured original (will re-read next frame)"); } private static void OnGui() { try { StyleMenu.Instance.Render(); } catch (Exception ex) { SafeLog.Error("SledNameStyler.OnGui", ex); } } private static void ToggleEnabled() { if (_enabled != null) { _enabled.Value = !_enabled.Value; SaveNow(); SafeLog.Info("SledNameStyler: " + (_enabled.Value ? "enabled" : "disabled")); } } private static void WriteEverywhere(string value) { WriteSyncUsername(value); WriteGameInfoName(value); } private static void EnsureCtrlType() { if (_ctrlType == null) { _ctrlType = Refl.FindType("Assembly-CSharp", "PlayerUsernameController"); } } private static string ReadSyncUsername() { try { EnsureCtrlType(); if (_ctrlType == null) { return ""; } Type val = Il2CppType.From(_ctrlType); Il2CppReferenceArray val2 = Object.FindObjectsOfType(val); if (val2 == null) { return ""; } foreach (Object item in (Il2CppArrayBase)(object)val2) { if (item == (Object)null) { continue; } object obj = Refl.CastToIl2Cpp(item, _ctrlType); if (obj == null) { continue; } PropertyInfo property = obj.GetType().GetProperty("IsOwner", BindingFlags.Instance | BindingFlags.Public); if (property == null) { continue; } object value = property.GetValue(obj); if (value != null && (bool)value) { FieldInfo field = obj.GetType().GetField("sync_Username", BindingFlags.Instance | BindingFlags.Public); object obj2 = ((field != null) ? field.GetValue(obj) : null); if (obj2 != null) { return (obj2.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj2) as string) ?? ""; } } } } catch { } return ""; } private static void WriteSyncUsername(string value) { try { EnsureCtrlType(); if (_ctrlType == null) { return; } Type val = Il2CppType.From(_ctrlType); Il2CppReferenceArray val2 = Object.FindObjectsOfType(val); if (val2 == null || ((Il2CppArrayBase)(object)val2).Length == 0) { return; } object obj = null; foreach (Object item in (Il2CppArrayBase)(object)val2) { if (item == (Object)null) { continue; } object obj2 = Refl.CastToIl2Cpp(item, _ctrlType); if (obj2 == null) { continue; } PropertyInfo property = obj2.GetType().GetProperty("IsOwner", BindingFlags.Instance | BindingFlags.Public); if (!(property == null)) { object value2 = property.GetValue(obj2); if (value2 != null && (bool)value2) { obj = obj2; break; } } } if (obj == null) { obj = Refl.CastToIl2Cpp(((Il2CppArrayBase)(object)val2)[0], _ctrlType); } if (obj != null) { object obj3 = obj.GetType().GetField("sync_Username", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj); (obj3?.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public))?.SetValue(obj3, value); } } catch { } } private static void WriteGameInfoName(string value) { if (_giInstanceProp == null || _giNameProp == null) { return; } try { object value2 = _giInstanceProp.GetValue(null); if (value2 != null) { object obj = Refl.CastToIl2Cpp(value2, _gameInfoType) ?? value2; _giNameProp.SetValue(obj, value); } } catch { } } private static string ReadGameInfoName() { if (_giInstanceProp == null || _giNameProp == null) { return ""; } try { object value = _giInstanceProp.GetValue(null); if (value == null) { return ""; } object obj = Refl.CastToIl2Cpp(value, _gameInfoType) ?? value; return (_giNameProp.GetValue(obj) as string) ?? ""; } catch { return ""; } } } internal static class TextTransform { public static readonly IReadOnlyList Names = new string[6] { "none", "uppercase", "lowercase", "fullwidth", "bubble", "smallcaps" }; private static readonly char[] _smallcaps = new char[26] { 'ᴀ', 'ʙ', 'ᴄ', 'ᴅ', 'ᴇ', 'ꜰ', 'ɢ', 'ʜ', 'ɪ', 'ᴊ', 'ᴋ', 'ʟ', 'ᴍ', 'ɴ', 'ᴏ', 'ᴘ', 'ǫ', 'ʀ', 'ꜱ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'x', 'ʏ', 'ᴢ' }; public static string Apply(string s, string mode) { if (string.IsNullOrEmpty(s) || string.IsNullOrEmpty(mode) || mode == "none") { return s; } return mode switch { "uppercase" => s.ToUpperInvariant(), "lowercase" => s.ToLowerInvariant(), "fullwidth" => MapPerChar(s, FullwidthChar), "bubble" => MapPerChar(s, BubbleChar), "smallcaps" => MapPerChar(s, SmallcapChar), _ => s, }; } private static string MapPerChar(string s, Func map) { StringBuilder stringBuilder = new StringBuilder(s.Length * 2); foreach (char arg in s) { stringBuilder.Append(map(arg)); } return stringBuilder.ToString(); } private static string FullwidthChar(char c) { if (c == ' ') { return "\u3000"; } if (c >= '!' && c <= '~') { return ((char)(c - 32 + 65280)).ToString(); } return c.ToString(); } private static string BubbleChar(char c) { if (c >= 'A' && c <= 'Z') { return ((char)(c - 65 + 9398)).ToString(); } if (c >= 'a' && c <= 'z') { return ((char)(c - 97 + 9424)).ToString(); } if (c == '0') { return "⓪"; } if (c >= '1' && c <= '9') { return ((char)(c - 49 + 9312)).ToString(); } return c.ToString(); } private static string SmallcapChar(char c) { char c2 = c; if (c >= 'A' && c <= 'Z') { c2 = (char)(c - 65 + 97); } if (c2 >= 'a' && c2 <= 'z') { return _smallcaps[c2 - 97].ToString(); } return c.ToString(); } } internal static class NameDecoration { private struct Pair { public string L; public string R; public Pair(string l, string r) { L = l; R = r; } } private static readonly Dictionary _wraps = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["none"] = new Pair("", ""), ["stars"] = new Pair("★ ", " ★"), ["sparkles"] = new Pair("✦ ", " ✦"), ["hearts"] = new Pair("♥ ", " ♥"), ["diamonds"] = new Pair("♦ ", " ♦"), ["crowns"] = new Pair("♚ ", " ♚"), ["swords"] = new Pair("⚔ ", " ⚔"), ["skulls"] = new Pair("☠ ", " ☠"), ["music"] = new Pair("♫ ", " ♫"), ["brackets"] = new Pair("「 ", " 」"), ["squarebrackets"] = new Pair("[ ", " ]"), ["parens"] = new Pair("( ", " )"), ["chevrons"] = new Pair("« ", " »"), ["arrows"] = new Pair("» ", " «"), ["waves"] = new Pair("~ ", " ~"), ["dots"] = new Pair("• ", " •"), ["vip"] = new Pair("[VIP] ", ""), ["pro"] = new Pair("[PRO] ", ""), ["mvp"] = new Pair("[MVP] ", ""), ["god"] = new Pair("[GOD] ", "") }; public static IReadOnlyList Names { get; } = new List(_wraps.Keys); public static string Apply(string s, string mode) { if (string.IsNullOrEmpty(mode) || mode == "none" || string.IsNullOrEmpty(s)) { return s; } if (_wraps.TryGetValue(mode, out var value)) { return value.L + s + value.R; } return s; } } internal static class NameGlow { private static readonly Dictionary _hex = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["none"] = null, ["red"] = "FF334488", ["orange"] = "FF880088", ["yellow"] = "FFCC0088", ["green"] = "22DD5588", ["cyan"] = "00CCFF88", ["blue"] = "3366FF88", ["purple"] = "9933FF88", ["pink"] = "FF66CC88", ["white"] = "FFFFFF55", ["black"] = "11111188" }; public static IReadOnlyList Names { get; } = new List(_hex.Keys); public static string Wrap(string content, string color) { if (string.IsNullOrEmpty(content)) { return content; } if (string.IsNullOrEmpty(color) || color == "none") { return content; } if (!_hex.TryGetValue(color, out var value) || value == null) { return content; } return $"{content}"; } } internal static class NameStyler { public delegate string Renderer(string baseName, float time); internal struct ColorRgb { public float R; public float G; public float B; public ColorRgb(float r, float g, float b) { R = r; G = g; B = b; } } private static readonly Dictionary _styles; private static readonly List _names; private static readonly Regex _stripMarkup; public static IReadOnlyList StyleNames => _names; static NameStyler() { _styles = new Dictionary(StringComparer.OrdinalIgnoreCase); _names = new List(); _stripMarkup = new Regex("<[^>]+>", RegexOptions.Compiled); Register(); } public static string StripMarkup(string s) { return string.IsNullOrEmpty(s) ? "" : _stripMarkup.Replace(s, ""); } public static string Render(string baseName, string styleName, float time) { if (string.IsNullOrEmpty(baseName)) { return ""; } if (string.IsNullOrEmpty(styleName)) { return baseName; } if (_styles.TryGetValue(styleName, out var value)) { try { return value(baseName, time); } catch { return baseName; } } return baseName; } public static string Decorate(string s, bool bold, bool italic, bool underline, bool strike, int sizePct) { StringBuilder stringBuilder = new StringBuilder(s.Length + 32); bool flag = sizePct > 0 && sizePct != 100; if (flag) { stringBuilder.Append(""); } if (bold) { stringBuilder.Append(""); } if (italic) { stringBuilder.Append(""); } if (underline) { stringBuilder.Append(""); } if (strike) { stringBuilder.Append(""); } stringBuilder.Append(s); if (strike) { stringBuilder.Append(""); } if (underline) { stringBuilder.Append(""); } if (italic) { stringBuilder.Append(""); } if (bold) { stringBuilder.Append(""); } if (flag) { stringBuilder.Append(""); } return stringBuilder.ToString(); } private static void Register() { Solid("none", null); Solid("white", "FFFFFF"); Solid("black", "111111"); Solid("red", "FF3344"); Solid("orange", "FF8800"); Solid("yellow", "FFCC00"); Solid("lime", "AAFF22"); Solid("green", "22DD55"); Solid("mint", "66FFCC"); Solid("cyan", "00CCFF"); Solid("blue", "3366FF"); Solid("purple", "9933FF"); Solid("magenta", "FF22AA"); Solid("pink", "FF66CC"); Solid("gold", "DAA520"); Solid("silver", "C0C0C0"); Gradient("fire", new string[3] { "FFEE44", "FF8800", "FF2222" }); Gradient("ice", new string[3] { "FFFFFF", "AAEEFF", "3366FF" }); Gradient("galaxy", new string[3] { "9933FF", "FF44AA", "3366FF" }); Gradient("sunset", new string[3] { "FFCC66", "FF6688", "AA33CC" }); Gradient("sunrise", new string[3] { "FFEE44", "FF88AA", "DD3344" }); Gradient("dusk", new string[3] { "FF8844", "AA44CC", "223388" }); Gradient("ocean", new string[3] { "00FFCC", "00AACC", "0044AA" }); Gradient("deepsea", new string[3] { "00CCAA", "0066AA", "112255" }); Gradient("toxic", new string[3] { "DDFF22", "55DD22", "117711" }); Gradient("candy", new string[3] { "FF66CC", "AA66FF", "66CCFF" }); Gradient("bubblegum", new string[3] { "FF77CC", "FFFFFF", "66DDFF" }); Gradient("cyberpunk", new string[3] { "00FFEE", "FF22AA", "FFEE00" }); Gradient("plasma", new string[3] { "00FFEE", "FF22AA", "FFCC00" }); Gradient("grayscale", new string[3] { "FFFFFF", "808080", "222222" }); Gradient("lava", new string[4] { "FFEE99", "FF8800", "DD2200", "660000" }); Gradient("blood", new string[3] { "660000", "DD0022", "FF4444" }); Gradient("neon", new string[3] { "AAFF22", "00FFEE", "FF22AA" }); Gradient("aurora", new string[3] { "22EE88", "00CCFF", "AA66FF" }); Gradient("sakura", new string[3] { "FFCCEE", "FF88BB", "FFCCEE" }); Gradient("royal", new string[3] { "FFD700", "8833DD", "440088" }); Gradient("rosegold", new string[3] { "FFD8B0", "FFA0A0", "DD7799" }); Gradient("forest", new string[3] { "AAFF44", "22AA33", "445522" }); Gradient("jungle", new string[3] { "AAEE44", "228833", "554422" }); Gradient("ember", new string[3] { "FFFFCC", "FFAA22", "DD3300" }); Gradient("arctic", new string[3] { "FFFFFF", "AADDFF", "5577CC" }); Gradient("cottoncandy", new string[3] { "FFCCEE", "DDBBFF", "BBDDFF" }); Gradient("tropical", new string[3] { "FFEE22", "00DDAA", "00AAFF" }); Gradient("dreamsicle", new string[3] { "FFFFEE", "FFCC88", "FF8844" }); Gradient("emerald", new string[3] { "EEFFEE", "44DD66", "117733" }); Gradient("twilight", new string[3] { "AA44CC", "FF6688", "FF9944" }); Gradient("nebula", new string[3] { "AA44FF", "FF44AA", "44CCFF" }); Gradient("watermelon", new string[3] { "55DD55", "FFFFFF", "FF3366" }); Gradient("peacock", new string[3] { "00DDCC", "0099CC", "224488" }); Gradient("chrome", new string[3] { "FFFFFF", "888899", "DDDDEE" }); Cycle("pride", new string[6] { "FF3344", "FF8800", "FFCC00", "22DD55", "3366FF", "9933FF" }); Cycle("ace", new string[4] { "111111", "808080", "FFFFFF", "800080" }); Cycle("candycane", new string[2] { "FF2233", "FFFFFF" }); Cycle("zebra", new string[2] { "111111", "FFFFFF" }); Cycle("bumblebee", new string[2] { "FFCC00", "111111" }); Cycle("pumpkin", new string[2] { "FF7700", "111111" }); Cycle("mintcookie", new string[2] { "66FFCC", "222222" }); Cycle("cyberlines", new string[2] { "00FFEE", "FF22AA" }); Cycle("rainbow", new string[8] { "FF3344", "FF8800", "FFCC00", "22DD55", "00CCFF", "3366FF", "9933FF", "FF66CC" }); Banded("canada", new string[3] { "FF0000", "FFFFFF", "FF0000" }); Banded("france", new string[3] { "0055A4", "FFFFFF", "EF4135" }); Banded("germany", new string[3] { "111111", "DD0000", "FFCC00" }); Banded("italy", new string[3] { "008C45", "FFFFFF", "CD212A" }); Banded("ireland", new string[3] { "169B62", "FFFFFF", "FF883E" }); Banded("mexico", new string[3] { "006847", "FFFFFF", "CE1126" }); Banded("netherlands", new string[3] { "AE1C28", "FFFFFF", "21468B" }); Banded("usa", new string[3] { "BB1133", "FFFFFF", "1144AA" }); Banded("argentina", new string[3] { "75AADB", "FFFFFF", "75AADB" }); Banded("spain", new string[3] { "AA151B", "F1BF00", "AA151B" }); Banded("austria", new string[3] { "C8102E", "FFFFFF", "C8102E" }); Banded("belgium", new string[3] { "111111", "FAE042", "EF3340" }); Banded("india", new string[3] { "FF9933", "FFFFFF", "138808" }); Banded("thailand", new string[3] { "ED1C24", "F4F5F8", "241D4F" }); Banded("portugal", new string[3] { "046A38", "FFFFFF", "DA291C" }); _styles["confetti"] = (string n, float _) => Flicker(n, 0f); _names.Add("confetti"); _styles["glitch"] = (string n, float _) => Glitch(n, 0f); _names.Add("glitch"); _styles["police"] = (string n, float _) => Police(n, 0f); _names.Add("police"); _styles["matrix"] = (string n, float _) => Matrix(n, 0f); _names.Add("matrix"); _styles["invisible"] = (string n, float _) => "" + n + ""; _names.Add("invisible"); } private static void Solid(string key, string hex) { if (hex == null) { _styles[key] = (string n, float _) => n; } else { _styles[key] = (string n, float _) => $"{n}"; } _names.Add(key); } private static void Gradient(string key, string[] stopHexes) { ColorRgb[] stops = new ColorRgb[stopHexes.Length]; for (int i = 0; i < stopHexes.Length; i++) { stops[i] = ParseHex(stopHexes[i]); } _styles[key] = (string n, float _) => GradientPerChar(n, stops); _names.Add(key); } private static void Cycle(string key, string[] hexes) { _styles[key] = (string n, float _) => CyclingColors(n, hexes); _names.Add(key); } private static void Banded(string key, string[] hexes) { _styles[key] = (string n, float _) => BandedColors(n, hexes); _names.Add(key); } private static string GradientPerChar(string name, ColorRgb[] stops) { if (string.IsNullOrEmpty(name) || stops.Length == 0) { return name; } StringBuilder stringBuilder = new StringBuilder(name.Length * 18); for (int i = 0; i < name.Length; i++) { float t = ((name.Length == 1) ? 0f : ((float)i / (float)(name.Length - 1))); ColorRgb c = LerpStops(stops, t); stringBuilder.Append("') .Append(name[i]) .Append(""); } return stringBuilder.ToString(); } private static string CyclingColors(string name, string[] hexes) { if (string.IsNullOrEmpty(name) || hexes.Length == 0) { return name; } StringBuilder stringBuilder = new StringBuilder(name.Length * 18); for (int i = 0; i < name.Length; i++) { stringBuilder.Append("') .Append(name[i]) .Append(""); } return stringBuilder.ToString(); } private static string BandedColors(string name, string[] hexes) { if (string.IsNullOrEmpty(name) || hexes.Length == 0) { return name; } int length = name.Length; int num = hexes.Length; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < num; i++) { int num2 = i * length / num; int num3 = (i + 1) * length / num; if (num3 > num2) { stringBuilder.Append("') .Append(name, num2, num3 - num2) .Append(""); } } return stringBuilder.ToString(); } private static string Flicker(string name, float time) { string[] array = new string[7] { "FF3344", "FF8800", "FFCC00", "22DD55", "00CCFF", "9933FF", "FF66CC" }; int seed = (int)(time * 8f); Random random = new Random(seed); StringBuilder stringBuilder = new StringBuilder(name.Length * 18); for (int i = 0; i < name.Length; i++) { stringBuilder.Append("') .Append(name[i]) .Append(""); } return stringBuilder.ToString(); } private static string Glitch(string name, float time) { string[] array = new string[4] { "FF1144", "AA00FF", "00FFEE", "FFFFFF" }; int seed = (int)(time * 12f); Random random = new Random(seed); StringBuilder stringBuilder = new StringBuilder(name.Length * 32); for (int i = 0; i < name.Length; i++) { string value = array[random.Next(array.Length)]; bool flag = random.NextDouble() < 0.18; stringBuilder.Append("'); if (flag) { stringBuilder.Append(""); } stringBuilder.Append(name[i]); if (flag) { stringBuilder.Append(""); } stringBuilder.Append(""); } return stringBuilder.ToString(); } private static string Police(string name, float time) { bool flag = (int)(time * 3f) % 2 == 0; StringBuilder stringBuilder = new StringBuilder(name.Length * 18); for (int i = 0; i < name.Length; i++) { string value = (((i % 2 == 0) ^ flag) ? "FF1133" : "1144FF"); stringBuilder.Append("') .Append(name[i]) .Append(""); } return stringBuilder.ToString(); } private static string Matrix(string name, float time) { int seed = (int)(time * 5f); Random random = new Random(seed); StringBuilder stringBuilder = new StringBuilder(name.Length * 18); for (int i = 0; i < name.Length; i++) { double num = random.NextDouble(); string value = ((!(num < 0.05)) ? ((!(num < 0.7)) ? "008822" : "00FF44") : "FFFFFF"); stringBuilder.Append("') .Append(name[i]) .Append(""); } return stringBuilder.ToString(); } private static ColorRgb ParseHex(string hex) { if (string.IsNullOrEmpty(hex) || hex.Length < 6) { return new ColorRgb(1f, 1f, 1f); } int num = int.Parse(hex.Substring(0, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture); int num2 = int.Parse(hex.Substring(2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture); int num3 = int.Parse(hex.Substring(4, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture); return new ColorRgb((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f); } private static string HexFrom(ColorRgb c) { int value = Mathf.Clamp((int)(c.R * 255f + 0.5f), 0, 255); int value2 = Mathf.Clamp((int)(c.G * 255f + 0.5f), 0, 255); int value3 = Mathf.Clamp((int)(c.B * 255f + 0.5f), 0, 255); return $"{value:X2}{value2:X2}{value3:X2}"; } private static ColorRgb Lerp(ColorRgb a, ColorRgb b, float t) { return new ColorRgb(a.R + (b.R - a.R) * t, a.G + (b.G - a.G) * t, a.B + (b.B - a.B) * t); } private static ColorRgb LerpStops(ColorRgb[] stops, float t) { if (stops.Length == 0) { return new ColorRgb(1f, 1f, 1f); } if (stops.Length == 1) { return stops[0]; } t = Mathf.Clamp01(t); float num = t * (float)(stops.Length - 1); int num2 = (int)Math.Floor(num); if (num2 >= stops.Length - 1) { return stops[^1]; } return Lerp(stops[num2], stops[num2 + 1], num - (float)num2); } } } namespace SledNameStyler.Util { internal static class Refl { private static readonly Dictionary _typeCache = new Dictionary(); private static bool _loggedAssemblies = false; private static MethodInfo _il2cppCastGeneric; public static Type FindType(string assemblyHint, string fullName) { if (_typeCache.TryGetValue(fullName, out var value)) { return value; } try { string[] array = new string[2] { fullName, "Il2Cpp." + fullName }; string[] array2 = new string[3] { assemblyHint, "Il2Cpp" + assemblyHint, assemblyHint + "-firstpass" }; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { string name = assembly.GetName().Name; string[] array3 = array2; foreach (string text in array3) { if (name != text) { continue; } string[] array4 = array; foreach (string name2 in array4) { Type type = assembly.GetType(name2); if (type != null) { _typeCache[fullName] = type; return type; } } } } Assembly[] assemblies2 = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies2) { string[] array5 = array; foreach (string name3 in array5) { Type type2; try { type2 = assembly2.GetType(name3); } catch { continue; } if (type2 != null) { _typeCache[fullName] = type2; return type2; } } } Assembly[] assemblies3 = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly3 in assemblies3) { Type[] types; try { types = assembly3.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = ex.Types; } catch { continue; } string text2 = fullName; int num = fullName.LastIndexOf('.'); if (num >= 0 && num < fullName.Length - 1) { text2 = fullName.Substring(num + 1); } Type[] array6 = types; foreach (Type type3 in array6) { if (!(type3 == null) && (type3.FullName == fullName || type3.FullName == "Il2Cpp." + fullName || (type3.FullName != null && type3.FullName.EndsWith("." + fullName)) || type3.Name == fullName || type3.Name == text2)) { _typeCache[fullName] = type3; SafeLog.Info($"Refl.FindType: '{fullName}' resolved via full scan as '{type3.FullName}' in {assembly3.GetName().Name}"); return type3; } } } if (!_loggedAssemblies) { SafeLog.Warn("Refl.FindType: '" + fullName + "' not found. Loaded assemblies:"); Assembly[] assemblies4 = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly4 in assemblies4) { SafeLog.Warn(" - " + assembly4.GetName().Name); } _loggedAssemblies = true; } return null; } catch (Exception ex2) { SafeLog.Error($"Refl.FindType({assemblyHint},{fullName})", ex2); return null; } } public static object CastToIl2Cpp(object obj, Type targetType) { if (obj == null || targetType == null) { return null; } if (targetType.IsInstanceOfType(obj)) { return obj; } try { if (_il2cppCastGeneric == null) { Type type = FindType("Il2CppInterop.Runtime", "Il2CppInterop.Runtime.InteropTypes.Il2CppObjectBase"); if (type == null) { type = obj.GetType(); } while (type != null) { MethodInfo method = type.GetMethod("Cast", BindingFlags.Instance | BindingFlags.Public); if (method != null && method.IsGenericMethodDefinition) { _il2cppCastGeneric = method; break; } type = type.BaseType; } } if (_il2cppCastGeneric == null) { return null; } MethodInfo methodInfo = _il2cppCastGeneric.MakeGenericMethod(targetType); return methodInfo.Invoke(obj, null); } catch (Exception ex) { SafeLog.Error("Refl.CastToIl2Cpp(" + targetType.FullName + ")", ex); return null; } } } internal static class SafeLog { private static Instance _logger; private static readonly LinkedList _ring = new LinkedList(); private const int RingMax = 200; public static IEnumerable Recent => _ring; public static void Bind(Instance logger) { _logger = logger; } public static void Info(string msg) { Instance logger = _logger; if (logger != null) { logger.Msg(msg); } Push("INFO " + msg); } public static void Warn(string msg) { Instance logger = _logger; if (logger != null) { logger.Warning(msg); } Push("WARN " + msg); } public static void Error(string msg, Exception ex = null) { if (_logger != null) { if (ex != null) { _logger.Error($"{msg}: {ex.GetType().Name}: {ex.Message}\n{ex.StackTrace}"); } else { _logger.Error(msg); } } Push("ERROR " + ((ex != null) ? (msg + ": " + ex.Message) : msg)); } private static void Push(string line) { _ring.AddLast(line); while (_ring.Count > 200) { _ring.RemoveFirst(); } } } } namespace SledNameStyler.Menu { internal sealed class StyleMenu { private const int W = 580; private const int H = 720; private Vector2 _styleScroll; private string _nameDraft = ""; private static readonly Regex _stripUnsupported = new Regex("]*>", RegexOptions.Compiled); private static GUIStyle _label; private static GUIStyle _header; private static GUIStyle _btn; private static GUIStyle _btnSel; private static GUIStyle _tf; private static GUIStyle _preview; private static GUIStyle _help; private static Texture2D _bgTex; private CursorLockMode _savedLock; private bool _savedCursorVis; private bool _cursorOverridden; public static StyleMenu Instance { get; } = new StyleMenu(); public bool Visible { get; private set; } public void Toggle() { Visible = !Visible; if (Visible) { OnShow(); } else { OnHide(); } } public void Hide() { if (Visible) { Visible = false; OnHide(); } } private void OnShow() { //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) try { if (!_cursorOverridden) { _savedLock = Cursor.lockState; _savedCursorVis = Cursor.visible; _cursorOverridden = true; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; _nameDraft = Mod.NameOverride ?? ""; } catch { } } private void OnHide() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) try { if (_cursorOverridden) { Cursor.lockState = _savedLock; Cursor.visible = _savedCursorVis; _cursorOverridden = false; } Mod.SaveNow(); } catch { } } public void Render() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Invalid comparison between Unknown and I4 //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Invalid comparison between Unknown and I4 if (!Visible) { return; } try { EnsureStyles(); int num = Mathf.Max(8, (Screen.width - 580) / 2); Rect val = default(Rect); ((Rect)(ref val))..ctor((float)num, 8f, 580f, 720f); GUI.DrawTexture(val, (Texture)(object)_bgTex); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 14f, ((Rect)(ref val)).width - 28f, ((Rect)(ref val)).height - 28f)); try { RenderHeader(); GUILayout.Space(4f); RenderStatus(); GUILayout.Space(6f); RenderNameField(); GUILayout.Space(6f); RenderPreview(); GUILayout.Space(6f); RenderStyleList(); GUILayout.Space(6f); RenderModifiers(); GUILayout.Space(4f); RenderFontEffects(); GUILayout.Space(4f); RenderSliders(); GUILayout.Space(6f); RenderApplyRow(); GUILayout.Space(4f); RenderEnableToggle(); GUILayout.Space(4f); GUILayout.Label("F11: open/close menu · F12: toggle on/off · Esc: close", _help, (Il2CppReferenceArray)null); } finally { GUILayout.EndArea(); } if (Event.current != null && (int)Event.current.type == 4 && (int)Event.current.keyCode == 27) { Hide(); Event.current.Use(); } } catch (Exception ex) { SafeLog.Error("StyleMenu.Render", ex); } } private void RenderHeader() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_003b: 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) GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label("SledNameStyler v0.2.0", _header, (Il2CppReferenceArray)null); GUILayout.FlexibleSpace(); Color color = GUI.color; GUI.color = (Mod.IsEnabled ? new Color(0f, 1f, 0.4f) : new Color(1f, 0.4f, 0.4f)); GUILayout.Label(Mod.IsEnabled ? "[ON]" : "[OFF]", _header, (Il2CppReferenceArray)null); GUI.color = color; GUILayout.EndHorizontal(); } private void RenderStatus() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) string text; Color color = default(Color); switch (Mod.Status) { case Mod.ApplyStatus.Applied: text = "● APPLYING — your name is styled in-game right now"; ((Color)(ref color))..ctor(0f, 1f, 0.4f); break; case Mod.ApplyStatus.Disabled: text = "○ DISABLED — press F12 or the Enable button below"; ((Color)(ref color))..ctor(1f, 0.4f, 0.4f); break; default: text = "… WAITING — join a lobby (or set a custom name) to apply"; ((Color)(ref color))..ctor(1f, 0.85f, 0.3f); break; } Color color2 = GUI.color; GUI.color = color; GUILayout.Label(text, _label, (Il2CppReferenceArray)null); GUI.color = color2; string text2 = (Mod.HasOriginal ? ("Real username: " + Mod.OriginalName) : "Real username: (not captured yet)"); GUILayout.Label(text2, _help, (Il2CppReferenceArray)null); } private void RenderApplyRow() { GUILayout.BeginHorizontal((Il2CppReferenceArray)null); if (GUILayout.Button("Apply now", _btn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(28f) })) { Mod.ForceApply(); } if (GUILayout.Button("Re-read real name", _btn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(180f), GUILayout.Height(28f) })) { Mod.RecaptureOriginal(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } private void RenderNameField() { GUILayout.Label("Custom name (empty = use your real username):", _label, (Il2CppReferenceArray)null); string text = GUILayout.TextField(_nameDraft ?? "", _tf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(544f) }); if (text != _nameDraft) { _nameDraft = text; Mod.NameOverride = _nameDraft; } } private void RenderPreview() { string s = (string.IsNullOrEmpty(_nameDraft) ? "PreviewName" : NameStyler.StripMarkup(_nameDraft)); string s2 = TextTransform.Apply(s, Mod.Transform); string baseName = NameDecoration.Apply(s2, Mod.Decoration); string s3 = NameStyler.Render(baseName, Mod.CurrentStyle, Time.time * Mathf.Max(Mod.AnimSpeed, 0.01f)); string input = NameStyler.Decorate(s3, Mod.Bold, Mod.Italic, Mod.Underline, Mod.Strike, Mod.SizePct); string text = _stripUnsupported.Replace(input, ""); GUILayout.Label(text, _preview, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(544f), GUILayout.Height(54f) }); } private void RenderModifiers() { CyclePicker("Letters", TextTransform.Names, Mod.Transform, delegate(string v) { Mod.Transform = v; }); CyclePicker("Wrap", NameDecoration.Names, Mod.Decoration, delegate(string v) { Mod.Decoration = v; }); CyclePicker("Glow", NameGlow.Names, Mod.Glow, delegate(string v) { Mod.Glow = v; }); } private void CyclePicker(string label, IReadOnlyList options, string current, Action set) { if (options.Count == 0) { return; } int num = 0; for (int i = 0; i < options.Count; i++) { if (string.Equals(options[i], current, StringComparison.OrdinalIgnoreCase)) { num = i; break; } } GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label(label, _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) }); if (GUILayout.Button("◀", _btn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(34f) })) { set(options[(num - 1 + options.Count) % options.Count]); } GUILayout.Label(options[num], _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); if (GUILayout.Button("▶", _btn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(34f) })) { set(options[(num + 1) % options.Count]); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } private void RenderStyleList() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) GUILayout.Label("Style: " + Mod.CurrentStyle, _label, (Il2CppReferenceArray)null); _styleScroll = GUILayout.BeginScrollView(_styleScroll, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(544f), GUILayout.Height(220f) }); try { IReadOnlyList styleNames = NameStyler.StyleNames; for (int i = 0; i < styleNames.Count; i++) { string text = styleNames[i]; bool flag = string.Equals(text, Mod.CurrentStyle, StringComparison.OrdinalIgnoreCase); if (GUILayout.Button((flag ? "● " : " ") + text, flag ? _btnSel : _btn, Array.Empty())) { Mod.CurrentStyle = text; } } } finally { GUILayout.EndScrollView(); } } private void RenderFontEffects() { GUILayout.BeginHorizontal((Il2CppReferenceArray)null); ToggleBtn("Bold", Mod.Bold, delegate(bool v) { Mod.Bold = v; }); ToggleBtn("Italic", Mod.Italic, delegate(bool v) { Mod.Italic = v; }); ToggleBtn("Underline", Mod.Underline, delegate(bool v) { Mod.Underline = v; }); ToggleBtn("Strike", Mod.Strike, delegate(bool v) { Mod.Strike = v; }); GUILayout.EndHorizontal(); } private void ToggleBtn(string label, bool value, Action set) { GUIStyle val = (value ? _btnSel : _btn); if (GUILayout.Button(label + (value ? " ●" : " ○"), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(124f) })) { set(!value); } } private void RenderSliders() { SliderRow("Size %", Mod.SizePct, 50, 250, 10, delegate(int v) { Mod.SizePct = v; }, (int v) => v + "%"); SliderRow("Anim ×", Mathf.RoundToInt(Mod.AnimSpeed * 10f), 1, 50, 1, delegate(int v) { Mod.AnimSpeed = (float)v / 10f; }, (int v) => ((float)v / 10f).ToString("0.0") + "×"); } private void SliderRow(string label, int value, int min, int max, int step, Action set, Func fmt) { GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label(label, _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) }); if (GUILayout.Button("-", _btn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) })) { set(Mathf.Max(min, value - step)); } GUILayout.Label(fmt(value), _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); if (GUILayout.Button("+", _btn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) })) { set(Mathf.Min(max, value + step)); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } private void RenderEnableToggle() { string text = (Mod.IsEnabled ? "Disable styling (use real username)" : "Enable styling"); if (GUILayout.Button(text, _btn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(544f), GUILayout.Height(28f) })) { Mod.IsEnabled = !Mod.IsEnabled; } } private static void EnsureStyles() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_006d: 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_007f: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_012a: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01b3: 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_01ca: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) if (_label == null) { Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.85f, 0.95f, 0.85f); Color textColor2 = default(Color); ((Color)(ref textColor2))..ctor(0f, 1f, 0.4f); GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 14, fontStyle = (FontStyle)1, richText = true }; val.normal.textColor = textColor; _label = new GUIStyle(val); _header = new GUIStyle(val) { fontSize = 18 }; _header.normal.textColor = textColor2; _help = new GUIStyle(val) { fontSize = 11, fontStyle = (FontStyle)2 }; _help.normal.textColor = new Color(0.7f, 0.85f, 0.7f); _btn = new GUIStyle(GUI.skin.button) { fontSize = 13, fontStyle = (FontStyle)1, richText = true }; _btnSel = new GUIStyle(_btn); _btnSel.normal.textColor = textColor2; _btnSel.hover.textColor = textColor2; _btnSel.active.textColor = textColor2; _tf = new GUIStyle(GUI.skin.textField) { fontSize = 14, richText = false }; _tf.normal.textColor = Color.white; _preview = new GUIStyle(val) { fontSize = 22, alignment = (TextAnchor)4 }; _preview.normal.textColor = Color.white; _bgTex = new Texture2D(1, 1); _bgTex.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.82f)); _bgTex.Apply(); } } } }