Decompiled source of DailySeeds v0.2.1
DailySeeds/DailySeeds.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DailySeeds.Core; using DailySeeds.Determinism; using DailySeeds.Integrity; using DailySeeds.Net; using DailySeeds.Run; using DailySeeds.UI; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using Steamworks; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.1.0")] [assembly: AssemblyInformationalVersion("0.2.1+d0e08cc532c42a976cd13a1cc022b2f0e59400e8")] [assembly: AssemblyProduct("Daily and weekly seeded runs with a shared leaderboard")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DailySeeds { public static class DailySeedsApi { public const int Version = 1; public static bool SeededRunActive { get { if (!RunContext.Active && RunContext.Pending == null) { return RunContext.PendingResume != null; } return true; } } public static string RunSeed { get { object obj = RunContext.Current?.RunSeed; if (obj == null) { obj = RunContext.Pending?.RunSeed; if (obj == null) { RunRecord pendingResume = RunContext.PendingResume; if (pendingResume == null) { return null; } obj = pendingResume.RunSeed; } } return (string)obj; } } } public static class ModInfo { public const string Guid = "dailyseeds.cu"; public const string Name = "Daily Seeds"; public const string Version = "0.2.1"; public const int DeterminismVersion = 3; } [BepInPlugin("dailyseeds.cu", "Daily Seeds", "0.2.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static RunTracker Tracker; internal static ConfigEntry<string> SeedSalt; internal static ConfigEntry<string> SeedOverride; internal static ConfigEntry<bool> IgnoreAttemptLimit; internal static ConfigEntry<bool> AllowIncompatibleMods; internal static ConfigEntry<bool> DumpEntities; internal static ConfigEntry<bool> ShowHud; internal static ConfigEntry<float> LoadoutGraceSeconds; internal static ConfigEntry<bool> VerboseLog; internal static ConfigEntry<bool> ConsoleOutput; internal static ConfigEntry<string> MenuButtonPlacement; internal static ConfigEntry<bool> ServerEnabled; internal static ConfigEntry<string> ServerUrl; private void Awake() { //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01db: 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) Log = ((BaseUnityPlugin)this).Logger; ServerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Server", "Enabled", true, "Use the leaderboard server for seeds and results. Off = every run is offline (local seed, unranked)."); ServerUrl = ((BaseUnityPlugin)this).Config.Bind<string>("Server", "Url", "https://dailyseeds.dailyseeds-server.workers.dev", "Leaderboard server address."); SeedSalt = ((BaseUnityPlugin)this).Config.Bind<string>("Seeds", "LocalSalt", "dailyseeds-dev", "Salt for offline seeds (server unreachable or disabled). Online runs get their seed from the server."); SeedOverride = ((BaseUnityPlugin)this).Config.Bind<string>("Debug", "SeedOverride", "", "If not empty, this text is hashed into the run seed instead of the period id. For determinism testing."); IgnoreAttemptLimit = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "IgnoreAttemptLimit", false, "Allow more than one daily attempt per difficulty locally. For testing only: the server still allows one ranked attempt."); AllowIncompatibleMods = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "AllowIncompatibleMods", false, "Let seeded runs start while a mod known to break seeded worlds is installed, to test compatibility. Such runs are never ranked: the server marks those mods as banned."); DumpEntities = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DumpEntities", false, "Write the sorted entity list of every generated layer to BepInEx/DailySeeds for diffing."); LoadoutGraceSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Run", "LoadoutGraceSeconds", 30f, "In-game seconds after the first layer is generated before the settled loadout snapshot is taken."); VerboseLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "VerboseLog", false, "Detailed trace (generation stages, snapshots, storage, server calls) in the log and the in-game console."); ConsoleOutput = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "ConsoleOutput", true, "Mirror the mod's messages to the in-game console."); ShowHud = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowHud", true, "Show the seeded-run label during gameplay."); MenuButtonPlacement = ((BaseUnityPlugin)this).Config.Bind<string>("UI", "MenuButtonRect", "", "Seeded-runs button on the main menu panorama: 'layer;x;y;width;height' in parallax-layer units. Empty = default position."); Harmony val = new Harmony("dailyseeds.cu"); val.PatchAll(typeof(Plugin).Assembly); StartMethodSeeder.PatchAll(val); GameObject val2 = new GameObject("DailySeedsRunner") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val2); Tracker = val2.AddComponent<RunTracker>(); val2.AddComponent<RunHud>(); val2.AddComponent<ServerClient>(); SceneManager.sceneUnloaded += OnSceneUnloaded; if (ConsoleScript.Commands.Count > 0) { DebugCommands.Register(); } ForeignSeedWatcher.Install(); Log.LogInfo((object)"Daily Seeds 0.2.1 loaded"); } private static void OnSceneUnloaded(Scene scene) { if (RunContext.Active && RunContext.InWorld && ((Scene)(ref scene)).handle == RunContext.WorldSceneHandle) { Tracker.OnLeavingRun(); } } } } namespace DailySeeds.UI { internal sealed class ArrowScroll : MonoBehaviour { private const float ArrowSpace = 34f; private const float WheelStep = 60f; private RectTransform _viewport; private Button _up; private Button _down; private float _offset; public RectTransform Content { get; private set; } private float Overflow { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) LayoutRebuilder.ForceRebuildLayoutImmediate(Content); Rect rect = Content.rect; float height = ((Rect)(ref rect)).height; rect = _viewport.rect; return Mathf.Max(0f, height - ((Rect)(ref rect)).height); } } public void Build() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0057: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) RectTransform parent = (RectTransform)((Component)this).transform; _viewport = UiKit.Rect("Viewport", (Transform)(object)parent).Stretch(0f, 0f, 34f, 34f); ((Component)_viewport).gameObject.AddComponent<RectMask2D>(); ((Graphic)((Component)_viewport).gameObject.AddComponent<Image>()).color = Color.clear; Content = UiKit.Rect("Content", (Transform)(object)_viewport); Content.anchorMin = new Vector2(0f, 1f); Content.anchorMax = new Vector2(1f, 1f); Content.pivot = new Vector2(0.5f, 1f); RectTransform content = Content; Vector2 offsetMin = (Content.offsetMax = Vector2.zero); content.offsetMin = offsetMin; VerticalLayoutGroup obj = ((Component)Content).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).spacing = 14f; ((Component)Content).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; _up = Arrow(parent, "Up", new Vector2(0.5f, 1f), 0f, -1f); _down = Arrow(parent, "Down", new Vector2(0.5f, 0f), 180f, 1f); } private Button Arrow(RectTransform parent, string name, Vector2 anchor, float rotation, float direction) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004f: Expected O, but got Unknown //IL_0060: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) Image background; Button obj = UiKit.Panel((Transform)(object)parent, name, delegate { Scroll(direction * 60f * 2f); }, out background); UiKit.Place((RectTransform)((Component)obj).transform, anchor, Vector2.zero, new Vector2(120f, 28f)); Image obj2 = UiKit.Image(((Component)obj).transform, "Arrow", UiKit.Triangle, UiKit.Gold); ((Graphic)obj2).rectTransform.Place(new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(28f, 16f)); ((Graphic)obj2).rectTransform.pivot = new Vector2(0.5f, 0.5f); ((Transform)((Graphic)obj2).rectTransform).localRotation = Quaternion.Euler(0f, 0f, rotation); return obj; } public void ResetToTop() { _offset = 0f; Apply(); } private void Scroll(float delta) { _offset += delta; Apply(); } private void Apply() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) float overflow = Overflow; _offset = Mathf.Clamp(_offset, 0f, overflow); Content.anchoredPosition = new Vector2(0f, _offset); ((Component)_up).gameObject.SetActive(_offset > 0.5f); ((Component)_down).gameObject.SetActive(_offset < overflow - 0.5f); } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) float y = Input.mouseScrollDelta.y; if (y != 0f && RectTransformUtility.RectangleContainsScreenPoint(_viewport, Vector2.op_Implicit(Input.mousePosition), (Camera)null)) { _offset -= y * 60f; } Apply(); } } [HarmonyPatch] internal static class DebugCommands { [CompilerGenerated] private static class <>O { public static Action <0>__Execute; } private const string Name = "dr"; private static readonly (string sub, string help)[] Subs = new(string, string)[13] { ("help", "List the subcommands."), ("status", "Current period, menu difficulty, armed and active seeded run."), ("seed", "Run seed and current layer seed."), ("hash", "Tile hash of the current world right now."), ("layers", "Fingerprints and stage hashes of the layers of the active run."), ("attempts", "List the local daily attempts."), ("reset", "reset daily | reset all: forget local daily attempts (today / everything)."), ("cancel", "Drop an armed seeded run that has not started yet."), ("qol", "QoL Unknown: every qol.* game setting with its value, and its seeded-run state."), ("world", "Mod world settings registered through CUCoreLib, with current and default values."), ("menu", "menu open | layers | edit | reset: seeded-run screen and the panorama button placement."), ("verbose", "verbose on|off: detailed trace in the console and log."), ("console", "console on|off: mirror the mod's messages to this console.") }; [HarmonyPatch(typeof(ConsoleScript), "RegisterAllCommands")] [HarmonyPostfix] private static void RegisterPostfix() { Register(); } public static void Register() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown if (ConsoleScript.SearchExact("dr") == null) { Dictionary<int, List<string>> dictionary = new Dictionary<int, List<string>> { [0] = Subs.Select(((string sub, string help) s) => s.sub).ToList(), [1] = new List<string> { "daily", "all", "on", "off", "open", "layers", "edit", "reset" } }; List<Command> commands = ConsoleScript.Commands; object obj = <>O.<0>__Execute; if (obj == null) { Action val = Execute; <>O.<0>__Execute = val; obj = (object)val; } commands.Add(new Command("dr", "Daily Seeds debug commands. 'dr help' lists them.", (Action)obj, dictionary, new(string, string)[2] { ("subcommand", "help, status, seed, hash, layers, attempts, reset, cancel, menu, verbose, console"), ("value", "Argument of the subcommand.") })); } } private static void Execute(string[] args) { string text = ((args.Length > 1) ? args[1].ToLowerInvariant() : "help"); string text2 = ((args.Length > 2) ? args[2].ToLowerInvariant() : null); switch (text) { case "help": { (string, string)[] subs = Subs; for (int i = 0; i < subs.Length; i++) { (string, string) tuple = subs[i]; DebugLog.Reply("dr " + tuple.Item1 + " - " + tuple.Item2); } break; } case "status": Status(); break; case "seed": if (!RunContext.Active) { DebugLog.Reply("No active seeded run."); } else { DebugLog.Reply("run seed " + RunContext.Current.RunSeed + ", layer seed " + SeedMath.ToHex(RunContext.LayerSeed)); } break; case "hash": DebugLog.Reply(((Object)(object)WorldGeneration.world != (Object)null) ? ("blocks=" + WorldFingerprint.HashBlocks(WorldGeneration.world) + " fluid=" + WorldFingerprint.HashFluid()) : "No world loaded."); break; case "layers": Layers(); break; case "attempts": { List<string> list2 = RunStorage.ListAttempts(); DebugLog.Reply((list2.Count == 0) ? "No daily attempts recorded." : ("Attempts: " + string.Join(", ", list2))); break; } case "reset": Reset(text2); break; case "menu": Menu(text2); break; case "world": { if (!WorldSettingsProbe.Available) { DebugLog.Reply("No CUCoreLib world settings (CUCoreLib 1.2+ not installed)."); break; } List<WorldSettingsProbe.Entry> list = WorldSettingsProbe.Describe(); DebugLog.Reply($"World settings: {list.Count}"); { foreach (WorldSettingsProbe.Entry item in list) { DebugLog.Reply(" " + item.Id + " = " + item.Value + " (default " + item.Default + ") " + item.Name); } break; } } case "qol": Qol(); break; case "cancel": if (RunContext.Pending == null) { DebugLog.Reply("Nothing armed."); } else { RunStarter.Cancel(); } break; case "verbose": Toggle(Plugin.VerboseLog, text2, "Verbose log"); break; case "console": Toggle(Plugin.ConsoleOutput, text2, "Console output"); break; default: DebugLog.Reply("Unknown subcommand '" + text + "'. Try 'dr help'."); break; } } private static void Qol() { DebugLog.Reply(QolSeedProbe.TryRead(out var seeded, out var seed) ? $"QoL seed state: seeded={seeded}, seed={seed}" : "QoL seed state: not readable (QoL not loaded?)"); int num = 0; foreach (Setting item in Settings.settings ?? new List<Setting>()) { if (item == null || item.name == null || !item.name.StartsWith("qol.", StringComparison.Ordinal)) { continue; } SettingBool val = (SettingBool)(object)((item is SettingBool) ? item : null); string text; if (val == null) { SettingInt val2 = (SettingInt)(object)((item is SettingInt) ? item : null); if (val2 == null) { SettingDropdown val3 = (SettingDropdown)(object)((item is SettingDropdown) ? item : null); if (val3 == null) { SettingFloat val4 = (SettingFloat)(object)((item is SettingFloat) ? item : null); text = ((val4 == null) ? ("(" + ((object)item).GetType().Name + ")") : val4.value.ToString(CultureInfo.InvariantCulture)); } else { text = val3.value.ToString(); } } else { text = val2.value.ToString(); } } else { text = val.value.ToString(); } DebugLog.Reply(" " + item.name + " = " + text); num++; } DebugLog.Reply($"QoL settings: {num}"); } private static void Status() { DateTime utcNow = DateTime.UtcNow; DebugLog.Reply($"Daily {SeedSchedule.ForInstant(RunMode.Daily, utcNow).Id}, Weekly {SeedSchedule.ForInstant(RunMode.Weekly, utcNow).Id} (UTC {utcNow:yyyy-MM-dd HH:mm})"); DebugLog.Reply(string.Format("Server: {0}, unsent messages {1}, ", ServerClient.Enabled ? Plugin.ServerUrl.Value : "disabled", ServerClient.Pending) + "Steam " + (SteamTicket.Available ? "ok" : "not running") + ((RunContext.Current != null) ? (", run " + (RunContext.Current.Offline ? "offline" : RunContext.Current.ServerRunId)) : "") + ((RunContext.Pending != null) ? (", armed " + (RunContext.Pending.Offline ? "offline" : RunContext.Pending.ServerRunId)) : "")); if ((Object)(object)PreRunScript.instance != (Object)null) { string mismatch; string text = RunStarter.MenuDifficulty(out mismatch); DebugLog.Reply("Menu difficulty: " + ((text != null) ? (Difficulty.DisplayName(text) + " (" + text + ")") : ("custom - " + mismatch))); } DebugLog.Reply($"Multiplayer: installed={MultiplayerProbe.TogetherInstalled}, session={MultiplayerProbe.SessionRunning()}, client={MultiplayerProbe.IsClientInSession()}"); List<string> list = IncompatibleMods.DetectLoaded(); DebugLog.Reply("Incompatible mods: " + ((list.Count > 0) ? string.Join("; ", list) : "none")); List<string> list2 = PreparedModDetector.DetectLoaded(); DebugLog.Reply("Prepared mods: " + ((list2.Count > 0) ? string.Join(", ", list2) : "none")); if (RunContext.Pending != null) { DebugLog.Reply($"Armed: {RunContext.Pending.Mode} {RunContext.Pending.PeriodId}/{RunContext.Pending.Difficulty}, seed {RunContext.Pending.RunSeed}"); } if (RunContext.PendingResume != null) { DebugLog.Reply("Resume pending: " + RunContext.PendingResume.PeriodId + "/" + RunContext.PendingResume.Difficulty); } if (!RunContext.Active) { DebugLog.Reply("Active: none"); return; } RunRecord current = RunContext.Current; DebugLog.Reply($"Active: {current.Mode} {current.PeriodId}/{current.Difficulty}, seed {current.RunSeed}, layers {current.Layers.Count}, max depth {current.MaxDepthMeters:0} m, outcome {current.Outcome}"); DebugLog.Reply(string.Format("Flags: MP={0} cheats={1} settingsModified={2} subcategory={3}", current.Integrity.MultiplayerDetected, current.Integrity.CheatsUsed, current.Integrity.RunSettingsModified, current.Subcategory ?? "-")); DebugLog.Reply($"Saves: suspends={current.Suspends} loads={current.SaveLoads} modsChanged={current.Integrity.ModsChangedOnResume} afterPeriodEnd={current.Integrity.ResumedAfterPeriodEnd} restoredCopy={current.Integrity.SaveRestoreSuspected}"); foreach (ResumeEntry resume in current.Resumes) { DebugLog.Reply($" resume {resume.Utc:yyyy-MM-dd HH:mm} #{resume.Suspends}: " + ((resume.Notes.Count == 0) ? "ok" : string.Join("; ", resume.Notes))); } } private static void Layers() { if (!RunContext.Active || RunContext.Current.Layers.Count == 0) { DebugLog.Reply("No layers recorded."); return; } foreach (LayerEntry layer in RunContext.Current.Layers) { DebugLog.Reply($"L{layer.BiomeDepth} seed={layer.LayerSeed} blocks={layer.BlocksHash} entities={layer.EntitiesHash} names={layer.EntityNamesHash} ({layer.EntityCount})"); foreach (string stage in layer.Stages) { DebugLog.Reply(" " + stage); } } } private static void Reset(string scope) { if (!(scope == "daily")) { if (scope == "all") { int num = RunStorage.ResetAttempts(null); DebugLog.Info($"Reset all daily attempts ({num} removed)."); } else { DebugLog.Reply("Usage: dr reset daily | dr reset all"); } } else { int num = RunStorage.ResetAttempts(SeedSchedule.Current(RunMode.Daily).Id + "/"); DebugLog.Info($"Reset today's daily attempts ({num} removed)."); } } private static void Toggle(ConfigEntry<bool> entry, string value, string label) { switch (value) { case "on": entry.Value = true; break; case "off": entry.Value = false; break; default: DebugLog.Reply("Use on or off."); return; case null: break; } DebugLog.Reply(label + ": " + (entry.Value ? "ON" : "OFF")); } private static void Menu(string value) { switch (value) { case "open": if ((Object)(object)SeedMenuScreen.Instance == (Object)null) { DebugLog.Reply("Open the main menu first."); } else { SeedMenuScreen.Open(); } break; case "layers": SeedMenuButton.DumpLayers(); break; case "edit": SeedMenuButton.ToggleEdit(); break; case "reset": SeedMenuButton.ResetPlacement(); break; default: DebugLog.Reply("dr menu open | layers | edit | reset"); break; } } } internal static class GuideText { public const string LeaderboardUrl = "https://dailyseeds.dailyseeds-server.workers.dev/leaderboard"; public static readonly (string title, string body)[] Sections = new(string, string)[11] { ("Daily Seeds", "Every player gets the same world and competes on one leaderboard.\n<color=#ffc300>Daily</color>: a new world every day (UTC). One attempt per difficulty.\n<color=#ffc300>Weekly</color>: a new world every Monday (UTC). Unlimited attempts, your best run counts."), ("How to play", "Pick a mode and a difficulty, press Next, choose your character and press Start.\nEach difficulty (Tough, Relaxed, Paradise, Desolate, Unchipped, Endless) has its own world and its own leaderboard. You can select a difficulty you already played today to look at its leaderboard; only starting it is blocked.\nClick a leaderboard row to see the mods and layers of that run."), ("Score", "+10 per metre on the way down (layers 1 to 10).\n+20000 for finishing layer 10 and starting the climb back up.\n+2000 for reaching an ending (the credits).\n-1 per second of in-game time. The game's own time skip is allowed and counts as in-game time.\nIn Endless, depth is everything. Equal scores go to whoever finished first."), ("Saving and continuing", "Use the normal save and exit at the end of a layer to continue later, with the vanilla Continue button or the Continue card on the seeded-run screen.\nContinue before the period ends and with the same mods. Loading an older copy of the save, or changing mods in between, makes the run unranked."), ("Leaderboards", "Every result lands on exactly one board, chosen in this order:\n1. <color=#ffc300>Solo or Multiplayer</color>: runs played in a Casualties Together session have their own boards.\n2. <color=#ffc300>Daily or Weekly</color>.\n3. <color=#ffc300>Vanilla, Prepared or Modded</color>. Vanilla: no mods that change the game (libraries and approved fixes are fine). Prepared: loadout mods that change your starting gear. Modded: any other gameplay mod, even together with a loadout mod. Mods the server does not know yet count as Modded until they are reviewed.\n4. <color=#ffc300>Difficulty</color>.\nDaily attempts are counted separately for solo and multiplayer.\nQoL Unknown is required: it generates the seeded world. With its default options the run stays Vanilla; its gameplay options put the run on the Modded boards."), ("Fair play", "A run is not ranked if cheats or console commands that disable achievements were used, if multiplayer cheats (the lobby rule sv_cheats) were on, if the run settings differ from the chosen preset, if an older save was loaded, or if mods or game files changed during the run. Suspicious results can be removed by moderation."), ("Multiplayer", "The host starts the seeded run from this screen, then launches it from the lobby as usual. Players who join do not need Daily Seeds. The run is recorded once, for the host."), ("Offline", "If the leaderboard server cannot be reached, you can still play the period offline. Offline runs use a local world and are never ranked."), ("Game updates", "If a game update changes how worlds are generated, the running leaderboards close and new ones start, with fresh Daily attempts. Updates that do not touch world generation change nothing."), ("Data sent to the server", "Your SteamID, to confirm the game is yours. It is never shown.\nYour Steam name and avatar, shown on the leaderboard.\nThe list of installed mods (name, version, file hash), the game version, the run statistics and a fingerprint of each generated layer.\nNothing else is collected."), ("Leaderboard on the web", "<color=#ffc300>https://dailyseeds.dailyseeds-server.workers.dev/leaderboard</color>") }; } internal sealed class LeaderboardPanel : MonoBehaviour { private const int MaxRows = 12; private const float RowHeight = 46f; private const float RefreshSeconds = 60f; private static readonly (string label, string category)[] Tabs = new(string, string)[3] { ("Vanilla", "vanilla"), ("Prepared", "prepared"), ("Modded", "modded") }; private const float RowsTop = 96f; private static readonly Dictionary<string, Texture2D> Avatars = new Dictionary<string, Texture2D>(); private static readonly Dictionary<string, JObject> Details = new Dictionary<string, JObject>(); private readonly Button[] _tabs = (Button[])(object)new Button[Tabs.Length]; private readonly TextMeshProUGUI[] _tabTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[Tabs.Length]; private readonly Button[] _play = (Button[])(object)new Button[2]; private readonly TextMeshProUGUI[] _playTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[2]; private bool _multiplayer = MultiplayerProbe.TogetherInstalled; private readonly List<(RectTransform row, RawImage avatar, TextMeshProUGUI rank, TextMeshProUGUI name, TextMeshProUGUI stats)> _rows = new List<(RectTransform, RawImage, TextMeshProUGUI, TextMeshProUGUI, TextMeshProUGUI)>(); private TextMeshProUGUI _status; private TextMeshProUGUI _mine; private readonly string[] _rowIds = new string[12]; private readonly string[] _rowRanks = new string[12]; private JArray _entries; private Button _details; private TextMeshProUGUI _detailsText; private string _detailsId; private int _tab; private RunMode _mode; private string _periodId; private string _difficulty; private string _shownKey; private float _fetchedAt = -999f; private int _request; public void Build(RectTransform area) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Expected O, but got Unknown //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_070c: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_084c: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_088a: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiKit.Rect("Play", (Transform)(object)area); val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(1f, 1f); val.pivot = new Vector2(0.5f, 1f); val.offsetMin = new Vector2(0f, -40f); val.offsetMax = Vector2.zero; string[] array = new string[2] { "Solo", "Multiplayer" }; Image background; for (int i = 0; i < 2; i++) { bool mp = i == 1; _play[i] = UiKit.Panel((Transform)(object)val, "Play" + i, delegate { SelectPlay(mp); }, out background); UiKit.Anchor((RectTransform)((Component)_play[i]).transform, (float)i / 2f, 0f, (float)(i + 1) / 2f, 1f); ((RectTransform)((Component)_play[i]).transform).offsetMin = new Vector2((i == 0) ? 0f : 3f, 0f); ((RectTransform)((Component)_play[i]).transform).offsetMax = new Vector2((i == 1) ? 0f : (-3f), 0f); _playTexts[i] = UiKit.FitText(((Component)_play[i]).transform, "Label", array[i], 20f, (TextAlignmentOptions)514); ((TMP_Text)_playTexts[i]).rectTransform.Stretch(4f, 4f, 2f, 2f); } RectTransform val2 = UiKit.Rect("Tabs", (Transform)(object)area); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.offsetMin = new Vector2(0f, -86f); val2.offsetMax = new Vector2(0f, -48f); for (int num = 0; num < Tabs.Length; num++) { int index = num; _tabs[num] = UiKit.Panel((Transform)(object)val2, "Tab" + num, delegate { SelectTab(index); }, out background); UiKit.Anchor((RectTransform)((Component)_tabs[num]).transform, (float)num / (float)Tabs.Length, 0f, (float)(num + 1) / (float)Tabs.Length, 1f); ((RectTransform)((Component)_tabs[num]).transform).offsetMin = new Vector2((num == 0) ? 0f : 3f, 0f); ((RectTransform)((Component)_tabs[num]).transform).offsetMax = new Vector2((num == Tabs.Length - 1) ? 0f : (-3f), 0f); _tabTexts[num] = UiKit.FitText(((Component)_tabs[num]).transform, "Label", Tabs[num].label, 18f, (TextAlignmentOptions)514); ((TMP_Text)_tabTexts[num]).rectTransform.Stretch(4f, 4f, 2f, 2f); } for (int num2 = 0; num2 < 12; num2++) { int index2 = num2; Button obj = UiKit.Panel((Transform)(object)area, "Row" + num2, delegate { OpenDetails(index2); }, out background); ((Component)obj).gameObject.SetActive(false); ColorBlock colors = ((Selectable)obj).colors; ((ColorBlock)(ref colors)).normalColor = new Color(0.32f, 0.32f, 0.36f, 0.08f); ((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).normalColor; ((Selectable)obj).colors = colors; RectTransform val3 = (RectTransform)((Component)obj).transform; val3.anchorMin = new Vector2(0f, 1f); val3.anchorMax = new Vector2(1f, 1f); val3.pivot = new Vector2(0.5f, 1f); val3.offsetMin = new Vector2(0f, 0f - (96f + (float)(num2 + 1) * 46f)); val3.offsetMax = new Vector2(0f, 0f - (96f + (float)num2 * 46f)); TextMeshProUGUI val4 = UiKit.FitText((Transform)(object)val3, "Rank", "", 20f, (TextAlignmentOptions)4100, UiKit.Gold); ((TMP_Text)val4).rectTransform.Anchor(0f, 0f, 0f, 1f); ((TMP_Text)val4).rectTransform.offsetMax = new Vector2(34f, 0f); RectTransform obj2 = UiKit.Rect("Avatar", (Transform)(object)val3).Place(new Vector2(0f, 0.5f), new Vector2(42f, 0f), new Vector2(38f, 38f)); obj2.pivot = new Vector2(0f, 0.5f); RawImage val5 = ((Component)obj2).gameObject.AddComponent<RawImage>(); ((Graphic)val5).raycastTarget = false; TextMeshProUGUI val6 = UiKit.FitText((Transform)(object)val3, "Name", "", 20f, (TextAlignmentOptions)257); ((TMP_Text)val6).rectTransform.Stretch(88f, 0f, 2f, 20.699999f); TextMeshProUGUI val7 = UiKit.FitText((Transform)(object)val3, "Stats", "", 16f, (TextAlignmentOptions)1025, UiKit.Dim); ((TMP_Text)val7).rectTransform.Stretch(88f, 0f, 23f, 4f); ((Component)val3).gameObject.SetActive(false); _rows.Add((val3, val5, val4, val6, val7)); } _status = UiKit.Text((Transform)(object)area, "Status", "", 20f, (TextAlignmentOptions)257, UiKit.Dim); ((TMP_Text)_status).rectTransform.anchorMin = new Vector2(0f, 1f); ((TMP_Text)_status).rectTransform.anchorMax = new Vector2(1f, 1f); ((TMP_Text)_status).rectTransform.pivot = new Vector2(0.5f, 1f); ((TMP_Text)_status).rectTransform.offsetMin = new Vector2(0f, -180f); ((TMP_Text)_status).rectTransform.offsetMax = new Vector2(0f, -96f); _details = UiKit.Panel((Transform)(object)area, "Details", CloseDetails, out background); RectTransform val8 = (RectTransform)((Component)_details).transform; val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; val8.offsetMin = new Vector2(0f, 196f); val8.offsetMax = new Vector2(0f, -96f); _detailsText = UiKit.FitText(((Component)_details).transform, "Text", "", 18f, (TextAlignmentOptions)257); ((TMP_Text)_detailsText).rectTransform.Stretch(12f, 12f, 10f, 10f); ((Component)_details).gameObject.SetActive(false); _mine = UiKit.Text((Transform)(object)area, "Mine", "", 18f, (TextAlignmentOptions)257); ((TMP_Text)_mine).rectTransform.anchorMin = new Vector2(0f, 0f); ((TMP_Text)_mine).rectTransform.anchorMax = new Vector2(1f, 0f); ((TMP_Text)_mine).rectTransform.pivot = new Vector2(0.5f, 0f); ((TMP_Text)_mine).rectTransform.offsetMin = Vector2.zero; ((TMP_Text)_mine).rectTransform.offsetMax = new Vector2(0f, 190f); } public void Show(RunMode mode, string periodId, string difficulty) { _mode = mode; _periodId = periodId; _difficulty = difficulty; Refresh(force: false); } public void Invalidate() { _shownKey = null; } private void SelectTab(int index) { _tab = index; Refresh(force: true); } private void SelectPlay(bool multiplayer) { _multiplayer = multiplayer; Refresh(force: true); } private void Update() { if (_periodId != null && Time.unscaledTime - _fetchedAt > 60f) { Refresh(force: true); } } private void Refresh(bool force) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (_periodId == null) { return; } string text = $"{_multiplayer}/{_periodId}/{_tab}/{_difficulty}"; for (int i = 0; i < _tabs.Length; i++) { ((Graphic)_tabTexts[i]).color = ((i == _tab) ? UiKit.Gold : UiKit.Dim); } for (int j = 0; j < 2; j++) { ((Graphic)_playTexts[j]).color = ((j == 1 == _multiplayer) ? UiKit.Gold : UiKit.Dim); } if (!force && text == _shownKey) { return; } if (text != _shownKey) { CloseDetails(); } _shownKey = text; _fetchedAt = Time.unscaledTime; ShowMine(); if (!ServerClient.Enabled || (Object)(object)ServerClient.Instance == (Object)null) { SetRows(null); ((TMP_Text)_status).text = "Server disabled in the config (Server.Enabled)."; return; } ((TMP_Text)_status).text = "Loading..."; string item = Tabs[_tab].category; int request = ++_request; string path = $"/v1/leaderboard?multiplayer={(_multiplayer ? 1 : 0)}&period={Uri.EscapeDataString(_periodId)}&category={item}" + $"&difficulty={_difficulty}&limit={12}"; ServerClient.Instance.Get(path, delegate(ApiResponse res) { if (request == _request && !((Object)(object)this == (Object)null)) { if (!res.Ok) { SetRows(null); ((TMP_Text)_status).text = (res.Unreachable ? "Leaderboard server unreachable." : ("Leaderboard error: " + res.Message)); } else { JToken obj = res.Body["entries"]; JArray val = (JArray)(object)((obj is JArray) ? obj : null); SetRows(val); bool valueOrDefault = ((JToken)res.Body).Value<bool?>((object)"final") == true; JToken obj2 = res.Body["parts"]; JArray val2 = (JArray)(object)((obj2 is JArray) ? obj2 : null); string text2 = ((val2 != null && ((JContainer)val2).Count > 1) ? string.Format("Game updated this period: part {0} of {1}. ", ((JContainer)val2).Values<int>().ToList().IndexOf(((JToken)res.Body).Value<int>((object)"generation")) + 1, ((JContainer)val2).Count) : ""); ((TMP_Text)_status).text = text2 + ((val == null || ((JContainer)val).Count == 0) ? "No ranked runs yet. Be the first." : (valueOrDefault ? "Final results." : "")); } } }); } private void SetRows(JArray entries) { _entries = entries; for (int i = 0; i < _rows.Count; i++) { (RectTransform row, RawImage avatar, TextMeshProUGUI rank, TextMeshProUGUI name, TextMeshProUGUI stats) tuple = _rows[i]; RectTransform item = tuple.row; RawImage item2 = tuple.avatar; TextMeshProUGUI item3 = tuple.rank; TextMeshProUGUI item4 = tuple.name; TextMeshProUGUI item5 = tuple.stats; JToken val = ((entries != null && i < ((JContainer)entries).Count) ? entries[i] : null); _rowIds[i] = ((val != null) ? val.Value<string>((object)"id") : null); ((Component)item).gameObject.SetActive(val != null && _detailsId == null); if (val != null) { ((TMP_Text)item3).text = "#" + val.Value<int>((object)"rank"); _rowRanks[i] = ((TMP_Text)item3).text; ((TMP_Text)item4).text = val.Value<string>((object)"persona") ?? "Player"; int valueOrDefault = val.Value<int?>((object)"gameTime").GetValueOrDefault(); ((TMP_Text)item5).text = string.Format("<color=#ffc300>{0}</color> {1} m {2:hh\\:mm\\:ss} {3}", val.Value<int>((object)"score"), val.Value<int>((object)"maxDepth"), TimeSpan.FromSeconds(valueOrDefault), OutcomeShort(val.Value<string>((object)"outcome"))); SetAvatar(item2, val.Value<string>((object)"avatar")); } } } private void OpenDetails(int index) { string id = _rowIds[index]; if (string.IsNullOrEmpty(id) || (Object)(object)ServerClient.Instance == (Object)null) { return; } _detailsId = id; foreach (var row in _rows) { ((Component)row.row).gameObject.SetActive(false); } ((Component)_details).gameObject.SetActive(true); string rank = _rowRanks[index]; if (Details.TryGetValue(id, out var value)) { ((TMP_Text)_detailsText).text = DetailsText(value, rank); return; } ((TMP_Text)_detailsText).text = "Loading..."; ServerClient.Instance.Get("/v1/runs/" + id, delegate(ApiResponse res) { if (!((Object)(object)this == (Object)null) && !(_detailsId != id)) { if (!res.Ok) { ((TMP_Text)_detailsText).text = (res.Unreachable ? "Leaderboard server unreachable." : ("Could not load the run: " + res.Message)) + "\n<color=#9a9a9a>Click to close.</color>"; } else { Details[id] = res.Body; ((TMP_Text)_detailsText).text = DetailsText(res.Body, rank); } } }); } private void CloseDetails() { if (_detailsId != null) { _detailsId = null; ((Component)_details).gameObject.SetActive(false); SetRows(_entries); } } private static string DetailsText(JObject d, string rank) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<color=#ffc300>" + rank + "</color> <noparse>" + ((JToken)d).Value<string>((object)"persona") + "</noparse> <color=#9a9a9a><size=80%>click to close</size></color>\n"); stringBuilder.Append(string.Format("<color=#ffc300>{0}</color> {1} m ", ((JToken)d).Value<int>((object)"score"), ((JToken)d).Value<int>((object)"maxDepth")) + string.Format("{0:hh\\:mm\\:ss} {1}\n\n", TimeSpan.FromSeconds(((JToken)d).Value<int>((object)"gameTime")), OutcomeShort(((JToken)d).Value<string>((object)"outcome")))); stringBuilder.Append("<color=#ffc300>MODS</color>\n"); JToken obj = d["mods"]; JArray val = (JArray)(object)((obj is JArray) ? obj : null); if (val == null || ((JContainer)val).Count == 0) { stringBuilder.Append("<color=#9a9a9a>none</color>\n"); } else { foreach (JToken item in val) { stringBuilder.Append("<noparse>").Append(item.Value<string>((object)"name")).Append("</noparse>"); string value = item.Value<string>((object)"version"); if (!string.IsNullOrEmpty(value)) { stringBuilder.Append(" <color=#9a9a9a><noparse>").Append(value).Append("</noparse></color>"); } stringBuilder.Append(ModTag(item.Value<string>((object)"category"))).Append('\n'); } } JToken obj2 = d["moddedOptions"]; JArray val2 = (JArray)(object)((obj2 is JArray) ? obj2 : null); if (val2 != null && ((JContainer)val2).Count > 0) { stringBuilder.Append("<color=orange>QoL gameplay options: ").Append(string.Join(", ", from o in ((JContainer)val2).Values<string>() select (!o.StartsWith("qol.game.", StringComparison.Ordinal)) ? o : o.Substring(9))).Append("</color>\n"); } JToken obj3 = d["layers"]; JArray val3 = (JArray)(object)((obj3 is JArray) ? obj3 : null); if (val3 != null && ((JContainer)val3).Count > 0) { stringBuilder.Append("\n<color=#ffc300>LAYERS</color> <color=#9a9a9a><size=80%>reached at</size></color>\n"); int num = 0; foreach (JToken item2 in val3) { stringBuilder.Append(string.Format("{0}: {1:hh\\:mm\\:ss}", item2.Value<int>((object)"biome") + 1, TimeSpan.FromSeconds(item2.Value<int>((object)"gameTime")))); stringBuilder.Append((++num % 4 == 0) ? "\n" : " "); } } return stringBuilder.ToString().TrimEnd(Array.Empty<char>()); } private static string ModTag(string category) { return category switch { "prepared" => " <color=#80c0ff><size=80%>Prepared</size></color>", "modded" => " <color=orange><size=80%>Modded</size></color>", "banned" => " <color=#ff6060><size=80%>Banned</size></color>", "unknown" => " <color=#9a9a9a><size=80%>not reviewed</size></color>", _ => "", }; } private void SetAvatar(RawImage img, string url) { //IL_001c: 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) img.texture = null; ((Graphic)img).color = new Color(1f, 1f, 1f, 0.15f); if (!string.IsNullOrEmpty(url) && url.StartsWith("https://", StringComparison.Ordinal)) { if (Avatars.TryGetValue(url, out var value)) { img.texture = (Texture)(object)value; ((Graphic)img).color = Color.white; } else { ((MonoBehaviour)this).StartCoroutine(LoadAvatar(img, url)); } } } private static IEnumerator LoadAvatar(RawImage img, string url) { UnityWebRequest req = UnityWebRequestTexture.GetTexture(url); try { req.timeout = 10; yield return req.SendWebRequest(); if ((int)req.result != 1) { yield break; } Texture2D content = DownloadHandlerTexture.GetContent(req); if ((Object)(object)content == (Object)null) { yield break; } Avatars[url] = content; if ((Object)(object)img != (Object)null) { img.texture = (Texture)(object)content; ((Graphic)img).color = Color.white; } } finally { ((IDisposable)req)?.Dispose(); } } private void ShowMine() { StringBuilder stringBuilder = new StringBuilder("<color=#ffc300>YOUR RUNS</color>\n"); List<RunRecord> list = RunStorage.ListResults(_periodId, _difficulty); if (list.Count == 0) { stringBuilder.Append("<color=#9a9a9a>No runs yet.</color>"); } int num = 0; foreach (RunRecord item in list) { if (num++ == 4) { break; } string text = ((item.Offline || item.ServerRunId == null) ? "<color=#9a9a9a>offline</color>" : ((item.Server == null) ? "<color=#9a9a9a>sending...</color>" : (item.Server.Ranked ? $"<color=#ffc300>{item.Server.Score}</color>" : ("<color=#ff6060>unranked</color> <size=80%>" + string.Join(", ", item.Server.Reasons) + "</size>")))); stringBuilder.Append($"{text} {item.MaxDescentDepthMeters:0} m {TimeSpan.FromSeconds(item.GameTime):hh\\:mm\\:ss} {OutcomeShort(item.Outcome.ToString())}\n"); } ((TMP_Text)_mine).text = stringBuilder.ToString(); } private static string OutcomeShort(string outcome) { return outcome switch { "Death" => "died", "EndingResolved" => "<color=#ffc300>resolved</color>", "EndingEscape" => "<color=#ffc300>escaped</color>", "EndingMerc" => "<color=#ffc300>merc</color>", "Abandoned" => "left", _ => "", }; } } [HarmonyPatch] internal static class MenuPatches { [HarmonyPatch(typeof(PreRunScript), "Start")] [HarmonyPostfix] private static void PreRunStartPostfix(PreRunScript __instance) { try { UiKit.Init(__instance); SeedMenuButton.Create(__instance); SeedMenuScreen.Create(__instance); ((Component)__instance).gameObject.AddComponent<ContinueMarker>(); } catch (Exception ex) { DebugLog.Warn("Could not build the seeded-run menu: " + ex); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void OverlayActivePostfix(ref bool __result) { if (SeedMenuScreen.IsOpen || SeedMenuButton.Editing) { __result = true; } } } internal sealed class ContinueMarker : MonoBehaviour { private TextMeshProUGUI _text; private string _baseText; private string _suffix = ""; private float _next; private void Update() { if (Time.unscaledTime < _next) { return; } _next = Time.unscaledTime + 2f; PreRunScript instance = PreRunScript.instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.saveTimeText == (Object)null)) { if ((Object)(object)_text == (Object)null) { _text = instance.saveTimeText; _baseText = ((TMP_Text)_text).text; } else if (((TMP_Text)_text).text != _baseText + _suffix) { _baseText = ((TMP_Text)_text).text; } RunRecord runRecord = (((Object)(object)instance.loadButton != (Object)null && ((Selectable)instance.loadButton).interactable) ? RunStorage.PeekSidecarForCurrentSave() : null); _suffix = ((runRecord == null) ? "" : $"\n<size=70%><color=#ffc300>Seeded: {runRecord.Mode} {runRecord.PeriodId} · {Difficulty.DisplayName(runRecord.Difficulty)}</color></size>"); string text = _baseText + _suffix; if (((TMP_Text)_text).text != text) { ((TMP_Text)_text).text = text; } } } } internal sealed class RunHud : MonoBehaviour { private GUIStyle _style; private void OnGUI() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) if (RunContext.Active && RunContext.InWorld && Plugin.ShowHud.Value) { if (_style == null) { _style = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)1, fontSize = 13, richText = true }; } RunRecord current = RunContext.Current; string text = ((current.Subcategory != null) ? (" <color=#80c0ff>" + current.Subcategory.ToUpperInvariant() + "</color>") : ""); if (current.Integrity.MultiplayerDetected) { text += " <color=orange>MP</color>"; } if (current.Offline) { text += " <color=#9a9a9a>OFFLINE</color>"; } if (current.Integrity.ModdedOptions.Count > 0) { text += " <color=orange>MODDED</color>"; } if (current.Integrity.SeedOverriddenByMod || current.Integrity.UnrankedOptions.Count > 0) { text += " <color=#ff6060>NOT SEEDED</color>"; } if (current.Integrity.CheatsUsed || current.Integrity.RunSettingsModified || current.Integrity.ModsChangedOnResume || current.Integrity.SaveRestoreSuspected) { text += " <color=#ff6060>UNRANKED</color>"; } else if (current.Integrity.ResumedAfterPeriodEnd) { text += " <color=#ff6060>PERIOD ENDED</color>"; } GUI.Label(new Rect(0f, 4f, (float)Screen.width, 24f), current.Mode.ToString().ToUpperInvariant() + " " + current.PeriodId + " · " + Difficulty.DisplayName(current.Difficulty) + text, _style); } } } internal sealed class SeedMenuButton : MonoBehaviour { private static readonly Vector2 DefaultCenter = new Vector2(0.349f, 0.775f); private static readonly Vector2 DefaultSize = new Vector2(0.128f, 0.227f); private const int DefaultLayer = 7; private const string DefaultPlacement = "7;-304.9;319.1;241.5;240.9"; private string _artName; private string _placeholder; private string _defaultPlacement; private ConfigEntry<string> _config; private Action _click; private Func<string> _labelText; private RectTransform _rt; private Image _art; private Image _glow; private TextMeshProUGUI _placeholderText; private TextMeshProUGUI _label; private Sprite _sprite; private Sprite _hoverSprite; private int _layer = -1; private bool _placed; private float _hover; private bool _editing; private bool _dragging; private Vector2 _grabOffset; private string _placementBeforeEdit; private bool _keysLive; public static SeedMenuButton Instance { get; private set; } public static SeedMenuButton Info { get; private set; } public static bool Editing { get { if (!((Object)(object)Instance != (Object)null) || !Instance._editing) { if ((Object)(object)Info != (Object)null) { return Info._editing; } return false; } return true; } } private static bool ConsoleOpen { get { if ((Object)(object)ConsoleScript.instance != (Object)null) { return ConsoleScript.instance.active; } return false; } } public static void Create(PreRunScript menu) { Instance = Make(menu, "DailySeedsMenuButton", "menu_button", "DAILY\nSEEDS", "7;-304.9;319.1;241.5;240.9", Plugin.MenuButtonPlacement, SeedMenuScreen.Open, MainLabel); } private static SeedMenuButton Make(PreRunScript menu, string name, string art, string placeholder, string defaultPlacement, ConfigEntry<string> config, Action click, Func<string> label) { //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_002f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = ((Component)menu.mainCanvas).gameObject.layer }; val.transform.SetParent(((Component)menu.mainCanvas).transform, false); SeedMenuButton seedMenuButton = val.AddComponent<SeedMenuButton>(); seedMenuButton._artName = art; seedMenuButton._placeholder = placeholder; seedMenuButton._defaultPlacement = defaultPlacement; seedMenuButton._config = config; seedMenuButton._click = click; seedMenuButton._labelText = label; seedMenuButton.Build(); return seedMenuButton; } private void Build() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) _rt = (RectTransform)((Component)this).transform; RectTransform rt = _rt; RectTransform rt2 = _rt; RectTransform rt3 = _rt; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); rt3.pivot = val; Vector2 anchorMin = (rt2.anchorMax = val); rt.anchorMin = anchorMin; _sprite = UiKit.LoadSprite(_artName + ".png"); _hoverSprite = UiKit.LoadSprite(_artName + "_hover.png"); _glow = UiKit.Image((Transform)(object)_rt, "Glow", UiKit.Glow, new Color(1f, 1f, 1f, 0f)); ((Graphic)_glow).rectTransform.Stretch(-40f, -40f, -40f, -40f); _art = UiKit.Image((Transform)(object)_rt, "Art", _sprite ?? UiKit.Frame, Color.white); ((Graphic)_art).rectTransform.Stretch(); _art.preserveAspect = (Object)(object)_sprite != (Object)null; if ((Object)(object)_sprite == (Object)null) { _placeholderText = UiKit.Text((Transform)(object)_rt, "Placeholder", _placeholder, 26f, (TextAlignmentOptions)514, UiKit.Dim); ((TMP_Text)_placeholderText).rectTransform.Stretch(6f, 6f, 6f, 6f); ((TMP_Text)_placeholderText).enableAutoSizing = true; ((TMP_Text)_placeholderText).fontSizeMin = 10f; ((TMP_Text)_placeholderText).fontSizeMax = 40f; } _label = UiKit.Text((Transform)(object)_rt, "Label", "", 30f, (TextAlignmentOptions)258); ((TMP_Text)_label).rectTransform.anchorMin = new Vector2(0.5f, 0f); ((TMP_Text)_label).rectTransform.anchorMax = new Vector2(0.5f, 0f); ((TMP_Text)_label).rectTransform.pivot = new Vector2(0.5f, 1f); ((TMP_Text)_label).rectTransform.anchoredPosition = new Vector2(0f, -8f); ((TMP_Text)_label).rectTransform.sizeDelta = new Vector2(520f, 120f); ((TMP_Text)_label).enableWordWrapping = false; ((TMP_Text)_label).overflowMode = (TextOverflowModes)0; ((Graphic)_label).color = new Color(1f, 1f, 1f, 0f); } private void LateUpdate() { if (!_placed) { if ((Object)(object)_rt == (Object)null) { return; } string value = _config.Value; _placed = TryPlace(string.IsNullOrWhiteSpace(value) ? _defaultPlacement : value); if (!_placed) { return; } } if (_editing) { EditUpdate(); return; } PreRunScript instance = PreRunScript.instance; int num; float num2; if (!((Object)(object)instance == (Object)null) && !instance.startedLoading && !SeedMenuScreen.IsOpen) { num = (VanillaOverlayActive(instance) ? 1 : 0); if (num == 0) { num2 = DistanceToCursor(); goto IL_008f; } } else { num = 1; } num2 = 99999f; goto IL_008f; IL_008f: float num3 = num2; float num4 = ((num3 <= 0f) ? 1f : Mathf.Max(1f - num3 * 0.005f, 0f)); _hover = Mathf.Lerp(_hover, num4, Time.unscaledDeltaTime * 6f); ApplyVisuals(num3 <= 0f); if (num == 0 && num3 <= 0f && Input.GetMouseButtonDown(0)) { PlayerCamera.PlayUISound("click", 1f); _click(); } } private void ApplyVisuals(bool hovered) { //IL_00c3: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_sprite != (Object)null) { _art.sprite = ((hovered && (Object)(object)_hoverSprite != (Object)null) ? _hoverSprite : _sprite); float num = Mathf.Lerp(0.82f, 1f, _hover); ((Graphic)_art).color = new Color(num, num, num, 1f); ((Graphic)_glow).color = new Color(1f, 1f, 1f, _hover * 0.25f); } else { ((Graphic)_art).color = new Color(1f, 1f, 1f, Mathf.Lerp(0.12f, 0.45f, _hover)); ((Graphic)_glow).color = new Color(1f, 1f, 1f, _hover * 0.3f); ((Graphic)_placeholderText).color = new Color(1f, 1f, 1f, Mathf.Lerp(0.35f, 1f, _hover)); } ((Transform)_rt).localScale = Vector3.one * Mathf.Lerp(1f, 1.03f, hovered ? 1f : 0f); ((TMP_Text)_label).text = _labelText(); Color color = ((Graphic)_label).color; bool flag = (Object)(object)this == (Object)(object)Instance && RunContext.Pending != null; color.a = Mathf.MoveTowards(color.a, (hovered || flag) ? 1f : 0f, Time.unscaledDeltaTime * 4f); ((Graphic)_label).color = new Color(1f, 1f, 1f, color.a); } private static string MainLabel() { RunRecord pending = RunContext.Pending; if (pending != null) { return $"<color=#ffc300>{pending.Mode} {pending.PeriodId} · {Difficulty.DisplayName(pending.Difficulty)}</color>\n<size=70%>armed - waiting for the world</size>"; } return "Seeded runs\n<size=70%>Daily · Weekly · Leaderboard</size>"; } public static bool VanillaOverlayActive(PreRunScript menu) { if ((!((Object)(object)menu.runSettingsScreen != (Object)null) || !menu.runSettingsScreen.activeSelf) && (!((Object)(object)menu.contentWarning != (Object)null) || !menu.contentWarning.activeSelf) && (!((Object)(object)menu.tutorialWarning != (Object)null) || !menu.tutorialWarning.activeSelf) && (!((Object)(object)menu.creditsScreen != (Object)null) || !menu.creditsScreen.activeSelf) && !ScrollableText.textExists) { return (Object)(object)SettingsMenu.instance != (Object)null; } return true; } private float DistanceToCursor() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_002e: 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_0057: 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_0076: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(_rt, Vector2.op_Implicit(Input.mousePosition), (Camera)null, ref val)) { return 99999f; } Rect rect = _rt.rect; if (((Rect)(ref rect)).Contains(val)) { return 0f; } Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(Mathf.Clamp(val.x, ((Rect)(ref rect)).xMin, ((Rect)(ref rect)).xMax), Mathf.Clamp(val.y, ((Rect)(ref rect)).yMin, ((Rect)(ref rect)).yMax)); return Vector2.Distance(val, val2); } private static List<ParallaxLayerInfo> Layers() { MenuParallax instance = MenuParallax.instance; if (!((Object)(object)instance != (Object)null) || instance.parallax == null) { return null; } return instance.parallax.layers; } private bool TryPlace(string placement) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01be: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_01fd: 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) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) List<ParallaxLayerInfo> list = Layers(); if (list == null || list.Count == 0) { return false; } if (TryParse(placement, out var layer, out var pos, out var size) && layer >= 0 && layer < list.Count && (Object)(object)list[layer].reference != (Object)null) { Attach(layer, list[layer].reference); _rt.anchoredPosition = pos; _rt.sizeDelta = size; DebugLog.Verbose($"Menu button on parallax layer {layer} at {Format(layer, pos, size)}"); return true; } int num = ((7 < list.Count && (Object)(object)list[7].reference != (Object)null) ? 7 : (-1)); int num2 = 0; while (num < 0 && num2 < list.Count) { if (!((Object)(object)list[num2].reference == (Object)null) && (num < 0 || Mathf.Abs(list[num2].mouseMoveScale) > Mathf.Abs(list[num].mouseMoveScale))) { num = num2; } num2++; } if (num < 0) { return false; } float num3 = (float)Screen.height * 16f / 9f; float num4 = ((float)Screen.width - num3) * 0.5f; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(num4 + DefaultCenter.x * num3, DefaultCenter.y * (float)Screen.height); Vector2 val2 = new Vector2(DefaultSize.x * num3, DefaultSize.y * (float)Screen.height) * 0.5f; RectTransform reference = list[num].reference; Vector2 anchoredPosition = reference.anchoredPosition; reference.anchoredPosition = list[num].originalPos; Vector2 val3 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(reference, val - val2, (Camera)null, ref val3); Vector2 val4 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(reference, val + val2, (Camera)null, ref val4); reference.anchoredPosition = anchoredPosition; Attach(num, reference); RectTransform rt = _rt; Vector2 val5 = (val3 + val4) * 0.5f; Rect rect = reference.rect; rt.anchoredPosition = val5 - ((Rect)(ref rect)).center; _rt.sizeDelta = new Vector2(Mathf.Abs(val4.x - val3.x), Mathf.Abs(val4.y - val3.y)); DebugLog.Verbose($"Menu button auto-placed on parallax layer {num}: {Current()} (save it with 'dr menu edit')"); return true; } private void Attach(int layer, RectTransform parent) { //IL_0037: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) _layer = layer; ((Transform)_rt).SetParent((Transform)(object)parent, false); RectTransform rt = _rt; RectTransform rt2 = _rt; RectTransform rt3 = _rt; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); rt3.pivot = val; Vector2 anchorMin = (rt2.anchorMax = val); rt.anchorMin = anchorMin; ((Transform)_rt).SetAsLastSibling(); } private string Current() { //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) return Format(_layer, _rt.anchoredPosition, _rt.sizeDelta); } private static string Format(int layer, Vector2 pos, Vector2 size) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) return string.Format(CultureInfo.InvariantCulture, "{0};{1:0.#};{2:0.#};{3:0.#};{4:0.#}", layer, pos.x, pos.y, size.x, size.y); } private static bool TryParse(string s, out int layer, out Vector2 pos, out Vector2 size) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) layer = -1; pos = (size = Vector2.zero); if (string.IsNullOrWhiteSpace(s)) { return false; } string[] array = s.Split(new char[1] { ';' }); if (array.Length != 5 || !int.TryParse(array[0], out layer)) { return false; } float[] array2 = new float[4]; for (int i = 0; i < 4; i++) { if (!float.TryParse(array[i + 1], NumberStyles.Float, CultureInfo.InvariantCulture, out array2[i])) { return false; } } pos = new Vector2(array2[0], array2[1]); size = new Vector2(Mathf.Max(array2[2], 10f), Mathf.Max(array2[3], 10f)); return true; } public static void DumpLayers() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) List<ParallaxLayerInfo> list = Layers(); if (list == null) { DebugLog.Reply("Main menu panorama not found (open the main menu)."); return; } for (int i = 0; i < list.Count; i++) { RectTransform reference = list[i].reference; if ((Object)(object)reference == (Object)null) { DebugLog.Reply($" [{i}] missing"); continue; } Image component = ((Component)reference).GetComponent<Image>(); object[] obj = new object[5] { i, ((Object)reference).name, list[i].mouseMoveScale, null, null }; Rect rect = reference.rect; obj[3] = ((Rect)(ref rect)).size.x; rect = reference.rect; obj[4] = ((Rect)(ref rect)).size.y; DebugLog.Reply(string.Format(" [{0}] {1} scale={2:0.###} size={3:0}x{4:0} ", obj) + string.Format("sibling={0} children={1} sprite={2}", ((Transform)reference).GetSiblingIndex(), ((Transform)reference).childCount, ((Object)(object)component != (Object)null && (Object)(object)component.sprite != (Object)null) ? ((Object)component.sprite).name : "-")); } if ((Object)(object)Instance != (Object)null && Instance._placed) { DebugLog.Reply("Button: " + Instance.Current()); } } public static void ToggleEdit(bool info = false) { SeedMenuButton seedMenuButton = (info ? Info : Instance); if ((Object)(object)seedMenuButton == (Object)null || !seedMenuButton._placed) { DebugLog.Reply("The menu button is not on screen (open the main menu)."); return; } SeedMenuButton seedMenuButton2 = (info ? Instance : Info); if ((Object)(object)seedMenuButton2 != (Object)null && seedMenuButton2._editing) { seedMenuButton2.EndEdit(save: true); } if (seedMenuButton._editing) { seedMenuButton.EndEdit(save: true); } else { seedMenuButton.BeginEdit(); } } public static void ResetPlacement() { SeedMenuButton[] array = new SeedMenuButton[2] { Instance, Info }; foreach (SeedMenuButton seedMenuButton in array) { if (!((Object)(object)seedMenuButton == (Object)null)) { seedMenuButton._config.Value = ""; seedMenuButton._editing = false; seedMenuButton._placed = seedMenuButton.TryPlace(seedMenuButton._defaultPlacement); } } DebugLog.Reply("Menu button placement reset to the default."); } private void BeginEdit() { _editing = true; _keysLive = false; _placementBeforeEdit = Current(); DebugLog.Reply("Menu button edit mode. Close the console, then: drag = move, wheel = size, Shift+wheel = width, Ctrl+wheel = height, [ ] = parallax layer, Enter = save, Esc = cancel."); } private void EndEdit(bool save) { _editing = false; _dragging = false; if (save) { _config.Value = Current(); DebugLog.Reply("Menu button placement saved: " + Current()); } else { TryPlace(_placementBeforeEdit); DebugLog.Reply("Menu button edit cancelled."); } } private void EditUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_0260: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) ((Graphic)_art).color = new Color(0.3f, 1f, 1f, 0.6f); ((Graphic)_glow).color = Color.clear; ((TMP_Text)_label).text = $"<color=#5ff>EDIT layer {_layer}</color>\n<size=60%>{Current()}</size>"; ((Graphic)_label).color = Color.white; if (ConsoleOpen) { _keysLive = false; _dragging = false; return; } if (!_keysLive) { _keysLive = !Input.anyKey && !Input.anyKeyDown; return; } RectTransform val = (RectTransform)((Transform)_rt).parent; Vector2 val2 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(val, Vector2.op_Implicit(Input.mousePosition), (Camera)null, ref val2); Vector2 val3 = val2; Rect rect = val.rect; Vector2 val4 = val3 - ((Rect)(ref rect)).center; if (Input.GetMouseButtonDown(0) && DistanceToCursor() <= 0f) { _dragging = true; _grabOffset = _rt.anchoredPosition - val4; } if (Input.GetMouseButtonUp(0)) { _dragging = false; } if (_dragging) { _rt.anchoredPosition = val4 + _grabOffset; } float y = Input.mouseScrollDelta.y; if (y != 0f) { float num = 1f + y * 0.05f; Vector2 val5 = _rt.sizeDelta; if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) { val5.x *= num; } else if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) { val5.y *= num; } else { val5 *= num; } _rt.sizeDelta = new Vector2(Mathf.Max(val5.x, 10f), Mathf.Max(val5.y, 10f)); } List<ParallaxLayerInfo> list = Layers(); int num2 = (Input.GetKeyDown((KeyCode)93) ? 1 : (Input.GetKeyDown((KeyCode)91) ? (-1) : 0)); if (num2 != 0 && list != null) { int num3 = (_layer + num2 + list.Count) % list.Count; if ((Object)(object)list[num3].reference != (Object)null) { Vector3 position = ((Transform)_rt).position; Attach(num3, list[num3].reference); ((Transform)_rt).position = position; } } if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { EndEdit(save: true); } else if (Input.GetKeyDown((KeyCode)27)) { EndEdit(save: false); } } } internal sealed class SeedMenuScreen : MonoBehaviour { private enum Step { Mode, Difficulty, Character } private RectTransform _root; private RectTransform _content; private TextMeshProUGUI _notes; private TextMeshProUGUI _lbTitle; private TextMeshProUGUI _startText; private LeaderboardPanel _board; private Button _offline; private bool _awaitingStart; private Button _back; private Button _start; private readonly Button[] _chips = (Button[])(object)new Button[3]; private readonly TextMeshProUGUI[] _chipTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3]; private readonly List<(TextMeshProUGUI text, Func<string> value)> _live = new List<(TextMeshProUGUI, Func<string>)>(); private Step _step; private RunMode? _mode; private string _difficulty; private int _character; private bool _busy; private float _nextTick; private string _leaderboardKey; private SelectionPulse _selection; private readonly Dictionary<string, RectTransform> _selectable = new Dictionary<string, RectTransform>(); private TextMeshProUGUI _charName; private TextMeshProUGUI _charStats; private TextMeshProUGUI _charDesc; private TextMeshProUGUI _charQuirks; private ArrowScroll _charScroll; private readonly List<(int index, Graphic graphic)> _charGraphics = new List<(int, Graphic)>(); private RectTransform _guide; private ArrowScroll _guideScroll; private bool _guideFromButton; private const float FadeSeconds = 0.15f; private readonly List<(Canvas canvas, int order)> _raised = new List<(Canvas, int)>(); private Canvas _canvas; private CanvasGroup _group; public static SeedMenuScreen Instance { get; private set; } public static bool IsOpen { get { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance._root != (Object)null) { return ((Component)Instance._root).gameObject.activeSelf; } return false; } } private bool GuideShown { get { if ((Object)(object)_guide != (Object)null) { return ((Component)_guide).gameObject.activeSelf; } return false; } } public static void Create(PreRunScript menu) { RectTransform obj = UiKit.Rect("DailySeedsMenu", ((Component)menu.mainCanvas).transform).Stretch(); ((Transform)obj).SetAsLastSibling(); Instance = ((Component)obj).gameObject.AddComponent<SeedMenuScreen>(); Instance.Build(); } public static void Open() { if (!((Object)(object)Instance == (Object)null) && !Instance._busy && !IsOpen) { Instance._guideFromButton = false; ((MonoBehaviour)Instance).StartCoroutine(Instance.Transition(open: true)); } } public static void OpenGuide() { if (!((Object)(object)Instance == (Object)null) && !Instance._busy) { if (IsOpen) { Instance.ShowGuide(show: true); return; } Instance._guideFromButton = true; ((MonoBehaviour)Instance).StartCoroutine(Instance.Transition(open: true)); } } private void ShowGuide(bool show) { ((Component)_guide).gameObject.SetActive(show); if (show) { _guideScroll.ResetToTop(); } } private void CloseGuide() { if (_guideFromButton) { Close(); } else { ShowGuide(show: false); } _guideFromButton = false; } private void BuildGuide() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_0216: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown _guide = UiKit.Rect("Guide", (Transform)(object)_root).Stretch(); Image obj = ((Component)_guide).gameObject.AddComponent<Image>(); obj.sprite = UiKit.White; ((Graphic)obj).color = new Color(0.02f, 0.02f, 0.04f, 0.97f); ((Graphic)obj).raycastTarget = true; RectTransform val = UiKit.Rect("Column", (Transform)(object)_guide); val.anchorMin = new Vector2(0.5f, 0f); val.anchorMax = new Vector2(0.5f, 1f); val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(1180f, 0f); Band(((TMP_Text)UiKit.FitText((Transform)(object)val, "Title", "HOW DAILY SEEDS WORKS", 52f, (TextAlignmentOptions)1025, UiKit.Gold)).rectTransform, 40f, 70f, 0f, 0f); RectTransform parent = UiKit.ScrollArea((Transform)(object)val, "Text", out _guideScroll); UiKit.Stretch((RectTransform)((Component)_guideScroll).transform, 0f, 0f, 130f, 150f); (string, string)[] sections = GuideText.Sections; for (int i = 0; i < sections.Length; i++) { var (text, text2) = sections[i]; UiKit.Text((Transform)(object)parent, "Heading", text, 32f, (TextAlignmentOptions)257, UiKit.Gold); UiKit.Text((Transform)(object)parent, "Body", text2, 24f, (TextAlignmentOptions)257); } RectTransform obj2 = UiKit.Rect("Footer", (Transform)(object)val); obj2.anchorMin = new Vector2(0f, 0f); obj2.anchorMax = new Vector2(1f, 0f); obj2.offsetMin = new Vector2(0f, 40f); obj2.offsetMax = new Vector2(0f, 120f); UiKit.Place((RectTransform)((Component)UiKit.TextButton((Transform)(object)obj2, "Web", "Open web leaderboard", 26f, delegate { Application.OpenURL("https://dailyseeds.dailyseeds-server.workers.dev/leaderboard"); }, out var text3)).transform, new Vector2(0f, 0.5f), Vector2.zero, new Vector2(420f, 80f)); UiKit.Place((RectTransform)((Component)UiKit.TextButton((Transform)(object)obj2, "Close", Loc("back", "Back"), 32f, CloseGuide, out text3)).transform, new Vector2(1f, 0.5f), Vector2.zero, new Vector2(260f, 80f)); ((Component)_guide).gameObject.SetActive(false); } public static void Close(bool instant = false) { if (!((Object)(object)Instance == (Object)null) && !Instance._busy && IsOpen) { if (instant) { Instance.SetOpen(open: false); } else { ((MonoBehaviour)Instance).StartCoroutine(Instance.Transition(open: false)); } } } private IEnumerator Transition(bool open) { _busy = true; if (open) { SetOpen(open: true); } float from = (open ? 0f : 1f); float to = (open ? 1f : 0f); for (float t = 0f; t < 0.15f; t += Time.unscaledDeltaTime) { _group.alpha = Mathf.Lerp(from, to, t / 0.15f); yield return null; } _group.alpha = to; if (!open) { SetOpen(open: false); } _busy = false; } private void SetOpen(bool open) { ((Component)this).transform.SetAsLastSibling(); ((Component)_root).gameObject.SetActive(open); if (!open) { RestoreOverlays(); return; } _group.alpha = (_busy ? 0f : 1f); RaiseAboveMenu(); ShowGuide(_guideFromButton); RunStarter.ClearError(); _leaderboardKey = null; _board.Invalidate(); int characterSelected = PreRunScript.characterSelected; _character = (CharacterUnlocked(characterSelected) ? characterSelected : 0); GoTo(_mode.HasValue ? _step : Step.Mode); } private static bool IsOverlay(Canvas c) { if ((Object)(object)c == (Object)null) { return false; } Canvas rootCanvas = c.rootCanvas; if ((Object)(object)GlobalDark.main != (Object)null && (Object)(object)GlobalDark.main.canvas != (Object)null && (Object)(object)rootCanvas == (Object)(object)GlobalDark.main.canvas.rootCanvas) { return true; } ConsoleScript instance = ConsoleScript.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.consoleCanvas != (Object)null) { return ((Component)c).transform.IsChildOf(instance.consoleCanvas.transform.root); } return false; } private void RaiseAboveMenu() { int num = 0; Canvas[] array = Object.FindObjectsOfType<Canvas>(); foreach (Canvas val in array) { if (!((Object)(object)val == (Object)(object)_canvas) && !IsOverlay(val) && !((Component)val).transform.IsChildOf(((Component)this).transform) && (val.isRootCanvas || val.overrideSorting)) { num = Mathf.Max(num, val.sortingOrder); } } _canvas.overrideSorting = true; _canvas.sortingOrder = num + 1; RestoreOverlays(); array = Object.FindObjectsOfType<Canvas>(); foreach (Canvas val2 in array) { if (IsOverlay(val2) && (val2.isRootCanvas || val2.overrideSorting) && val2.sortingOrder <= _canvas.sortingOrder) { _raised.Add((val2, val2.sortingOrder)); val2.sortingOrder = _canvas.sortingOrder + 1; } } } private void RestoreOverlays() { foreach (var (val, sortingOrder) in _raised) { if ((Object)(object)val != (Object)null) { val.sortingOrder = sortingOrder; } } _raised.Clear(); } private void Build() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Expected O, but got Unknown //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Expected O, but got Unknown //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Expected O, but got Unknown //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) _root = UiKit.Rect("Root", ((Component)this).transform).Stretch(); _canvas = ((Component)_root).gameObject.AddComponent<Canvas>(); ((Component)_root).gameObject.AddComponent<GraphicRaycaster>(); _group = ((Component)_root).gameObject.AddComponent<CanvasGroup>(); Image obj = ((Component)_root).gameObject.AddComponent<Image>(); obj.sprite = UiKit.White; ((Graphic)obj).color = new Color(0.02f, 0.02f, 0.04f, 0.94f); ((Graphic)obj).raycastTarget = true; RectTransform parent = UiKit.Rect("Prepare", (Transform)(object)_root).Anchor(0f, 0f, 0.75f, 1f); Band(((TMP_Text)UiKit.FitText((Transform)(object)parent, "Title", "SEEDED RUNS", 56f, (TextAlignmentOptions)1025, UiKit.Gold)).rectTransform, 40f, 70f, 80f, 60f); Band(((TMP_Text)UiKit.FitText((Transform)(object)parent, "Subtitle", "Everyone plays the same world. Pick a mode, a difficulty and a character.", 24f, (TextAlignmentOptions)257, UiKit.Dim)).rectTransform, 120f, 36f, 82f, 60f); RectTransform parent2 = Band(UiKit.Rect("Steps", (Transform)(object)parent), 185f, 56f, 80f, 60f); for (int i = 0; i < 3; i++) { int index = i; _chips[i] = UiKit.Panel((Transform)(object)parent2, "Step" + i, delegate { OnChip(index); }, out var _); _chipTexts[i] = UiKit.FitText(((Component)_chips[i]).transform, "Label", "", 22f, (TextAlignmentOptions)4097); ((TMP_Text)_chipTexts[i]).rectTransform.Stretch(14f, 10f, 4f, 4f); UiKit.Anchor((RectTransform)((Component)_chips[i]).transform, (float)i / 3f, 0f, (float)(i + 1) / 3f, 1f); ((RectTransform)((Component)_chips[i]).transform).offsetMin = new Vector2((i == 0) ? 0f : 8f, 0f); ((RectTransform)((Component)_chips[i]).transform).offsetMax = new Vector2((i == 2) ? 0f : (-8f), 0f); } _content = UiKit.Rect("Content", (Transform)(object)parent).Stretch(80f, 60f, 275f, 175f); RectTransform val = UiKit.Rect("Footer", (Transform)(object)parent); val.anchorMin = new Vector2(0f, 0f); val.anchorMax = new Vector2(1f, 0f); val.offsetMin = new Vector2(80f, 50f); val.offsetMax = new Vector2(-60f, 150f); _notes = UiKit.Text((Transform)(object)val, "Notes", "", 24f, (TextAlignmentOptions)4097); ((TMP_Text)_notes).rectTransform.Stretch(0f, 600f, -18f, -32f); ((TMP_Text)_notes).enableAutoSizing = true; ((TMP_Text)_notes).fontSizeMax = 24f; ((TMP_Text)_notes).fontSizeMin = 13f; ((TMP_Text)_notes).overflowMode = (TextOverflowModes)3; _back = UiKit.TextButton((Transform)(object)val, "Back", Loc("back", "Back"), 32f, Back, out var text); UiKit.Place((RectTransform)((Component)_back).transform, new Vector2(1f, 0.5f), new Vector2(-360f, 0f), new Vector2(220f, 90f)); _start = UiKit.TextButton((Transform)(object)val, "Start", Loc("startrun", "Start"), 36f, Primary, out _startText); UiKit.Place((RectTransform)((Component)_start).transform, new Vector2(1f, 0.5f), Vector2.zero, new Vector2(340f, 90f)); _offline = UiKit.TextButton((Transform)(object)val, "Offline", "Play offline", 24f, delegate { StartRun(offline: true); }, out text); UiKit.Place((RectTransform)((Component)_offline).transform, new Vector2(1f, 0.5f), new Vector2(0f, 72f), new Vector2(340f, 48f)); UiKit.Tooltip(((Component)_offline).gameObject, "Offline run", "Local seed, not ranked. The result stays on this computer."); ((Component)_offline).gameObject.SetActive(false); RectTransform parent3 = UiKit.Rect("Leaderboard", (Transform)(object)_root).Anchor(0.75f, 0f, 1f, 1f); ((Graphic)UiKit.Image((Transform)(object)parent3, "Background", UiKit.White, new Color(0.06f, 0.06f, 0.09f, 0.95f))).rectTransform.Stretch(); Image obj2 = UiKit.Image((Transform)(object)parent3, "Edge", UiKit.White, new Color(UiKit.Gold.r, UiKit.Gold.g, UiKit.Gold.b, 0.35f)); ((Graphic)obj2).rectTransform.anchorMin = new Vector2(0f, 0f); ((Graphic)obj2).rectTransform.anchorMax = new Vector2(0f, 1f); ((Graphic)obj2).rectTransform.offsetMin = Vector2.zero; ((Graphic)obj2).rectTransform.offsetMax = new Vector2(2f, 0f); Band(((TMP_Text)UiKit.FitText((Transform)(object)parent3, "Header", "LEADERBOARD", 40f, (TextAlignmentOptions)1025, UiKit.Gold)).rectTransform, 40f, 80f, 40f, 30f); _lbTitle = UiKit.Text((Transform)(object)parent3, "Board", "", 24f, (TextAlignmentOptions)257, UiKit.Dim); Band(((TMP_Text)_lbTitle).rectTransform, 128f, 70f, 40f, 30f); RectTransform val2 = UiKit.Rect("Board", (Transform)(object)parent3).Stretch(30f, 24f, 205f, 40f); _board = ((Component)val2).gameObject.AddComponent<LeaderboardPanel>(); _board.Build(val2); UiKit.Place((RectTransform)((Component)UiKit.TextButton((Transform)(object)parent, "Info", "? How it works", 24f, delegate { ShowGuide(show: true); }, out text)).transform, new Vector2(1f, 1f), new Vector2(-60f, -50f), new Vector2(260f, 56f)); BuildGuide(); ((Component)_root).gameObject.SetA