Decompiled source of SelfObserver v0.4.1
plugins/SelfObserver.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SelfPip { internal static class CameraRig { public static Character LocalCharacter() { try { Character localCharacter = Character.localCharacter; return ((Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null) ? localCharacter : null; } catch { return null; } } public static bool TryCompute(SlotConfig slot, out Vector3 position, out Vector3 forward) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0090: 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_00a0: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; forward = Vector3.forward; Character val = LocalCharacter(); if (slot == null || (Object)(object)val == (Object)null) { return false; } try { Vector3 center = val.Center; Vector3 val2 = FlatForward(val); Vector3 val3 = Vector3.Cross(Vector3.up, val2); Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Quaternion.AngleAxis(slot.GetYaw(), Vector3.up) * -val2; position = center + val4 * slot.GetDistance() + normalized * slot.GetSide() + Vector3.up * slot.GetHeight(); Vector3 val5 = center - position; forward = ((((Vector3)(ref val5)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val5)).normalized : val4); return true; } catch (Exception ex) { ModConfig.Warn("计算机位失败:" + ex.Message); return false; } } private static Vector3 FlatForward(Character c) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = c.data.lookDirection_Flat; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = ((Component)c).transform.forward; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } } internal static class ClimbGate { private static float _lastClimbTime = -9999f; public static bool IsClimbing { get; private set; } public static bool Active { get; private set; } public static float SinceClimb => Time.time - _lastClimbTime; public static void Update(bool onlyWhenClimbing, float graceSeconds) { bool flag = false; try { Character localCharacter = Character.localCharacter; flag = (Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null && localCharacter.data.isClimbingAnything; } catch { flag = false; } if (flag) { _lastClimbTime = Time.time; } IsClimbing = flag; bool flag2 = Time.time - _lastClimbTime < Mathf.Max(0f, graceSeconds); Active = !onlyWhenClimbing || flag || flag2; } public static void Reset() { _lastClimbTime = -9999f; IsClimbing = false; Active = false; } } internal static class L { public static bool English { get { if (ModConfig.UseEnglish != null) { return ModConfig.UseEnglish.Value; } return false; } } public static string T(string chinese, string english) { if (!English) { return chinese; } return english; } public static void Toggle() { ConfigEntry<bool> useEnglish = ModConfig.UseEnglish; if (useEnglish != null) { useEnglish.Value = !useEnglish.Value; ModConfig.Save(); } } public static string ModeName(ShowMode mode) { if (mode != ShowMode.KeySwitch) { return T("跟随时机", "auto"); } return T("按键开关", "key switch"); } public static string OnOff(bool on) { if (!on) { return T("关", "off"); } return T("开", "on"); } } internal enum ShowMode { Follow, KeySwitch } internal sealed class SlotConfig { public int Index; public ConfigEntry<float> Distance; public ConfigEntry<float> HeightOffset; public ConfigEntry<float> SideOffset; public ConfigEntry<float> YawOffset; public ConfigEntry<float> Fov; public ConfigEntry<float> PosX; public ConfigEntry<float> PosY; public ConfigEntry<float> WinWidth; public ConfigEntry<float> WinHeight; public ConfigEntry<ShowMode> Mode; public ConfigEntry<bool> KeyOn; public ConfigEntry<KeyCode> ToggleKey; public ConfigEntry<bool> LongPressToggle; public ConfigEntry<float> LongPressSeconds; public ShowMode GetMode() { if (Mode == null) { return ShowMode.Follow; } return Mode.Value; } public void SetMode(ShowMode mode) { if (Mode != null) { Mode.Value = mode; } } public bool GetKeyOn() { if (KeyOn != null) { return KeyOn.Value; } return false; } public void SetKeyOn(bool on) { if (KeyOn != null) { KeyOn.Value = on; } } public KeyCode GetKey() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (ToggleKey == null) { return (KeyCode)0; } return ToggleKey.Value; } public bool GetLongPressToggle() { if (LongPressToggle != null) { return LongPressToggle.Value; } return false; } public float GetLongPressSeconds() { return Mathf.Clamp((LongPressSeconds != null) ? LongPressSeconds.Value : 1f, 0.2f, 5f); } public float GetDistance() { if (Distance == null) { return 10f; } return Distance.Value; } public float GetHeight() { if (HeightOffset == null) { return 1f; } return HeightOffset.Value; } public float GetSide() { if (SideOffset == null) { return 0f; } return SideOffset.Value; } public float GetYaw() { if (YawOffset == null) { return 0f; } return YawOffset.Value; } public float GetFov() { if (Fov == null) { return 60f; } return Fov.Value; } public float GetWidth() { if (WinWidth == null) { return 420f; } return Mathf.Max(120f, WinWidth.Value); } public float GetHeightPixels() { float num = ((WinHeight != null) ? WinHeight.Value : 280f); if (!(num > 1f)) { return GetWidth() * 9f / 16f; } return num; } } internal static class ModConfig { public const int MaxSlots = 4; public static ConfigEntry<KeyCode> MenuKey; public static ConfigEntry<KeyCode> LayoutKey; public static ConfigEntry<bool> Enabled; public static ConfigEntry<bool> UseEnglish; public static ConfigEntry<float> PanelScale; public static ConfigEntry<bool> DetailedLog; public static ConfigEntry<int> SlotCount; public static ConfigEntry<int> Corner; public static ConfigEntry<float> Margin; public static ConfigEntry<float> WindowGap; public static ConfigEntry<float> ResolutionScale; public static ConfigEntry<float> MaxRenderDistance; public static ConfigEntry<bool> RenderShadows; public static ConfigEntry<bool> DrawBorder; public static ConfigEntry<bool> ShowLabel; public static ConfigEntry<bool> AllowMouseDrag; public static ConfigEntry<bool> OnlyWhenClimbing; public static ConfigEntry<float> ClimbGraceSeconds; public static ConfigEntry<bool> SmoothFollow; public const string DefWindowBg = "#15171C"; public const string DefTitleBar = "#21252E"; public const string DefNavBg = "#1A1D24"; public const string DefCardBg = "#1E222A"; public const string DefCardEdge = "#39404E"; public const string DefButtonBg = "#272C36"; public const string DefFieldBg = "#101318"; public const string DefAccent = "#FFC94D"; public const string DefTextMain = "#E8EAEF"; public const string DefTextSub = "#C3CAD6"; public const string DefTextHint = "#A6AFBE"; public const string DefOk = "#74D69A"; public const string DefWarn = "#F2A65A"; public const string DefBad = "#EB6B6B"; public const string DefVideoBorder = "#0A0D12"; public static ConfigEntry<string> ColorWindowBg; public static ConfigEntry<string> ColorTitleBar; public static ConfigEntry<string> ColorNavBg; public static ConfigEntry<string> ColorCardBg; public static ConfigEntry<string> ColorCardEdge; public static ConfigEntry<string> ColorButtonBg; public static ConfigEntry<string> ColorFieldBg; public static ConfigEntry<string> ColorAccent; public static ConfigEntry<string> ColorTextMain; public static ConfigEntry<string> ColorTextSub; public static ConfigEntry<string> ColorTextHint; public static ConfigEntry<string> ColorOk; public static ConfigEntry<string> ColorWarn; public static ConfigEntry<string> ColorBad; public static ConfigEntry<string> ColorVideoBorder; public static readonly List<SlotConfig> Slots = new List<SlotConfig>(); private static ConfigFile _file; public static bool LayoutMode; public static void Init(ConfigFile config) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected O, but got Unknown _file = config; MenuKey = config.Bind<KeyCode>("菜单", "菜单按键", (KeyCode)284, "打开/关闭自身观察窗控制面板的按键。"); LayoutKey = config.Bind<KeyCode>("菜单", "布局模式按键", (KeyCode)0, "「布局模式」的快捷键。默认为空(不占用任何按键),只在控制面板里点击开关;需要快捷键时自行绑定。"); Enabled = config.Bind<bool>("菜单", "启用自身观察窗", true, "总开关。关闭后不创建任何小窗相机,几乎零开销。"); UseEnglish = config.Bind<bool>("菜单", "界面语言(英文)", false, "面板界面是否使用英文。也可在面板底部「缩放」旁的按钮上一键切换中英文。"); PanelScale = config.Bind<float>("菜单", "面板缩放", 1f, new ConfigDescription("控制面板整体缩放(含文字)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 2.5f), Array.Empty<object>())); DetailedLog = config.Bind<bool>("菜单", "详细日志", false, "输出详细日志,便于排查问题。"); SlotCount = config.Bind<int>("小窗", "小窗数量", 1, new ConfigDescription("同时显示的小窗个数(每个小窗一个独立机位)。", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 4), Array.Empty<object>())); Corner = config.Bind<int>("小窗", "小窗位置", 3, new ConfigDescription("多窗自动摆放时贴的屏幕角落:0=右下,1=右上,2=左下,3=左上(默认)。", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>())); Margin = config.Bind<float>("小窗", "小窗边距(像素)", 16f, new ConfigDescription("自动摆放时小窗与屏幕边缘的距离。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>())); WindowGap = config.Bind<float>("小窗", "小窗间距(像素)", 8f, new ConfigDescription("多个小窗彼此之间的空隙。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>())); ResolutionScale = config.Bind<float>("小窗", "渲染分辨率比例", 1f, new ConfigDescription("小窗画面的渲染分辨率比例:1 表示与屏幕上的小窗同分辨率,越大越清晰也越耗性能。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 2f), Array.Empty<object>())); MaxRenderDistance = config.Bind<float>("小窗", "渲染最大距离(米)", 600f, new ConfigDescription("小窗相机能看到的最远距离。调小可减少远处渲染开销。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(30f, 3000f), Array.Empty<object>())); RenderShadows = config.Bind<bool>("小窗", "小窗渲染阴影", false, "是否让小窗相机单独渲染阴影。默认关闭以省性能。"); DrawBorder = config.Bind<bool>("小窗", "小窗描边", true, "是否在小窗四周画一圈深色描边,便于和游戏画面区分。"); ShowLabel = config.Bind<bool>("小窗", "显示窗口标签", true, "是否在小窗左上角显示「自身视角 N」标签。"); AllowMouseDrag = config.Bind<bool>("小窗", "允许鼠标拖动小窗", true, "开启后可在「面板打开」或「布局模式」时直接鼠标拖动小窗移动、拖右下角缩放,并自动写回配置。关闭则只能用面板里的数值调节。"); OnlyWhenClimbing = config.Bind<bool>("显示时机", "仅攀爬时开启", true, "开启后小窗只在攀爬(墙面/绳索/藤蔓)+ 宽限时间内显示,其余时间自动隐藏以省性能。"); ClimbGraceSeconds = config.Bind<float>("显示时机", "攀爬宽限秒数", 3f, new ConfigDescription("停止攀爬后小窗继续保留的秒数,避免攀爬中频繁开合。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); SmoothFollow = config.Bind<bool>("显示时机", "平滑跟随", true, "小窗相机平滑跟随角色,减少角色晃动带来的画面抖动。"); BindColors(config); Slots.Clear(); for (int i = 0; i < 4; i++) { Slots.Add(BindSlot(config, i)); } } private static SlotConfig BindSlot(ConfigFile config, int index) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown string text = "窗口" + (index + 1); return new SlotConfig { Index = index, Mode = config.Bind<ShowMode>(text, "小窗开关模式", ShowMode.Follow, "0=跟随时机(按「显示时机」的规则,例如仅在攀爬时显示)、1=按键开关(开/关只认下面的开关按键,不受攀爬等判定影响)。两种模式都能在游戏内面板里直接点选。"), KeyOn = config.Bind<bool>(text, "按键开关状态", false, "「按键开关」模式下的开/关状态,由短按开关按键切换,也可以在面板里直接点。「跟随时机」模式下这一项不起作用。"), ToggleKey = config.Bind<KeyCode>(text, "开关按键", (KeyCode)0, "「按键开关」模式下:短按开/关这一路小窗。若勾选了「长按切换显示模式」,长按即可在「跟随时机 / 按键开关」之间切换。默认为空(不占用任何按键),点「清除」可解绑。"), LongPressToggle = config.Bind<bool>(text, "长按切换显示模式", false, "勾选后:短按开关按键仍然是开/关,长按则在这一路小窗的「跟随时机 / 按键开关」两种显示模式之间切换。不勾选时长按无作用。"), LongPressSeconds = config.Bind<float>(text, "长按判定秒数", 1f, new ConfigDescription("按住开关按键多久算「长按」(仅本窗口生效)。默认 1 秒。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>())), Distance = config.Bind<float>(text, "摄像机距离(米)", 10f, new ConfigDescription("小窗摄像机与角色的水平距离(米)。默认 10 米。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 100f), Array.Empty<object>())), HeightOffset = config.Bind<float>(text, "摄像机高度偏移(米)", 1f, new ConfigDescription("小窗摄像机相对角色中心点的高度偏移(米)。默认 +1,即位于角色中心点偏上 1 米。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-20f, 40f), Array.Empty<object>())), SideOffset = config.Bind<float>(text, "摄像机左右偏移(米)", 0f, new ConfigDescription("小窗摄像机相对角色朝向的左右偏移(米),正数偏向角色右侧。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-40f, 40f), Array.Empty<object>())), YawOffset = config.Bind<float>(text, "摄像机环向角度(度)", 0f, new ConfigDescription("以角色水平朝向为基准的环绕角度:0=正后方(默认),90=角色右侧,180=角色正前方,-90=角色左侧。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), Array.Empty<object>())), Fov = config.Bind<float>(text, "视野角度(度)", 60f, new ConfigDescription("该机位的视野角度。越小越拉近。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(15f, 120f), Array.Empty<object>())), PosX = config.Bind<float>(text, "小窗水平位置", -1f, new ConfigDescription("小窗左上角 X 坐标(像素)。-1 表示按「小窗位置」角落自动摆放;手动拖动后自动写回。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 8192f), Array.Empty<object>())), PosY = config.Bind<float>(text, "小窗垂直位置", -1f, new ConfigDescription("小窗左上角 Y 坐标(像素)。-1 表示按「小窗位置」角落自动摆放;手动拖动后自动写回。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 8192f), Array.Empty<object>())), WinWidth = config.Bind<float>(text, "小窗宽度(像素)", 420f, new ConfigDescription("小窗宽度(像素)。也可直接拖动小窗右下角调整,会自动写回。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(120f, 1920f), Array.Empty<object>())), WinHeight = config.Bind<float>(text, "小窗高度(像素)", 280f, new ConfigDescription("小窗高度(像素)。填 0 表示按 16:9 由宽度推算;拖动右下角调整后会自动写回。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1080f), Array.Empty<object>())) }; } private static void BindColors(ConfigFile config) { ColorWindowBg = config.Bind<string>("配色", "窗口背景色", "#15171C", "控制面板窗口的底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTitleBar = config.Bind<string>("配色", "标题栏背景色", "#21252E", "标题栏底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorNavBg = config.Bind<string>("配色", "导航栏背景色", "#1A1D24", "左侧页签栏底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorCardBg = config.Bind<string>("配色", "卡片背景色", "#1E222A", "内容卡片底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorCardEdge = config.Bind<string>("配色", "卡片描边色", "#39404E", "卡片与分隔线的描边色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorButtonBg = config.Bind<string>("配色", "按钮背景色", "#272C36", "普通按钮底色(悬停/按下会自动变亮),格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorFieldBg = config.Bind<string>("配色", "输入框背景色", "#101318", "输入框与滑条轨道底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorAccent = config.Bind<string>("配色", "强调色", "#FFC94D", "关键功能色:数值、选中项、页签高亮、滑条滑块与主按钮都用它,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTextMain = config.Bind<string>("配色", "主文字色", "#E8EAEF", "标题、卡片标题、按钮等主要文字,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTextSub = config.Bind<string>("配色", "正文文字色", "#C3CAD6", "说明文字与表单标签,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTextHint = config.Bind<string>("配色", "小字文字色", "#A6AFBE", "脚注、提示、尺寸数值等小号文字,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorOk = config.Bind<string>("配色", "正常状态色", "#74D69A", "「显示中」「已开启」等正常状态,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorWarn = config.Bind<string>("配色", "警告状态色", "#F2A65A", "「未在局内」「已达上限」等提醒,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorBad = config.Bind<string>("配色", "错误状态色", "#EB6B6B", "异常与危险操作的文字,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorVideoBorder = config.Bind<string>("配色", "小窗描边色", "#0A0D12", "屏幕上小窗四周的描边与小窗标签底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); } public static int ActiveSlotCount() { return Mathf.Clamp((SlotCount == null) ? 1 : SlotCount.Value, 1, 4); } public static bool SlotVisible(int index, bool timingActive) { if (index < 0 || index >= Slots.Count) { return false; } SlotConfig slotConfig = Slots[index]; if (slotConfig.GetMode() == ShowMode.KeySwitch) { return slotConfig.GetKeyOn(); } return timingActive; } public static int VisibleSlotCount(bool timingActive) { int num = 0; for (int i = 0; i < ActiveSlotCount(); i++) { if (SlotVisible(i, timingActive)) { num++; } } return num; } public static void CollectVisibleSlots(List<int> into, bool timingActive) { into.Clear(); for (int i = 0; i < ActiveSlotCount(); i++) { if (SlotVisible(i, timingActive)) { into.Add(i); } } } public static int CountByMode(ShowMode mode) { int num = 0; for (int i = 0; i < ActiveSlotCount(); i++) { if (Slots[i].GetMode() == mode) { num++; } } return num; } public static float SafePanelScale() { return Mathf.Clamp((PanelScale != null) ? PanelScale.Value : 1f, 0.6f, 2.5f); } public static void SaveRect(SlotConfig slot, Rect rect) { if (slot != null) { if (slot.PosX != null) { slot.PosX.Value = Mathf.Round(((Rect)(ref rect)).x); } if (slot.PosY != null) { slot.PosY.Value = Mathf.Round(((Rect)(ref rect)).y); } if (slot.WinWidth != null) { slot.WinWidth.Value = Mathf.Round(((Rect)(ref rect)).width); } if (slot.WinHeight != null) { slot.WinHeight.Value = Mathf.Round(((Rect)(ref rect)).height); } Log("窗口 " + (slot.Index + 1) + " 位置/大小已保存:" + Mathf.Round(((Rect)(ref rect)).x) + "," + Mathf.Round(((Rect)(ref rect)).y) + " " + Mathf.Round(((Rect)(ref rect)).width) + "×" + Mathf.Round(((Rect)(ref rect)).height)); } } public static void Save() { if (_file != null) { _file.Save(); } } public static void Log(string message) { if (DetailedLog != null && DetailedLog.Value) { PluginInfo.Log(message); } } public static void Warn(string message) { PluginInfo.Warn(message); } } internal abstract class ModPanelBase { protected const float TitleBarHeight = 32f; private const float MinScale = 0.6f; private const float MaxScale = 2.5f; protected const float ScaleStep = 0.1f; private bool _visible; private int _tab; private Rect _rect; private float _scale = 1f; private bool _scaleLoaded; private bool _resizing; private Vector2 _scroll; private string _toast; private float _toastUntil; private bool _savedCursorVisible; private bool _cursorForced; private Action<KeyCode> _captureSetter; private object _captureToken; protected virtual int WindowId => 61851; protected abstract string Title { get; } protected virtual string TitleNote => null; protected abstract string[] TabLabels { get; } protected virtual float MinWidth => 560f; protected virtual float MaxWidth => 1100f; protected virtual float MinHeight => 320f; protected virtual float MaxHeight => 1000f; protected virtual float NavWidth => 104f; protected virtual float DefaultWidth => 700f; protected virtual float DefaultHeight => 560f; public bool Visible => _visible; protected int CurrentTab => _tab; public bool IsCapturingKey => _captureToken != null; protected float Scale => _scale; protected abstract void DrawTab(int index); protected virtual void DrawStatusStrip() { } protected virtual void OnOpen() { } protected virtual void OnTabChanged(int index) { } protected virtual float LoadScale() { return 1f; } protected virtual void SaveScale(float value) { } protected ModPanelBase() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) _rect = new Rect(28f, 28f, DefaultWidth, DefaultHeight); } public void Toast(string text, float seconds = 2.5f) { Notify(text, seconds); } public Rect WindowRectPixels() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) float num = (_scaleLoaded ? _scale : 1f); return new Rect(((Rect)(ref _rect)).x * num, ((Rect)(ref _rect)).y * num, ((Rect)(ref _rect)).width * num, ((Rect)(ref _rect)).height * num); } public void Toggle() { _visible = !_visible; if (_visible) { OnOpen(); } else { CancelCapture(); } UpdateCursor(); } public void Close() { _visible = false; CancelCapture(); UpdateCursor(); } public void Tick() { UpdateCursor(); } protected void Notify(string text, float seconds = 2.5f) { _toast = text; _toastUntil = Time.unscaledTime + seconds; } private void UpdateCursor() { if (_visible) { if (!_cursorForced) { _savedCursorVisible = Cursor.visible; _cursorForced = true; } if (!Cursor.visible) { Cursor.visible = true; } } else if (_cursorForced) { _cursorForced = false; Cursor.visible = _savedCursorVisible; } } public void Draw() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) if (_visible) { if (!_scaleLoaded) { _scaleLoaded = true; _scale = Mathf.Clamp(LoadScale(), 0.6f, 2.5f); } PanelTheme.EnsureBuilt(); HandleKeyCapture(); Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(_scale, _scale, 1f)); ((Rect)(ref _rect)).width = Mathf.Clamp(((Rect)(ref _rect)).width, MinWidth, MaxWidth); ((Rect)(ref _rect)).height = Mathf.Clamp(((Rect)(ref _rect)).height, MinHeight, MaxHeight); float num = (float)Screen.width / _scale; float num2 = (float)Screen.height / _scale; ((Rect)(ref _rect)).x = Mathf.Clamp(((Rect)(ref _rect)).x, 0f - ((Rect)(ref _rect)).width + 120f, Mathf.Max(0f, num - 120f)); ((Rect)(ref _rect)).y = Mathf.Clamp(((Rect)(ref _rect)).y, 0f, Mathf.Max(0f, num2 - 40f)); _rect = GUI.Window(WindowId, _rect, new WindowFunction(DrawWindowInternal), GUIContent.none, PanelTheme.Window); GUI.matrix = matrix; } } private void DrawWindowInternal(int id) { //IL_003c: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) DrawTitleBar(); GUILayout.Space(38f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); DrawNav(); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.Space(2f); DrawStatusStrip(); _scroll = GUILayout.BeginScrollView(_scroll, false, false, GUIStyle.none, GUI.skin.verticalScrollbar, PanelTheme.Scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) }); DrawTab(_tab); GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.Space(8f); GUILayout.EndHorizontal(); DrawFooter(); DrawResizeHandle(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width - 120f, 32f)); } protected virtual float DrawTitleBarExtras(float x) { return x; } private void DrawTitleBar() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_003e: 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_00da: 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) GUI.Box(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 32f), GUIContent.none, PanelTheme.TitleBar); float x = PanelTheme.TitleText.CalcSize(new GUIContent(Title)).x; GUI.Label(new Rect(12f, 0f, x + 6f, 32f), Title, PanelTheme.TitleText); if (!string.IsNullOrEmpty(TitleNote)) { GUI.Label(new Rect(12f + x + 8f, 0f, 320f, 32f), TitleNote, PanelTheme.TitleNote); } float num = ((Rect)(ref _rect)).width - 8f - 26f; if (GUI.Button(new Rect(num, 6f, 26f, 20f), "×", PanelTheme.Button)) { Close(); } DrawTitleBarExtras(num); } private void DrawNav() { GUILayout.BeginVertical(PanelTheme.NavBg, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(NavWidth), GUILayout.ExpandHeight(true) }); string[] tabLabels = TabLabels; for (int i = 0; i < tabLabels.Length; i++) { bool flag = _tab == i; if (GUILayout.Button(tabLabels[i], flag ? PanelTheme.NavItemOn : PanelTheme.NavItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }) && !flag) { _tab = i; OnTabChanged(i); } } GUILayout.FlexibleSpace(); DrawNavFooter(); GUILayout.EndVertical(); } protected virtual void DrawNavFooter() { } private void DrawFooter() { //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Space(8f); GUILayout.Label(Loc("缩放", "Zoom"), PanelTheme.Hint, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }); if (GUILayout.Button("-", PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(24f), GUILayout.Height(18f) })) { SetScale(_scale - 0.1f); } GUILayout.Label(PanelWidgets.Fmt(_scale, "0.0") + "x", PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }); if (GUILayout.Button("+", PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(24f), GUILayout.Height(18f) })) { SetScale(_scale + 0.1f); } if (GUILayout.Button(Loc("重置", "Reset"), PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(38f), GUILayout.Height(18f) })) { SetScale(1f); } DrawFooterExtras(); GUILayout.Space(10f); if (!string.IsNullOrEmpty(_toast) && Time.unscaledTime < _toastUntil) { GUIStyle val = new GUIStyle(PanelTheme.Sub); val.normal.textColor = PanelTheme.TxtOk; GUILayout.Label(_toast, val, Array.Empty<GUILayoutOption>()); } else { DrawFooterHint(); } GUILayout.FlexibleSpace(); GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.Space(4f); } protected virtual void DrawFooterHint() { } protected virtual void DrawFooterExtras() { } protected virtual string Loc(string chinese, string english) { return chinese; } private void DrawResizeHandle() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref _rect)).width - 16f, ((Rect)(ref _rect)).height - 16f, 14f, 14f); GUI.Label(val, "◢", PanelTheme.Hint); Event current = Event.current; if (current != null) { if ((int)current.type == 0 && ((Rect)(ref val)).Contains(current.mousePosition)) { _resizing = true; current.Use(); } else if (_resizing && (int)current.type == 3) { ((Rect)(ref _rect)).width = Mathf.Clamp(current.mousePosition.x + 8f, MinWidth, MaxWidth); ((Rect)(ref _rect)).height = Mathf.Clamp(current.mousePosition.y + 8f, MinHeight, MaxHeight); current.Use(); } else if (_resizing && (int)current.type == 1) { _resizing = false; current.Use(); } } } protected void SetScale(float value) { _scale = Mathf.Clamp(Mathf.Round(value * 100f) / 100f, 0.6f, 2.5f); SaveScale(_scale); } protected unsafe void KeyBindRow(string label, KeyCode current, Action<KeyCode> setter, object token, string hint = null) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(label, PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(132f) }); bool flag = _captureToken != null && _captureToken == token; if (GUILayout.Button(flag ? Loc("请按下任意键…", "Press any key...") : (((int)current == 0) ? Loc("未绑定", "Not bound") : ((object)(*(KeyCode*)(¤t))/*cast due to .constrained prefix*/).ToString()), flag ? PanelTheme.ChipOn : PanelTheme.Button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(21f) })) { if (flag) { CancelCapture(); } else { _captureSetter = setter; _captureToken = token; GUIUtility.keyboardControl = 0; Notify(Loc("按 Esc 可取消设置。", "Press Esc to cancel."), 4f); } } if (GUILayout.Button(Loc("清除", "Clear"), PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(46f), GUILayout.Height(21f) })) { setter?.Invoke((KeyCode)0); } GUILayout.EndHorizontal(); if (!string.IsNullOrEmpty(hint)) { GUILayout.Label(hint, PanelTheme.Hint, Array.Empty<GUILayoutOption>()); } } private unsafe void HandleKeyCapture() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_001d: 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_0023: 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_002a: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (_captureToken == null) { return; } Event current = Event.current; if (current == null || (int)current.type != 4) { return; } KeyCode keyCode = current.keyCode; if ((int)keyCode != 0) { if ((int)keyCode == 27) { Notify(Loc("已取消按键设置。", "Key binding cancelled.")); } else { _captureSetter?.Invoke(keyCode); Notify(Loc("已设置为 ", "Set to ") + ((object)(*(KeyCode*)(&keyCode))/*cast due to .constrained prefix*/).ToString()); } CancelCapture(); current.Use(); } } private void CancelCapture() { _captureSetter = null; _captureToken = null; } } internal sealed class PanelColorItem { public string Name; public string NameEn; public string Note; public string NoteEn; public string Fallback; public Func<string> Read; public Action<string> Write; } internal sealed class PanelColorPreset { public string Name; public string NameEn; public string[] Hex; } internal sealed class PanelContrastPair { public string Name; public string NameEn; public Func<Color> Fore; public Func<Color> Back; public float Recommend; } internal sealed class PanelColorPicker { private readonly IList<PanelColorItem> _items; private readonly IList<PanelColorPreset> _presets; private readonly IList<PanelContrastPair> _contrast; private readonly Func<string, string, string> _loc; private readonly Action _save; private readonly Action<string> _notify; private readonly string[] _buffer; private readonly string[] _synced; private int _editing = -1; public PanelColorPicker(IList<PanelColorItem> items, IList<PanelColorPreset> presets, IList<PanelContrastPair> contrast, Func<string, string, string> loc, Action save, Action<string> notify) { _items = items; _presets = presets; _contrast = contrast; _loc = loc; _save = save; _notify = notify; int num = items?.Count ?? 0; _buffer = new string[num]; _synced = new string[num]; } public void Draw() { if (_items != null && _items.Count != 0) { DrawPresets(); DrawColorCard(); DrawContrastCard(); } } private void DrawPresets() { PanelWidgets.BeginCard(_loc("配色预设", "Presets")); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (PanelWidgets.Btn(_loc("恢复默认", "Defaults"), 96f)) { for (int i = 0; i < _items.Count; i++) { WriteItem(_items[i], _items[i].Fallback); } AfterPreset(_loc("已恢复默认配色。", "Default colours restored.")); } if (_presets != null) { for (int j = 0; j < _presets.Count; j++) { PanelColorPreset panelColorPreset = _presets[j]; if (PanelWidgets.Btn(_loc(panelColorPreset.Name, panelColorPreset.NameEn), 96f)) { for (int k = 0; k < _items.Count && k < panelColorPreset.Hex.Length; k++) { WriteItem(_items[k], panelColorPreset.Hex[k]); } AfterPreset(_loc("已改用", "Applied ") + _loc(panelColorPreset.Name, panelColorPreset.NameEn) + _loc("。", ".")); } } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); PanelWidgets.Hint(_loc("想让小字更清楚就调亮「小字文字色」;下面的对比度检查可以量化这件事。", "To make small text easier to read, brighten the hint colour; the contrast check below quantifies it.")); PanelWidgets.EndCard(); } private void AfterPreset(string toast) { if (_save != null) { _save(); } _editing = -1; for (int i = 0; i < _buffer.Length; i++) { _buffer[i] = null; _synced[i] = null; } if (_notify != null) { _notify(toast); } } private void DrawColorCard() { PanelWidgets.BeginCard(_loc("颜色", "Colors")); for (int i = 0; i < _items.Count; i++) { DrawColorRow(i); } PanelWidgets.Hint(_loc("颜色即时生效并写入配置文件;填错格式的那一项会被忽略,面板保持上一次的有效颜色。", "Changes apply immediately and are saved to the config file. A malformed entry is ignored and the previous colour stays.")); PanelWidgets.EndCard(); } private void DrawColorRow(int index) { //IL_000f: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) PanelColorItem panelColorItem = _items[index]; Color val = Current(index); SyncBuffer(index); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(_loc(panelColorItem.Name, panelColorItem.NameEn), PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(132f) }); PanelTheme.FillRect(GUILayoutUtility.GetRect(24f, 18f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(24f), GUILayout.Height(18f) }), val); string text = PanelWidgets.TextBox(_buffer[index], 88f); if (text != _buffer[index]) { _buffer[index] = text; ApplyTyped(index, text); } bool flag = _editing == index; if (GUILayout.Button(_loc("微调", "Tune"), flag ? PanelTheme.ChipOn : PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(50f), GUILayout.Height(20f) })) { if (flag) { _editing = -1; if (_save != null) { _save(); } if (_notify != null) { _notify(_loc("配色已保存。", "Colours saved.")); } } else { _editing = index; _buffer[index] = PanelTheme.ToHex(val); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (!PanelTheme.TryParse(_buffer[index], out var _)) { GUIStyle val2 = new GUIStyle(PanelTheme.Sub); val2.normal.textColor = PanelTheme.TxtBad; GUILayout.Label(_loc("格式应为 #RRGGBB,例如 #1E222A;当前输入已忽略。", "Expected #RRGGBB such as #1E222A; this input is ignored."), val2, Array.Empty<GUILayoutOption>()); } if (flag) { GUILayout.Label(_loc(panelColorItem.Note, panelColorItem.NoteEn), PanelTheme.Hint, Array.Empty<GUILayoutOption>()); DrawSliders(index, val); } } private void DrawSliders(int index, Color current) { //IL_000a: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); float num = GUILayout.HorizontalSlider(Screen255(current.r), 0f, 255f, PanelTheme.SliderTrack, PanelTheme.SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); GUILayout.Label("R " + Mathf.RoundToInt(num), PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) }); float num2 = GUILayout.HorizontalSlider(Screen255(current.g), 0f, 255f, PanelTheme.SliderTrack, PanelTheme.SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); GUILayout.Label("G " + Mathf.RoundToInt(num2), PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) }); float num3 = GUILayout.HorizontalSlider(Screen255(current.b), 0f, 255f, PanelTheme.SliderTrack, PanelTheme.SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); GUILayout.Label("B " + Mathf.RoundToInt(num3), PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) }); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); Color val = default(Color); ((Color)(ref val))..ctor(num / 255f, num2 / 255f, num3 / 255f, current.a); if (!Same(val, current)) { WriteItem(_items[index], PanelTheme.ToHex(val)); _buffer[index] = PanelTheme.ToHex(val); } } private static float Screen255(float v) { return Mathf.Round(v * 255f); } private static bool Same(Color a, Color b) { //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_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_0032: 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 (Mathf.Abs(a.r - b.r) < 0.002f && Mathf.Abs(a.g - b.g) < 0.002f) { return Mathf.Abs(a.b - b.b) < 0.002f; } return false; } private Color Current(int index) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) PanelColorItem panelColorItem = _items[index]; if (panelColorItem.Read != null && PanelTheme.TryParse(panelColorItem.Read(), out var color)) { return color; } if (PanelTheme.TryParse(panelColorItem.Fallback, out color)) { return color; } return Color.magenta; } private void SyncBuffer(int index) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) string text = ((_items[index].Read != null) ? _items[index].Read() : string.Empty); if (!string.Equals(_synced[index], text, StringComparison.OrdinalIgnoreCase)) { _synced[index] = text; if (!PanelTheme.TryParse(_buffer[index], out var color) || !string.Equals(PanelTheme.ToHex(color), text, StringComparison.OrdinalIgnoreCase)) { _buffer[index] = text; } } } private void ApplyTyped(int index, string typed) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (PanelTheme.TryParse(typed, out var color)) { WriteItem(_items[index], PanelTheme.ToHex(color)); } } private static void WriteItem(PanelColorItem item, string hex) { if (item.Write != null && !string.IsNullOrEmpty(hex)) { item.Write(hex); } } private void DrawContrastCard() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (_contrast != null && _contrast.Count != 0) { PanelWidgets.BeginCard(_loc("对比度检查", "Contrast check")); for (int i = 0; i < _contrast.Count; i++) { PanelContrastPair panelContrastPair = _contrast[i]; float num = PanelTheme.Contrast(panelContrastPair.Fore(), panelContrastPair.Back()); Color color = ((num >= panelContrastPair.Recommend) ? PanelTheme.TxtOk : ((num >= panelContrastPair.Recommend * 0.75f) ? PanelTheme.TxtWarn : PanelTheme.TxtBad)); PanelWidgets.KVColored(_loc(panelContrastPair.Name, panelContrastPair.NameEn), PanelWidgets.Fmt(num, "0.0") + ":1" + _loc("(建议 ", " (aim ") + PanelWidgets.Fmt(panelContrastPair.Recommend, "0.#") + "+)", color, 132f); } PanelWidgets.Hint(_loc("数值越高越清楚。正文建议 4.5 以上、小字建议 7 以上;低于建议值的会标红。面板是半透明的,实际观感还会受背后游戏画面影响。", "Higher is clearer. Aim for 4.5+ for body text and 7+ for small text; anything below is flagged red. The panel is translucent, so the game behind it also affects how it looks.")); PanelWidgets.EndCard(); } } } internal static class PanelTheme { internal const float AlphaWindow = 0.97f; internal const float AlphaNav = 0.9f; internal const float AlphaCard = 0.92f; internal const float AlphaVideoLabel = 0.78f; public static Color ColWindow = Hex(1382172, 0.97f); public static Color ColWindowEdge = Hex(3752014); public static Color ColTitleBar = Hex(2172206); public static Color ColNavBg = Hex(1711396, 0.9f); public static Color ColCard = Hex(1974826, 0.92f); public static Color ColCardEdge = Hex(3752014); public static Color ColBtn = Hex(2567222); public static Color ColBtnHover = Hex(3357255); public static Color ColBtnActive = Hex(4278874); public static Color ColBtnEdge = Hex(4015187); public static Color ColPrimary = Hex(16763213); public static Color ColPrimaryHover = Hex(16767095); public static Color ColDanger = Hex(10699844); public static Color ColDangerHover = Hex(12737114); public static Color ColSelected = Hex(3358810); public static Color ColSelectedEdge = Hex(7244477); public static Color ColField = Hex(1053464); public static Color ColFieldEdge = Hex(4344411); public static Color TxtMain = Hex(15264495); public static Color TxtSub = Hex(12831446); public static Color TxtWeak = Hex(10923966); public static Color TxtAccent = Hex(16763213); public static Color TxtOk = Hex(7657114); public static Color TxtWarn = Hex(15902298); public static Color TxtBad = Hex(15428459); public static Color ColVideoBorder = Hex(658706); public static Color ColVideoLabelText = Hex(15264495); private static readonly string[] FontCandidates = new string[10] { "Microsoft YaHei UI", "Microsoft YaHei", "微软雅黑", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "SimHei", "黑体", "SimSun", "宋体" }; private static Font _cachedFont; private static bool _fontResolved; private static bool _dirty = true; private static readonly List<Texture2D> Textures = new List<Texture2D>(); private static Texture2D _white; public static bool UseSystemFont { get; set; } = true; public static string FontName { get; private set; } = "(Unity 内置)"; public static Action<string> Log { get; set; } = delegate { }; public static Func<bool> PaletteSync { get; set; } public static GUIStyle Window { get; private set; } public static GUIStyle TitleBar { get; private set; } public static GUIStyle TitleText { get; private set; } public static GUIStyle TitleNote { get; private set; } public static GUIStyle NavBg { get; private set; } public static GUIStyle NavItem { get; private set; } public static GUIStyle NavItemOn { get; private set; } public static GUIStyle Card { get; private set; } public static GUIStyle CardTitle { get; private set; } public static GUIStyle Label { get; private set; } public static GUIStyle Sub { get; private set; } public static GUIStyle Hint { get; private set; } public static GUIStyle Value { get; private set; } public static GUIStyle Button { get; private set; } public static GUIStyle ButtonPrimary { get; private set; } public static GUIStyle ButtonDanger { get; private set; } public static GUIStyle Mini { get; private set; } public static GUIStyle Chip { get; private set; } public static GUIStyle ChipOn { get; private set; } public static GUIStyle Row { get; private set; } public static GUIStyle RowOn { get; private set; } public static GUIStyle Field { get; private set; } public static GUIStyle Toggle { get; private set; } public static GUIStyle Divider { get; private set; } public static GUIStyle Scroll { get; private set; } public static GUIStyle OnVideoLabel { get; private set; } public static GUIStyle Border { get; private set; } public static GUIStyle SliderTrack { get; private set; } public static GUIStyle SliderThumb { get; private set; } public static void Invalidate() { _dirty = true; } internal static Color Hex(int rgb, float a = 1f) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) return new Color((float)((rgb >> 16) & 0xFF) / 255f, (float)((rgb >> 8) & 0xFF) / 255f, (float)(rgb & 0xFF) / 255f, a); } public static bool TryParse(string hex, out Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) color = default(Color); if (string.IsNullOrEmpty(hex)) { return false; } string text = hex.Trim(); if (text.Length > 0 && text[0] == '#') { text = text.Substring(1); } if (text.Length == 3) { text = new string(new char[6] { text[0], text[0], text[1], text[1], text[2], text[2] }); } if (text.Length != 6 && text.Length != 8) { return false; } if (!TryByte(text, 0, out var value) || !TryByte(text, 2, out var value2) || !TryByte(text, 4, out var value3)) { return false; } int value4 = 255; if (text.Length == 8 && !TryByte(text, 6, out value4)) { return false; } color = new Color((float)value / 255f, (float)value2 / 255f, (float)value3 / 255f, (float)value4 / 255f); return true; } private static bool TryByte(string s, int start, out int value) { value = 0; int num = HexDigit(s[start]); int num2 = HexDigit(s[start + 1]); if (num < 0 || num2 < 0) { return false; } value = (num << 4) | num2; return true; } private static int HexDigit(char c) { if (c >= '0' && c <= '9') { return c - 48; } if (c >= 'a' && c <= 'f') { return c - 97 + 10; } if (c >= 'A' && c <= 'F') { return c - 65 + 10; } return -1; } public static string ToHex(Color c) { //IL_0005: 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_004b: Unknown result type (might be due to invalid IL or missing references) return "#" + Mathf.RoundToInt(Mathf.Clamp01(c.r) * 255f).ToString("X2") + Mathf.RoundToInt(Mathf.Clamp01(c.g) * 255f).ToString("X2") + Mathf.RoundToInt(Mathf.Clamp01(c.b) * 255f).ToString("X2"); } public static float Luminance(Color c) { //IL_0005: 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_0028: Unknown result type (might be due to invalid IL or missing references) return 0.2126f * Linear(c.r) + 0.7152f * Linear(c.g) + 0.0722f * Linear(c.b); } public static float Contrast(Color a, Color b) { //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) float num = Luminance(a); float num2 = Luminance(b); float num3 = Mathf.Max(num, num2); float num4 = Mathf.Min(num, num2); return (num3 + 0.05f) / (num4 + 0.05f); } private static float Linear(float c) { if (!(c <= 0.03928f)) { return Mathf.Pow((c + 0.055f) / 1.055f, 2.4f); } return c / 12.92f; } public static bool SetColor(ref Color field, string hex, float alpha) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!TryParse(hex, out var color)) { return false; } color.a = alpha; if (Same(field, color)) { return false; } field = color; return true; } public static void DeriveTokens() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0055: 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_0069: 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_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_009b: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) ColBtnHover = Lighten(ColBtn, 0.1f); ColBtnActive = Lighten(ColBtn, 0.2f); ColBtnEdge = Lighten(ColBtn, 0.18f); ColPrimaryHover = Lighten(ColPrimary, 0.14f); ColDanger = Mix(Color.black, TxtBad, 0.62f); ColDangerHover = Mix(Color.black, TxtBad, 0.8f); ColSelected = Lighten(ColCard, 0.14f); ColSelectedEdge = ColPrimary; ColWindowEdge = ColCardEdge; ColFieldEdge = Lighten(ColField, 0.26f); ColVideoLabelText = TxtMain; } private static bool Same(Color a, Color b) { //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_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_0032: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(a.r - b.r) < 0.002f && Mathf.Abs(a.g - b.g) < 0.002f && Mathf.Abs(a.b - b.b) < 0.002f) { return Mathf.Abs(a.a - b.a) < 0.002f; } return false; } private static Color Lighten(Color c, float amount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Mix(c, Color.white, amount); } private static Color Mix(Color a, Color b, float t) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) return new Color(Mathf.Lerp(a.r, b.r, t), Mathf.Lerp(a.g, b.g, t), Mathf.Lerp(a.b, b.b, t), a.a); } private static Font ResolveFont() { if (!UseSystemFont) { FontName = "(Unity 内置)"; return null; } if (_fontResolved && (Object)(object)_cachedFont != (Object)null) { FontName = ((Object)_cachedFont).name; return _cachedFont; } _fontResolved = true; try { string[] oSInstalledFontNames = Font.GetOSInstalledFontNames(); string[] fontCandidates = FontCandidates; foreach (string text in fontCandidates) { if (oSInstalledFontNames != null && Array.IndexOf(oSInstalledFontNames, text) >= 0) { Font val = Font.CreateDynamicFontFromOSFont(text, 14); if (!((Object)(object)val == (Object)null)) { ((Object)val).hideFlags = (HideFlags)61; _cachedFont = val; FontName = text; Log?.Invoke("面板字体已切换为系统字体:" + text); return val; } } } Log?.Invoke("未找到候选中文字体,沿用 Unity 内置字体。"); } catch (Exception ex) { Log?.Invoke("加载系统字体失败,沿用内置字体:" + ex.Message); } FontName = "(Unity 内置)"; return null; } public static void EnsureBuilt() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_007a: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_008d: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected O, but got Unknown //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: 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_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: 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_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Expected O, but got Unknown //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Expected O, but got Unknown //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0432: 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) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Expected O, but got Unknown //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Expected O, but got Unknown //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Expected O, but got Unknown //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Expected O, but got Unknown //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Expected O, but got Unknown //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Expected O, but got Unknown //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Expected O, but got Unknown //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Expected O, but got Unknown //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Expected O, but got Unknown //IL_0670: Expected O, but got Unknown //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Expected O, but got Unknown //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Expected O, but got Unknown //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_0775: Expected O, but got Unknown //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Expected O, but got Unknown //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) if (PaletteSync != null && PaletteSync()) { _dirty = true; } if (_dirty || Window == null || !((Object)(object)Window.normal.background != (Object)null)) { ReleaseTextures(); _dirty = false; Font val = ResolveFont(); Window = Solid(ColWindow, ColWindowEdge, 10, 1); Window.padding = new RectOffset(0, 0, 0, 0); Window.overflow = new RectOffset(0, 0, 0, 0); TitleBar = Solid(ColTitleBar, ColTitleBar, 10, 0); TitleBar.padding = new RectOffset(12, 12, 0, 0); TitleText = Text(val, 15, (FontStyle)1, TxtMain, (TextAnchor)3); TitleNote = Text(val, 11, (FontStyle)0, TxtWeak, (TextAnchor)3); Label = Text(val, 13, (FontStyle)0, TxtMain, (TextAnchor)3, wrap: true); Sub = Text(val, 13, (FontStyle)0, TxtSub, (TextAnchor)3, wrap: true); Hint = Text(val, 12, (FontStyle)0, TxtWeak, (TextAnchor)0, wrap: true); Value = Text(val, 13, (FontStyle)1, TxtAccent, (TextAnchor)3, wrap: true); CardTitle = Text(val, 14, (FontStyle)1, TxtMain, (TextAnchor)3); NavBg = Solid(ColNavBg, ColNavBg, 0, 0); NavBg.padding = new RectOffset(6, 6, 8, 8); NavItem = Clickable(val, 13, new Color(ColNavBg.r, ColNavBg.g, ColNavBg.b, 0f), ColBtnHover, ColSelected, TxtSub, TxtMain, 6, 0); NavItem.alignment = (TextAnchor)3; NavItem.padding = new RectOffset(10, 6, 0, 0); NavItem.margin = new RectOffset(0, 0, 1, 1); NavItemOn = Clickable(val, 13, ColSelected, ColSelected, ColSelected, TxtAccent, TxtAccent, 6, 1, ColSelectedEdge); NavItemOn.fontStyle = (FontStyle)1; NavItemOn.alignment = (TextAnchor)3; NavItemOn.padding = new RectOffset(10, 6, 0, 0); NavItemOn.margin = new RectOffset(0, 0, 1, 1); Card = Solid(ColCard, ColCardEdge, 8, 1); Card.padding = new RectOffset(10, 10, 9, 10); Card.margin = new RectOffset(0, 0, 3, 5); Button = Clickable(val, 13, ColBtn, ColBtnHover, ColBtnActive, TxtMain, Color.white, 6, 1, ColBtnEdge); ButtonPrimary = Clickable(val, 13, ColPrimary, ColPrimaryHover, ColPrimaryHover, Hex(1774600), Color.white, 6, 0); ButtonPrimary.fontStyle = (FontStyle)1; ButtonDanger = Clickable(val, 13, ColDanger, ColDangerHover, ColDangerHover, Hex(16771561), Color.white, 6, 0); Mini = Clickable(val, 12, ColBtn, ColBtnHover, ColBtnActive, TxtSub, Color.white, 5, 1, ColBtnEdge); Mini.padding = new RectOffset(4, 4, 0, 0); Chip = Clickable(val, 12, ColBtn, ColBtnHover, ColBtnActive, TxtSub, Color.white, 9, 1, ColBtnEdge); Chip.padding = new RectOffset(6, 6, 2, 2); ChipOn = Clickable(val, 12, ColSelected, ColSelected, ColSelected, TxtAccent, TxtAccent, 9, 1, ColSelectedEdge); ChipOn.fontStyle = (FontStyle)1; ChipOn.padding = new RectOffset(6, 6, 2, 2); Row = Clickable(val, 13, Hex(1777446, 0.55f), ColBtnHover, ColBtnActive, TxtMain, Color.white, 5, 0); Row.alignment = (TextAnchor)3; Row.padding = new RectOffset(8, 8, 0, 0); Row.margin = new RectOffset(0, 0, 1, 1); RowOn = Clickable(val, 13, ColSelected, ColSelected, ColSelected, TxtAccent, TxtAccent, 5, 1, ColSelectedEdge); RowOn.fontStyle = (FontStyle)1; RowOn.alignment = (TextAnchor)3; RowOn.padding = new RectOffset(8, 8, 0, 0); RowOn.margin = new RectOffset(0, 0, 1, 1); Field = new GUIStyle(GUI.skin.textField); ApplyBg(Field, Nine(ColField, ColFieldEdge, 5, 1), 6); Field.normal.textColor = TxtMain; Field.focused.textColor = Color.white; Field.hover.textColor = TxtMain; Field.alignment = (TextAnchor)3; Field.padding = new RectOffset(6, 6, 0, 0); Field.fontSize = 13; if ((Object)(object)val != (Object)null) { Field.font = val; } Toggle = new GUIStyle(GUI.skin.toggle); Toggle.normal.textColor = TxtSub; Toggle.onNormal.textColor = TxtAccent; Toggle.hover.textColor = TxtMain; Toggle.onHover.textColor = TxtAccent; Toggle.fontSize = 13; Toggle.padding = new RectOffset(20, 0, 0, 0); if ((Object)(object)val != (Object)null) { Toggle.font = val; } Divider = Solid(ColCardEdge, ColCardEdge, 0, 0); Scroll = new GUIStyle(GUI.skin.scrollView) { padding = new RectOffset(0, 4, 0, 0) }; OnVideoLabel = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)3, padding = new RectOffset(6, 6, 0, 0), wordWrap = false }; OnVideoLabel.normal.textColor = ColVideoLabelText; OnVideoLabel.normal.background = Nine(new Color(ColVideoBorder.r, ColVideoBorder.g, ColVideoBorder.b, 0.78f), new Color(ColVideoBorder.r, ColVideoBorder.g, ColVideoBorder.b, 0.78f), 5, 0); if ((Object)(object)val != (Object)null) { OnVideoLabel.font = val; } Border = Solid(Hex(724241, 0.95f), Hex(724241, 0.95f), 2, 0); SliderTrack = new GUIStyle(GUI.skin.horizontalSlider); ApplyBg(SliderTrack, Nine(ColField, ColFieldEdge, 4, 1), 5); SliderTrack.fixedHeight = 12f; SliderThumb = new GUIStyle(GUI.skin.horizontalSliderThumb); ApplyBg(SliderThumb, Nine(ColPrimaryHover, ColPrimaryHover, 5, 0), 6); SliderThumb.fixedWidth = 12f; SliderThumb.fixedHeight = 17f; } } private static void ReleaseTextures() { for (int i = 0; i < Textures.Count; i++) { if ((Object)(object)Textures[i] != (Object)null) { Object.Destroy((Object)(object)Textures[i]); } } Textures.Clear(); } public static void FillRect(Rect rect, Color color) { //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_white == (Object)null) { _white = new Texture2D(1, 1, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; _white.SetPixel(0, 0, Color.white); _white.Apply(false, false); } Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_white); GUI.color = color2; } private static GUIStyle Text(Font font, int size, FontStyle fs, Color color, TextAnchor anchor, bool wrap = false) { //IL_000a: 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_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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_003d: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = fs, alignment = anchor, wordWrap = wrap, padding = new RectOffset(0, 0, 1, 1) }; val.normal.textColor = color; val.hover.textColor = color; if ((Object)(object)font != (Object)null) { val.font = font; } return val; } private static GUIStyle Solid(Color fill, Color edge, int radius, int border) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_001a: Expected O, but got Unknown GUIStyle val = new GUIStyle(); ApplyBg(val, Nine(fill, edge, radius, border), radius + border + 1); return val; } private static GUIStyle Clickable(Font font, int size, Color normal, Color hover, Color active, Color textNormal, Color textHover, int radius, int border, Color edge = default(Color)) { //IL_000a: 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_0016: 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_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_0033: Expected O, but got Unknown //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_0042: Expected O, but got Unknown //IL_0043: Expected O, but got Unknown //IL_005b: 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_0061: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_0116: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.button) { fontSize = size, alignment = (TextAnchor)4, wordWrap = false, padding = new RectOffset(6, 6, 0, 0), margin = new RectOffset(2, 2, 2, 2) }; if ((Object)(object)font != (Object)null) { val.font = font; } int num = radius + border + 1; Texture2D background = Nine(normal, (border > 0) ? edge : normal, radius, border); Texture2D background2 = Nine(hover, (border > 0) ? edge : hover, radius, border); Texture2D background3 = Nine(active, (border > 0) ? edge : active, radius, border); val.border = new RectOffset(num, num, num, num); val.normal.background = background; val.hover.background = background2; val.active.background = background3; val.focused.background = background2; val.onNormal.background = background3; val.onHover.background = background2; val.onActive.background = background3; val.onFocused.background = background3; val.normal.textColor = textNormal; val.hover.textColor = textHover; val.active.textColor = textHover; val.focused.textColor = textHover; val.onNormal.textColor = textHover; val.onHover.textColor = textHover; val.onActive.textColor = textHover; val.onFocused.textColor = textHover; return val; } private static void ApplyBg(GUIStyle s, Texture2D tex, int slice) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown s.border = new RectOffset(slice, slice, slice, slice); s.normal.background = tex; s.hover.background = tex; s.active.background = tex; s.focused.background = tex; s.onNormal.background = tex; s.onHover.background = tex; s.onActive.background = tex; s.onFocused.background = tex; } private static Texture2D Nine(Color fill, Color edge, int radius, int border) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0032: Expected O, but got Unknown //IL_0101: 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_0105: 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_010a: 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_0123: Unknown result type (might be due to invalid IL or missing references) int num = radius + border + 1; int num2 = Mathf.Max(4, num * 2 + 2); Texture2D val = new Texture2D(num2, num2, (TextureFormat)5, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61 }; Textures.Add(val); Color[] array = (Color[])(object)new Color[num2 * num2]; float num3 = Mathf.Max(0.001f, (float)(radius + border)); float num4 = Mathf.Max(0f, num3 - (float)border); for (int i = 0; i < num2; i++) { for (int j = 0; j < num2; j++) { float num5 = (float)j + 0.5f; float num6 = (float)i + 0.5f; float num7 = Mathf.Max(0f, Mathf.Max(num3 - num5, num5 - ((float)num2 - num3))); float num8 = Mathf.Max(0f, Mathf.Max(num3 - num6, num6 - ((float)num2 - num3))); float num9 = Mathf.Sqrt(num7 * num7 + num8 * num8); float num10 = Mathf.Clamp01(num3 - num9 + 0.5f); float num11 = Mathf.Clamp01(num4 - num9 + 0.5f); Color val2 = ((border > 0) ? Color.Lerp(edge, fill, num11) : fill); val2.a *= num10; array[i * num2 + j] = val2; } } val.SetPixels(array); val.Apply(false, false); return val; } } internal static class PanelWidgets { public static void BeginCard(string title = null) { GUILayout.BeginVertical(PanelTheme.Card, Array.Empty<GUILayoutOption>()); if (!string.IsNullOrEmpty(title)) { GUILayout.Label(title, PanelTheme.CardTitle, Array.Empty<GUILayoutOption>()); Divider(); } } public static void EndCard() { GUILayout.EndVertical(); } public static void Divider() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) GUI.Box(GUILayoutUtility.GetRect(1f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }), GUIContent.none, PanelTheme.Divider); GUILayout.Space(4f); } public static void Info(string text) { GUILayout.Label(text, PanelTheme.Sub, Array.Empty<GUILayoutOption>()); } public static void Hint(string text) { GUILayout.Label(text, PanelTheme.Hint, Array.Empty<GUILayoutOption>()); } public static void Caption(string text, float width) { GUILayout.Label(text, PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); } public static void KV(string label, string value, float labelWidth = 96f) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(label, PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(labelWidth) }); GUILayout.Label(value, PanelTheme.Value, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); } public static void KVColored(string label, string value, Color color, float labelWidth = 96f) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(label, PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(labelWidth) }); GUIStyle val = new GUIStyle(PanelTheme.Value); val.normal.textColor = color; GUILayout.Label(value, val, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); } public static bool Btn(string label, float width, GUIStyle style = null, float height = 21f) { return GUILayout.Button(label, style ?? PanelTheme.Button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(height) }); } public static bool BtnWide(string label, GUIStyle style = null, float height = 23f) { return GUILayout.Button(label, style ?? PanelTheme.Button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(height) }); } public static string TextBox(string value, float width) { return GUILayout.TextField(value ?? string.Empty, PanelTheme.Field, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(20f) }); } public static bool ToggleRow(bool value, string label, string hint = null) { bool result = GUILayout.Toggle(value, " " + label, PanelTheme.Toggle, Array.Empty<GUILayoutOption>()); if (!string.IsNullOrEmpty(hint)) { Hint(hint); } return result; } public static float SliderRow(string label, float value, float min, float max, string format = "0.##", float labelWidth = 118f, float valueWidth = 56f) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(label, PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(labelWidth) }); float num = GUILayout.HorizontalSlider(value, min, max, PanelTheme.SliderTrack, PanelTheme.SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(18f) }); GUILayout.Label(Fmt(num, format), PanelTheme.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(valueWidth) }); GUILayout.EndHorizontal(); return num; } public static float NumberRow(string label, float value, float step, float min, float max, string format = "0", float labelWidth = 118f, float valueWidth = 60f) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(label, PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(labelWidth) }); if (GUILayout.Button("-", PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(18f) })) { value = Mathf.Clamp(Mathf.Round(value - step),