Decompiled source of PotentialSystem v1.0.0

PotentialSystem.dll

Decompiled 12 hours ago
using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using FastText;
using FastText.Data;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Lowiro.UI.Projection;
using Microsoft.CodeAnalysis;
using Str;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.InputSystem;
using UnityEngine.ResourceManagement.AsyncOperations;
using _B;
using _K;
using _m;
using ifapp.Game;
using ifapp.Game.Common;
using ifapp.Game.Data;
using ifapp.Game.Input;
using ifapp.Game.NovelEngine.Model;
using ifapp.Game.Scenes;
using ifapp.Game.Scenes.SongSelect;
using ifapp.Game.UI;
using ifapp.Game.UI.Common;
using ifapp.Game.UI.Settings;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PotentialSystem")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("可切换官方等级、安小璃和萌泪酱定数,提供角色 PTT 菱形、原生设置、完整成绩浏览、潜力值排序与 B50 图片导出。")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PotentialSystem")]
[assembly: AssemblyTitle("PotentialSystem")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace InFalsusMod
{
	internal static class WindowsConsoleEncoding
	{
		private const uint Utf8CodePage = 65001u;

		internal static void EnsureUtf8(ManualLogSource logger)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			if (!OperatingSystem.IsWindows() || !ConsoleManager.ConsoleActive || GetConsoleOutputCP() == 65001)
			{
				return;
			}
			bool flag = default(bool);
			if (!SetConsoleOutputCP(65001u))
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(75, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to set the BepInEx console output code page to UTF-8 (Win32 error ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Marshal.GetLastWin32Error());
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
				}
				logger.LogError(val);
				return;
			}
			uint consoleOutputCP = GetConsoleOutputCP();
			if (consoleOutputCP != 65001)
			{
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(54, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BepInEx console output code page remained ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(consoleOutputCP);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("; expected ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(65001u);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
				}
				logger.LogError(val);
			}
		}

		[DllImport("kernel32.dll")]
		private static extern uint GetConsoleOutputCP();

		[DllImport("kernel32.dll", SetLastError = true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool SetConsoleOutputCP(uint codePage);
	}
	internal static class NativeButtons
	{
		internal static void UpdateText(UIButton button, UIButton template, string text)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			Il2CppArrayBase<FastText> componentsInChildren = ((Component)button).GetComponentsInChildren<FastText>(true);
			Il2CppArrayBase<FastText> componentsInChildren2 = ((Component)template).GetComponentsInChildren<FastText>(true);
			if (componentsInChildren.Length != componentsInChildren2.Length)
			{
				throw new InvalidOperationException("原版按钮文字层级已改变。");
			}
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				FastText obj = componentsInChildren[i];
				FastText val = componentsInChildren2[i];
				obj.style = val.style;
				obj.SetFontFamilyAsset(val.FontFamilyAsset);
				obj.SetFontSize(val.FontSize, (UpdateType)1);
				obj.SetTextNonLocalized(text, (UpdateType)0);
				obj.targetLocalization = val.targetLocalization;
				obj.dirtyFlags = (DirtyFlags)(obj.dirtyFlags | 0xC);
				obj.EnsureDirtyFlagsProcessed();
			}
		}

		internal static UIButton Create(UIButton template, InputReceiver owner, string name, string text, Action<UIButton> clicked)
		{
			UIManager val = UIManager._ftA();
			if ((Object)(object)val == (Object)null || (Object)(object)template.constrained2D == (Object)null)
			{
				throw new InvalidOperationException("原生按钮输入或布局尚未就绪。");
			}
			GameObject val2 = Object.Instantiate<GameObject>(((Component)template).gameObject, ((Component)template).transform.parent, false);
			((Object)val2).name = "InFalsus." + name;
			val2.SetActive(false);
			try
			{
				UIButton component = val2.GetComponent<UIButton>();
				Il2CppArrayBase<FastText> componentsInChildren = val2.GetComponentsInChildren<FastText>(true);
				if ((Object)(object)component == (Object)null || (Object)(object)component.constrained2D == (Object)null || (Object)(object)component.ButtonCollider == (Object)null || componentsInChildren.Length == 0)
				{
					throw new InvalidOperationException("原生按钮缺少布局、碰撞体或文字组件。");
				}
				component._Gjb = null;
				component._hjb = null;
				component._Hjb = null;
				component._ijb = null;
				component._Ijb = null;
				component.UserComponent = null;
				component._DSA(_EI.op_Implicit(clicked));
				component._dSA((_dI)1);
				UpdateText(component, template, text);
				val._mtA(component, owner);
				return component;
			}
			catch
			{
				Object.Destroy((Object)(object)val2);
				throw;
			}
		}

		internal static void Place(UIButton button, Transform parent, Vector2 offset, Vector2 size)
		{
			//IL_0024: 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_0036: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			((Component)button).transform.SetParent(parent, false);
			Constrained2DTransform constrained2DTransform = button.constrained2D.constrained2DTransform;
			constrained2DTransform.anchor = new Vector2(0.5f, 0.5f);
			constrained2DTransform.offset = offset;
			constrained2DTransform.sizeInPixels = size;
			constrained2DTransform.parentAlignment = (Constrained2DAlignment)0;
			button.constrained2D.constrained2DTransform = constrained2DTransform;
			foreach (FastText componentsInChild in ((Component)button).GetComponentsInChildren<FastText>(true))
			{
				componentsInChild.presention = (FastTextPresentation)((componentsInChild.presention | 0x40) & -33);
				componentsInChild.SetMaxAutoLineBreakPixelWidth((int)Math.Max(24f, size.x - 24f), (UpdateType)1);
				componentsInChild.dirtyFlags = (DirtyFlags)(componentsInChild.dirtyFlags | 8);
				componentsInChild.EnsureDirtyFlagsProcessed();
			}
			((Component)button).gameObject.SetActive(true);
			button.constrained2D._rQA();
			button.constrained2D._PQA((byte)63);
		}

		internal static void SetState(UIButton button, bool enabled, bool selected = false)
		{
			button._dSA((_dI)(enabled ? ((!selected) ? 1 : 2) : 0));
		}
	}
	internal static class PngRgba
	{
		private static readonly byte[] Signature = new byte[8] { 137, 80, 78, 71, 13, 10, 26, 10 };

		private const int BytesPerPixel = 4;

		internal static DecodedImage Decode(Stream stream)
		{
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			Span<byte> span = memoryStream.GetBuffer().AsSpan(0, (int)memoryStream.Length);
			if (span.Length < Signature.Length || !span.Slice(0, Signature.Length).SequenceEqual(Signature))
			{
				throw new InvalidDataException("特性筛选入口图案不是 PNG。");
			}
			int num = 0;
			int num2 = 0;
			using MemoryStream memoryStream2 = new MemoryStream();
			int num3 = Signature.Length;
			while (true)
			{
				if (num3 + 12 > span.Length)
				{
					throw new InvalidDataException("特性筛选入口图案数据不完整。");
				}
				int num4 = checked((int)BinaryPrimitives.ReadUInt32BigEndian(span.Slice(num3)));
				Span<byte> span2 = span.Slice(num3 + 4, 4);
				if (num3 + 12 + num4 > span.Length)
				{
					throw new InvalidDataException("特性筛选入口图案数据不完整。");
				}
				Span<byte> span3 = span.Slice(num3 + 8, num4);
				checked
				{
					if (span2.SequenceEqual("IHDR"u8))
					{
						num = (int)BinaryPrimitives.ReadUInt32BigEndian(span3);
						num2 = (int)BinaryPrimitives.ReadUInt32BigEndian(span3.Slice(4));
						if (num <= 0 || num2 <= 0 || span3[8] != 8 || span3[9] != 6 || span3[10] != 0 || span3[11] != 0 || span3[12] != 0)
						{
							throw new InvalidDataException("特性筛选入口图案必须是 8 位 RGBA 非隔行 PNG。");
						}
					}
					else if (span2.SequenceEqual("IDAT"u8))
					{
						memoryStream2.Write(span3);
					}
					else if (span2.SequenceEqual("IEND"u8))
					{
						break;
					}
				}
				num3 += 12 + num4;
			}
			if (num == 0)
			{
				throw new InvalidDataException("特性筛选入口图案缺少 IHDR。");
			}
			int num5;
			byte[] array;
			checked
			{
				num5 = num * 4;
				array = new byte[(num5 + 1) * num2];
				memoryStream2.Position = 0L;
			}
			using (ZLibStream zLibStream = new ZLibStream(memoryStream2, CompressionMode.Decompress))
			{
				int num6;
				for (int i = 0; i < array.Length; i += num6)
				{
					if ((num6 = zLibStream.Read(array, i, array.Length - i)) == 0)
					{
						throw new InvalidDataException("特性筛选入口图案像素数据不完整。");
					}
				}
			}
			byte[] array2 = new byte[checked(num5 * num2)];
			byte[] array3 = new byte[num5];
			byte[] array4 = new byte[num5];
			for (int j = 0; j < num2; j++)
			{
				int num7 = j * (num5 + 1);
				byte filter = array[num7];
				array.AsSpan(num7 + 1, num5).CopyTo(array4);
				Unfilter(filter, array4, array3);
				array4.CopyTo(array2.AsSpan((num2 - 1 - j) * num5, num5));
				byte[] array5 = array4;
				array4 = array3;
				array3 = array5;
			}
			return new DecodedImage(num, num2, array2);
		}

		private static void Unfilter(byte filter, byte[] line, byte[] previous)
		{
			for (int i = 0; i < line.Length; i++)
			{
				int num = ((i >= 4) ? line[i - 4] : 0);
				int num2 = previous[i];
				int upLeft = ((i >= 4) ? previous[i - 4] : 0);
				int num3 = filter switch
				{
					0 => 0, 
					1 => num, 
					2 => num2, 
					3 => (num + num2) / 2, 
					4 => Paeth(num, num2, upLeft), 
					_ => throw new InvalidDataException("特性筛选入口图案使用了未知的 PNG 过滤类型。"), 
				};
				line[i] = (byte)(line[i] + num3);
			}
		}

		private static int Paeth(int left, int up, int upLeft)
		{
			int num = left + up - upLeft;
			int num2 = Math.Abs(num - left);
			int num3 = Math.Abs(num - up);
			int num4 = Math.Abs(num - upLeft);
			if (num2 > num3 || num2 > num4)
			{
				if (num3 > num4)
				{
					return upLeft;
				}
				return up;
			}
			return left;
		}
	}
	internal readonly record struct DecodedImage(int Width, int Height, byte[] BottomUpPixels);
}
namespace InFalsusMod.Potential
{
	internal static class B50Image
	{
		internal const int Columns = 5;

