using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using R2API.Networking; using R2API.Networking.Interfaces; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Navigation; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Stats; using RoR2.UI; using TMPro; using Unity.Collections; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Profiling; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ScorchedVoxels")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.20.72.0")] [assembly: AssemblyInformationalVersion("0.20.72+a4d65434dd33f229551efc8d9b06c8cae4d20476")] [assembly: AssemblyProduct("ScorchedVoxels")] [assembly: AssemblyTitle("ScorchedVoxels")] [assembly: AssemblyVersion("0.20.72.0")] [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 ScorchedVoxels { internal class ArcadeColorGrid { private class Tile { public int idx; public UiTile ui; public Image sprite; public Image swatch; public UiKit.Label badge; } public const float TileW = 96f; public const float TileH = 112f; public const float Gap = 8f; private const float SpriteScale = 6f; private readonly List tiles = new List(); private string profileKey; public Action onChanged; public int PickedCount => UserLifetimeStats.ArcadeColors(profileKey).Count; public float Build(RectTransform content, float contentW, string userProfileKey) { profileKey = userProfileKey; tiles.Clear(); int num = Mathf.Max(2, Mathf.FloorToInt((contentW + 8f) / 104f)); float num2 = (0f - ((float)num * 96f + (float)(num - 1) * 8f)) * 0.5f; for (int i = 0; i < 16; i++) { int num3 = i % num; int num4 = i / num; float x = num2 + (float)num3 * 104f + 48f; float y = 0f - ((float)num4 * 120f + 56f); tiles.Add(BuildTile(content, i, x, y)); } Refresh(); return (float)((16 + num - 1) / num) * 120f; } private Tile BuildTile(RectTransform content, int idx, float x, float y) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023e: 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) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) Tile tile = new Tile { idx = idx }; tile.ui = new UiTile($"color_{idx}", content, new Vector2(96f, 112f), new Vector2(x, y), (UnityAction)delegate { OnTileClicked(idx); }); GameObject val = new GameObject("commando"); val.transform.SetParent(((Component)tile.ui.Face).transform, false); tile.sprite = val.AddComponent(); ((Graphic)tile.sprite).raycastTarget = false; RectTransform rectTransform = ((Graphic)tile.sprite).rectTransform; rectTransform.pivot = new Vector2(0.5f, 0f); rectTransform.anchorMin = new Vector2(0.5f, 0f); rectTransform.anchorMax = new Vector2(0.5f, 0f); rectTransform.sizeDelta = new Vector2(36f, 66f); rectTransform.anchoredPosition = new Vector2(0f, 26f); if (CommandoSprites.Ready) { tile.sprite.sprite = CommandoSprites.CommandoFrame(idx, 0f); } else { ((Behaviour)tile.sprite).enabled = false; tile.swatch = UiKit.CreateImage("swatch", ((Component)tile.ui.Face).transform, CommandoSprites.Tint(idx)); ((Graphic)tile.swatch).raycastTarget = false; RectTransform rectTransform2 = ((Graphic)tile.swatch).rectTransform; rectTransform2.pivot = new Vector2(0.5f, 0f); rectTransform2.anchorMin = new Vector2(0.5f, 0f); rectTransform2.anchorMax = new Vector2(0.5f, 0f); rectTransform2.sizeDelta = new Vector2(36f, 66f); rectTransform2.anchoredPosition = new Vector2(0f, 26f); } UiKit.Label label = UiKit.CreateLabel($"label_{idx}", ((Component)tile.ui.Face).transform, 11f, UiKit.TextPale, (TextAnchor)4); label.Rect.anchorMin = new Vector2(0f, 0f); label.Rect.anchorMax = new Vector2(1f, 0f); label.Rect.pivot = new Vector2(0.5f, 0f); label.Rect.sizeDelta = new Vector2(-6f, 20f); label.Rect.anchoredPosition = new Vector2(0f, 3f); label.ClipSingleLine(); label.Text = CommandoSprites.ColorwayNames[idx]; tile.badge = UiKit.CreateLabel($"badge_{idx}", ((Component)tile.ui.Face).transform, 16f, UiKit.Gold, (TextAnchor)4); tile.badge.Rect.anchorMin = new Vector2(1f, 1f); tile.badge.Rect.anchorMax = new Vector2(1f, 1f); tile.badge.Rect.sizeDelta = new Vector2(22f, 22f); tile.badge.Rect.anchoredPosition = new Vector2(-14f, -14f); tile.badge.Bold(); tile.badge.Text = ""; return tile; } private void OnTileClicked(int idx) { List list = new List(UserLifetimeStats.ArcadeColors(profileKey)); if (list.Contains(idx)) { list.Remove(idx); } else if (list.Count < 3) { list.Add(idx); } else { list[2] = idx; } UserLifetimeStats.SetArcadeColors(profileKey, list); Refresh(); onChanged?.Invoke(); } public void Refresh() { IReadOnlyList readOnlyList = UserLifetimeStats.ArcadeColors(profileKey); foreach (Tile tile in tiles) { int num = -1; for (int i = 0; i < readOnlyList.Count; i++) { if (readOnlyList[i] == tile.idx) { num = i; break; } } tile.ui.Selected = num == 0; tile.badge.Text = ((num >= 0) ? (num + 1).ToString() : ""); } } public void Tick() { if (!CommandoSprites.Ready) { return; } float unscaledTime = Time.unscaledTime; foreach (Tile tile in tiles) { tile.sprite.sprite = CommandoSprites.CommandoFrame(tile.idx, unscaledTime); if (!((Behaviour)tile.sprite).enabled) { ((Behaviour)tile.sprite).enabled = true; } if ((Object)(object)tile.swatch != (Object)null && ((Behaviour)tile.swatch).enabled) { ((Behaviour)tile.swatch).enabled = false; } } } } internal static class ArcadeTheming { public static string DestinationScene; } internal static class ArcadeLocal { public static NetworkUser User() { foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances != (Object)null && ((NetworkBehaviour)readOnlyInstances).isLocalPlayer) { return readOnlyInstances; } } return null; } public static string ProfileKey() { NetworkUser val = User(); if (!((Object)(object)val == (Object)null)) { return UserLifetimeStats.ProfileKey(val); } return null; } public static uint NetId() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) NetworkUser val = User(); if (!((Object)(object)val == (Object)null)) { NetworkInstanceId netId = ((NetworkBehaviour)val).netId; return ((NetworkInstanceId)(ref netId)).Value; } return 0u; } public static int PreferredColorway() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) NetworkUser val = User(); if ((Object)(object)val == (Object)null) { return 0; } IReadOnlyList readOnlyList = UserLifetimeStats.ArcadeColors(val); if (readOnlyList != null && readOnlyList.Count > 0) { return readOnlyList[0]; } NetworkInstanceId netId = ((NetworkBehaviour)val).netId; return CommandoSprites.ColorwayFor(((NetworkInstanceId)(ref netId)).Value); } } internal static class ArcadeRng { public static uint Step(ref uint state) { uint num = state; num ^= num << 13; num ^= num >> 17; num ^= num << 5; return state = num; } public static int Next(ref uint state, int maxExclusive) { return (int)(Step(ref state) % (uint)maxExclusive); } } internal class ArcadeContext { public uint seed; public RectTransform panel; public float width; public float height; public WormsGame.MatchConfig wormsMatch; public RaceGame.MatchConfig raceMatch; } internal interface IMiniGame { void Start(ArcadeContext ctx); void Tick(float dt); void End(); } internal static class ArcadeInput { public static bool Blocked; public static bool ActionDown; public static bool ActionHeld; public static bool RopeDown; public static bool RopeHeld; public static bool DuckHeld; public static bool ToggleDown; public static void Poll(RectTransform clickArea) { //IL_005a: 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_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) if (Blocked) { ActionDown = (ActionHeld = (RopeDown = (RopeHeld = (DuckHeld = (ToggleDown = false))))); return; } ActionDown = Input.GetKeyDown((KeyCode)32) || Input.GetKeyDown((KeyCode)119) || Input.GetKeyDown((KeyCode)273) || (Input.GetMouseButtonDown(0) && inArea(Vector2.op_Implicit(Input.mousePosition))); ActionHeld = Input.GetKey((KeyCode)32) || Input.GetKey((KeyCode)119) || Input.GetKey((KeyCode)273) || Input.GetMouseButton(0); RopeDown = Input.GetKeyDown((KeyCode)115) || Input.GetKeyDown((KeyCode)274) || Input.GetKeyDown((KeyCode)306) || (Input.GetMouseButtonDown(1) && inArea(Vector2.op_Implicit(Input.mousePosition))); RopeHeld = Input.GetKey((KeyCode)115) || Input.GetKey((KeyCode)274) || Input.GetKey((KeyCode)306) || Input.GetMouseButton(1); DuckHeld = Input.GetKey((KeyCode)115) || Input.GetKey((KeyCode)274) || Input.GetKey((KeyCode)306); ToggleDown = Input.GetKeyDown((KeyCode)103); bool inArea(Vector2 p) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clickArea != (Object)null) { return RectTransformUtility.RectangleContainsScreenPoint(clickArea, p); } return false; } } } internal static class ArcadeHost { internal enum GameKind { Runner, Worms, Race, Terrarium } private abstract class MatchChannel { protected const float ResendSeconds = 2f; protected const float HostSilenceFoldSeconds = 8f; protected readonly bool hostLive; protected float nextResendAt; protected float lastHostMsgAt; protected abstract uint HostMatchId { get; } protected abstract uint RunningMatchId { get; } protected abstract bool JoinPending { get; } protected MatchChannel(bool hostLive) { this.hostLive = hostLive; lastHostMsgAt = Time.unscaledTime; } protected abstract void StartPendingGame(); protected abstract void SendAnnounce(); protected abstract void SendTeardown(); protected abstract void HostTickCanon(); protected abstract void Close(); public void StampHostMsg() { lastHostMsgAt = Time.unscaledTime; } public void Tick() { if (JoinPending) { if (!uiBuilt) { return; } StartPendingGame(); } if (!NetworkServer.active) { if (RunningMatchId != 0 && Time.unscaledTime - lastHostMsgAt > 8f) { Close(); FoldLocalMatch(); } } else { if (!hostLive) { return; } if (RunningMatchId != HostMatchId) { SendTeardown(); Close(); return; } HostTickCanon(); if (Time.unscaledTime >= nextResendAt) { nextResendAt = Time.unscaledTime + 2f; SendAnnounce(); } } } } private sealed class WormsChannel : MatchChannel { private readonly WormsGame.MatchConfig hostCfg; private WormsGame.MatchConfig pendingCfg; private WormsShot[] pendingShots; private readonly List shotLog = new List(); private WormsShot[] shotLogCache = Array.Empty(); private readonly List requestQueue = new List(); private readonly HashSet forfeited = new HashSet(); private int timedShotCount = -1; private float turnDeadlineAt; protected override uint HostMatchId => hostCfg.matchId; protected override uint RunningMatchId { get { if (!(game is WormsGame wormsGame)) { return 0u; } return wormsGame.MatchId; } } protected override bool JoinPending => pendingCfg != null; private WormsChannel(bool hostLive, WormsGame.MatchConfig hostCfg) : base(hostLive) { this.hostCfg = hostCfg; } public static WormsChannel Host(WormsGame.MatchConfig cfg) { return new WormsChannel(hostLive: true, cfg); } public static WormsChannel Join(WormsGame.MatchConfig cfg, WormsShot[] shots) { WormsChannel wormsChannel = new WormsChannel(hostLive: false, null); if (uiBuilt) { StartGame(GameKind.Worms, cfg, null); if (game is WormsGame wormsGame) { wormsGame.CatchUp(shots); } } else { wormsChannel.pendingCfg = cfg; wormsChannel.pendingShots = shots; } return wormsChannel; } public bool OwnsMatch(uint matchId) { if (hostLive) { return hostCfg.matchId == matchId; } return false; } protected override void StartPendingGame() { WormsGame.MatchConfig matchCfg = pendingCfg; WormsShot[] array = pendingShots; pendingCfg = null; pendingShots = null; StartGame(GameKind.Worms, matchCfg, null); if (game is WormsGame wormsGame && array != null) { wormsGame.CatchUp(array); } } protected override void SendAnnounce() { if (shotLogCache.Length != shotLog.Count) { shotLogCache = shotLog.ToArray(); } NetMessageExtensions.Send((INetMessage)(object)new WormsMatchMessage(hostCfg.matchId, hostCfg.seed, hostCfg.ids, hostCfg.colorways, shotLogCache), (NetworkDestination)1); } protected override void SendTeardown() { NetMessageExtensions.Send((INetMessage)(object)new WormsMatchMessage(0u, 0u, Array.Empty(), Array.Empty(), Array.Empty()), (NetworkDestination)1); } protected override void HostTickCanon() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) WormsGame wormsGame = (WormsGame)game; if (wormsGame.MatchOver) { requestQueue.Clear(); return; } while (!wormsGame.InFlight && !wormsGame.MatchOver && requestQueue.Count > 0) { WormsShot shot = requestQueue[0]; requestQueue.RemoveAt(0); HostApplyShot(shot); } if (wormsGame.MatchOver) { return; } uint currentTurnOwner = wormsGame.CurrentTurnOwner; if (currentTurnOwner != 0) { bool flag = false; foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances != (Object)null) { NetworkInstanceId netId = ((NetworkBehaviour)readOnlyInstances).netId; if (((NetworkInstanceId)(ref netId)).Value == currentTurnOwner) { flag = true; break; } } } if (!flag && forfeited.Add(currentTurnOwner)) { HostApplyShot(new WormsShot { shooterNetId = currentTurnOwner, weapon = 254 }); } } if (wormsGame.InFlight || wormsGame.KnownShotCount != timedShotCount) { timedShotCount = wormsGame.KnownShotCount; turnDeadlineAt = Time.unscaledTime + 45f; } else if (currentTurnOwner != 0 && Time.unscaledTime >= turnDeadlineAt) { HostApplyShot(new WormsShot { shooterNetId = currentTurnOwner, weapon = byte.MaxValue }); } } protected override void Close() { wormsChannel = null; } public void HostApplyClientRequest(WormsShot shot) { //IL_0024: 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) if (!WormsGame.ValidWeaponByte(shot.weapon)) { return; } NetworkUser val = ArcadeLocal.User(); if ((Object)(object)val != (Object)null) { uint shooterNetId = shot.shooterNetId; NetworkInstanceId netId = ((NetworkBehaviour)val).netId; if (shooterNetId == ((NetworkInstanceId)(ref netId)).Value) { return; } } HostApplyShot(shot); } public void HostApplyShot(WormsShot shot) { if (!hostLive || !(game is WormsGame wormsGame) || wormsGame.MatchId != hostCfg.matchId || wormsGame.MatchOver || (shot.weapon != byte.MaxValue && shot.weapon != 254 && !WormsGame.ValidWeaponByte(shot.weapon))) { return; } if (wormsGame.InFlight) { for (int num = requestQueue.Count - 1; num >= 0; num--) { if (requestQueue[num].shooterNetId == shot.shooterNetId && requestQueue[num].weapon != 254) { requestQueue.RemoveAt(num); } } requestQueue.Add(shot); } else if (shot.weapon == 254 || shot.shooterNetId == wormsGame.CurrentTurnOwner) { int count = shotLog.Count; shotLog.Add(shot); wormsGame.ApplyShot(shot, animate: true); NetMessageExtensions.Send((INetMessage)(object)new WormsShotMessage(hostCfg.matchId, (ushort)count, shot), (NetworkDestination)1); } } } private sealed class RaceChannel : MatchChannel { private readonly RaceGame.MatchConfig hostCfg; private RaceGame.MatchConfig pendingCfg; private float roundBumpAt; protected override uint HostMatchId => hostCfg.matchId; protected override uint RunningMatchId { get { if (!(game is RaceGame raceGame)) { return 0u; } return raceGame.MatchId; } } protected override bool JoinPending => pendingCfg != null; private RaceChannel(bool hostLive, RaceGame.MatchConfig hostCfg) : base(hostLive) { this.hostCfg = hostCfg; } public static RaceChannel Host(RaceGame.MatchConfig cfg) { return new RaceChannel(hostLive: true, cfg); } public static RaceChannel Join(RaceGame.MatchConfig cfg) { RaceChannel raceChannel = new RaceChannel(hostLive: false, null); if (uiBuilt) { StartGame(GameKind.Race, null, cfg); } else { raceChannel.pendingCfg = cfg; } return raceChannel; } protected override void StartPendingGame() { RaceGame.MatchConfig raceCfg = pendingCfg; pendingCfg = null; StartGame(GameKind.Race, null, raceCfg); } protected override void SendAnnounce() { NetMessageExtensions.Send((INetMessage)(object)new RaceMatchMessage(hostCfg.matchId, hostCfg.seed, hostCfg.round, hostCfg.ids, hostCfg.colorways, hostCfg.wins), (NetworkDestination)1); } protected override void SendTeardown() { NetMessageExtensions.Send((INetMessage)(object)new RaceMatchMessage(0u, 0u, 0, Array.Empty(), Array.Empty(), Array.Empty()), (NetworkDestination)1); } protected override void HostTickCanon() { RaceGame raceGame = (RaceGame)game; if (raceGame.TryTakeRoundWinner(out var winner)) { for (int i = 0; i < hostCfg.ids.Length; i++) { if (hostCfg.ids[i] == winner && hostCfg.wins[i] < byte.MaxValue) { hostCfg.wins[i]++; } } raceGame.ApplyMatchState(hostCfg.round, hostCfg.wins); roundBumpAt = Time.unscaledTime + 3f; nextResendAt = 0f; } if (roundBumpAt > 0f && Time.unscaledTime >= roundBumpAt) { roundBumpAt = 0f; hostCfg.round++; raceGame.ApplyMatchState(hostCfg.round, hostCfg.wins); nextResendAt = 0f; } } protected override void Close() { raceChannel = null; } } [CompilerGenerated] private static class <>O { public static UnityAction <0>__ToggleColorPanel; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__50_0; public static UnityAction <>9__51_0; public static UnityAction <>9__51_1; public static UnityAction <>9__51_2; public static UnityAction <>9__51_3; public static UnityAction <>9__51_4; internal void b__50_0() { if (colorCount != null) { colorCount.Text = $"{colorGrid.PickedCount} / 3 picked"; } } internal void b__51_0() { StartOrStop(GameKind.Runner); } internal void b__51_1() { StartOrStop(GameKind.Race); } internal void b__51_2() { StartOrStop(GameKind.Worms); } internal void b__51_3() { StartOrStop(GameKind.Terrarium); } internal void b__51_4() { holdEngaged = !holdEngaged; holdBtn.Text = (holdEngaged ? "UNLOCK LOADING" : "LOCK LOADING"); } } private const float ButtonH = 30f; internal const float RunnerStripH = 150f; internal const float RunnerSoloW = 480f; private const float WormsStripW = 1100f; private const float WormsStripH = 185f; private const float RaceStripW = 1100f; private const float RaceStripH = 208f; private const float TankStripW = 700f; private const float TankStripH = 185f; private const float StripBottomLimit = -408f; internal const float CeremonyGraceSeconds = 3f; private const float ReelArrivalGrace = 1.5f; private static float lastLotteryAt = -1f; private static bool holdEngaged; private static UiKit.Btn holdBtn; private static GameKind activeKind; private static GameKind lastKind = GameKind.Runner; private static float stripH = 150f; private static float btnNoteUntil; private static UiKit.Btn btnNoteOn; private static string btnNotePrior; private static GameObject root; private static float attachedAt; private static bool uiBuilt; private static UiKit.Btn playBtn; private static UiKit.Btn raceBtn; private static UiKit.Btn wormsBtn; private static UiKit.Btn tankBtn; private static UiKit.Btn colorsBtn; private static GameObject colorPanel; private static ArcadeColorGrid colorGrid; private static UiKit.Label colorCount; private static GameObject strip; private static RectTransform stripRect; private static RectTransform stripContent; private static IMiniGame game; private static float matchStartedAt; private const float StopArmSeconds = 0.75f; private static WormsChannel wormsChannel; private static RaceChannel raceChannel; public static bool CeremonyClosed { get; private set; } public static bool HoldingLoadingScreen { get { if ((Object)(object)root != (Object)null && uiBuilt) { return holdEngaged; } return false; } } public static bool StripOpen => (Object)(object)strip != (Object)null; public static float StripReserve { get { if (!((Object)(object)strip != (Object)null)) { return 0f; } return stripH + 44f; } } public static void Attach(GameObject overlayRoot) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown CeremonyClosed = false; lastLotteryAt = -1f; uiBuilt = false; holdEngaged = false; attachedAt = Time.unscaledTime; root = new GameObject("arcade"); root.transform.SetParent(overlayRoot.transform, false); UiKit.Stretch(root.AddComponent()); if (ModOptions.ArcadeEnabled.Value) { CommandoSprites.EnsureLoading(); WeaponIcons.EnsureLoading(); } } public static void Detach() { EndGame(); SpectateStrips.Clear(); TerrariumStrips.Clear(); ArcadeSpectate.Clear(); RaceSpectate.Clear(); TerrariumNet.Clear(); DropMatchChannels(); RaceSpectate.ActiveMatchId = 0u; btnNoteUntil = 0f; btnNoteOn = null; btnNotePrior = null; matchStartedAt = 0f; root = null; playBtn = null; raceBtn = null; wormsBtn = null; tankBtn = null; colorsBtn = null; colorPanel = null; colorGrid = null; colorCount = null; holdBtn = null; strip = null; stripRect = null; stripContent = null; uiBuilt = false; holdEngaged = false; CeremonyClosed = false; lastLotteryAt = -1f; } public static void Tick() { if ((Object)(object)root == (Object)null || !ModOptions.ArcadeEnabled.Value) { return; } int num; if (!CeremonyClosed) { if (!LoadingOverlay.AnyReelAwaitingShow) { num = (LoadingOverlay.AnyReelLive ? 1 : 0); if (num == 0) { goto IL_003d; } } else { num = 1; } lastLotteryAt = Time.unscaledTime; goto IL_003d; } goto IL_0098; IL_003d: float num2 = ((num != 0) ? float.MaxValue : ((!(lastLotteryAt >= 0f)) ? ((NetworkUser.readOnlyInstancesList.Count > 1) ? (attachedAt + 1.5f) : attachedAt) : lastLotteryAt)); if (Time.unscaledTime < num2) { return; } CeremonyClosed = true; CommandoSprites.EnsureLoading(); WeaponIcons.EnsureLoading(); goto IL_0098; IL_0098: if (CommandoSprites.Failed) { return; } if (!uiBuilt) { if (!CommandoSprites.Ready) { return; } BuildUi(); } PositionUi(); if (holdBtn != null) { bool flag = NetworkUser.readOnlyInstancesList.Count <= 1 || NetworkServer.active; if (holdBtn.Go.activeSelf != flag) { holdBtn.Go.SetActive(flag); } } ArcadeInput.Blocked = (Object)(object)colorPanel != (Object)null; ArcadeInput.Poll(stripContent); bool flag2 = game is WormsGame { MatchId: not 0u } || (game is RaceGame raceGame && raceGame.MatchId != 0); bool flag3 = (lastKind == GameKind.Worms || lastKind == GameKind.Race) && NetworkUser.readOnlyInstancesList.Count > 1; if (ArcadeInput.ToggleDown && !flag2 && !flag3) { StartOrStop(lastKind); } colorGrid?.Tick(); SpectateStrips.Tick(); TerrariumStrips.Tick(); if (game != null && ((Object)(object)colorPanel == (Object)null || flag2)) { game.Tick(Mathf.Min(Time.unscaledDeltaTime, 0.05f)); } TickButtonNote(); TickMatchChannels(); } private static void ToggleColorPanel() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_00dc: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: 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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)colorPanel != (Object)null) { Object.Destroy((Object)(object)colorPanel); colorPanel = null; colorGrid = null; colorCount = null; return; } string text = ArcadeLocal.ProfileKey() ?? UserLifetimeStats.ProfileKey(LocalUserManager.GetFirstLocalUser()); if (text == null) { return; } colorPanel = new GameObject("arcadeColorModal"); colorPanel.transform.SetParent(root.transform, false); UiKit.Stretch(colorPanel.AddComponent()); Image obj = UiKit.CreateImage("dim", colorPanel.transform, new Color(0f, 0f, 0f, 0.55f)); UiKit.Stretch(((Graphic)obj).rectTransform); ButtonClickedEvent onClick = ((Component)obj).gameObject.AddComponent