using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BingoAPI.Conditions; using BingoAPI.Conditions.Attributes; using BingoAPI.Conditions.BuiltIn; using BingoAPI.Conditions.Factories; using BingoAPI.Conditions.Interfaces; using BingoAPI.Events; using BingoAPI.Goals; using BingoAPI.Helpers; using BingoAPI.Models; using BingoAPI.Models.Settings; using BingoAPI.Networking; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Silksong.BingoSync.Conditions; using Silksong.BingoSync.Configurations; using Silksong.BingoSync.Data; using Silksong.BingoSync.Exceptions; using Silksong.BingoSync.Extensions; using Silksong.BingoSync.Helpers; using Silksong.BingoSync.Networking; using Silksong.BingoSync.Patches; using Silksong.BingoSync.UI.Abstract; using Silksong.BingoSync.UI.Components; using Silksong.BingoSync.UI.Constants; using Silksong.BingoSync.UI.Containers; using Silksong.BingoSync.UI.Items; using Silksong.BingoSync.UI.Menus; using Silksong.ModMenu.Elements; using Silksong.ModMenu.Plugin; using Silksong.ModMenu.Screens; using UnityEngine; using UnityEngine.Events; 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("WarperSan")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Connects Silksong to BingoSync, letting you play bingo directly in-game")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2+7a8cc8dd5a9fba0ece2a5b6d060ccb2c843417d9")] [assembly: AssemblyProduct("Silksong.BingoSync")] [assembly: AssemblyTitle("Silksong.BingoSync")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/WarperSan/Silksong.BingoSync")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class CompilerLoweringPreserveAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class SkipLocalsInitAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] [Embedded] internal static class IsExternalInit { } [EditorBrowsable(EditorBrowsableState.Never)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class ExtensionMarkerAttribute : Attribute { public string Name { get; } public ExtensionMarkerAttribute(string name) { Name = name; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class UnscopedRefAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] [Embedded] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Embedded] [AttributeUsage(AttributeTargets.All)] [ExcludeFromCodeCoverage] internal sealed class EmbeddedAttribute : Attribute { } } namespace Silksong.BingoSync { internal class Controller : IDisposable { public delegate void CardCallback(Card? card); public GoalPool Pool = new GoalPool(); public readonly EventDispatcher Events; private readonly Session _session; private readonly HttpClient _client; private Card? _card; private Task? _runningCardUpdate; private readonly GoalTracker _tracker; public Team Team => _session.Team; public bool IsConnected => _session.IsInRoom; public event CardCallback? OnCardUpdated; public Controller() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown Events = new EventDispatcher(); SubscribeToEvents(Events); _tracker = new GoalTracker(); _tracker.OnGoalMarked += new GoalChangedCallback(OnGoalMarked); _tracker.OnGoalCleared += new GoalChangedCallback(OnGoalCleared); _client = new HttpClient(new LoggingHandler(new HttpClientHandler())) { Timeout = TimeSpan.FromSeconds(30.0), BaseAddress = new Uri("https://bingosync.com"), DefaultRequestHeaders = { UserAgent = { new ProductInfoHeaderValue("dev.warpersan.silksong.bingosync", Plugin.Version) } } }; _session = new Session(Events, _client, new Uri("wss://sockets.bingosync.com")); } private void SubscribeToEvents(EventDispatcher events) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown events.OnSelfConnected += new ConnectionCallback(OnConnected); events.OnSelfSquareMarked += new MarkCallback(OnSquareMarked); events.OnOtherSquareMarked += new MarkCallback(OnSquareMarked); events.OnSelfSquareCleared += new ClearCallback(OnSquareCleared); events.OnOtherSquareCleared += new ClearCallback(OnSquareCleared); events.OnSelfCardGenerated += new GenerateCallback(OnCardGenerated); events.OnOtherCardGenerated += new GenerateCallback(OnCardGenerated); } private void UnsubscribeFromEvents(EventDispatcher events) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown events.OnSelfConnected -= new ConnectionCallback(OnConnected); events.OnSelfSquareMarked -= new MarkCallback(OnSquareMarked); events.OnOtherSquareMarked -= new MarkCallback(OnSquareMarked); events.OnSelfSquareCleared -= new ClearCallback(OnSquareCleared); events.OnOtherSquareCleared -= new ClearCallback(OnSquareCleared); events.OnSelfCardGenerated -= new GenerateCallback(OnCardGenerated); events.OnOtherCardGenerated -= new GenerateCallback(OnCardGenerated); } private void OnConnected(Player player) { UpdateCard(); } private void OnGoalMarked(Goal goal) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (_card == null) { return; } int[] array = _card.FindByGoal(goal); int[] array2 = array; foreach (int num in array2) { if (!_card.IsMarkedBy(num, _session.Team)) { _session.MarkSquare(num, default(CancellationToken)); } } } private void OnGoalCleared(Goal goal) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (_card == null) { return; } int[] array = _card.FindByGoal(goal); int[] array2 = array; foreach (int num in array2) { if (_card.IsMarkedBy(num, _session.Team)) { _session.ClearSquare(num, default(CancellationToken)); } } } private void OnSquareMarked(Player player, Square square, Team team) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Card? card = _card; if (card != null) { card.Mark(square.Index, team); } this.OnCardUpdated?.Invoke(_card); } private void OnSquareCleared(Player player, Square square, Team team) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Card? card = _card; if (card != null) { card.Unmark(square.Index, team); } this.OnCardUpdated?.Invoke(_card); } private void OnCardGenerated(Player player, bool isHidden) { UpdateCard(); } public Task Join(JoinRoomSettings settings) { return _session.JoinRoom(settings, default(CancellationToken)); } public Task Exit() { return _session.LeaveRoom(default(CancellationToken)); } public Task SetTeam(Team team) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _session.ChangeTeam(team, default(CancellationToken)); } private void UpdateCard() { if (_runningCardUpdate != null && !_runningCardUpdate.IsCompleted) { Log.Warning("An update of 'Card' is already pending."); return; } _runningCardUpdate = Task.Run(() => _session.GetCard(Pool, default(CancellationToken))); _runningCardUpdate.ContinueWith(delegate(Task task) { Card result = task.Result; _tracker.Clear(); if (result != null) { Goal[] allGoals = result.GetAllGoals(); foreach (Goal val in allGoals) { _tracker.TryAdd(val); } } _card = result; this.OnCardUpdated?.Invoke(_card); }); } public void Evaluate() { _tracker.Evaluate(); } public void Dispose() { UnsubscribeFromEvents(Events); _client.Dispose(); _session.Dispose(); } } internal static class ConfigMenu { public static AbstractMenuScreen Create(Configuration configuration) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown AbstractMenuScreen[] array = (AbstractMenuScreen[])(object)new AbstractMenuScreen[5] { CreateGeneralConfig(configuration.General), CreateJoinConfig(configuration.Join), CreateBoardConfig(configuration.Board), CreateAccessibilityConfig(configuration.Accessibility), CreateExperimentalConfig(configuration.Experimental) }; PaginatedMenuScreenBuilder val = new PaginatedMenuScreenBuilder(LocalizedText.op_Implicit(Plugin.Name), 8); AbstractMenuScreen[] array2 = array; foreach (AbstractMenuScreen val2 in array2) { TextButton val3 = new TextButton(val2); val.Add((MenuElement)(object)val3); } return (AbstractMenuScreen)(object)val.Build(); } private static AbstractMenuScreen CreateGeneralConfig(GeneralConfig config) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PaginatedMenuScreenBuilder val = new PaginatedMenuScreenBuilder(LocalizedText.op_Implicit("General"), 8); MenuElement val2 = default(MenuElement); if (ConfigEntryFactory.GenerateBoolElement((ConfigEntryBase)(object)config.UseAdvancedTeams, ref val2)) { val.Add(val2); } return (AbstractMenuScreen)(object)val.Build(); } private static AbstractMenuScreen CreateJoinConfig(JoinConfig config) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PaginatedMenuScreenBuilder val = new PaginatedMenuScreenBuilder(LocalizedText.op_Implicit("Join"), 8); MenuElement val2 = default(MenuElement); if (ConfigEntryFactory.GenerateStringElement((ConfigEntryBase)(object)config.Nickname, ref val2)) { val.Add(val2); } MenuElement val3 = default(MenuElement); if (ConfigEntryFactory.GenerateStringElement((ConfigEntryBase)(object)config.Code, ref val3)) { val.Add(val3); } MenuElement val4 = default(MenuElement); if (ConfigEntryFactory.GenerateStringElement((ConfigEntryBase)(object)config.Password, ref val4)) { val.Add(val4); } MenuElement val5 = default(MenuElement); if (ConfigEntryFactory.GenerateKeyCodeElement((ConfigEntryBase)(object)config.ToggleUI, ref val5)) { val.Add(val5); } return (AbstractMenuScreen)(object)val.Build(); } private static AbstractMenuScreen CreateBoardConfig(BoardConfig config) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PaginatedMenuScreenBuilder val = new PaginatedMenuScreenBuilder(LocalizedText.op_Implicit("Board"), 8); MenuElement val2 = default(MenuElement); if (ConfigEntryFactory.GenerateKeyCodeElement((ConfigEntryBase)(object)config.ToggleUI, ref val2)) { val.Add(val2); } return (AbstractMenuScreen)(object)val.Build(); } private static AbstractMenuScreen CreateExperimentalConfig(ExperimentalConfig config) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) PaginatedMenuScreenBuilder val = new PaginatedMenuScreenBuilder(LocalizedText.op_Implicit("Experimental"), 8); TextLabel val2 = new TextLabel(LocalizedText.op_Implicit("Theses settings are experimental and can cause performance issues")); ((Graphic)val2.Text).color = Color.yellow; val2.Text.fontSize = 30; val.Add((MenuElement)(object)val2); MenuElement val3 = default(MenuElement); if (ConfigEntryFactory.GenerateBoolElement((ConfigEntryBase)(object)config.EvaluateOnHeroUpdate, ref val3)) { val.Add(val3); } return (AbstractMenuScreen)(object)val.Build(); } private static AbstractMenuScreen CreateAccessibilityConfig(AccessibilityConfig config) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PaginatedMenuScreenBuilder val = new PaginatedMenuScreenBuilder(LocalizedText.op_Implicit("Accessibility"), 8); MenuElement val2 = default(MenuElement); if (ConfigEntryFactory.GenerateEnumChoiceElement((ConfigEntryBase)(object)config.BoardCellFont, ref val2)) { val.Add(val2); } MenuElement val3 = default(MenuElement); if (ConfigEntryFactory.GenerateEnumChoiceElement((ConfigEntryBase)(object)config.BoardPosition, ref val3)) { val.Add(val3); } MenuElement val4 = default(MenuElement); if (ConfigEntryFactory.GenerateEnumChoiceElement((ConfigEntryBase)(object)config.BoardScale, ref val4)) { val.Add(val4); } MenuElement val5 = default(MenuElement); if (MenuElementGenerators.CreateIntSliderGenerator().Invoke((ConfigEntryBase)(object)config.BoardOpacity, ref val5)) { val.Add(val5); } return (AbstractMenuScreen)(object)val.Build(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("dev.warpersan.silksong.bingosync", "Silksong.BingoSync", "1.2.2")] public class Plugin : BaseUnityPlugin, IModMenuCustomMenu, IModMenuInterface { internal static readonly Controller Controller = new Controller(); public const string Id = "dev.warpersan.silksong.bingosync"; public static string Name => "Silksong.BingoSync"; public static string Version => "1.2.2"; public AbstractMenuScreen BuildCustomMenu() { return ConfigMenu.Create(Configuration.SafeInstance); } private void Awake() { Log.Logger = Log.LogCore; Configuration.Load(((BaseUnityPlugin)this).Config); Patch.ApplyAll(); Log.Info("dev.warpersan.silksong.bingosync v" + Version + " has loaded!"); } private void Start() { ConditionRegistry.RegisterAll(); } } } namespace Silksong.BingoSync.UI.Menus { internal class ConnectionMenu : MonoBehaviour { private enum State { Offline, Connecting, Online, Disconnecting } private State _state; private CanvasGroup? _canvasGroup; private Button? _actionButton; private JoinForm? _joinForm; private TeamPicker? _teamPicker; private void SetOnline() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) _state = State.Online; _joinForm?.DisableInputs(); if ((Object)(object)_teamPicker != (Object)null) { _teamPicker.EnableInputs(); _teamPicker.SetTeam(Plugin.Controller.Team); } } private void SetOffline() { _state = State.Offline; _joinForm?.EnableInputs(); if ((Object)(object)_teamPicker != (Object)null) { _teamPicker.DisableInputs(); _teamPicker.SetTeam((Team)0); } } private void OnActionClicked() { State state = _state; if ((state == State.Connecting || state == State.Disconnecting) ? true : false) { Log.Warning($"State '{_state}' has no action assigned."); } else if (_state == State.Offline) { JoinRoom(); } else if (_state == State.Online) { LeaveRoom(); } } private void OnTeamSelected(Team team) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (_state != State.Online) { Log.Warning("Cannot change team without being online."); } else { ChangeTeam(team); } } private void ToggleVisibility() { if (!((Object)(object)_canvasGroup == (Object)null)) { bool flag = _canvasGroup.alpha > 0f; _canvasGroup.alpha = (flag ? 0f : 1f); _canvasGroup.blocksRaycasts = !flag; } } private void Update() { switch (_state) { case State.Offline: _actionButton?.SetText("Join"); break; case State.Connecting: _actionButton?.SetText("Connecting..."); break; case State.Online: _actionButton?.SetText("Leave"); break; case State.Disconnecting: _actionButton?.SetText("Disconnecting..."); break; default: throw new ArgumentOutOfRangeException(); } } private async Task JoinRoom() { if (_state != State.Offline) { throw new InvalidOperationException(); } if ((Object)(object)_joinForm == (Object)null) { throw new NullReferenceException("No 'JoinForm' assigned."); } _joinForm.DisableInputs(); JoinRoomSettings settings = _joinForm.GetSettings(); try { _state = State.Connecting; if (!(await Plugin.Controller.Join(settings))) { SetOffline(); Log.Error("Failed to join the room '" + settings.Code + "'."); } else { SetOnline(); } } catch (Exception arg) { SetOffline(); Log.Error($"Error while joining the room '{settings.Code}': {arg}"); } } private async Task LeaveRoom() { if (_state != State.Online) { throw new InvalidOperationException(); } _teamPicker?.DisableInputs(); try { _state = State.Disconnecting; if (!(await Plugin.Controller.Exit())) { SetOnline(); Log.Error("Failed to exit the room."); } else { SetOffline(); } } catch (Exception arg) { SetOnline(); Log.Error($"Error while joining the room: {arg}"); } } private async Task ChangeTeam(Team team) { //IL_0016: 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) if (_state != State.Online) { throw new InvalidOperationException(); } Controller controller = Plugin.Controller; if (controller == null) { throw new NullReferenceException("No 'Controller' assigned."); } if ((Object)(object)_teamPicker == (Object)null) { throw new NullReferenceException("No 'TeamPicker' assigned."); } _teamPicker.DisableInputs(); try { if (!(await controller.SetTeam(team))) { Log.Error("Failed to change team."); } } catch (Exception arg) { Log.Error($"Error while joining the room: {arg}"); } _teamPicker.SetTeam(controller.Team); _teamPicker.EnableInputs(); } public static ConnectionMenu Create(JoinRoomSettings settings) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ConnectionMenu"); ConnectionMenu connectionMenu = val.AddComponent(); RectTransform val2 = val.AddComponent(); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; VerticalLayoutGroup val3 = val.AddComponent(); ((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f; ((LayoutGroup)val3).childAlignment = (TextAnchor)7; ((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false; connectionMenu._canvasGroup = val.AddComponent(); JoinForm joinForm = JoinForm.Create(); ((Component)joinForm).transform.SetParent(((Component)val3).transform, false); joinForm.SetSettings(settings); connectionMenu._joinForm = joinForm; TeamPicker teamPicker = TeamPicker.Create(connectionMenu.OnTeamSelected); ((Component)teamPicker).transform.SetParent(((Component)val3).transform, false); connectionMenu._teamPicker = teamPicker; Button button = Button.Create(connectionMenu.OnActionClicked); ((Component)button).transform.SetParent(val.transform, false); connectionMenu._actionButton = button; CallOnInput callOnInput = val.AddComponent(); callOnInput.SetInput(Configuration.SafeInstance.Join.ToggleUI, connectionMenu.ToggleVisibility); connectionMenu.SetOffline(); return connectionMenu; } } } namespace Silksong.BingoSync.UI.Items { internal class BingoCell : MonoBehaviour { private Text? _text; private Dictionary? _teamMarks; public void SetSquare(Goal goal, Team teams) { //IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Text? text = _text; if (text != null) { text.text = goal.Name; } if (_teamMarks == null) { return; } foreach (KeyValuePair teamMark in _teamMarks) { teamMark.Deconstruct(out var key, out var value); Team val = key; Image val2 = value; bool active = ((Enum)teams).HasFlag((Enum)(object)val); ((Component)val2).gameObject.SetActive(active); } } public void AddTeam(Team team) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (_teamMarks != null && _teamMarks.TryGetValue(team, out Image value)) { ((Component)value).gameObject.SetActive(true); } } public void RemoveTeam(Team team) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (_teamMarks != null && _teamMarks.TryGetValue(team, out Image value)) { ((Component)value).gameObject.SetActive(false); } } public static BingoCell Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BingoCell"); val.AddComponent(); BingoCell bingoCell = val.AddComponent(); GameObject val2 = new GameObject("Background"); val2.transform.SetParent(val.transform, false); Image val3 = val2.AddComponent(); ((Graphic)val3).color = new Color(0.1f, 0.1f, 0.1f, 1f); VerticalLayoutGroup val4 = val2.AddComponent(); ((LayoutGroup)val4).childAlignment = (TextAnchor)4; Dictionary dictionary = new Dictionary(); foreach (Team value in Enum.GetValues(typeof(Team))) { if ((int)value != 0) { GameObject val6 = new GameObject(((object)value/*cast due to .constrained prefix*/).ToString()); val6.transform.SetParent(((Component)val4).transform, false); Image val7 = val6.AddComponent(); ((Graphic)val7).color = Colors.GetColor(value); dictionary.Add(value, val7); } } GameObject val8 = new GameObject("Darkener"); val8.transform.SetParent(val.transform, false); Image val9 = val8.AddComponent(); ((Graphic)val9).color = new Color(0f, 0f, 0f, 0.4f); GameObject val10 = new GameObject("Text"); val10.transform.SetParent(val.transform, false); RectTransform val11 = val10.AddComponent(); val11.anchorMin = Vector2.zero; val11.anchorMax = Vector2.one; val11.offsetMin = Vector2.one * 5f; val11.offsetMax = -Vector2.one * 5f; Text val12 = val10.AddComponent(); val12.fontSize = 12; val12.text = "Placeholder"; val12.alignment = (TextAnchor)3; ((Graphic)val12).color = Color.white; val12.font = Fonts.Normal; AccessibilityTextFont accessibilityTextFont = val10.AddComponent(); accessibilityTextFont.Bind(Configuration.SafeInstance.Accessibility.BoardCellFont); bingoCell._text = val12; bingoCell._teamMarks = dictionary; return bingoCell; } } internal class TeamPickerButton : MonoBehaviour { private Outline? _outline; private Action? _onClick; private Color _teamColor = Color.white; public Team Team { get; private set; } public void Select() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_outline != (Object)null) { ((Shadow)_outline).effectColor = Color.white; } } public void Unselect() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_outline != (Object)null) { ((Shadow)_outline).effectColor = _teamColor; } } private void OnClick() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) _onClick?.Invoke(Team); } public static TeamPickerButton Create(Team team, Action onClick) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_0047: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00f3: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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) GameObject val = new GameObject("TeamPickerButton"); val.AddComponent(); TeamPickerButton teamPickerButton = val.AddComponent(); teamPickerButton.Team = team; teamPickerButton._onClick = onClick; Color val2 = (teamPickerButton._teamColor = team.GetColor()); Image val3 = val.AddComponent(); Color color = val2 * 0.6f; color.a = 1f; ((Graphic)val3).color = color; Button val4 = val.AddComponent