		internal const int CardWidth = 833;

		internal const int CardHeight = 278;

		internal const int Gap = 20;

		internal static byte[] Render(PotentialSnapshot snapshot, IReadOnlyDictionary<ChartKey, PixelImage> covers, PixelImage badge)
		{
			int num = Math.Max(1, (snapshot.B50.Count + 5 - 1) / 5);
			int num2 = 360 + num * 298 - 20 + 140;
			using WindowsBitmap windowsBitmap = new WindowsBitmap(4405, num2);
			windowsBitmap.Fill(0, 0, 4405, num2, 2435636u);
			windowsBitmap.Fill(0, 0, 4405, 305, 2106928u);
			windowsBitmap.Image(badge, 80, 40, 220, 220);
			windowsBitmap.Text(PotentialCalculator.Format(snapshot.Potential), 118, 130, 150, 70, 43, 16777215u, bold: true);
			windowsBitmap.Text("IN FALSUS", 350, 35, 1200, 70, 48, 16777215u, bold: true);
			windowsBitmap.Text("PLAYER BESTS · B50", 350, 104, 1500, 100, 72, 16777215u, bold: true);
			windowsBitmap.Text($"B50 {PotentialCalculator.Format(snapshot.B50Average)}    B10 {PotentialCalculator.Format(snapshot.B10Average)}    {snapshot.B50.Count}/50", 350, 225, 1440, 46, 30, 12898014u);
			windowsBitmap.Text("UNOFFICIAL POTENTIAL", 3575, 58, 750, 48, 32, 10940630u, bold: true, right: true);
			windowsBitmap.Text(PotentialCalculator.Format(snapshot.Potential), 3625, 115, 700, 115, 98, 16777215u, bold: true, right: true);
			windowsBitmap.Text($"MAX {PotentialCalculator.Format(snapshot.Maximum)}    已游玩 {snapshot.Plays.Count} 谱面", 3575, 238, 750, 42, 28, 12898014u, bold: false, right: true);
			windowsBitmap.Fill(80, 317, 4245, 3, 10940630u);
			for (int i = 0; i < snapshot.B50.Count; i++)
			{
				RankedPlay rankedPlay = snapshot.B50[i];
				ChartDefinition chartDefinition = rankedPlay.Chart ?? throw new InvalidDataException("B50 中存在无法匹配的谱面。");
				if (!covers.TryGetValue(rankedPlay.Play.Key, out PixelImage value))
				{
					throw new InvalidDataException("缺少分享图封面:" + chartDefinition.Title + "。");
				}
				int item = 80 + i % 5 * 853;
				int item2 = 360 + i / 5 * 298;
				DrawCard(windowsBitmap, rankedPlay, value, (X: item, Y: item2, Width: 833, Height: 278));
			}
			if (snapshot.B50.Count == 0)
			{
				windowsBitmap.Text("还没有已游玩的谱面", 80, 450, 4245, 80, 44, 12898014u);
			}
			windowsBitmap.Fill(80, num2 - 92, 4245, 2, 10940630u);
			string text = "谱面定数来源:" + CommunityConstants.DisplayName(snapshot.Catalog.Source);
			windowsBitmap.Text("PotentialSystem · PTT = (B50 总和 + B10 总和) / 60 · " + text, 80, num2 - 69, 3795, 44, 25, 11713997u);
			windowsBitmap.Text(DateTime.Now.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture), 3895, num2 - 69, 430, 44, 25, 11713997u, bold: false, right: true);
			return windowsBitmap.ToClipboardDib();
		}

