Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Scrubbed Title Screen v1.1.6
BepInEx/plugins/Scrubbed_Title_Screen/Scrubbed_Title_Screen.dll
Decompiled 2 weeks 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.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using NetworkingUtils; using Splatform; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("Scrubbed_Title_Screen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.6.0")] [assembly: AssemblyInformationalVersion("1.1.6")] [assembly: AssemblyProduct("Scrubbed_Title_Screen")] [assembly: AssemblyTitle("Scrubbed_Title_Screen")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")] [assembly: AssemblyVersion("1.1.6.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 JPValheim.ScrubbedTitleScreen { internal sealed class ArtworkFeedback : MonoBehaviour { private Button _button; private TitleImageRollover _rollover; private bool _title; private bool _keyboard; private Vector2 _pointer; private ArtworkFocusFrame _frame; internal void Configure(Button button, TitleImageRollover rollover, bool title) { //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_0020: 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_006d: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b1: 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_00b7: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) _button = button; _rollover = rollover; _title = title; _pointer = Vector2.op_Implicit(ZInput.pointerPosition); if (!Object.op_Implicit((Object)(object)_frame)) { GameObject val = new GameObject("ScrubbedTitleScreen_ArtworkFocus", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(ArtworkFocusFrame) }); val.layer = ((Component)this).gameObject.layer; val.transform.SetParent(((Component)this).transform, false); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; _frame = val.GetComponent<ArtworkFocusFrame>(); ((Graphic)_frame).raycastTarget = false; ((Graphic)_frame).color = new Color(1f, 0.8f, 0.38f, 0.9f); ((Behaviour)_frame).enabled = false; } } private void LateUpdate() { //IL_00b6: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_button) && Object.op_Implicit((Object)(object)_rollover)) { bool flag = (_title ? MenuInputs.TitleVisible(FejdStartup.instance) : (ServerPage.Active && ServerPage.Stage == ServerPageStage.Splash)); if (_title) { Plugin.SetTitleImageVisible(MenuInputs.TitleArtworkVisible(FejdStartup.instance), flag); } bool num = ((Selectable)_button).IsInteractable() && flag; if (ZInput.GetKeyDown((KeyCode)9, true) || ZInput.GetKeyDown((KeyCode)273, true) || ZInput.GetKeyDown((KeyCode)274, true) || ZInput.GetKeyDown((KeyCode)276, true) || ZInput.GetKeyDown((KeyCode)275, true) || ZInput.GetKeyDown((KeyCode)13, true)) { _keyboard = true; } Vector2 val = Vector2.op_Implicit(ZInput.pointerPosition); if (_pointer != val || ZInput.GetMouseButtonDown(0)) { _keyboard = false; } _pointer = val; bool enabled = num && (_keyboard || ZInput.IsGamepadActive()) && Object.op_Implicit((Object)(object)EventSystem.current) && (Object)(object)EventSystem.current.currentSelectedGameObject == (Object)(object)((Component)_button).gameObject; if (Object.op_Implicit((Object)(object)_frame)) { ((Behaviour)_frame).enabled = enabled; } } } private void OnDisable() { if (Object.op_Implicit((Object)(object)_rollover)) { _rollover.SetFocused(focused: false); } if (Object.op_Implicit((Object)(object)_frame)) { ((Behaviour)_frame).enabled = false; } } internal static float FitScale(float scale, Vector2 available, Vector2 image) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) return Mathf.Min(scale, Mathf.Min(Mathf.Max(1f, available.x - 40f) / image.x, Mathf.Max(1f, available.y - 40f) / image.y)); } } internal sealed class ArtworkFocusFrame : MaskableGraphic { protected override void OnPopulateMesh(VertexHelper mesh) { //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) mesh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; Add(mesh, ((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin, ((Rect)(ref rect)).xMax, ((Rect)(ref rect)).yMin + 2f); Add(mesh, ((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMax - 2f, ((Rect)(ref rect)).xMax, ((Rect)(ref rect)).yMax); Add(mesh, ((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin + 2f, ((Rect)(ref rect)).xMin + 2f, ((Rect)(ref rect)).yMax - 2f); Add(mesh, ((Rect)(ref rect)).xMax - 2f, ((Rect)(ref rect)).yMin + 2f, ((Rect)(ref rect)).xMax, ((Rect)(ref rect)).yMax - 2f); } private void Add(VertexHelper mesh, float x0, float y0, float x1, float y1) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0051: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0089: Unknown result type (might be due to invalid IL or missing references) int currentVertCount = mesh.currentVertCount; mesh.AddVert(new Vector3(x0, y0), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(new Vector3(x0, y1), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(new Vector3(x1, y1), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(new Vector3(x1, y0), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); mesh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3); } } internal sealed class ArtworkHitMask { private readonly int _width; private readonly int _height; private readonly int _stride; private readonly int[] _counts; internal ArtworkHitMask(Texture2D texture) { _width = ((Texture)texture).width; _height = ((Texture)texture).height; _stride = _width + 1; _counts = new int[checked(_stride * (_height + 1))]; Color32[] pixels = texture.GetPixels32(); for (int i = 0; i < _height; i++) { int num = 0; for (int j = 0; j < _width; j++) { if (pixels[i * _width + j].a >= 13) { num++; } _counts[(i + 1) * _stride + j + 1] = _counts[i * _stride + j + 1] + num; } } } internal bool Contains(float u, float v, float radiusU, float radiusV) { int num = Mathf.Max(0, Mathf.FloorToInt((u - radiusU) * (float)_width)); int num2 = Mathf.Min(_width - 1, Mathf.FloorToInt((u + radiusU) * (float)_width)); int num3 = Mathf.Max(0, Mathf.FloorToInt((v - radiusV) * (float)_height)); int num4 = Mathf.Min(_height - 1, Mathf.FloorToInt((v + radiusV) * (float)_height)); if (num > num2 || num3 > num4) { return false; } return _counts[(num4 + 1) * _stride + num2 + 1] - _counts[num3 * _stride + num2 + 1] - _counts[(num4 + 1) * _stride + num] + _counts[num3 * _stride + num] > 0; } } internal sealed class BottomInformation : MonoBehaviour { private static BottomInformation _title; private static FejdStartup _titleOwner; private TMP_Text _text; private Material _material; private TipNavigation _navigation; private int _messageCount; private int _createdFrame; private FejdStartup _startup; private bool _confirmation; private readonly List<RaycastResult> _hits = new List<RaycastResult>(); private TipSettings _settings; private SoftTipBacking _backing; private Vector2 _parentSize; private Vector2 _targetSize; private Vector2 _targetCenter; private bool _laidOut; private bool _measureBacking = true; private bool _hasBacking; private readonly CycleTimer _timer = new CycleTimer(); private static TipNavigation _joinNavigation; private static TipNavigation _pauseNavigation; private static TipNavigation _titleNavigation; private static bool _newJoinOpening; internal static void NewJoinOpening() { _newJoinOpening = true; } internal static void RefreshTitle(FejdStartup startup) { DestroyTitle(); if (Object.op_Implicit((Object)(object)startup) && Object.op_Implicit((Object)(object)startup.m_mainMenu)) { if ((Object)(object)_titleOwner != (Object)(object)startup) { _titleNavigation?.OpenAgain(); } _titleOwner = startup; _title = Create(startup.m_mainMenu.transform, confirmation: false); if (Object.op_Implicit((Object)(object)_title)) { _title._startup = startup; } } } internal static void DestroyTitle() { if (Object.op_Implicit((Object)(object)_title)) { ((Component)_title).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)_title).gameObject); } _title = null; } internal static BottomInformation Create(Transform parent, bool confirmation) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Expected O, but got Unknown TipSettings tipSettings = (confirmation ? PresentationSettings.PageTips(ServerPage.FromPauseMenu) : PresentationSettings.TitleTips); if (!tipSettings.Enabled.Value) { return null; } TipSettings obj = ((!confirmation && PresentationSettings.ReuseJoinTips.Value) ? PresentationSettings.JoinTips : tipSettings); string[] array = obj.Messages(); string[] array2 = obj.OpeningMessages(); if (array.Length + array2.Length == 0) { return null; } TMP_FontAsset val = TipTypography.Font(); if (!Object.op_Implicit((Object)(object)val)) { return null; } GameObject val2 = new GameObject("ScrubbedTitleScreen_Information", new Type[1] { typeof(RectTransform) }); val2.SetActive(false); val2.layer = ((Component)parent).gameObject.layer; val2.transform.SetParent(parent, false); BottomInformation bottomInformation = val2.AddComponent<BottomInformation>(); bottomInformation._settings = tipSettings; bottomInformation._confirmation = confirmation; bottomInformation._createdFrame = Time.frameCount; GameObject val3 = new GameObject("ScrubbedTitleScreen_TipBacking", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(SoftTipBacking) }); val3.layer = val2.layer; val3.transform.SetParent(val2.transform, false); bottomInformation._backing = val3.GetComponent<SoftTipBacking>(); ((Graphic)bottomInformation._backing).raycastTarget = false; ((Behaviour)bottomInformation._backing).enabled = false; RectTransform rectTransform = ((Graphic)bottomInformation._backing).rectTransform; Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0.5f, 0.5f); rectTransform.pivot = val4; Vector2 anchorMin = (rectTransform.anchorMax = val4); rectTransform.anchorMin = anchorMin; GameObject val6 = new GameObject("ScrubbedTitleScreen_TipText", new Type[2] { typeof(RectTransform), typeof(CanvasRenderer) }); val6.layer = val2.layer; val6.transform.SetParent(val2.transform, false); RectTransform component = val6.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; anchorMin = (component.offsetMax = Vector2.zero); component.offsetMin = anchorMin; TipNavigation tipNavigation = ((!confirmation) ? _titleNavigation : (ServerPage.FromPauseMenu ? _pauseNavigation : _joinNavigation)); if (tipNavigation == null || !tipNavigation.Matches(array, tipSettings.Order.Value, array2)) { tipNavigation = new TipNavigation(array, tipSettings.Order.Value, null, array2); } else if (confirmation && _newJoinOpening) { tipNavigation.OpenAgain(); } if (confirmation) { _newJoinOpening = false; } if (!confirmation) { _titleNavigation = tipNavigation; } else if (ServerPage.FromPauseMenu) { _pauseNavigation = tipNavigation; } else { _joinNavigation = tipNavigation; } bottomInformation._navigation = tipNavigation; bottomInformation._messageCount = array.Length + array2.Length; bottomInformation._text = (TMP_Text)(object)val6.AddComponent<TextMeshProUGUI>(); bottomInformation._text.font = val; bottomInformation._text.fontStyle = (FontStyles)(tipSettings.Bold.Value ? 1 : 0); bottomInformation._text.fontSharedMaterial = ((TMP_Asset)val).material; if (Object.op_Implicit((Object)(object)bottomInformation._text.fontSharedMaterial)) { bottomInformation._material = new Material(bottomInformation._text.fontSharedMaterial); TipTypography.Style(bottomInformation._material, tipSettings.Bold.Value); bottomInformation._text.fontSharedMaterial = bottomInformation._material; bottomInformation._text.UpdateMeshPadding(); } bottomInformation._text.richText = true; ((Graphic)bottomInformation._text).raycastTarget = false; bottomInformation._text.textWrappingMode = (TextWrappingModes)1; bottomInformation._text.overflowMode = (TextOverflowModes)0; bottomInformation._text.text = tipNavigation.Current; bottomInformation.Layout(); val2.SetActive(true); bottomInformation.UpdateBacking(((Behaviour)bottomInformation._text).isActiveAndEnabled); return bottomInformation; } private void LateUpdate() { //IL_00ac: 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) bool flag = (_confirmation ? ServerPage.Active : MenuInputs.TitleVisible(_startup)); ((Behaviour)_text).enabled = flag; Layout(); UpdateBacking(flag); if (_confirmation || !flag || Time.frameCount == _createdFrame || _messageCount < 2 || MenuInputs.TextEntryActive()) { return; } int num = TipInput.Direction(_hits); if (num != 0 && !_confirmation && ZInput.GetMouseButtonDown(0)) { Canvas val = (Object.op_Implicit((Object)(object)((Graphic)_text).canvas) ? ((Graphic)_text).canvas.rootCanvas : null); Camera val2 = ((Object.op_Implicit((Object)(object)val) && (int)val.renderMode != 0) ? val.worldCamera : null); if (!RectTransformUtility.RectangleContainsScreenPoint(_text.rectTransform, Vector2.op_Implicit(ZInput.pointerPosition), val2)) { num = 0; } } if (num != 0) { Advance(num); } if (_timer.Tick(Time.unscaledDeltaTime, _settings.Interval.Value, active: true, num != 0)) { Advance(1); } } internal void SetPageVisible(bool visible) { ((Behaviour)_text).enabled = visible; UpdateBacking(visible); } internal bool Advance(int direction) { if (_messageCount < 2 || direction == 0) { return false; } string text = _text.text; NextMessage(direction); return text != _text.text; } private void Layout() { //IL_0056: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01d8: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: 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) if (!Object.op_Implicit((Object)(object)_text)) { return; } Transform parent = ((Component)this).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (val == null) { return; } Rect rect; if (_laidOut) { Vector2 parentSize = _parentSize; rect = val.rect; if (parentSize == ((Rect)(ref rect)).size) { return; } } rect = val.rect; _parentSize = ((Rect)(ref rect)).size; _laidOut = true; _measureBacking = true; RectTransform val2 = (RectTransform)((Component)this).transform; float value = _settings.Scale.Value; float num = 24f; float value2 = _settings.Width.Value; rect = val.rect; float width = Mathf.Min(value2, Mathf.Max(1f, ((Rect)(ref rect)).width - 40f)); float value3 = _settings.Height.Value; rect = val.rect; float num2 = Mathf.Min(value3, Mathf.Max(1f, ((Rect)(ref rect)).height - 40f)); Vector2 val3 = UiPlacement.Anchor(_settings.Anchor.Value); Vector2 val4 = (val2.pivot = val3); Vector2 anchorMin = (val2.anchorMax = val4); val2.anchorMin = anchorMin; val2.sizeDelta = new Vector2(width, num2); rect = val.rect; val2.anchoredPosition = UiPlacement.Bounded(((Rect)(ref rect)).size, val2.sizeDelta, val3, new Vector2(_settings.X.Value, _settings.Y.Value)); RectTransform rectTransform = _text.rectTransform; ((Vector2)(ref val4))..ctor(0.5f, 0.5f); rectTransform.pivot = val4; anchorMin = (rectTransform.anchorMax = val4); rectTransform.anchorMin = anchorMin; ((Transform)rectTransform).localScale = Vector3.one * value; rectTransform.sizeDelta = new Vector2(width / value, num2 / value); rectTransform.anchoredPosition = Vector2.zero; _text.alignment = (TextAlignmentOptions)((val3.y == 0f) ? 1026 : ((val3.y == 1f) ? 258 : 514)); _text.fontSize = num; _text.enableAutoSizing = false; _text.fontSizeMin = num; _text.fontSizeMax = num; ((Graphic)_text).color = _settings.Color.Value; value = PresentationMath.FitTipScale(value, width, num2, delegate(float candidate) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Vector2 preferredValues = _text.GetPreferredValues(_text.text, width / candidate, float.PositiveInfinity); return (Width: preferredValues.x, Height: preferredValues.y); }); ((Transform)rectTransform).localScale = Vector3.one * value; rectTransform.sizeDelta = new Vector2(width / value, num2 / value); } private void MeasureBacking() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0039: 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_0063: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) _text.ForceMeshUpdate(false, false); Bounds textBounds = _text.textBounds; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(((Bounds)(ref textBounds)).size.x, ((Bounds)(ref textBounds)).size.y); _hasBacking = TipBackingGeometry.HasContent(val); if (_hasBacking) { float x = ((Transform)_text.rectTransform).localScale.x; _targetSize = TipBackingGeometry.Fit(val, x, _settings.EdgeSoftness.Value); _targetCenter = new Vector2(((Bounds)(ref textBounds)).center.x * x, ((Bounds)(ref textBounds)).center.y * x); } _measureBacking = false; } private void UpdateBacking(bool visible) { //IL_0079: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (!visible || _settings.Backing.Value <= 0f) { ((Behaviour)_backing).enabled = false; return; } if (_measureBacking || _text.havePropertiesChanged) { MeasureBacking(); } if (!_hasBacking) { ((Behaviour)_backing).enabled = false; return; } RectTransform rectTransform = ((Graphic)_backing).rectTransform; Vector2 val = (((Behaviour)_backing).enabled ? TipBackingGeometry.Follow(rectTransform.sizeDelta, _targetSize, Time.unscaledDeltaTime) : _targetSize); Vector2 val2 = (((Behaviour)_backing).enabled ? TipBackingGeometry.Follow(rectTransform.anchoredPosition, _targetCenter, Time.unscaledDeltaTime) : _targetCenter); if (rectTransform.sizeDelta != val) { rectTransform.sizeDelta = val; } if (rectTransform.anchoredPosition != val2) { rectTransform.anchoredPosition = val2; } _backing.Configure(_settings.EdgeSoftness.Value, _settings.Backing.Value); ((Behaviour)_backing).enabled = true; } private void NextMessage(int direction) { _text.text = _navigation.Move(direction); _laidOut = false; Layout(); _measureBacking = true; if (((Behaviour)_backing).enabled) { MeasureBacking(); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_material)) { Object.Destroy((Object)(object)_material); } } } internal static class ConfigMigration { internal const string Server = "1. Server"; internal const string TitleImage = "2. Title Image"; internal const string Branding = "3. Title Branding"; internal const string Page = "4. Join Page"; internal const string Button = "5. Join Page Button"; internal const string JoinTips = "6. Join Page Tips"; internal const string TitleTips = "7. Title Screen Tips"; internal const string Changelog = "8. Project Changelog"; internal const string PauseTips = "9. In-game Page Tips"; private static ConfigFile _config; private static string _previous; internal static string Previous(ConfigFile config) { if (config != _config) { _config = config; _previous = (File.Exists(config.ConfigFilePath) ? File.ReadAllText(config.ConfigFilePath) : ""); } return _previous; } internal static string Section(string section) { return section switch { "Server" => "1. Server", "Custom title image" => "2. Title Image", "Title branding" => "3. Title Branding", "Join Page" => "4. Join Page", "Join Page Button" => "5. Join Page Button", "Join Page Tips" => "6. Join Page Tips", "Title Screen Tips" => "7. Title Screen Tips", "Project changelog" => "8. Project Changelog", "In-game Page Tips" => "9. In-game Page Tips", _ => section, }; } internal static bool HasCurrentSetting(string content, string section, string key) { if (!HasSetting(content, Section(section), key)) { return HasSetting(content, section, key); } return true; } internal static ConfigEntry<T> Bind<T>(ConfigFile config, string section, string key, T value, ConfigDescription description) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown string content = Previous(config); string text = Section(section); if (text == section) { return config.Bind<T>(section, key, value, description); } bool num = HasSetting(content, section, key); T value2 = value; if (num) { value2 = config.Bind<T>(new ConfigDefinition(section, key), value, (ConfigDescription)null).Value; } config.Remove(new ConfigDefinition(section, key)); ConfigEntry<T> val = config.Bind<T>(text, key, value, description); if (num && !HasSetting(content, text, key)) { val.Value = value2; } return val; } internal static void Clear() { _config = null; _previous = null; } internal static bool HasSetting(string content, string section, string key) { bool flag = false; string[] array = (content ?? "").Split(new char[2] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.StartsWith("#", StringComparison.Ordinal)) { continue; } if (text.StartsWith("[", StringComparison.Ordinal)) { flag = string.Equals(text, "[" + section + "]", StringComparison.Ordinal); } else if (flag) { int num = text.IndexOf('='); if (num >= 0 && string.Equals(text.Substring(0, num).Trim(), key, StringComparison.Ordinal)) { return true; } } } return false; } internal static bool HasSection(string content, string section) { string[] array = (content ?? "").Split(new char[2] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { if (string.Equals(array[i].Trim(), "[" + section + "]", StringComparison.Ordinal)) { return true; } } return false; } } internal static class ConfirmationPresentation { private static readonly OptionalPng Background = new OptionalPng(); private static readonly OptionalPng Page = new OptionalPng("Image page"); private static readonly OptionalPng Preview = new OptionalPng("First image page"); private static readonly Dictionary<Graphic, bool> Original = new Dictionary<Graphic, bool>(); private static GameObject _root; private static BottomInformation _information; private static RawImage _image; private static Image _surface; private static Image _dimming; private static JoinPageNavigation _navigation; private static string[] _pages = Array.Empty<string>(); private static string[] _knownPages = Array.Empty<string>(); private static int _index; private static bool _hasOpening; private static TipNavigation _sequence; private static string[] _imageKeys = Array.Empty<string>(); internal static bool HasPages => _pages.Length != 0; internal static bool OpeningPage { get { if (!_hasOpening) { return !HasPages; } return _index == 0; } } private static int PageCount => Mathf.Max(1, _pages.Length + (_hasOpening ? 1 : 0)); internal static bool HasContent() { if (Object.op_Implicit((Object)(object)Background.Load(PresentationSettings.BackgroundFile?.Value))) { return true; } string text = PresentationSettings.ImagePagesFolder?.Value; if (string.IsNullOrWhiteSpace(text)) { Preview.Clear(); return false; } if (Object.op_Implicit((Object)(object)_root) && HasPages && Object.op_Implicit((Object)(object)_image) && Object.op_Implicit((Object)(object)_image.texture)) { return true; } string[] array = ReadPages(text); foreach (string configuredPath in array) { if (Object.op_Implicit((Object)(object)Preview.Load(configuredPath))) { return true; } } return Object.op_Implicit((Object)(object)Preview.Texture); } internal static void Apply(GameObject cover) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00af: 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) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) Clear(); Graphic[] componentsInChildren = cover.GetComponentsInChildren<Graphic>(true); foreach (Graphic val in componentsInChildren) { if (!((Object)val).name.StartsWith("ScrubbedTitleScreen_")) { Original[val] = ((Behaviour)val).enabled; } } _root = Panel("ScrubbedTitleScreen_Backdrop", cover.transform, Color.clear, blocksInput: true); _surface = _root.GetComponent<Image>(); GameObject val2 = new GameObject("ScrubbedTitleScreen_JoinImage", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(RawImage) }) { layer = cover.layer }; val2.transform.SetParent(_root.transform, false); _image = val2.GetComponent<RawImage>(); ((Graphic)_image).raycastTarget = false; val2.AddComponent<ConfirmationImageLayout>().Configure(_image); _dimming = Panel("ScrubbedTitleScreen_Readability", _root.transform, Color.clear, blocksInput: false).GetComponent<Image>(); GameObject val3 = new GameObject("ScrubbedTitleScreen_PageNavigation"); val3.transform.SetParent(cover.transform, false); _navigation = val3.AddComponent<JoinPageNavigation>(); _navigation.Configure(); Refresh(cover, refreshContent: true, refreshTips: true); } internal static void Refresh(GameObject cover, bool refreshContent, bool refreshTips) { if (!Object.op_Implicit((Object)(object)_root)) { return; } if (refreshContent) { string text = CurrentPagePath(); bool openingPage = OpeningPage; Background.Load(PresentationSettings.BackgroundFile.Value); string value = PresentationSettings.ImagePagesFolder.Value; string[] array = ReadPages(value); if (string.IsNullOrWhiteSpace(value)) { _pages = Array.Empty<string>(); Page.Clear(); Preview.Clear(); } else if (array.Length != 0) { _pages = array; } _hasOpening = Object.op_Implicit((Object)(object)Background.Texture); int num = Array.IndexOf(_pages, text); _index = ((num >= 0) ? (num + (_hasOpening ? 1 : 0)) : ((!openingPage) ? Mathf.Clamp(_index, 0, PageCount - 1) : 0)); if (!_hasOpening && HasPages && text == null) { for (int i = 0; i < _pages.Length; i++) { if (Object.op_Implicit((Object)(object)Page.Load(_pages[i])) && Page.IsLoadedFrom(_pages[i])) { _index = i; break; } } } string[] array2 = new string[PageCount]; array2[0] = ""; Array.Copy(_pages, 0, array2, _hasOpening ? 1 : 0, _pages.Length); if (_sequence == null || !_sequence.Matches(array2, PresentationSettings.ImageOrder.Value)) { bool flag = _sequence != null; _sequence = new TipNavigation(array2, PresentationSettings.ImageOrder.Value); int num2 = ((text != null) ? Array.IndexOf(array2, text) : ((!(flag && openingPage) || !_hasOpening) ? ((!_hasOpening && PresentationSettings.ImageOrder.Value == TipOrder.InOrder) ? _index : (-1)) : 0)); if (num2 >= 0) { _sequence.Select(num2); } } _imageKeys = array2; _index = Math.Max(0, Array.IndexOf(array2, _sequence.Current)); } ShowBackground(OpeningPage ? Background.Texture : (HasPages ? (Page.Load(CurrentPagePath()) ?? Preview.Texture) : null)); if (refreshTips) { if (Object.op_Implicit((Object)(object)_information)) { ((Component)_information).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)_information).gameObject); } _information = BottomInformation.Create(cover.transform, confirmation: true); } if (Object.op_Implicit((Object)(object)_information)) { _information.SetPageVisible(visible: true); } } private static string[] ReadPages(string folder) { if (string.IsNullOrWhiteSpace(folder)) { _knownPages = Array.Empty<string>(); return _knownPages; } string[] array = SplashPages.PathsIn(folder, PresentationSettings.BackgroundFile?.Value); if (array.Length != 0) { _knownPages = array; } return _knownPages; } private static string CurrentPagePath() { int num = _index - (_hasOpening ? 1 : 0); if (num < 0 || num >= _pages.Length) { return null; } return _pages[num]; } internal static void MovePage(int direction) { if (ServerPage.Browsing && HasPages && Object.op_Implicit((Object)(object)_image) && _sequence != null && direction != 0) { _index = Array.IndexOf(_imageKeys, _sequence.Move(direction)); ShowBackground(OpeningPage ? Background.Texture : Page.Load(CurrentPagePath())); if (Object.op_Implicit((Object)(object)_information)) { _information.SetPageVisible(visible: true); } } } internal static void MoveTip(int direction) { if (ServerPage.Browsing && Object.op_Implicit((Object)(object)_information)) { _information.Advance(direction); } } private static void ShowBackground(Texture2D texture) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) bool flag = !Object.op_Implicit((Object)(object)texture) && PresentationSettings.EnvironmentBackdrop.Value; foreach (KeyValuePair<Graphic, bool> item in Original) { if (Object.op_Implicit((Object)(object)item.Key)) { ((Behaviour)item.Key).enabled = flag && item.Value; } } ((Graphic)_surface).color = new Color(0.045f, 0.045f, 0.05f, flag ? 0f : 1f); ((Graphic)_dimming).color = new Color(0f, 0f, 0f, PresentationSettings.Dimming.Value); ((Behaviour)_dimming).enabled = Object.op_Implicit((Object)(object)texture); _image.texture = (Texture)(object)texture; ((Behaviour)_image).enabled = Object.op_Implicit((Object)(object)texture); } private static GameObject Panel(string name, Transform parent, Color color, bool blocksInput) { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = color; ((Graphic)component2).raycastTarget = blocksInput; return val; } internal static void Clear() { if (Object.op_Implicit((Object)(object)_root)) { _root.SetActive(false); Object.Destroy((Object)(object)_root); } if (Object.op_Implicit((Object)(object)_information)) { ((Component)_information).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)_information).gameObject); } if (Object.op_Implicit((Object)(object)_navigation)) { ((Component)_navigation).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)_navigation).gameObject); } _root = null; _information = null; _image = null; _surface = (_dimming = null); _navigation = null; _pages = Array.Empty<string>(); _index = 0; _hasOpening = false; _sequence = null; _imageKeys = Array.Empty<string>(); foreach (KeyValuePair<Graphic, bool> item in Original) { if (Object.op_Implicit((Object)(object)item.Key)) { ((Behaviour)item.Key).enabled = item.Value; } } Original.Clear(); } internal static void Dispose() { Clear(); _knownPages = Array.Empty<string>(); Background.Clear(); Page.Clear(); Preview.Clear(); } internal static void ResetImages() { Background.Invalidate(); Page.Invalidate(); Preview.Invalidate(); } } internal sealed class ConfirmationImageLayout : MonoBehaviour { private RawImage _image; internal void Configure(RawImage image) { _image = image; LateUpdate(); } private void LateUpdate() { //IL_0035: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_image) && Object.op_Implicit((Object)(object)_image.texture)) { Transform parent = ((Component)this).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (val != null) { Rect rect = val.rect; float width = ((Rect)(ref rect)).width; rect = val.rect; (float, float, float, float, float, float) tuple = PresentationMath.Fit(width, ((Rect)(ref rect)).height, _image.texture.width, _image.texture.height, PresentationSettings.Fit.Value); RectTransform val2 = (RectTransform)((Component)this).transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.pivot = val3; Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; val2.anchoredPosition = Vector2.zero; val2.sizeDelta = new Vector2(tuple.Item1, tuple.Item2); _image.uvRect = new Rect(tuple.Item3, tuple.Item4, tuple.Item5, tuple.Item6); } } } } internal static class CrosshairVisibility { private static readonly FieldInfo Crosshair = AccessTools.Field(typeof(Hud), "m_crosshair"); private static readonly FieldInfo Bow = AccessTools.Field(typeof(Hud), "m_crosshairBow"); private static readonly Dictionary<Graphic, bool> Original = new Dictionary<Graphic, bool>(); internal static void Apply(Hud hud) { Menu instance = Menu.instance; if (Object.op_Implicit((Object)(object)hud) && (ServerPage.Active || (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.m_menuDialog) && ((Component)instance.m_menuDialog).gameObject.activeInHierarchy))) { object? obj = Crosshair?.GetValue(hud); Hide((Graphic)((obj is Graphic) ? obj : null)); object? obj2 = Bow?.GetValue(hud); Hide((Graphic)((obj2 is Graphic) ? obj2 : null)); } } private static void Hide(Graphic graphic) { if (Object.op_Implicit((Object)(object)graphic)) { if (!Original.ContainsKey(graphic)) { Original[graphic] = ((Behaviour)graphic).enabled; } ((Behaviour)graphic).enabled = false; } } internal static void Restore() { foreach (KeyValuePair<Graphic, bool> item in Original) { if (Object.op_Implicit((Object)(object)item.Key)) { ((Behaviour)item.Key).enabled = item.Value; } } Original.Clear(); } } [HarmonyPatch(typeof(Hud), "UpdateCrosshair")] internal static class CrosshairMenuPatch { private static void Prefix() { CrosshairVisibility.Restore(); } private static void Postfix(Hud __instance) { CrosshairVisibility.Apply(__instance); } } internal static class CurrentServer { private static ServerJoinData _requested; private static ServerJoinData _connected; private static ZNet _network; internal static bool ShouldHide(ServerTarget server, bool hideOnCurrentServer) { if (hideOnCurrentServer) { return IsConfigured(server); } return false; } internal static void Joining(ServerJoinData server) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) _requested = server; } internal static void Connected(ZNet network, ZRpc rpc) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)network) && !network.IsServer() && (int)ZNet.GetConnectionStatus() == 2 && network.GetServerPeer()?.m_rpc == rpc) { _network = network; _connected = _requested; } } internal static bool IsConfigured(ServerTarget server) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_0093: 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_00a8: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_0171: Invalid comparison between Unknown and I4 //IL_0145: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if (server == null || !Object.op_Implicit((Object)(object)_network) || (Object)(object)_network != (Object)(object)ZNet.instance || _network.IsServer() || (int)ZNet.GetConnectionStatus() != 2) { return false; } if (JoinNative.Matches(_connected, server)) { return true; } if (!((ServerJoinData)(ref _connected)).IsValid || !Object.op_Implicit((Object)(object)MultiBackendMatchmaking.Instance)) { return false; } if ((int)_connected.m_type == 3 && ((ServerJoinData)(ref _connected)).Dedicated.m_port != server.Port) { return false; } ServerJoinData val = default(ServerJoinData); ((ServerJoinData)(ref val))..ctor(new ServerJoinDataDedicated(server.Host, server.Port)); IPv6Address? val2 = default(IPv6Address?); IPv6Address? val3 = default(IPv6Address?); if ((int)_connected.m_type == 3 && ((ServerJoinData)(ref _connected)).Dedicated.m_port == server.Port && MultiBackendMatchmaking.GetServerIPCached(((ServerJoinData)(ref _connected)).Dedicated, ref val2) && MultiBackendMatchmaking.GetServerIPCached(((ServerJoinData)(ref val)).Dedicated, ref val3) && val2.HasValue && val3.HasValue) { IPv6Address value = val2.Value; if (((IPv6Address)(ref value)).Equals(val3.Value)) { return true; } } ServerMatchmakingData serverMatchmakingData = MultiBackendMatchmaking.GetServerMatchmakingData(_connected, default(DateTime)); ServerMatchmakingData serverMatchmakingData2 = MultiBackendMatchmaking.GetServerMatchmakingData(val, default(DateTime)); if (!string.IsNullOrEmpty(serverMatchmakingData.m_joinCode) && !string.IsNullOrEmpty(serverMatchmakingData2.m_joinCode)) { return serverMatchmakingData.m_joinCode == serverMatchmakingData2.m_joinCode; } if ((int)_connected.m_type == 1) { PlatformUserID hostUser = serverMatchmakingData.m_hostUser; if (((PlatformUserID)(ref hostUser)).IsValid) { hostUser = serverMatchmakingData2.m_hostUser; if (((PlatformUserID)(ref hostUser)).IsValid) { return serverMatchmakingData.m_hostUser == serverMatchmakingData2.m_hostUser; } } } return false; } internal static void Destroyed(ZNet network) { //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) if (!((Object)(object)_network != (Object)(object)network)) { _network = null; _connected = ServerJoinData.None; } } internal static void Clear() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //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) _requested = (_connected = ServerJoinData.None); _network = null; } } internal sealed class CycleTimer { private float _elapsed; private float _interval; internal bool Tick(float seconds, float interval, bool active, bool manual = false) { if (interval != _interval || manual || !(interval > 0f) || float.IsInfinity(interval)) { _elapsed = 0f; _interval = interval; } if (!active || manual || !(interval > 0f) || float.IsInfinity(interval) || !(seconds > 0f) || float.IsInfinity(seconds)) { return false; } _elapsed += Math.Min(seconds, interval); if (_elapsed < interval) { return false; } _elapsed = 0f; return true; } } [HarmonyPatch(typeof(FejdStartup), "SetupGui")] internal static class FejdStartupSetupGuiPatch { [HarmonyPostfix] [HarmonyPriority(0)] private static void Postfix(FejdStartup __instance) { TitleScreenScrubber.Apply(__instance); } } [HarmonyPatch(typeof(FejdStartup), "Start")] internal static class FejdStartupStartPatch { [HarmonyPostfix] [HarmonyPriority(0)] private static void Postfix(FejdStartup __instance) { TitleScreenScrubber.Apply(__instance); QuickJoin.FrontendReady(); } } internal static class HoverAudioFormat { internal static string Describe(string configured, float startSeconds) { try { string text = Resolve(configured); if (text.Length == 0) { return "off"; } string fileName = Path.GetFileName(text); if (!File.Exists(text)) { return fileName + " (not found; cached audio may remain)"; } if (!TryGetType(text, out var _)) { return fileName + " (unsupported format)"; } return fileName + "; start at " + startSeconds.ToString("0.###", CultureInfo.InvariantCulture) + " s"; } catch { return "invalid file path"; } } internal static string Resolve(string configured) { if (string.IsNullOrWhiteSpace(configured)) { return ""; } string fullPath = Path.GetFullPath(Path.IsPathRooted(configured.Trim()) ? configured.Trim() : Path.Combine(Paths.ConfigPath, configured.Trim())); if (Path.HasExtension(fullPath)) { return fullPath; } string[] array = new string[3] { ".wav", ".ogg", ".mp3" }; foreach (string text in array) { if (File.Exists(fullPath + text)) { return fullPath + text; } string directoryName = Path.GetDirectoryName(fullPath); if (Directory.Exists(directoryName)) { string name = Path.GetFileName(fullPath) + text; string text2 = Directory.GetFiles(directoryName).OrderBy<string, string>((string p) => p, StringComparer.Ordinal).FirstOrDefault((string p) => string.Equals(Path.GetFileName(p), name, StringComparison.OrdinalIgnoreCase)); if (text2 != null) { return text2; } } } return fullPath; } internal static bool TryGetType(string path, out AudioType type) { switch (Path.GetExtension(path ?? "").ToLowerInvariant()) { case ".mp3": case ".mp2": type = (AudioType)13; return true; case ".wav": case ".wave": type = (AudioType)20; return true; case ".ogg": case ".oga": type = (AudioType)14; return true; default: type = (AudioType)0; return false; } } } internal sealed class ImageButtonGuard : MonoBehaviour, ICanvasRaycastFilter { private Transform _scope; private Selectable _owner; private Texture2D _normal; private ArtworkHitMask _mask; private float _extra; internal void Configure(Transform scope, Selectable owner, Texture2D normal = null, float extra = 0f) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) _scope = scope; _owner = owner; _extra = (float.IsNaN(extra) ? 0f : Mathf.Clamp(extra, 0f, 100f)); if (_extra > 0f && Object.op_Implicit((Object)(object)normal)) { if ((Object)(object)normal != (Object)(object)_normal || _mask == null) { _mask = new ArtworkHitMask(normal); } } else { _mask = null; } _normal = normal; RawImage component = ((Component)this).gameObject.GetComponent<RawImage>(); if (Object.op_Implicit((Object)(object)component)) { ((Graphic)component).raycastPadding = new Vector4(0f - _extra, 0f - _extra, 0f - _extra, 0f - _extra); } } public bool IsRaycastLocationValid(Vector2 point, Camera eventCamera) { //IL_0023: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_normal)) { Transform transform = ((Component)this).transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); Vector2 val2 = default(Vector2); if (val != null && RectTransformUtility.ScreenPointToLocalPointInRectangle(val, point, eventCamera, ref val2)) { Rect rect = val.rect; if (((Rect)(ref rect)).width <= 0f || ((Rect)(ref rect)).height <= 0f || val2.x < ((Rect)(ref rect)).xMin - _extra || val2.x > ((Rect)(ref rect)).xMax + _extra || val2.y < ((Rect)(ref rect)).yMin - _extra || val2.y > ((Rect)(ref rect)).yMax + _extra) { return false; } float num = (val2.x - ((Rect)(ref rect)).xMin) / ((Rect)(ref rect)).width; float num2 = (val2.y - ((Rect)(ref rect)).yMin) / ((Rect)(ref rect)).height; bool flag = false; if (num >= 0f && num <= 1f && num2 >= 0f && num2 <= 1f) { for (int i = -1; i <= 1; i++) { if (flag) { break; } for (int j = -1; j <= 1; j++) { if (flag) { break; } flag = _normal.GetPixelBilinear(Mathf.Clamp01(num + (float)j * 4f / ((Rect)(ref rect)).width), Mathf.Clamp01(num2 + (float)i * 4f / ((Rect)(ref rect)).height)).a >= 0.05f; } } } if (!flag && _mask != null) { flag = _mask.Contains(num, num2, (4f + _extra) / ((Rect)(ref rect)).width, (4f + _extra) / ((Rect)(ref rect)).height); } if (!flag) { return false; } } } if (!Object.op_Implicit((Object)(object)_scope) || !Object.op_Implicit((Object)(object)_owner)) { return true; } Graphic[] componentsInChildren = ((Component)_scope).GetComponentsInChildren<Graphic>(false); foreach (Graphic val3 in componentsInChildren) { if (!((Behaviour)val3).enabled || !val3.raycastTarget || val3.depth < 0 || val3.canvasRenderer.cull || Object.op_Implicit((Object)(object)((Component)val3).GetComponentInParent<ImageButtonGuard>())) { continue; } Selectable componentInParent = ((Component)val3).GetComponentInParent<Selectable>(); if (Object.op_Implicit((Object)(object)componentInParent) && !((Object)(object)componentInParent == (Object)(object)_owner) && ((UIBehaviour)componentInParent).IsActive()) { Canvas canvas = val3.canvas; Camera val4 = ((Object.op_Implicit((Object)(object)canvas) && (int)canvas.renderMode != 0) ? canvas.worldCamera : null); if (RectTransformUtility.RectangleContainsScreenPoint(val3.rectTransform, point, val4, val3.raycastPadding) && val3.Raycast(point, val4)) { return false; } } } return true; } } internal static class JoinNative { private static readonly FieldInfo QueuedServer = AccessTools.Field(typeof(FejdStartup), "m_queuedJoinServer"); private static readonly FieldInfo RequestedServer = AccessTools.Field(typeof(ZSteamMatchmaking), "m_joinData"); private static readonly MethodInfo SetPassword = AccessTools.PropertySetter(typeof(FejdStartup), "ServerPassword"); private static readonly FieldInfo Profiles = AccessTools.Field(typeof(FejdStartup), "m_profiles"); private static readonly FieldInfo ProfileIndex = AccessTools.Field(typeof(FejdStartup), "m_profileIndex"); private static readonly MethodInfo UpdateCharacters = AccessTools.Method(typeof(FejdStartup), "UpdateCharacterList", (Type[])null, (Type[])null); private static readonly FieldInfo MenuAnimator = AccessTools.Field(typeof(FejdStartup), "m_menuAnimator"); internal static bool Available { get { if (QueuedServer != null && RequestedServer != null && SetPassword != null && Profiles != null && ProfileIndex != null && UpdateCharacters != null) { return MenuAnimator != null; } return false; } } internal static void Validate() { if (!Available) { throw new MissingMemberException("Valheim's queued-join/password API changed."); } } internal static bool Matches(ServerJoinData data, ServerTarget server) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (server != null && (int)data.m_type == 3 && ((ServerJoinData)(ref data)).Dedicated.m_port == server.Port) { ServerJoinDataDedicated dedicated = ((ServerJoinData)(ref data)).Dedicated; return string.Equals(((ServerJoinDataDedicated)(ref dedicated)).m_host, server.Host, StringComparison.OrdinalIgnoreCase); } return false; } internal static ServerJoinData Queued(FejdStartup startup) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return (ServerJoinData)QueuedServer.GetValue(startup); } internal static void Password(string value) { SetPassword.Invoke(null, new object[1] { value }); } internal static bool SelectMostRecentCharacter(FejdStartup startup) { string text = PlatformPrefs.GetString("profile", ""); if (string.IsNullOrEmpty(text) || !(Profiles.GetValue(startup) is List<PlayerProfile> list)) { return false; } for (int i = 0; i < list.Count; i++) { if (!(list[i].GetFilename() != text)) { ProfileIndex.SetValue(startup, i); UpdateCharacters.Invoke(startup, null); return true; } } return false; } internal static bool SelectCurrentCharacter(FejdStartup startup, JoinAttempt attempt) { if (attempt.CharacterFilename == null || !(Profiles.GetValue(startup) is List<PlayerProfile> list)) { return false; } for (int i = 0; i < list.Count; i++) { PlayerProfile val = list[i]; if (val.GetPlayerID() == attempt.CharacterId && !(val.GetFilename() != attempt.CharacterFilename) && !(((object)Unsafe.As<FileSource, FileSource>(ref val.m_fileSource)/*cast due to .constrained prefix*/).ToString() != attempt.CharacterSource)) { ProfileIndex.SetValue(startup, i); UpdateCharacters.Invoke(startup, null); return true; } } return false; } internal static void ClearRequest(ServerTarget server) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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) if (Available) { ZSteamMatchmaking instance = ZSteamMatchmaking.instance; if (instance != null && Matches((ServerJoinData)RequestedServer.GetValue(instance), server)) { RequestedServer.SetValue(instance, ServerJoinData.None); } FejdStartup instance2 = FejdStartup.instance; if (Object.op_Implicit((Object)(object)instance2) && Matches(Queued(instance2), server)) { QueuedServer.SetValue(instance2, ServerJoinData.None); } } } internal static void ReturnToMenu(FejdStartup startup) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)startup).CancelInvoke("LoadMainSceneIfBackendSelected"); if (Object.op_Implicit((Object)(object)startup.m_loading)) { startup.m_loading.SetActive(false); } startup.SetServerToJoin(ServerJoinData.None); startup.OnSelelectCharacterBack(); object? value = MenuAnimator.GetValue(startup); Animator val = (Animator)((value is Animator) ? value : null); if (val != null && Object.op_Implicit((Object)(object)val)) { val.ResetTrigger("FadeOut"); val.SetTrigger("FadeIn"); } } } [HarmonyPatch(typeof(FejdStartup), "ProceedJoinRequest")] internal static class JoinRequestPatch { private static void Prefix(ServerJoinData joinData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (QuickJoin.Attempt != null && !JoinNative.Matches(joinData, QuickJoin.Attempt.Server)) { QuickJoin.Cancel(); } } private static void Postfix(FejdStartup __instance, ServerJoinData joinData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) QuickJoin.Accepted(__instance, joinData); } } [HarmonyPatch(typeof(FejdStartup), "JoinServer")] internal static class JoiningPatch { private static void Prefix(FejdStartup __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) CurrentServer.Joining(__instance.GetServerToJoin()); if (QuickJoin.Attempt != null) { if (JoinNative.Matches(__instance.GetServerToJoin(), QuickJoin.Attempt.Server)) { QuickJoin.Attempt.Stage = JoinStage.Connecting; QuickJoin.Attempt.Frontend = __instance; } else { QuickJoin.Cancel(); } } } private static void Postfix(FejdStartup __instance) { JoinAttempt attempt = QuickJoin.Attempt; if (attempt != null && attempt.Stage == JoinStage.Connecting && !((MonoBehaviour)__instance).IsInvoking("LoadMainSceneIfBackendSelected") && !__instance.m_loading.activeSelf) { QuickJoin.ConnectionFailed(__instance); } } } [HarmonyPatch(typeof(FejdStartup), "OnSelelectCharacterBack")] internal static class CharacterBackPatch { private static void Prefix() { QuickJoin.Cancel(); } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError", new Type[] { typeof(ConnectionStatus) })] internal static class ConnectionFailurePatch { private static void Prefix(FejdStartup __instance) { QuickJoin.ConnectionFailed(__instance); } } [HarmonyPatch(typeof(EulaWindow), "DeclineButton")] internal static class EulaDeclinedPatch { private static void Prefix() { QuickJoin.Cancel(); } } [HarmonyPatch(typeof(ZNet), "RPC_ClientHandshake")] internal static class PasswordPatch { internal struct Scope { internal bool Changed; internal string Previous; } private static void Prefix(ZNet __instance, ZRpc rpc, bool needPassword, out Scope __state) { __state = default(Scope); if (__instance.IsServer()) { return; } JoinAttempt attempt = QuickJoin.Attempt; if (attempt != null && attempt.Stage == JoinStage.Connecting && __instance.GetPeers().Exists((ZNetPeer peer) => peer.m_server && peer.m_rpc == rpc)) { QuickJoin.Attempt.Network = __instance; if (needPassword) { __state = new Scope { Changed = true, Previous = FejdStartup.ServerPassword }; JoinNative.Password(QuickJoin.CanSupplyPassword ? QuickJoin.Attempt.Server.Password : null); } } } private static Exception Finalizer(Exception __exception, Scope __state) { if (__state.Changed) { JoinNative.Password(__state.Previous); } return __exception; } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] internal static class ConnectedPatch { private static void Postfix(ZNet __instance, ZRpc rpc) { CurrentServer.Connected(__instance, rpc); QuickJoin.Success(__instance, rpc); } } [HarmonyPatch(typeof(ZNet), "RPC_Error")] internal static class ErrorPatch { private static void Prefix(ZNet __instance, ZRpc rpc, int error) { QuickJoin.Error(__instance, rpc, error); } } [HarmonyPatch(typeof(Game), "ContinueLogout")] internal static class LogoutDecisionPatch { private static void Postfix(Game __instance) { JoinAttempt attempt = QuickJoin.Attempt; if (attempt != null && attempt.Stage == JoinStage.LeavingWorld && !__instance.IsShuttingDown()) { QuickJoin.Cancel(); } } } [HarmonyPatch(typeof(Menu), "OnLogoutNo")] internal static class LogoutCancelPatch { private static void Prefix() { QuickJoin.Cancel(); } } [HarmonyPatch(typeof(Menu), "Hide")] internal static class LeaveMenuPatch { private static void Prefix() { CrosshairVisibility.Restore(); JoinAttempt attempt = QuickJoin.Attempt; if (attempt != null && attempt.Stage == JoinStage.LeavingWorld && Object.op_Implicit((Object)(object)Game.instance) && !Game.instance.IsShuttingDown()) { QuickJoin.Cancel(); } } } [HarmonyPatch(typeof(ZNet), "OnDestroy")] internal static class NetworkDestroyedPatch { private static void Prefix(ZNet __instance) { CurrentServer.Destroyed(__instance); JoinAttempt attempt = QuickJoin.Attempt; if (attempt != null && attempt.Stage == JoinStage.Connecting && (Object)(object)QuickJoin.Attempt.Network == (Object)(object)__instance) { QuickJoin.Cancel(); } } } internal sealed class LocalTextFile { private readonly string _label; private string _text; private string _path; private string _warning; private DateTime _stamp; private bool _attempted; internal LocalTextFile(string label) { _label = label; } internal void Invalidate() { _attempted = false; } internal string Read(string configured) { if (string.IsNullOrWhiteSpace(configured)) { _text = (_path = (_warning = null)); _attempted = false; return null; } try { string fullPath = Path.GetFullPath(Path.IsPathRooted(configured.Trim()) ? configured.Trim() : Path.Combine(Paths.ConfigPath, configured.Trim())); if (!File.Exists(fullPath)) { return _text; } DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(fullPath); if (_attempted && fullPath == _path && lastWriteTimeUtc == _stamp) { return _text; } _path = fullPath; _stamp = lastWriteTimeUtc; _attempted = true; string text = File.ReadAllText(fullPath, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true)); _text = text; _warning = null; } catch (Exception ex) { string text2 = _label + " could not load: " + configured + ": " + ex.Message; if (_warning != text2) { Plugin.Warn(text2); _warning = text2; } } return _text; } } internal static class MenuInputs { private static readonly FieldInfo MenuList = AccessTools.Field(typeof(FejdStartup), "m_menuList"); private static readonly FieldInfo Settings = AccessTools.Field(typeof(FejdStartup), "m_settingsPopup"); internal static bool TitleArtworkVisible(FejdStartup startup) { if (!Object.op_Implicit((Object)(object)startup) || !Object.op_Implicit((Object)(object)startup.m_changeLog) || !startup.m_changeLog.activeInHierarchy) { return TitleVisible(startup); } if (!Object.op_Implicit((Object)(object)startup.m_mainMenu) || !startup.m_mainMenu.activeInHierarchy || UnifiedPopup.IsVisible()) { return false; } object? obj = Settings?.GetValue(startup); GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (Object.op_Implicit((Object)(object)val)) { return !val.activeInHierarchy; } return true; } internal static bool TitleVisible(FejdStartup startup) { if (!Object.op_Implicit((Object)(object)startup) || !Object.op_Implicit((Object)(object)startup.m_mainMenu) || !startup.m_mainMenu.activeInHierarchy || UnifiedPopup.IsVisible() || (Object.op_Implicit((Object)(object)startup.m_changeLog) && startup.m_changeLog.activeInHierarchy)) { return false; } if (MenuList != null) { object? value = MenuList.GetValue(startup); GameObject val = (GameObject)((value is GameObject) ? value : null); if (!Object.op_Implicit((Object)(object)val) || !val.activeInHierarchy) { return false; } } object? obj = Settings?.GetValue(startup); GameObject val2 = (GameObject)((obj is GameObject) ? obj : null); if (Object.op_Implicit((Object)(object)val2)) { return !val2.activeInHierarchy; } return true; } internal static bool TextEntryActive() { if (Console.IsVisible() || TextInput.IsVisible() || (Object.op_Implicit((Object)(object)Chat.instance) && Chat.instance.HasFocus())) { return true; } EventSystem current = EventSystem.current; GameObject val = (Object.op_Implicit((Object)(object)current) ? current.currentSelectedGameObject : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } TMP_InputField componentInParent = val.GetComponentInParent<TMP_InputField>(); InputField componentInParent2 = val.GetComponentInParent<InputField>(); if (!Object.op_Implicit((Object)(object)componentInParent) || !componentInParent.isFocused) { if (Object.op_Implicit((Object)(object)componentInParent2)) { return componentInParent2.isFocused; } return false; } return true; } } internal sealed class OptionalPng { private string _path; private string _warning; private readonly string _label; private DateTime _stamp; internal Texture2D Texture { get; private set; } internal OptionalPng(string label = "Join background") { _label = label; } internal bool IsLoadedFrom(string configured) { if (!Object.op_Implicit((Object)(object)Texture) || string.IsNullOrWhiteSpace(configured)) { return false; } return string.Equals(Path.GetFullPath(Path.IsPathRooted(configured) ? configured : Path.Combine(Paths.ConfigPath, configured)), _path, StringComparison.OrdinalIgnoreCase); } internal Texture2D Load(string configuredPath, bool keepOnMissing = true) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown Texture2D val = null; try { string text = (configuredPath ?? "").Trim(); if (text.Length == 0) { Clear(); return null; } text = Path.GetFullPath(Path.IsPathRooted(text) ? text : Path.Combine(Paths.ConfigPath, text)); if (!File.Exists(text)) { if (!keepOnMissing) { Clear(); } return Texture; } DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(text); if (Object.op_Implicit((Object)(object)Texture) && text == _path && lastWriteTimeUtc == _stamp) { return Texture; } if (!string.Equals(Path.GetExtension(text), ".png", StringComparison.OrdinalIgnoreCase)) { throw new InvalidDataException("The image must be a PNG."); } val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text))) { throw new InvalidDataException("The PNG could not be decoded."); } ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; Clear(); Texture = val; _path = text; _stamp = lastWriteTimeUtc; _warning = null; return Texture; } catch (Exception ex) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } string text2 = _label + " could not load: " + ex.Message; if (_warning != text2) { Plugin.Warn(text2); _warning = text2; } return Texture; } } internal void Clear() { if (Object.op_Implicit((Object)(object)Texture)) { Object.Destroy((Object)(object)Texture); } Texture = null; _path = null; _stamp = default(DateTime); } internal void Invalidate() { _stamp = default(DateTime); } } internal sealed class PageButtonFocus : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { private static readonly MethodInfo PointerInside = AccessTools.PropertyGetter(typeof(Selectable), "isPointerInside"); private Button _button; private ColorBlock _colors; private SpriteState _sprites; private AnimationTriggers _triggers; private bool _keyboard; private bool _pointerInside; private bool _showFocus; private bool _configured; private Vector2 _pointer; internal bool KeyboardActive => _keyboard; internal void Configure(Button button, bool keyboard = false) { //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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) _button = button; _keyboard = keyboard; _colors = ((Selectable)button).colors; _sprites = ((Selectable)button).spriteState; _triggers = ((Selectable)button).animationTriggers; object obj = PointerInside?.Invoke(button, null); _pointerInside = obj is bool && (bool)obj; _pointer = Vector2.op_Implicit(ZInput.pointerPosition); Refresh(force: true); } private void LateUpdate() { Refresh(force: false); } public void OnPointerEnter(PointerEventData eventData) { _pointerInside = true; Refresh(force: true); } public void OnPointerExit(PointerEventData eventData) { _pointerInside = false; Refresh(force: true); } private void OnDisable() { _pointerInside = false; _keyboard = false; Refresh(force: true); } private void Refresh(bool force) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0103: 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_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_0144: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_button)) { if (ZInput.GetKeyDown((KeyCode)9, true) || ZInput.GetKeyDown((KeyCode)273, true) || ZInput.GetKeyDown((KeyCode)274, true) || ZInput.GetKeyDown((KeyCode)276, true) || ZInput.GetKeyDown((KeyCode)275, true) || ZInput.GetKeyDown((KeyCode)13, true)) { _keyboard = true; } Vector2 val = Vector2.op_Implicit(ZInput.pointerPosition); if (val != _pointer || ZInput.GetMouseButtonDown(0)) { _keyboard = false; } _pointer = val; bool flag = _pointerInside || _keyboard || ZInput.IsGamepadActive(); if (force || !_configured || flag != _showFocus) { _configured = true; _showFocus = flag; ColorBlock colors = _colors; ((ColorBlock)(ref colors)).selectedColor = (flag ? ((ColorBlock)(ref _colors)).highlightedColor : ((ColorBlock)(ref _colors)).normalColor); ((Selectable)_button).colors = colors; SpriteState sprites = _sprites; ((SpriteState)(ref sprites)).selectedSprite = (flag ? ((SpriteState)(ref _sprites)).highlightedSprite : null); ((Selectable)_button).spriteState = sprites; ((Selectable)_button).animationTriggers = new AnimationTriggers { normalTrigger = _triggers.normalTrigger, highlightedTrigger = _triggers.highlightedTrigger, pressedTrigger = _triggers.pressedTrigger, disabledTrigger = _triggers.disabledTrigger, selectedTrigger = (flag ? _triggers.highlightedTrigger : _triggers.normalTrigger) }; } } } internal void Restore() { //IL_0015: 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) if (Object.op_Implicit((Object)(object)_button)) { ((Selectable)_button).colors = _colors; ((Selectable)_button).spriteState = _sprites; ((Selectable)_button).animationTriggers = _triggers; _button = null; } } private void OnDestroy() { Restore(); } } internal static class PauseJoinButton { [CompilerGenerated] private static class <>O { public static UnityAction <0>__ConfirmSwitch; } private static Button _button; private static Menu _menu; private static float _fontSize; internal static void Refresh(Menu menu) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00cc: 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_00d7: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)menu) || !Object.op_Implicit((Object)(object)menu.menuEntriesParent) || !Object.op_Implicit((Object)(object)menu.m_logoutButton)) { return; } ServerTarget server; bool flag = PresentationSettings.PauseEntryAction.Value != ServerClickAction.Disabled && ServerPage.CanOpen(out server, fromPause: true) && !CurrentServer.ShouldHide(server, PresentationSettings.HideOnCurrentServer.Value); if ((Object)(object)_menu != (Object)(object)menu) { Destroy(); } if (!Object.op_Implicit((Object)(object)_button) && flag) { _menu = menu; _button = Object.Instantiate<Button>(menu.m_logoutButton, (Transform)(object)menu.menuEntriesParent, false); ((Object)_button).name = "ScrubbedTitleScreen_Server"; _button.onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick = _button.onClick; object obj = <>O.<0>__ConfirmSwitch; if (obj == null) { UnityAction val = ConfirmSwitch; <>O.<0>__ConfirmSwitch = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ((Component)_button).transform.SetAsLastSibling(); TMP_Text componentInChildren = ((Component)_button).GetComponentInChildren<TMP_Text>(true); _fontSize = (Object.op_Implicit((Object)(object)componentInChildren) ? componentInChildren.fontSize : 18f); if (!Object.op_Implicit((Object)(object)((Component)_button).GetComponent<LayoutElement>())) { LayoutElement obj2 = ((Component)_button).gameObject.AddComponent<LayoutElement>(); RectTransform component = ((Component)menu.m_logoutButton).GetComponent<RectTransform>(); float num; if (!Object.op_Implicit((Object)(object)component)) { num = 30f; } else { Rect rect = component.rect; num = ((Rect)(ref rect)).height; } float minHeight = num; obj2.preferredHeight = num; obj2.minHeight = minHeight; obj2.flexibleHeight = 0f; } } if (Object.op_Implicit((Object)(object)_button)) { ((Component)_button).gameObject.SetActive(flag); ((Selectable)_button).interactable = QuickJoin.Attempt == null; TMP_Text componentInChildren2 = ((Component)_button).GetComponentInChildren<TMP_Text>(true); if (Object.op_Implicit((Object)(object)componentInChildren2) && flag) { componentInChildren2.text = QuickJoin.PageName; componentInChildren2.richText = false; componentInChildren2.enableAutoSizing = true; componentInChildren2.fontSizeMin = _fontSize * 0.65f; componentInChildren2.fontSizeMax = _fontSize; componentInChildren2.fontSize = _fontSize; ((Graphic)componentInChildren2).color = Color.white; ((Graphic)componentInChildren2).raycastTarget = true; } LayoutRebuilder.ForceRebuildLayoutImmediate(menu.menuEntriesParent); Navigation(menu); } } private static void ConfirmSwitch() { ServerPage.FromPause(_menu); } internal static void Navigation(Menu menu) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_menu != (Object)(object)menu) && Object.op_Implicit((Object)(object)_button)) { Button val = ((Object.op_Implicit((Object)(object)menu.m_quitButton) && ((Component)menu.m_quitButton).gameObject.activeSelf) ? menu.m_quitButton : menu.m_logoutButton); Button continueButton = menu.m_continueButton; bool activeSelf = ((Component)_button).gameObject.activeSelf; Navigation navigation = ((Selectable)_button).navigation; ((Navigation)(ref navigation)).mode = (Mode)4; ((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)val; ((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)continueButton; ((Selectable)_button).navigation = navigation; navigation = ((Selectable)val).navigation; ((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)(activeSelf ? _button : continueButton); ((Selectable)val).navigation = navigation; navigation = ((Selectable)continueButton).navigation; ((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)(activeSelf ? _button : val); ((Selectable)continueButton).navigation = navigation; } } internal static void Destroy() { if (Object.op_Implicit((Object)(object)_button)) { Object.Destroy((Object)(object)((Component)_button).gameObject); } _button = null; _menu = null; } } [HarmonyPatch(typeof(Menu), "Start")] internal static class MenuStartPatch { private static void Postfix(Menu __instance) { PauseJoinButton.Refresh(__instance); } } [HarmonyPatch(typeof(Menu), "Show")] internal static class MenuShowPatch { private static void Postfix(Menu __instance) { PauseJoinButton.Refresh(__instance); CrosshairVisibility.Apply(Hud.instance); } } [HarmonyPatch(typeof(Menu), "UpdateNavigation")] internal static class MenuNavigationPatch { private static void Postfix(Menu __instance) { PauseJoinButton.Navigation(__instance); } } [BepInPlugin("com.jpvalheim.scrubbedtitlescreen", "Scrubbed_Title_Screen", "1.1.6")] public sealed class Plugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static EventHandler <0>__OnImageSettingChanged; public static UnityAction <1>__FromTitle; } public const string PluginGuid = "com.jpvalheim.scrubbedtitlescreen"; public const string PluginName = "Scrubbed_Title_Screen"; public const string PluginVersion = "1.1.6"; private const string CustomImageObjectName = "ScrubbedTitleScreen_CustomImage"; private static Plugin _instance; private static ConfigEntry<bool> _customImageEnabled; private static ConfigEntry<string> _customImageFile; private static ConfigEntry<ScreenAnchor> _customImageAnchor; private static ConfigEntry<float> _customImageOffsetX; private static ConfigEntry<float> _customImageOffsetY; private static ConfigEntry<float> _customImageScale; private static GameObject _customImageObject; private static bool _imageRaycastTarget; private static Texture2D _customImageTexture; private static Texture2D _hoverImageTexture; private static string _loadedHoverImagePath; private static DateTime _loadedHoverImageWriteTimeUtc; private static string _lastHoverImageWarning; private static string _loadedImagePath; private static DateTime _loadedImageWriteTimeUtc; private static string _lastImageWarning; private Harmony _harmony; internal static bool Reloading { get; private set; } internal static string ImageFile => _customImageFile?.Value; internal static bool ImagesEnabled { get { if (_customImageEnabled != null) { return _customImageEnabled.Value; } return false; } } private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown _instance = this; bool saveOnConfigSet = ((BaseUnityPlugin)this).Config.SaveOnConfigSet; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; try { BindConfiguration(); QuickJoin.Initialize(((BaseUnityPlugin)this).Config); PresentationSettings.Initialize(((BaseUnityPlugin)this).Config, (int)QualitySettings.activeColorSpace == 1); } finally { ((BaseUnityPlugin)this).Config.SaveOnConfigSet = saveOnConfigSet; } if (saveOnConfigSet) { ((BaseUnityPlugin)this).Config.Save(); } _harmony = new Harmony("com.jpvalheim.scrubbedtitlescreen"); _harmony.PatchAll(); ReloadCommand.Register(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Scrubbed_Title_Screen 1.1.6 loaded from " + typeof(Plugin).Assembly.Location + ". Config: " + ((BaseUnityPlugin)this).Config.ConfigFilePath)); } private void OnDestroy() { ServerPage.Close(); ServerPage.Disabled(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } ProjectChangelog.Dispose(); ReloadCommand.Dispose(); UnbindConfiguration(); QuickJoin.Dispose(); PresentationSettings.Dispose(); TitleBranding.Restore(); BottomInformation.DestroyTitle(); ConfirmationPresentation.Dispose(); TipTypography.Dispose(); ServerPageControls.Dispose(); TitlePageButton.Destroy(); CrosshairVisibility.Restore(); DestroyCustomImage(); _instance = null; } private void BindConfiguration() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown _customImageEnabled = ConfigMigration.Bind(((BaseUnityPlugin)this).Config, "Custom title image", "Enabled", value: true, new ConfigDescription("Show the title image. Its action is set by Title click action in [1. Server].\nIf the image is missing or disabled, a text entry appears when page content is available. Set the action to Disabled to hide it.", (AcceptableValueBase)null, Array.Empty<object>())); _customImageFile = ConfigMigration.Bind(((BaseUnityPlugin)this).Config, "Custom title image", "PNG file", "Scrubbed_Title_Screen/TitleImage.png", new ConfigDescription("Title image path, relative to BepInEx/config or a full path. For a hover image, add _Hover before .png in the same folder.", (AcceptableValueBase)null, Array.Empty<object>())); _customImageAnchor = ConfigMigration.Bind(((BaseUnityPlugin)this).Config, "Custom title image", "Anchor", ScreenAnchor.Center, new ConfigDescription("Screen position of the title image. Use Offset X and Y to move it.", (AcceptableValueBase)null, Array.Empty<object>())); _customImageOffsetX = ConfigMigration.Bind(((BaseUnityPlugin)this).Config, "Custom title image", "Offset X", 30f, new ConfigDescription("UI pixels from the anchor. Positive moves right; negative moves left.", (AcceptableValueBase)null, Array.Empty<object>())); _customImageOffsetY = ConfigMigration.Bind(((BaseUnityPlugin)this).Config, "Custom title image", "Offset Y", 80f, new ConfigDescription("UI pixels from the anchor. Positive moves up; negative moves down.", (AcceptableValueBase)null, Array.Empty<object>())); _customImageScale = ConfigMigration.Bind(((BaseUnityPlugin)t