		private static void DrawCard(WindowsBitmap image, RankedPlay play, PixelImage cover, (int X, int Y, int Width, int Height) bounds)
		{
			ChartDefinition chart = play.Chart;
			CoverPalette coverPalette = CoverPalette.From(cover);
			var (num, num2, num3, _) = bounds;
			image.RoundedFill(bounds, 16, coverPalette.Border);
			image.RoundedFill((X: num + 2, Y: num2 + 2, Width: num3 - 4, Height: bounds.Height - 4), 14, coverPalette.Background);
			image.Image(cover, num + 18, num2 + 21, 236, 236);
			int x = num + 274;
			int num4 = num3 - 298;
			uint rgb = PotentialPresentation.DifficultyRgb(play.Play.Difficulty);
			image.Text(PotentialPresentation.Difficulty(play.Play.Difficulty) + "  " + PotentialCalculator.FormatConstant(chart.Constant), x, num2 + 20, num4 - 188, 40, 25, rgb, bold: true);
			image.Text(PotentialCalculator.Format(play.Potential.Value), num + num3 - 197, num2 + 15, 173, 51, 42, rgb, bold: true, right: true);
			image.Text(chart.Title, x, num2 + 73, num4, 42, 33, 16777215u, bold: true);
			image.Text(chart.Artist, x, num2 + 116, num4, 30, 22, 13227231u);
			image.Text(PotentialPresentation.Score(play.Play.Score), x, num2 + 153, num4, 68, 56, 15792895u, bold: true);
			image.Text(PotentialPresentation.Lamp(play.Play.Lamp), x, num2 + 231, num4 - 100, 32, 25, (play.Play.Lamp == 2) ? 10940630u : 13819111u, bold: true);
			image.Text($"#{play.Rank}", num + num3 - 130, num2 + 222, 106, 41, 33, 16777215u, bold: true, right: true);
		}
	}
	internal sealed class BrowserWidgets : IDisposable
	{
		private readonly SongSelectScene scene;

		private readonly InputReceiver owner;

		private readonly List<BrowserGraphic> graphics = new List<BrowserGraphic>();

		private readonly List<UIButton> buttons = new List<UIButton>();

		private readonly List<Delegate> callbacks = new List<Delegate>();

		private readonly List<(Constrained2D Layout, BoxCollider Collider)> hitAreas = new List<(Constrained2D, BoxCollider)>();

		internal Constrained2D Root { get; }

		internal Vector2 Size => LayoutSize(Root);

		internal BrowserWidgets(SongSelectScene scene, InputReceiver owner)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			this.scene = scene;
			this.owner = owner;
			Root = Container(((Component)scene.scene).transform, "Results", Vector2.zero);
			try
			{
				Constrained2DTransform constrained2DTransform = Root.constrained2DTransform;
				constrained2DTransform.sizeInParentNormalized = new Vector2(0.96f, 0.94f);
				constrained2DTransform.zPosition = -1f;
				constrained2DTransform.overrideMaterialRenderQueueOffset = 100;
				Root.constrained2DTransform = constrained2DTransform;
				Root._PQA((byte)63);
			}
			catch
			{
				Dispose();
				throw;
			}
		}

		internal static ChildAccessCalculated ReadLayout(Constrained2D constrained)
		{
			//IL_0006: 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)
			Il2CppStructArray<ChildAccessCalculated> val = (((int)constrained.constrained2DTransform.type == 0) ? _wi._Pib : _wi._qib);
			int id = constrained.Id;
			if (id == 65535 || val == null || id >= ((Il2CppArrayBase<ChildAccessCalculated>)(object)val).Length)
			{
				throw new InvalidOperationException($"原生 UI 控件尚未登记布局:{((Object)constrained).name} (Id={id})。");
			}
			return ((Il2CppArrayBase<ChildAccessCalculated>)(object)val)[id];
		}

		private static Vector2 LayoutSize(Constrained2D constrained)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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)
			//IL_0019: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			_wi._ERA(false);
			ChildAccessCalculated val = ReadLayout(constrained);
			float2 cameraPixelSize = ProjectionValues.CameraPixelSize;
			Vector3 cachedWorldScale = val.CachedWorldScale;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(val.CalculatedNormalizedSizeOfScreen.x * cameraPixelSize.x / cachedWorldScale.x, val.CalculatedNormalizedSizeOfScreen.y * cameraPixelSize.y / cachedWorldScale.y);
			if (!float.IsFinite(val2.x) || !float.IsFinite(val2.y) || val2.x <= 0f || val2.y <= 0f)
			{
				throw new InvalidOperationException("原生 UI 容器的布局范围尚未就绪。");
			}
			return val2;
		}

		internal Constrained2D Container(Transform parent, string name, Vector2 size, bool hitArea = false)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0076: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("InFalsus.PotentialSystem." + name);
			val.SetActive(false);
			val.layer = ((Component)scene.backButton).gameObject.layer;
			val.transform.SetParent(parent, false);
			try
			{
				BoxCollider val2 = null;
				if (hitArea)
				{
					val2 = val.AddComponent<BoxCollider>();
					((Collider)val2).enabled = false;
				}
				Constrained2D val3 = val.AddComponent<Constrained2D>();
				Constrained2DTransform constrained2DTransform = val3.constrained2DTransform;
				constrained2DTransform.transform = val.transform;
				constrained2DTransform.type = (Constrained2DType)0;
				constrained2DTransform.sizeInPixels = size;
				constrained2DTransform.sizeInParentNormalized = Vector2.zero;
				constrained2DTransform.anchor = new Vector2(0.5f, 0.5f);
				constrained2DTransform.parentAlignment = (Constrained2DAlignment)0;
				constrained2DTransform.offset = Vector2.zero;
				constrained2DTransform.renderableScale = Vector2.one;
				constrained2DTransform.color = Color.white;
				val3.constrained2DTransform = constrained2DTransform;
				val.SetActive(true);
				val3._rQA();
				val3._RQA();
				val3._PQA((byte)63);
				Place(val3, Vector2.zero, size);
				if ((Object)(object)val2 != (Object)null)
				{
					hitAreas.Add((val3, val2));
				}
				return val3;
			}
			catch
			{
				Object.Destroy((Object)(object)val);
				throw;
			}
		}

		internal static void Place(Constrained2D constrained, Vector2 center, Vector2 size)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			Constrained2DTransform constrained2DTransform = constrained.constrained2DTransform;
			Vector2 sizeInParentNormalized = constrained2DTransform.sizeInParentNormalized;
			if ((int)constrained2DTransform.type == 0 && size != Vector2.zero)
			{
				Vector2 val = LayoutSize(((Component)((Component)constrained).transform.parent).GetComponentInParent<Constrained2D>() ?? throw new InvalidOperationException("原生 UI 控件缺少父布局容器。"));
				((Vector2)(ref sizeInParentNormalized))..ctor(size.x / val.x, size.y / val.y);
			}
			if (!(constrained2DTransform.offset == center) || !(constrained2DTransform.sizeInPixels == size) || !(constrained2DTransform.sizeInParentNormalized == sizeInParentNormalized))
			{
				constrained2DTransform.offset = center;
				constrained2DTransform.sizeInPixels = size;
				constrained2DTransform.sizeInParentNormalized = sizeInParentNormalized;
				constrained.constrained2DTransform = constrained2DTransform;
				constrained._PQA((byte)63);
			}
		}

		internal BrowserGraphic Graphic(Transform parent, string name, Texture texture, Color color)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(((Component)scene.leftSongCardContainer.songCardPrefab.jacket).gameObject, parent, false);
			((Object)val).name = "InFalsus.PotentialSystem." + name;
			try
			{
				foreach (Collider componentsInChild in val.GetComponentsInChildren<Collider>(true))
				{
					componentsInChild.enabled = false;
				}
				Constrained2D component = val.GetComponent<Constrained2D>();
				Constrained2DTransform constrained2DTransform = component.constrained2DTransform;
				Material val2 = constrained2DTransform.renderableTargetMaterial ?? throw new InvalidOperationException("原生图形缺少材质。");
				constrained2DTransform.transform = val.transform;
				constrained2DTransform.meshRenderer = val.GetComponent<MeshRenderer>();
				constrained2DTransform.meshFilter = val.GetComponent<MeshFilter>();
				constrained2DTransform.type = (Constrained2DType)1;
				constrained2DTransform.sizeInParentNormalized = Vector2.zero;
				constrained2DTransform.anchor = new Vector2(0.5f, 0.5f);
				constrained2DTransform.parentAlignment = (Constrained2DAlignment)0;
				constrained2DTransform.renderableScale = Vector2.one;
				constrained2DTransform.color = color;
				constrained2DTransform.zPosition = -0.02f;
				constrained2DTransform.overrideMaterialRenderQueueOffset = 0;
				constrained2DTransform.spriteBlendEffect = (_Ti)0;
				component.constrained2DTransform = constrained2DTransform;
				Material val3 = new Material(val2)
				{
					name = ((Object)val).name,
					hideFlags = (HideFlags)61,
					mainTexture = texture
				};
				component._irA(val3, false);
				BrowserGraphic browserGraphic = new BrowserGraphic(component, val3);
				graphics.Add(browserGraphic);
				val.SetActive(true);
				component._rQA();
				component._PQA((byte)63);
				return browserGraphic;
			}
			catch
			{
				Object.Destroy((Object)(object)val);
				throw;
			}
		}

		internal NativeLabel Label(Transform parent, string name, float fontSize)
		{
			//IL_001c: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			NativeLabel nativeLabel = new NativeLabel(scene.topBar.text, parent, name, new Vector2(0.5f, 0.5f), (Constrained2DAlignment)0, Vector2.zero, fontSize);
			nativeLabel.Text.SetAlignment((AlignmentOptions)4, (UpdateType)1);
			Constrained2D component = ((Component)nativeLabel.Text).GetComponent<Constrained2D>();
			Constrained2DTransform constrained2DTransform = component.constrained2DTransform;
			constrained2DTransform.overrideMaterialRenderQueueOffset = 0;
			constrained2DTransform.sizeInParentNormalized = Vector2.zero;
			component.constrained2DTransform = constrained2DTransform;
			component._PQA((byte)63);
			return nativeLabel;
		}

		internal UIButton Button(Transform parent, string name, string text, Action clicked)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_00a5: 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)
			Constrained2D val = Container(parent, name, new Vector2(100f, 60f), hitArea: true);
			UIButton val2 = ((Component)val).gameObject.AddComponent<UIButton>();
			buttons.Add(val2);
			val2.constrained2D = val;
			val2.ButtonCollider = ((Component)val).GetComponent<BoxCollider>();
			val2.button = scene.backButton.button;
			val2.sfxSetType = scene.backButton.sfxSetType;
			val2.flags = (Flags)132;
			BrowserGraphic background = Graphic(((Component)val2).transform, name + ".Backing", (Texture)(object)Texture2D.whiteTexture, PotentialPresentation.Color(2636113u));
			Label(((Component)val2).transform, name + ".Text", 3.4f).Set(text, Color.white);
			_EI val3 = _EI.op_Implicit((Action<UIButton>)delegate
			{
				clicked();
			});
			_fI val4 = _fI.op_Implicit((Action<UIButton, bool>)delegate(UIButton _, bool hovered)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				background.Tint(PotentialPresentation.Color(hovered ? 4348796u : 2636113u));
			});
			callbacks.Add((Delegate)(object)val3);
			callbacks.Add((Delegate)(object)val4);
			val2._DSA(val3);
			val2._eSA(val4);
			val2._dSA((_dI)1);
			UIManager._ftA()._mtA(val2, owner);
			return val2;
		}

		internal static void PlaceButton(UIButton button, Vector2 center, Vector2 size, float scale)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_003d: Invalid comparison between Unknown and I4
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			Place(button.constrained2D, center, size);
			foreach (Constrained2D componentsInChild in ((Component)button).GetComponentsInChildren<Constrained2D>(true))
			{
				if (!((Object)(object)componentsInChild == (Object)(object)button.constrained2D) && (int)componentsInChild.constrained2DTransform.type == 1)
				{
					Place(componentsInChild, Vector2.zero, size);
				}
			}
			foreach (FastText componentsInChild2 in ((Component)button).GetComponentsInChildren<FastText>(true))
			{
				componentsInChild2.SetFontSize(3.4f * scale, (UpdateType)1);
				componentsInChild2.SetMaxAutoLineBreakPixelWidth((int)(size.x - 24f * scale), (UpdateType)1);
				componentsInChild2.EnsureDirtyFlagsProcessed();
			}
		}

		internal static Material SwapMaterial(Constrained2D target, Material current, Texture texture, Vector2 scale, Vector2 offset)
		{
			//IL_0001: 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_0012: 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_0021: 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_0028: 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_0031: Expected O, but got Unknown
			Material val = new Material(current)
			{
				name = ((Object)current).name,
				hideFlags = (HideFlags)61,
				mainTexture = texture,
				mainTextureScale = scale,
				mainTextureOffset = offset
			};
			try
			{
				target._irA(val, false);
			}
			catch
			{
				Object.Destroy((Object)(object)val);
				throw;
			}
			Object.Destroy((Object)(object)current);
			return val;
		}

		internal static void SyncHitArea(Constrained2D constrained, BoxCollider collider)
		{
			//IL_0001: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			ChildAccessCalculated val = ReadLayout(constrained);
			float2 cameraPixelSize = ProjectionValues.CameraPixelSize;
			Vector2 val2 = Vector2.Scale(val.CalculatedNormalizedSizeOfScreen, new Vector2(cameraPixelSize.x, cameraPixelSize.y));
			if (val2.x <= 0f || val2.y <= 0f)
			{
				((Collider)collider).enabled = false;
				return;
			}
			float2 worldSize = ProjectionValues.GetWorldSize(val.CalculatedZFromCamera, val2);
			Vector3 lossyScale = ((Component)collider).transform.lossyScale;
			if (Mathf.Abs(lossyScale.x) <= 0f || Mathf.Abs(lossyScale.y) <= 0f)
			{
				((Collider)collider).enabled = false;
				return;
			}
			collider.center = Vector3.zero;
			collider.size = new Vector3(worldSize.x / Mathf.Abs(lossyScale.x), worldSize.y / Mathf.Abs(lossyScale.y), 0.01f);
			((Collider)collider).enabled = true;
		}

		internal static bool ContainsPoint(Constrained2D constrained, Vector2 point)
		{
			//IL_0001: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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)
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ChildAccessCalculated val = ReadLayout(constrained);
			Vector2 val2 = point - val.CalculatedNormalizedPositionInScreen;
			Vector2 calculatedNormalizedSizeOfScreen = val.CalculatedNormalizedSizeOfScreen;
			if (Math.Abs(val2.x) <= calculatedNormalizedSizeOfScreen.x / 2f)
			{
				return Math.Abs(val2.y) <= calculatedNormalizedSizeOfScreen.y / 2f;
			}
			return false;
		}

		internal void SyncHitAreas()
		{
			_wi._ERA(false);
			foreach (var (constrained, collider) in hitAreas)
			{
				SyncHitArea(constrained, collider);
			}
		}

		internal void Keep(Delegate callback)
		{
			callbacks.Add(callback);
		}

		public void Dispose()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			if ((Object)(object)Root != (Object)null)
			{
				((Component)Root).gameObject.SetActive(false);
			}
			foreach (var hitArea in hitAreas)
			{
				BoxCollider item = hitArea.Collider;
				if ((Object)(object)item != (Object)null)
				{
					((Collider)item).enabled = false;
				}
			}
			hitAreas.Clear();
			bool flag = default(bool);
			foreach (UIButton button in buttons)
			{
				if (!((Object)(object)button != (Object)null))
				{
					continue;
				}
				try
				{
					UIManager obj = UIManager._ftA();
					if (obj != null)
					{
						obj._ktA(button);
					}
				}
				catch (Exception ex)
				{
					ManualLogSource logger = Plugin.Logger;
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(10, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("注销成绩页按钮失败:");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
					}
					logger.LogError(val);
				}
			}
			buttons.Clear();
			if ((Object)(object)Root != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)Root).gameObject);
			}
			foreach (BrowserGraphic graphic in graphics)
			{
				graphic.Dispose();
			}
			graphics.Clear();
			callbacks.Clear();
		}
	}
	internal sealed class BrowserGraphic : IDisposable
	{
		private Material? material;

		private Texture? displayedTexture;

		private Vector2 displayedScale = Vector2.one;

		private Vector2 displayedOffset;

		internal Constrained2D Layout { get; }

		internal BrowserGraphic(Constrained2D layout, Material material)
		{
			//IL_0001: 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)
			Layout = layout;
			this.material = material;
			displayedTexture = material.mainTexture;
		}

		public void Dispose()
		{
			if ((Object)(object)material != (Object)null)
			{
				Object.Destroy((Object)(object)material);
			}
			material = null;
		}

		internal void Tint(Color color)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			Constrained2DTransform constrained2DTransform = Layout.constrained2DTransform;
			if (!(constrained2DTransform.color == color))
			{
				constrained2DTransform.color = color;
				Layout.constrained2DTransform = constrained2DTransform;
				Layout._PQA((byte)63);
			}
		}

		internal void Show(Vector2 center, Vector2 size, Texture texture, float lower = float.NegativeInfinity, float upper = float.PositiveInfinity)
		{
			//IL_0000: 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_001b: 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_005a: 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_0075: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00ea: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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)
			float num = Math.Max(center.y - size.y / 2f, lower);
			float num2 = Math.Min(center.y + size.y / 2f, upper);
			bool flag = num2 > num;
			((Component)Layout).gameObject.SetActive(flag);
			if (flag)
			{
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(1f, (num2 - num) / size.y);
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(0f, (num - center.y + size.y / 2f) / size.y);
				if ((Object)(object)material != (Object)null && ((Object)(object)displayedTexture != (Object)(object)texture || displayedScale != val || displayedOffset != val2))
				{
					material = BrowserWidgets.SwapMaterial(Layout, material, texture, val, val2);
					displayedTexture = texture;
					displayedScale = val;
					displayedOffset = val2;
				}
				BrowserWidgets.Place(Layout, new Vector2(center.x, (num2 + num) / 2f), new Vector2(size.x, num2 - num));
			}
		}
	}
	internal readonly record struct ChartKey(ushort SongId, byte Difficulty);
	internal sealed record ChartDefinition(string Id, decimal Constant, string Title, string Artist, AssetReferenceT<Material>? Jacket);
	internal sealed class ChartCatalog
	{
		private readonly Dictionary<ChartKey, ChartDefinition> charts;

		internal int Count => charts.Count;

		internal decimal Maximum { get; }

		internal Localization Language { get; }

		internal ChartConstantSource Source { get; }

		private ChartCatalog(Dictionary<ChartKey, ChartDefinition> charts, Localization language, ChartConstantSource source)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			this.charts = charts;
			Language = language;
			Source = source;
			Maximum = PotentialCalculator.Overall(charts.Values.Select((ChartDefinition chart) => chart.Constant + 2.2m));
		}

		internal static ChartCatalog Read(SongData data, ChartConstantSource source)
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Expected O, but got Unknown
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: 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_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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_01f1: Expected I4, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			Il2CppReferenceArray<SongInfo> val = data.allSongInfo ?? throw new InvalidOperationException("歌曲数据尚未载入。");
			Dictionary<ChartKey, ChartDefinition> dictionary = new Dictionary<ChartKey, ChartDefinition>();
			HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal);
			Localization val2 = NativeLabel.CurrentLanguage();
			Dictionary<ushort, AssetReferenceT<Material>> dictionary2 = new Dictionary<ushort, AssetReferenceT<Material>>();
			Dictionary<string, AssetReferenceT<Material>> dictionary3 = new Dictionary<string, AssetReferenceT<Material>>(StringComparer.Ordinal);
			bool flag = default(bool);
			try
			{
				if (data.songIdJacketMaterials != null)
				{
					foreach (SongJacketEntry item in (Il2CppArrayBase<SongJacketEntry>)(object)data.songIdJacketMaterials)
					{
						if (((item != null) ? item.JacketLargeMaterial : null) != null)
						{
							dictionary2[item.SongId.Value] = item.JacketLargeMaterial;
						}
					}
				}
				if (data.chartIdJacketMaterials != null)
				{
					foreach (SongDataChartJacketEntry item2 in (Il2CppArrayBase<SongDataChartJacketEntry>)(object)data.chartIdJacketMaterials)
					{
						if (((item2 != null) ? item2.JacketLargeMaterial : null) != null && !string.IsNullOrEmpty(item2.ChartId))
						{
							dictionary3[item2.ChartId] = item2.JacketLargeMaterial;
						}
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource logger = Plugin.Logger;
				BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(19, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("封面索引读取失败,将显示缺失素材提示:");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex);
				}
				logger.LogWarning(val3);
			}
			bool flag2 = false;
			foreach (SongInfo item3 in (Il2CppArrayBase<SongInfo>)(object)val)
			{
				if (item3 == null || item3.Id.Value == 0)
				{
					continue;
				}
				foreach (SongChartInfo item4 in (Il2CppArrayBase<SongChartInfo>)(object)(item3.ChartInfos ?? throw new InvalidDataException($"歌曲 {item3.Id.Value} 缺少谱面定义。")))
				{
					if (item4 == null || !item4.Available)
					{
						continue;
					}
					byte b = (byte)(int)item4.Difficulty;
					if (b == 0 || (b & (b - 1)) != 0 || item4.Rating < 0 || string.IsNullOrWhiteSpace(item4.Id))
					{
						throw new InvalidDataException($"歌曲 {item3.Id.Value} 的可用谱面定义无效。");
					}
					string title = item3.BaseName;
					string artist = "";
					try
					{
						_SH val4 = new _SH(item3, item4.Difficulty, val2);
						title = val4._pOA();
						artist = val4._POA();
					}
					catch (Exception ex2)
					{
						if (!flag2)
						{
							ManualLogSource logger2 = Plugin.Logger;
							BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(21, 1, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("本地化歌曲名称读取失败,暂用原生歌曲标识:");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex2);
							}
							logger2.LogWarning(val3);
						}
						flag2 = true;
					}
					if (!dictionary3.TryGetValue(item4.Id, out var value) && !dictionary2.TryGetValue(item3.Id.Value, out value))
					{
						value = data.FallbackJacketLargeMaterial;
					}
					ChartKey key = new ChartKey(item3.Id.Value, b);
					decimal constant = CommunityConstants.Resolve(item4.Id, item4.Rating, source);
					if (!dictionary.TryAdd(key, new ChartDefinition(item4.Id, constant, title, artist, value)) || !hashSet.Add(item4.Id))
					{
						throw new InvalidDataException("游戏存在重复谱面身份:" + item4.Id + "。");
					}
				}
			}
			if (dictionary.Count == 0)
			{
				throw new InvalidOperationException("游戏尚未提供可用谱面。");
			}
			return new ChartCatalog(dictionary, val2, source);
		}

		internal bool TryGet(ChartKey key, out ChartDefinition chart)
		{
			return charts.TryGetValue(key, out chart);
		}
	}
	internal static class ClipboardImage
	{
		internal static void Copy(byte[] dib)
		{
			if (dib.Length < 40)
			{
				throw new InvalidDataException("生成的分享图不完整。");
			}
			IntPtr intPtr = GetActiveWindow();
			if (intPtr == IntPtr.Zero)
			{
				intPtr = Process.GetCurrentProcess().MainWindowHandle;
			}
			if (intPtr == IntPtr.Zero)
			{
				throw new InvalidOperationException("无法取得游戏窗口,图片尚未写入剪贴板。");
			}
			IntPtr intPtr2 = GlobalAlloc(2u, (UIntPtr)(uint)dib.Length);
			if (intPtr2 == IntPtr.Zero)
			{
				throw new Win32Exception(Marshal.GetLastWin32Error(), "无法分配剪贴板图片内存。");
			}
			bool flag = false;
			try
			{
				IntPtr intPtr3 = GlobalLock(intPtr2);
				if (intPtr3 == IntPtr.Zero)
				{
					throw new Win32Exception(Marshal.GetLastWin32Error(), "无法锁定剪贴板图片内存。");
				}
				try
				{
					Marshal.Copy(dib, 0, intPtr3, dib.Length);
				}
				finally
				{
					GlobalUnlock(intPtr2);
				}
				if (!OpenClipboard(intPtr))
				{
					throw new Win32Exception(Marshal.GetLastWin32Error(), "剪贴板正被占用,请稍后再次导出。");
				}
				flag = true;
				if (!EmptyClipboard() || SetClipboardData(8u, intPtr2) == IntPtr.Zero)
				{
					throw new Win32Exception(Marshal.GetLastWin32Error(), "无法把分享图写入剪贴板。");
				}
				intPtr2 = IntPtr.Zero;
			}
			finally
			{
				if (flag)
				{
					CloseClipboard();
				}
				if (intPtr2 != IntPtr.Zero)
				{
					GlobalFree(intPtr2);
				}
			}
		}

		[DllImport("user32.dll")]
		private static extern IntPtr GetActiveWindow();

		[DllImport("user32.dll", SetLastError = true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool OpenClipboard(IntPtr owner);

		[DllImport("user32.dll", SetLastError = true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool EmptyClipboard();

		[DllImport("user32.dll", SetLastError = true)]
		private static extern IntPtr SetClipboardData(uint format, IntPtr memory);

		[DllImport("user32.dll")]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool CloseClipboard();

		[DllImport("kernel32.dll", SetLastError = true)]
		private static extern IntPtr GlobalAlloc(uint flags, UIntPtr bytes);

		[DllImport("kernel32.dll", SetLastError = true)]
		private static extern IntPtr GlobalLock(IntPtr memory);

		[DllImport("kernel32.dll")]
		[return: MarshalAs(UnmanagedType.Bool)]
		private static extern bool GlobalUnlock(IntPtr memory);

		[DllImport("kernel32.dll")]
		private static extern IntPtr GlobalFree(IntPtr memory);
	}
	internal enum ChartConstantSource
	{
		OfficialLevel,
		AnXiaoLi,
		MengLei
	}
	internal static class CommunityConstants
	{
		internal const string NativeRule = "integer-rating-v1";

		internal const string CommunityRule = "community-experimental-v1";

		internal const string AnXiaoLiRule = "anxiaoli-v1";

		internal const string MengLeiRule = "menglei-v4";

		private static readonly Lazy<IReadOnlyDictionary<string, decimal>> anXiaoLi = new Lazy<IReadOnlyDictionary<string, decimal>>(() => Read("AnXiaoLiConstants"));

		private static readonly Lazy<IReadOnlyDictionary<string, decimal>> mengLei = new Lazy<IReadOnlyDictionary<string, decimal>>(() => Read("CommunityConstants"));

		internal static string DisplayName(ChartConstantSource source)
		{
			return source switch
			{
				ChartConstantSource.OfficialLevel => "官方等级", 
				ChartConstantSource.AnXiaoLi => "安小璃", 
				ChartConstantSource.MengLei => "萌泪酱", 
				_ => throw new ArgumentOutOfRangeException("source"), 
			};
		}

		internal static string Rule(ChartConstantSource source)
		{
			return source switch
			{
				ChartConstantSource.OfficialLevel => "integer-rating-v1", 
				ChartConstantSource.AnXiaoLi => "anxiaoli-v1", 
				ChartConstantSource.MengLei => "menglei-v4", 
				_ => throw new ArgumentOutOfRangeException("source"), 
			};
		}

		internal static decimal Resolve(string chartId, int rating, ChartConstantSource source)
		{
			IReadOnlyDictionary<string, decimal> readOnlyDictionary = source switch
			{
				ChartConstantSource.OfficialLevel => null, 
				ChartConstantSource.AnXiaoLi => anXiaoLi.Value, 
				ChartConstantSource.MengLei => mengLei.Value, 
				_ => throw new ArgumentOutOfRangeException("source"), 
			};
			if (readOnlyDictionary == null || !readOnlyDictionary.TryGetValue(chartId, out var value))
			{
				return rating;
			}
			return value;
		}

		private static IReadOnlyDictionary<string, decimal> Read(string name)
		{
			using Stream utf8Json = Assembly.GetExecutingAssembly().GetManifestResourceStream("PotentialSystem." + name + ".json") ?? throw new InvalidDataException("缺少内置定数表:" + name + "。");
			Dictionary<string, decimal> dictionary = JsonSerializer.Deserialize<Dictionary<string, decimal>>(utf8Json) ?? throw new InvalidDataException("内置定数表为空:" + name + "。");
			if (dictionary.Count == 0 || dictionary.Any((KeyValuePair<string, decimal> pair) => string.IsNullOrWhiteSpace(pair.Key) || pair.Value < 0m || decimal.Truncate(pair.Value * 10m) != pair.Value * 10m))
			{
				throw new InvalidDataException("内置定数表含无效谱面身份或定数:" + name + "。");
			}
			return dictionary;
		}
	}
	internal sealed class CoverCache : IDisposable
	{
		private sealed class Entry
		{
			internal AsyncOperationHandle<Material>? Handle;

			internal Texture2D? Texture;

			internal PixelImage? Pixels;

			internal CoverPalette Palette = CoverPalette.Neutral;

			internal string? Error;

			internal bool Finished;
		}

		private readonly Dictionary<string, Entry> entries = new Dictionary<string, Entry>(StringComparer.Ordinal);

		private Entry Request(ChartDefinition? chart)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			object obj;
			if ((object)chart == null)
			{
				obj = null;
			}
			else
			{
				AssetReferenceT<Material>? jacket = chart.Jacket;
				if (jacket == null)
				{
					obj = null;
				}
				else
				{
					Object runtimeKey = ((AssetReference)jacket).RuntimeKey;
					obj = ((runtimeKey != null) ? runtimeKey.ToString() : null);
				}
			}
			if (obj == null)
			{
				obj = "missing:" + chart?.Id;
			}
			string key = (string)obj;
			if (entries.TryGetValue(key, out Entry value))
			{
				return value;
			}
			Entry entry = new Entry();
			entries.Add(key, entry);
			try
			{
				object obj2;
				if ((object)chart == null)
				{
					obj2 = null;
				}
				else
				{
					AssetReferenceT<Material>? jacket2 = chart.Jacket;
					obj2 = ((jacket2 != null) ? ((AssetReference)jacket2).RuntimeKey : null);
				}
				if (obj2 == null)
				{
					throw new InvalidDataException("谱面没有可读取的封面引用。");
				}
				entry.Handle = Addressables.LoadAssetAsync<Material>(((AssetReference)chart.Jacket).RuntimeKey);
			}
			catch (Exception ex)
			{
				entry.Error = ex.Message;
				entry.Finished = true;
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(8, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("封面加载失败:");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(chart?.Id);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(",");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				logger.LogWarning(val);
			}
			return entry;
		}

		private static void Poll(Entry entry)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Invalid comparison between Unknown and I4
			if (entry.Finished || entry.Handle == null || !entry.Handle.IsDone)
			{
				return;
			}
			entry.Finished = true;
			try
			{
				if ((int)entry.Handle.Status == 1)
				{
					Material result = entry.Handle.Result;
					if (!((Object)(object)((result != null) ? result.mainTexture : null) == (Object)null))
					{
						(Texture2D, PixelImage) tuple = Capture(entry.Handle.Result.mainTexture);
						entry.Texture = tuple.Item1;
						entry.Pixels = tuple.Item2;
						entry.Palette = CoverPalette.From(entry.Pixels);
						return;
					}
				}
				Exception operationException = entry.Handle.OperationException;
				throw new InvalidOperationException("游戏封面加载失败:" + ((operationException != null) ? operationException.Message : null));
			}
			catch (Exception ex)
			{
				entry.Error = ex.Message;
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(7, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("封面读取失败:");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				logger.LogWarning(val);
			}
		}

		private static (Texture2D Texture, PixelImage Pixels) Capture(Texture source)
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			RenderTexture active = RenderTexture.active;
			RenderTexture temporary = RenderTexture.GetTemporary(256, 256, 0, (RenderTextureFormat)0);
			Texture2D val = null;
			try
			{
				Graphics.Blit(source, temporary);
				RenderTexture.active = temporary;
				val = new Texture2D(256, 256, (TextureFormat)4, false)
				{
					name = "PotentialSystem.Cover",
					hideFlags = (HideFlags)61,
					wrapMode = (TextureWrapMode)1,
					filterMode = (FilterMode)1
				};
				val.ReadPixels(new Rect(0f, 0f, 256f, 256f), 0, 0, false);
				val.Apply(false, false);
				byte[] array = ((IEnumerable<byte>)val.GetRawTextureData()).ToArray();
				if (array.Length != 262144)
				{
					throw new InvalidDataException("封面像素长度无效。");
				}
				return (Texture: val, Pixels: new PixelImage(256, 256, array));
			}
			catch
			{
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
				}
				throw;
			}
			finally
			{
				RenderTexture.active = active;
				RenderTexture.ReleaseTemporary(temporary);
			}
		}

		internal Texture2D? GetTexture(ChartDefinition? chart, out CoverPalette palette, out string? error)
		{
			Entry entry = Request(chart);
			Poll(entry);
			error = entry.Error;
			palette = entry.Palette;
			return entry.Texture;
		}

		internal bool Prepare(IReadOnlyList<RankedPlay> plays, out Dictionary<ChartKey, PixelImage> images, out string? error)
		{
			images = new Dictionary<ChartKey, PixelImage>();
			error = null;
			bool result = true;
			foreach (RankedPlay play in plays)
			{
				Entry entry = Request(play.Chart);
				Poll(entry);
				if (entry.Error != null && error == null)
				{
					error = play.Chart?.Title + ":" + entry.Error;
				}
				if (!entry.Finished)
				{
					result = false;
				}
				if (entry.Pixels != null)
				{
					images.Add(play.Play.Key, entry.Pixels);
				}
			}
			return result;
		}

		public void Dispose()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			bool flag = default(bool);
			foreach (Entry value in entries.Values)
			{
				try
				{
					if ((Object)(object)value.Texture != (Object)null)
					{
						Object.Destroy((Object)(object)value.Texture);
					}
				}
				finally
				{
					try
					{
						if (value.Handle != null && value.Handle.IsValid())
						{
							Addressables.Release<Material>(value.Handle);
						}
					}
					catch (Exception ex)
					{
						ManualLogSource logger = Plugin.Logger;
						BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(12, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("释放浏览页封面引用失败:");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
						}
						logger.LogError(val);
					}
				}
				value.Handle = null;
				value.Texture = null;
			}
			entries.Clear();
		}
	}
	internal readonly record struct CoverPalette(uint Background, uint Border)
	{
		internal static CoverPalette Neutral => new CoverPalette(2304823u, 4608868u);

		internal static CoverPalette From(PixelImage image)
		{
			if (image.Rgba.Length != checked(image.Width * image.Height * 4))
			{
				throw new InvalidDataException("曲绘颜色统计的像素长度无效。");
			}
			int[] array = new int[512];
			long[] array2 = new long[512];
			long[] array3 = new long[512];
			long[] array4 = new long[512];
			long num = 0L;
			long num2 = 0L;
			long num3 = 0L;
			int num4 = 0;
			for (int i = 0; i < image.Rgba.Length; i += 16)
			{
				if (image.Rgba[i + 3] >= 128)
				{
					int num5 = image.Rgba[i];
					int num6 = image.Rgba[i + 1];
					int num7 = image.Rgba[i + 2];
					num += num5;
					num2 += num6;
					num3 += num7;
					num4++;
					int num8 = (num5 * 54 + num6 * 183 + num7 * 19) / 256;
					if (num8 >= 24 && num8 <= 226)
					{
						int num9 = 32 + Math.Max(num5, Math.Max(num6, num7)) - Math.Min(num5, Math.Min(num6, num7));
						int num10 = (num5 >> 5 << 6) | (num6 >> 5 << 3) | (num7 >> 5);
						array[num10] += num9;
						array2[num10] += (long)num5 * (long)num9;
						array3[num10] += (long)num6 * (long)num9;
						array4[num10] += (long)num7 * (long)num9;
					}
				}
			}
			if (num4 == 0)
			{
				return Neutral;
			}
			int num11 = 0;
			for (int j = 1; j < array.Length; j++)
			{
				if (array[j] > array[num11])
				{
					num11 = j;
				}
			}
			int num12 = array[num11];
			(int, int, int) rgb = ((num12 == 0) ? ((int)(num / num4), (int)(num2 / num4), (int)(num3 / num4)) : ((int)(array2[num11] / num12), (int)(array3[num11] / num12), (int)(array4[num11] / num12)));
			return new CoverPalette(Shade(rgb, 0.3f), Shade(rgb, 0.48f));
		}

		private static uint Shade((int Red, int Green, int Blue) rgb, float amount)
		{
			int num = (int)(18f + (float)(rgb.Red - 18) * amount);
			int num2 = (int)(25f + (float)(rgb.Green - 25) * amount);
			int num3 = (int)(35f + (float)(rgb.Blue - 35) * amount);
			return (uint)((num << 16) | (num2 << 8) | num3);
		}
	}
	internal sealed class NativeLabel : IDisposable
	{
		private string? value;

		private Color color;

		private Localization language;

		internal FastText Text { get; }

		internal NativeLabel(FastText template, Transform parent, string name, Vector2 anchor, Constrained2DAlignment alignment, Vector2 offset, float fontSize)
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(((Component)template).gameObject, parent, false);
			((Object)val).name = "InFalsus.PotentialSystem." + name;
			try
			{
				Text = val.GetComponent<FastText>() ?? throw new InvalidOperationException("文字模板缺少 FastText。");
				Constrained2D val2 = val.GetComponent<Constrained2D>() ?? throw new InvalidOperationException("文字模板缺少 Constrained2D。");
				foreach (Collider componentsInChild in val.GetComponentsInChildren<Collider>(true))
				{
					componentsInChild.enabled = false;
				}
				Text.meshRenderer = val.GetComponent<MeshRenderer>();
				Text.meshFilter = val.GetComponent<MeshFilter>();
				PotentialFonts.Apply(Text);
				Constrained2DTransform constrained2DTransform = val2.constrained2DTransform;
				constrained2DTransform.transform = val.transform;
				constrained2DTransform.fastText = Text;
				constrained2DTransform.meshRenderer = Text.meshRenderer;
				constrained2DTransform.meshFilter = Text.meshFilter;
				constrained2DTransform.anchor = anchor;
				constrained2DTransform.parentAlignment = alignment;
				constrained2DTransform.offset = offset;
				constrained2DTransform.zPosition = -0.25f;
				constrained2DTransform.renderableScale = Vector2.one;
				constrained2DTransform.color = Color.white;
				constrained2DTransform.sizeInParentNormalized = Vector2.zero;
				constrained2DTransform.overrideMaterialRenderQueueOffset = 0;
				val2.constrained2DTransform = constrained2DTransform;
				Text.SetFontSize(fontSize, (UpdateType)1);
				Text.SetAlignment((AlignmentOptions)4, (UpdateType)1);
				val.SetActive(true);
				val2._rQA();
				val2._PQA((byte)63);
			}
			catch
			{
				Object.Destroy((Object)(object)val);
				throw;
			}
		}

		internal static Localization CurrentLanguage()
		{
			//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)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Localization currentLocalization = Strings.GetCurrentLocalization();
			if ((int)currentLocalization != 0)
			{
				return currentLocalization;
			}
			return Strings.GetLocalizationForSystemLanguage();
		}

		internal bool Set(string text, Color tint)
		{
			//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_0050: 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_006a: 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_009c: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if ((Object)(object)Text == (Object)null)
			{
				return false;
			}
			Localization val = CurrentLanguage();
			if (value == text && color == tint && language == val)
			{
				return false;
			}
			Text.SetTextNonLocalized(text, (UpdateType)1);
			Text.targetLocalization = val;
			Text.SetTextColor(tint, (UpdateType)1);
			FastText text2 = Text;
			text2.dirtyFlags = (DirtyFlags)(text2.dirtyFlags | 0xC);
			Text.EnsureDirtyFlagsProcessed();
			((Component)Text).GetComponent<Constrained2D>()._PQA((byte)63);
			value = text;
			color = tint;
			language = val;
			return true;
		}

		public void Dispose()
		{
			if ((Object)(object)Text != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)Text).gameObject);
			}
		}
	}
	internal sealed class NativePotentialPage : IDisposable
	{
		private readonly BrowserWidgets widgets;

		private readonly Constrained2D viewport;

		private readonly Constrained2D content;

		private readonly UIScrollView scroll;

		private readonly UiProgressVerticalSliderContainer slider;

		private readonly UIButton close;

		private readonly UIButton export;

		private readonly UIButton search;

		private readonly UIButton track;

		private readonly BrowserGraphic background;

		private readonly BrowserGraphic badge;

		private readonly BrowserGraphic line;

		private readonly BrowserGraphic pip;

		private readonly NativeLabel title;

		private readonly NativeLabel account;

		private readonly NativeLabel summary;

		private readonly NativeLabel status;

		private readonly NativeLabel searchText;

		private readonly NativeLabel empty;

		private readonly List<BrowserCard> cards = new List<BrowserCard>();

		private Vector2 size;

		private float scale;

		private float cardScale;

		private float viewportHeight;

		private float cardWidth;

		private float maximum;

		private int columns;

		private RankedPlay[] plays = Array.Empty<RankedPlay>();

		internal NativePotentialPage(SongSelectScene scene, InputReceiver receiver, Action closePage, Action exportImage, Action focusSearch)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			widgets = new BrowserWidgets(scene, receiver);
			try
			{
				Transform transform = ((Component)widgets.Root).transform;
				background = widgets.Graphic(transform, "Results.Backing", (Texture)(object)Texture2D.whiteTexture, PotentialPresentation.Color(528156u));
				badge = widgets.Graphic(transform, "Results.Badge", (Texture)(object)Texture2D.whiteTexture, Color.white);
				title = widgets.Label(transform, "Results.Title", 5f);
				account = widgets.Label(transform, "Results.Account", 3.6f);
				summary = widgets.Label(transform, "Results.Summary", 3f);
				status = widgets.Label(transform, "Results.Status", 2.8f);
				viewport = widgets.Container(transform, "Results.Viewport", Vector2.one, hitArea: true);
				content = widgets.Container(((Component)viewport).transform, "Results.ScrollPosition", Vector2.one);
				scroll = ((Component)viewport).gameObject.AddComponent<UIScrollView>();
				((UIScrollInterface)scroll).boxCollider = ((Component)viewport).GetComponent<BoxCollider>();
				scroll.contentContainer = content;
				scroll.contentContainerTransform = ((Component)content).transform;
				scroll.scrollDirection = (_lI)1;
				scroll.weight = 0.22f;
				scroll.maxForce = 1600f;
				scroll.constrainScrollToBounds = true;
				UIManager._ftA()._KtA((UIScrollInterface)(object)scroll, receiver);
				empty = widgets.Label(((Component)viewport).transform, "Results.Empty", 3.8f);
				close = widgets.Button(transform, "Results.Close", "关闭", closePage);
				export = widgets.Button(transform, "Results.Export", "导出 B50 到剪贴板", exportImage);
				search = widgets.Button(transform, "Results.Search", " ", focusSearch);
				searchText = widgets.Label(((Component)search).transform, "Results.SearchText", 3.2f);
				track = widgets.Button(transform, "Results.Scrollbar", " ", delegate
				{
				});
				UIButton obj = track;
				obj.flags = (Flags)(obj.flags | 0xA);
				line = widgets.Graphic(((Component)track).transform, "Results.Scrollbar.Line", (Texture)(object)Texture2D.whiteTexture, PotentialPresentation.Color(1385273u));
				pip = widgets.Graphic(((Component)track).transform, "Results.Scrollbar.Thumb", (Texture)(object)Texture2D.whiteTexture, PotentialPresentation.Color(10731228u));
				slider = ((Component)track).gameObject.AddComponent<UiProgressVerticalSliderContainer>();
				slider.inputLayer = receiver;
				slider.line = line.Layout;
				slider.pipIcon = pip.Layout;
				slider.pipSelector = track;
				slider.pipSelectorC2D = track.constrained2D;
				slider.boxCollider = track.ButtonCollider;
				_ab val = _ab.op_Implicit((Action<UiProgressVerticalSliderContainer, float>)delegate(UiProgressVerticalSliderContainer _, float value)
				{
					SetScroll((1f - value) * maximum);
				});
				widgets.Keep((Delegate)(object)val);
				slider._BE(val);
				Layout();
				InputManager instance = InputManager.Instance;
				if (instance != null)
				{
					instance.RequestLastMouseMoveReplay();
				}
			}
			catch
			{
				Dispose();
				throw;
			}
		}

		private void Layout()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0041: 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_0080: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: 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)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0545: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = widgets.Size;
			if (val.x <= 0f || val.y <= 0f)
			{
				throw new InvalidOperationException("游戏成绩页的原生布局范围不可用。");
			}
			if (size == val)
			{
				return;
			}
			size = val;
			scale = Mathf.Clamp(size.y / 1015f, 0.65f, 2f);
			float num = 24f * scale;
			background.Show(Vector2.zero, size, (Texture)(object)Texture2D.whiteTexture);
			PlaceLabel(title, Center(180f * scale, 26f * scale, size.x - 204f * scale, 60f * scale), size.x - 204f * scale, 5f * scale);
			PlaceLabel(account, Center(180f * scale, 92f * scale, size.x - 204f * scale, 40f * scale), size.x - 204f * scale, 3.6f * scale);
			PlaceLabel(summary, Center(180f * scale, 142f * scale, size.x - 204f * scale, 35f * scale), size.x - 204f * scale, 3f * scale);
			BrowserWidgets.PlaceButton(close, Center(size.x - num - 95f * scale, 193f * scale, 95f * scale, 60f * scale), new Vector2(95f, 60f) * scale, scale);
			BrowserWidgets.PlaceButton(export, Center(size.x - num - 400f * scale, 193f * scale, 285f * scale, 60f * scale), new Vector2(285f, 60f) * scale, scale);
			BrowserWidgets.PlaceButton(search, Center(num, 193f * scale, 420f * scale, 50f * scale), new Vector2(420f, 50f) * scale, scale);
			PlaceLabel(searchText, Vector2.zero, 395f * scale, 3.2f * scale);
			PlaceLabel(status, Center(num, size.y - 52f * scale, size.x - num * 2f, 40f * scale), size.x - num * 2f, 2.8f * scale);
			float num2 = 265f * scale;
			viewportHeight = size.y - num2 - 64f * scale;
			float num3 = size.x - num * 2f - 46f * scale;
			BrowserWidgets.Place(viewport, Center(num, num2, num3, viewportHeight), new Vector2(num3, viewportHeight));
			BrowserWidgets.Place(content, Vector2.zero, new Vector2(num3, viewportHeight));
			columns = 5;
			cardScale = num3 / (float)(columns * 833 + (columns - 1) * 20);
			cardWidth = 833f * cardScale;
			BrowserWidgets.PlaceButton(track, Center(size.x - num - 30f * scale, num2 + 30f * scale, 30f * scale, viewportHeight - 60f * scale), new Vector2(30f * scale, viewportHeight - 60f * scale), scale);
			line.Show(Vector2.zero, new Vector2(10f * scale, viewportHeight - 60f * scale), (Texture)(object)Texture2D.whiteTexture);
			pip.Show(Vector2.zero, new Vector2(26f, 54f) * scale, (Texture)(object)Texture2D.whiteTexture);
			SetBounds();
			foreach (BrowserCard card in cards)
			{
				card.Invalidate();
			}
		}

		private Vector2 Center(float x, float y, float width, float height)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2((0f - size.x) / 2f + x + width / 2f, size.y / 2f - y - height / 2f);
		}

		internal static void PlaceLabel(NativeLabel label, Vector2 center, float width, float fontSize, float align = 0f)
		{
			//IL_0009: 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_0013: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			FastText text = label.Text;
			text.presention = (FastTextPresentation)((text.presention & -65) | 0x20);
			text.SetFontSize(fontSize, (UpdateType)1);
			text.EnsureDirtyFlagsProcessed();
			Constrained2D component = ((Component)text).GetComponent<Constrained2D>();
			BrowserWidgets.Place(component, center, component.constrained2DTransform.sizeInPixels);
			float num = component._mrA().x;
			if (num > width && num > 0f)
			{
				text.SetFontSize(fontSize * width / num, (UpdateType)0);
				component._PQA((byte)63);
				num = width;
			}
			if (align != 0f && num > 0f)
			{
				BrowserWidgets.Place(component, center + new Vector2(align * (width - num) / 2f, 0f), component.constrained2DTransform.sizeInPixels);
			}
		}

		internal void SetPlays(RankedPlay[] filtered)
		{
			plays = filtered;
			SetBounds();
			SetScroll(0f);
			foreach (BrowserCard card in cards)
			{
				card.Invalidate();
			}
		}

		private void SetBounds()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			int num = (plays.Length + columns - 1) / Math.Max(1, columns);
			maximum = Math.Max(0f, (float)(num * 298) * cardScale - 20f * cardScale - viewportHeight);
			scroll._QTA(new Rect(0f, 0f, 0f, maximum));
			scroll._sTA();
			NativeButtons.SetState(track, maximum > 0f);
		}

		internal void Wheel(Vector2 delta)
		{
			//IL_000b: 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)
			scroll._TTA(new Vector2(0f, Mathf.Clamp(delta.y, -120f, 120f) * 0.75f * scale));
		}

		private void SetScroll(float position)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			content._wQA(0f, Mathf.Clamp(position, 0f, maximum));
			scroll._gkb = Vector3.zero;
		}

		internal void Render(PotentialSnapshot snapshot, PotentialBadges badges, CoverCache covers, string query, string message, bool focused, bool exporting)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			Layout();
			badge.Show(Center(30f * scale, 27f * scale, 135f * scale, 135f * scale), new Vector2(135f, 135f) * scale, (Texture)(object)badges.Texture(PotentialBadges.Tier(snapshot.Potential)));
			SetLabel(title, "潜力值 · 全部最佳成绩", size.x - 204f * scale, 5f * scale);
			SetLabel(account, "PTT " + PotentialCalculator.Format(snapshot.Potential) + "  /  MAX " + PotentialCalculator.Format(snapshot.Maximum), size.x - 204f * scale, 3.6f * scale);
			SetLabel(summary, $"B50 {PotentialCalculator.Format(snapshot.B50Average)}   B10 {PotentialCalculator.Format(snapshot.B10Average)}   已游玩 {snapshot.Plays.Count} 谱面", size.x - 204f * scale, 3f * scale);
			SetLabel(status, message, size.x - 48f * scale, 2.8f * scale);
			SetLabel(searchText, (string.IsNullOrEmpty(query) && !focused) ? "搜索歌名、作者或难度" : ("搜索:" + query), 395f * scale, 3.2f * scale);
			NativeButtons.SetState(search, enabled: true, focused);
			NativeButtons.SetState(export, !exporting);
			slider._cE((maximum > 0f) ? (1f - content.constrained2DTransform.offset.y / maximum) : 1f);
			((Component)empty.Text).gameObject.SetActive(plays.Length == 0);
			if (plays.Length == 0)
			{
				empty.Set("没有符合条件的已游玩谱面。", Color.white);
			}
			int num = Math.Max(0, (int)(content.constrained2DTransform.offset.y / (298f * cardScale)));
			int num2 = (int)Math.Ceiling(viewportHeight / (298f * cardScale)) + 1;
			int num3 = Math.Min(plays.Length - num * columns, num2 * columns);
			while (cards.Count < num3)
			{
				cards.Add(new BrowserCard(widgets, ((Component)viewport).transform));
			}
			float y = content.constrained2DTransform.offset.y;
			float x = viewport.constrained2DTransform.sizeInPixels.x;
			Vector2 center = default(Vector2);
			for (int i = 0; i < cards.Count; i++)
			{
				if (i >= num3)
				{
					cards[i].Hide();
					continue;
				}
				int num4 = num * columns + i;
				((Vector2)(ref center))..ctor((0f - x) / 2f + (float)(num4 % columns) * (cardWidth + 20f * cardScale) + cardWidth / 2f, viewportHeight / 2f - (float)(num4 / columns * 298) * cardScale - 139f * cardScale + y);
				cards[i].Render(plays[num4], covers, center, cardWidth, cardScale, viewportHeight);
			}
			widgets.SyncHitAreas();
		}

		private static void SetLabel(NativeLabel label, string value, float width, float fontSize)
		{
			//IL_0002: 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)
			if (label.Set(value, Color.white))
			{
				PlaceLabel(label, ((Component)label.Text).GetComponent<Constrained2D>().constrained2DTransform.offset, width, fontSize);
			}
		}

		public void Dispose()
		{
			try
			{
				if ((Object)(object)scroll != (Object)null)
				{
					UIManager obj = UIManager._ftA();
					if (obj != null)
					{
						obj._ItA((UIScrollInterface)(object)scroll);
					}
				}
			}
			finally
			{
				widgets.Dispose();
			}
		}
	}
	internal sealed class BrowserCard
	{
		private const float Height = 278f;

		private readonly Constrained2D root;

		private readonly BrowserGraphic border;

		private readonly BrowserGraphic background;

		private readonly BrowserGraphic cover;

		private readonly NativeLabel[] labels;

		private RankedPlay? bound;

		internal BrowserCard(BrowserWidgets widgets, Transform parent)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			BrowserCard browserCard = this;
			root = widgets.Container(parent, "Results.Card", Vector2.one);
			border = widgets.Graphic(((Component)root).transform, "Results.Card.Border", (Texture)(object)Texture2D.whiteTexture, Color.white);
			background = widgets.Graphic(((Component)root).transform, "Results.Card.Backing", (Texture)(object)Texture2D.whiteTexture, Color.white);
			cover = widgets.Graphic(((Component)root).transform, "Results.Card.Cover", (Texture)(object)Texture2D.whiteTexture, Color.white);
			Constrained2DTransform constrained2DTransform = border.Layout.constrained2DTransform;
			constrained2DTransform.zPosition = 0f;
			border.Layout.constrained2DTransform = constrained2DTransform;
			border.Layout._PQA((byte)63);
			constrained2DTransform = cover.Layout.constrained2DTransform;
			constrained2DTransform.zPosition = -0.04f;
			cover.Layout.constrained2DTransform = constrained2DTransform;
			cover.Layout._PQA((byte)63);
			labels = (from i in Enumerable.Range(0, 8)
				select widgets.Label(((Component)browserCard.root).transform, "Results.Card.Text" + i, 3f)).ToArray();
		}

		internal void Invalidate()
		{
			bound = null;
		}

		internal void Hide()
		{
			((Component)root).gameObject.SetActive(false);
		}

		internal void Render(RankedPlay play, CoverCache covers, Vector2 center, float width, float scale, float height)
		{
			//IL_0020: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00b9: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0163: 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)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			((Component)root).gameObject.SetActive(true);
			BrowserWidgets.Place(root, center, new Vector2(width, 278f * scale));
			float num = (0f - height) / 2f - center.y;
			float num2 = height / 2f - center.y;
			CoverPalette palette;
			string error;
			Texture2D texture = covers.GetTexture(play.Chart, out palette, out error);
			border.Tint(PotentialPresentation.Color(palette.Border));
			border.Show(Vector2.zero, new Vector2(width, 278f * scale), (Texture)(object)Texture2D.whiteTexture, num, num2);
			background.Tint(PotentialPresentation.Color(palette.Background));
			background.Show(Vector2.zero, new Vector2(width - 4f * scale, 274f * scale), (Texture)(object)Texture2D.whiteTexture, num, num2);
			float num3 = 236f * scale;
			cover.Show(new Vector2((0f - width) / 2f + 136f * scale, 0f), new Vector2(num3, num3), (Texture)(object)(texture ?? Texture2D.whiteTexture), num, num2);
			cover.Tint(((Object)(object)texture == (Object)null) ? PotentialPresentation.Color(1515565u) : Color.white);
			if (bound != play)
			{
				Color tint = PotentialPresentation.Color(PotentialPresentation.DifficultyRgb(play.Play.Difficulty));
				labels[0].Set(play.Rank.HasValue ? $"#{play.Rank}" : "#--", Color.white);
				labels[1].Set(play.Potential.HasValue ? PotentialCalculator.Format(play.Potential.Value) : "--.---", tint);
				labels[2].Set((play.Chart == null) ? (PotentialPresentation.Difficulty(play.Play.Difficulty) + "  定数不可用") : (PotentialPresentation.Difficulty(play.Play.Difficulty) + "  " + PotentialCalculator.FormatConstant(play.Chart.Constant)), tint);
				labels[3].Set(play.Chart?.Title ?? play.Play.ChartId, Color.white);
				labels[4].Set(PotentialPresentation.Score(play.Play.Score), Color.white);
				labels[5].Set(PotentialPresentation.Lamp(play.Play.Lamp), (Color)((play.Play.Lamp == 2) ? new Color(0.65f, 0.95f, 0.84f) : Color.white));
				labels[6].Set(play.Chart?.Artist ?? "", PotentialPresentation.Color(13227231u));
				float num4 = 1f * scale;
				float num5 = (0f - width) / 2f + 274f * num4;
				float num6 = width - 298f * num4;
				float num7 = 139f * scale;
				NativePotentialPage.PlaceLabel(labels[2], new Vector2(num5 + (num6 - 188f * num4) / 2f, num7 - 40f * num4), num6 - 188f * num4, F(25f), -1f);
				NativePotentialPage.PlaceLabel(labels[1], new Vector2(width / 2f - 110.5f * num4, num7 - 40.5f * num4), 173f * num4, F(42f), 1f);
				NativePotentialPage.PlaceLabel(labels[3], new Vector2(num5 + num6 / 2f, num7 - 94f * num4), num6, F(33f), -1f);
				NativePotentialPage.PlaceLabel(labels[6], new Vector2(num5 + num6 / 2f, num7 - 131f * num4), num6, F(22f), -1f);
				NativePotentialPage.PlaceLabel(labels[4], new Vector2(num5 + num6 / 2f, num7 - 187f * num4), num6, F(56f), -1f);
				NativePotentialPage.PlaceLabel(labels[5], new Vector2(num5 + (num6 - 100f * num4) / 2f, num7 - 247f * num4), num6 - 100f * num4, F(25f), -1f);
				NativePotentialPage.PlaceLabel(labels[0], new Vector2(width / 2f - 77f * num4, num7 - 242.5f * num4), 106f * num4, F(33f), 1f);
				NativePotentialPage.PlaceLabel(labels[7], new Vector2((0f - width) / 2f + 136f * num4, 0f), 220f * num4, F(22f));
				bound = play;
			}
			labels[7].Set((error != null) ? "封面不可用" : "封面加载中", PotentialPresentation.Color(13227231u));
			NativeLabel[] array = labels;
			foreach (NativeLabel nativeLabel in array)
			{
				float y = ((Component)nativeLabel.Text).GetComponent<Constrained2D>().constrained2DTransform.offset.y;
				bool flag = y - 19f * scale >= num && y + 19f * scale <= num2;
				((Component)nativeLabel.Text).gameObject.SetActive(flag && (nativeLabel != labels[7] || (Object)(object)texture == (Object)null));
			}
			float F(float px)
			{
				return px * 0.125f * 278f / 278f * scale;
			}
		}
	}
	internal sealed class NativeScoreLine : IDisposable
	{
		private const float Width = 310f;

		private Constrained2D? row;

		private NativeLabel? value;

		private readonly float fontSize;

		internal bool Alive => (Object)(object)row != (Object)null;

		internal NativeScoreLine(Transform parent, FastText scoreTemplate)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			fontSize = scoreTemplate.FontSize;
			GameObject val = new GameObject("InFalsus.PotentialSystem.ChartValue");
			try
			{
				val.SetActive(false);
				val.transform.SetParent(parent, false);
				row = val.AddComponent<Constrained2D>();
				Constrained2DTransform constrained2DTransform = row.constrained2DTransform;
				constrained2DTransform.transform = val.transform;
				constrained2DTransform.type = (Constrained2DType)0;
				constrained2DTransform.anchor = new Vector2(0.5f, 0.5f);
				constrained2DTransform.parentAlignment = (Constrained2DAlignment)2;
				constrained2DTransform.offset = new Vector2(0f, 40f);
				constrained2DTransform.renderableScale = Vector2.one;
				constrained2DTransform.color = Color.white;
				constrained2DTransform.zPosition = -0.2f;
				constrained2DTransform.overrideMaterialRenderQueueOffset = 12;
				row.constrained2DTransform = constrained2DTransform;
				val.SetActive(true);
				row._rQA();
				row._RQA();
				row._PQA((byte)63);
				BrowserWidgets.Place(row, constrained2DTransform.offset, new Vector2(310f, 54f));
				value = new NativeLabel(scoreTemplate, val.transform, "ChartValue.Text", new Vector2(0.5f, 0.5f), (Constrained2DAlignment)0, Vector2.zero, fontSize);
			}
			catch
			{