Decompiled source of DangerWarning v1.3.1
plugins/DangerWarning.dll
Decompiled 2 months 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 System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using StandardMenu; using UnityEngine; using UnityEngine.SceneManagement; using Zorro.Core; [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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [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 StandardMenu { public struct KeyCombo { public KeyCode Key; public bool Ctrl; public bool Alt; public bool Shift; public bool Meta; public bool HasModifiers { get { if (!Ctrl && !Alt && !Shift) { return Meta; } return true; } } public bool IsValid => (int)Key > 0; } public static class KeyComboUtil { public static KeyCombo Parse(string text) { //IL_000b: 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) //IL_0102: Unknown result type (might be due to invalid IL or missing references) KeyCombo result = new KeyCombo { Key = (KeyCode)0 }; if (string.IsNullOrEmpty(text)) { return result; } string[] array = text.Split(new char[1] { '+' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); if (text2.Length != 0) { KeyCode key; if (IsModifierName(text2)) { result.Ctrl |= EqualsIgnoreCase(text2, "ctrl") || EqualsIgnoreCase(text2, "control"); result.Alt |= EqualsIgnoreCase(text2, "alt"); result.Shift |= EqualsIgnoreCase(text2, "shift"); result.Meta |= EqualsIgnoreCase(text2, "meta") || EqualsIgnoreCase(text2, "win") || EqualsIgnoreCase(text2, "cmd") || EqualsIgnoreCase(text2, "command"); } else if (TryParseKey(text2, out key)) { result.Key = key; } } } return result; } public unsafe static string Format(KeyCombo combo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)combo.Key == 0) { return string.Empty; } string text = string.Empty; if (combo.Ctrl) { text += "Ctrl+"; } if (combo.Alt) { text += "Alt+"; } if (combo.Shift) { text += "Shift+"; } if (combo.Meta) { text += "Meta+"; } return text + ((object)(*(KeyCode*)(&combo.Key))/*cast due to .constrained prefix*/).ToString(); } public static string Format(bool ctrl, bool alt, bool shift, bool meta, KeyCode key) { //IL_000a: 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) return Format(new KeyCombo { Key = key, Ctrl = ctrl, Alt = alt, Shift = shift, Meta = meta }); } public static string Pretty(string text) { if (!string.IsNullOrEmpty(text)) { return text; } return "未绑定"; } public static bool IsModifierKey(KeyCode key) { //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_0008: Invalid comparison between Unknown and I4 if (key - 303 <= 7) { return true; } return false; } public static bool HeldCtrl() { if (!Input.GetKey((KeyCode)306)) { return Input.GetKey((KeyCode)305); } return true; } public static bool HeldAlt() { if (!Input.GetKey((KeyCode)308)) { return Input.GetKey((KeyCode)307); } return true; } public static bool HeldShift() { if (!Input.GetKey((KeyCode)304)) { return Input.GetKey((KeyCode)303); } return true; } public static bool HeldMeta() { if (!Input.GetKey((KeyCode)310)) { return Input.GetKey((KeyCode)309); } return true; } public static bool ModifiersMatch(KeyCombo combo) { if (HeldCtrl() == combo.Ctrl && HeldAlt() == combo.Alt && HeldShift() == combo.Shift) { return HeldMeta() == combo.Meta; } return false; } public static bool Down(KeyCombo combo) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (combo.IsValid && Input.GetKeyDown(combo.Key)) { return ModifiersMatch(combo); } return false; } public static bool Held(KeyCombo combo) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (combo.IsValid && Input.GetKey(combo.Key)) { return ModifiersMatch(combo); } return false; } private static bool IsModifierName(string token) { if (!EqualsIgnoreCase(token, "ctrl") && !EqualsIgnoreCase(token, "control") && !EqualsIgnoreCase(token, "alt") && !EqualsIgnoreCase(token, "shift") && !EqualsIgnoreCase(token, "meta") && !EqualsIgnoreCase(token, "win") && !EqualsIgnoreCase(token, "cmd")) { return EqualsIgnoreCase(token, "command"); } return true; } private static bool EqualsIgnoreCase(string a, string b) { return string.Equals(a, b, StringComparison.OrdinalIgnoreCase); } private static bool TryParseKey(string token, out KeyCode key) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected I4, but got Unknown try { key = (KeyCode)(int)(KeyCode)Enum.Parse(typeof(KeyCode), token, ignoreCase: true); return true; } catch { key = (KeyCode)0; return false; } } } internal static class L { private static ConfigEntry<bool> _useEnglish; public static bool English { get { if (_useEnglish != null) { return _useEnglish.Value; } return false; } } public static void Bind(ConfigEntry<bool> useEnglish) { _useEnglish = useEnglish; } public static string T(string chinese, string english) { if (!English) { return chinese; } return english; } public static void Toggle() { if (_useEnglish != null) { _useEnglish.Value = !_useEnglish.Value; ((ConfigEntryBase)_useEnglish).ConfigFile.Save(); } } } internal sealed class MenuWindowHost : MenuWindow { private static MethodInfo _openMethod; private static MethodInfo _closeMethod; public override bool openOnStart => false; public override bool selectOnOpen => false; public override bool closeOnPause => false; public override bool closeOnUICancel => false; public override bool blocksPlayerInput => true; public override bool showCursorWhileOpen => true; public override bool autoHideOnClose => true; public static MenuWindowHost Instance { get; private set; } public static MenuWindowHost Create(GameObject host) { //IL_0005: 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_0012: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("StandardMenu_MenuWindow") { hideFlags = (HideFlags)61 }; val.transform.SetParent(host.transform, false); Instance = val.AddComponent<MenuWindowHost>(); return Instance; } public static void SetActive(bool active) { if ((Object)(object)Instance == (Object)null) { return; } try { if (active) { if (!((MenuWindow)Instance).isOpen) { if (_openMethod == null) { _openMethod = typeof(MenuWindow).GetMethod("Open", BindingFlags.Instance | BindingFlags.NonPublic); } _openMethod?.Invoke(Instance, null); } } else if (((MenuWindow)Instance).isOpen) { if (_closeMethod == null) { _closeMethod = typeof(MenuWindow).GetMethod("Close", BindingFlags.Instance | BindingFlags.NonPublic); } _closeMethod?.Invoke(Instance, null); } } catch (Exception ex) { Debug.LogWarning((object)("[StandardMenu] 切换菜单窗口状态失败:" + ex.Message)); } } } [Serializable] public struct PanelRectData { public float x; public float y; public float width; public float height; public static implicit operator Rect(PanelRectData d) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Rect(d.x, d.y, d.width, d.height); } public static implicit operator PanelRectData(Rect r) { return new PanelRectData { x = ((Rect)(ref r)).x, y = ((Rect)(ref r)).y, width = ((Rect)(ref r)).width, height = ((Rect)(ref r)).height }; } } public abstract class ModConfigBase { protected ConfigFile _file; public virtual string DefWindowBg => "#15171C"; public virtual string DefTitleBar => "#21252E"; public virtual string DefNavBg => "#1A1D24"; public virtual string DefCardBg => "#1E222A"; public virtual string DefCardEdge => "#39404E"; public virtual string DefButtonBg => "#272C36"; public virtual string DefFieldBg => "#101318"; public virtual string DefAccent => "#FFC94D"; public virtual string DefTextMain => "#E8EAEF"; public virtual string DefTextSub => "#C3CAD6"; public virtual string DefTextHint => "#A6AFBE"; public virtual string DefOk => "#74D69A"; public virtual string DefWarn => "#F2A65A"; public virtual string DefBad => "#EB6B6B"; public virtual string DefVideoBorder => "#0A0D12"; public ConfigEntry<string> MenuKey { get; protected set; } public ConfigEntry<bool> MasterEnabled { get; protected set; } public ConfigEntry<int> MenuOpenMode { get; protected set; } public ConfigEntry<float> MenuLongPressSeconds { get; protected set; } public ConfigEntry<float> PanelScale { get; protected set; } public ConfigEntry<float> PanelRectX { get; protected set; } public ConfigEntry<float> PanelRectY { get; protected set; } public ConfigEntry<float> PanelRectW { get; protected set; } public ConfigEntry<float> PanelRectH { get; protected set; } public ConfigEntry<string> ColorWindowBg { get; protected set; } public ConfigEntry<string> ColorTitleBar { get; protected set; } public ConfigEntry<string> ColorNavBg { get; protected set; } public ConfigEntry<string> ColorCardBg { get; protected set; } public ConfigEntry<string> ColorCardEdge { get; protected set; } public ConfigEntry<string> ColorButtonBg { get; protected set; } public ConfigEntry<string> ColorFieldBg { get; protected set; } public ConfigEntry<string> ColorAccent { get; protected set; } public ConfigEntry<string> ColorTextMain { get; protected set; } public ConfigEntry<string> ColorTextSub { get; protected set; } public ConfigEntry<string> ColorTextHint { get; protected set; } public ConfigEntry<string> ColorOk { get; protected set; } public ConfigEntry<string> ColorWarn { get; protected set; } public ConfigEntry<string> ColorBad { get; protected set; } public ConfigEntry<string> ColorVideoBorder { get; protected set; } public abstract void Init(ConfigFile config); public void Save() { ConfigFile file = _file; if (file != null) { file.Save(); } } protected void BindStandardMenu(ConfigFile config, string modName, string defaultMenuKey = "F3") { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown _file = config; string text = "菜单"; string text2 = "面板"; MenuKey = config.Bind<string>(text, "菜单按键", defaultMenuKey, "打开/关闭控制面板的按键,支持组合键,例如 F3、Alt+P、Ctrl+Shift+K。留空表示未绑定,只能靠面板上的 × 关闭。"); MasterEnabled = config.Bind<bool>(text, "启用", true, "总开关。关闭后蜘蛛红线、秃鹫光柱与预警、青蛙光柱、孢子炸弹高亮全部停用。"); L.Bind(config.Bind<bool>(text, "界面语言(英文)", false, "面板界面是否使用英文。也可在面板底部一键切换中英文。")); PanelScale = config.Bind<float>(text2, "面板缩放", 1f, new ConfigDescription("控制面板整体缩放(含文字)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 2.5f), Array.Empty<object>())); PanelRectX = config.Bind<float>(text2, "面板窗口 X", 28f, new ConfigDescription("面板窗口左上角 X 坐标(逻辑像素)。拖动面板后自动保存。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1000f, 8192f), Array.Empty<object>())); PanelRectY = config.Bind<float>(text2, "面板窗口 Y", 28f, new ConfigDescription("面板窗口左上角 Y 坐标(逻辑像素)。拖动面板后自动保存。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1000f, 8192f), Array.Empty<object>())); PanelRectW = config.Bind<float>(text2, "面板窗口宽度", 700f, new ConfigDescription("面板窗口宽度(逻辑像素)。拖动右下角调整后自动保存。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(560f, 1100f), Array.Empty<object>())); PanelRectH = config.Bind<float>(text2, "面板窗口高度", 560f, new ConfigDescription("面板窗口高度(逻辑像素)。拖动右下角调整后自动保存。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(320f, 1000f), Array.Empty<object>())); config.Bind<bool>(text, "详细日志", false, "输出详细日志,便于排查问题。"); MenuOpenMode = config.Bind<int>(text, "打开方式", 0, new ConfigDescription("打开/关闭菜单的方式:0 = 短按切换;1 = 长按达到秒数才切换(避免误触)。", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1), Array.Empty<object>())); MenuLongPressSeconds = config.Bind<float>(text, "长按秒数", 1.5f, new ConfigDescription("长按切换菜单时需要持续按住的秒数。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 3f), Array.Empty<object>())); BindColors(config); } private void BindColors(ConfigFile config) { ColorWindowBg = config.Bind<string>("配色", "窗口背景色", DefWindowBg, "控制面板窗口的底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTitleBar = config.Bind<string>("配色", "标题栏背景色", DefTitleBar, "标题栏底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorNavBg = config.Bind<string>("配色", "导航栏背景色", DefNavBg, "左侧页签栏底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorCardBg = config.Bind<string>("配色", "卡片背景色", DefCardBg, "内容卡片底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorCardEdge = config.Bind<string>("配色", "卡片描边色", DefCardEdge, "卡片与分隔线的描边色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorButtonBg = config.Bind<string>("配色", "按钮背景色", DefButtonBg, "普通按钮底色(悬停/按下会自动变亮),格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorFieldBg = config.Bind<string>("配色", "输入框背景色", DefFieldBg, "输入框与滑条轨道底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorAccent = config.Bind<string>("配色", "强调色", DefAccent, "关键功能色:数值、选中项、页签高亮、滑条滑块与主按钮都用它,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTextMain = config.Bind<string>("配色", "主文字色", DefTextMain, "标题、卡片标题、按钮等主要文字,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTextSub = config.Bind<string>("配色", "正文文字色", DefTextSub, "说明文字与表单标签,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorTextHint = config.Bind<string>("配色", "小字文字色", DefTextHint, "脚注、提示、尺寸数值等小号文字,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorOk = config.Bind<string>("配色", "正常状态色", DefOk, "「显示中」「已开启」等正常状态,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorWarn = config.Bind<string>("配色", "警告状态色", DefWarn, "「未在局内」「已达上限」等提醒,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorBad = config.Bind<string>("配色", "错误状态色", DefBad, "异常与危险操作的文字,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); ColorVideoBorder = config.Bind<string>("配色", "小窗描边色", DefVideoBorder, "屏幕上小窗四周的描边与小窗标签底色,格式 #RRGGBB。面板「配色」页可直接调整,点「恢复默认配色」还原。"); } public Rect? LoadPanelRect() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (PanelRectX == null || PanelRectY == null || PanelRectW == null || PanelRectH == null) { return null; } float value = PanelRectX.Value; float value2 = PanelRectY.Value; float value3 = PanelRectW.Value; float value4 = PanelRectH.Value; if (Mathf.Approximately(value, 28f) && Mathf.Approximately(value2, 28f) && Mathf.Approximately(value3, 700f) && Mathf.Approximately(value4, 560f)) { return null; } return new Rect(value, value2, value3, value4); } public void SavePanelRect(Rect rect) { if (PanelRectX != null) { PanelRectX.Value = Mathf.Round(((Rect)(ref rect)).x); PanelRectY.Value = Mathf.Round(((Rect)(ref rect)).y); PanelRectW.Value = Mathf.Round(((Rect)(ref rect)).width); PanelRectH.Value = Mathf.Round(((Rect)(ref rect)).height); Save(); } } public float LoadPanelScale() { if (PanelScale == null) { return 1f; } return Mathf.Clamp(PanelScale.Value, 0.6f, 2.5f); } public void SavePanelScale(float value) { if (PanelScale != null) { PanelScale.Value = Mathf.Clamp(Mathf.Round(value * 100f) / 100f, 0.6f, 2.5f); Save(); } } public virtual void Log(string message) { } public virtual void Warn(string 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 _rectLoaded; private bool _resizing; private bool _rectMoved; private Vector2 _scroll; private string _toast; private float _toastUntil; private bool _savedCursorVisible; private bool _cursorForced; private Action<KeyCode> _captureSetter; private Action<string> _comboSetter; private object _captureToken; protected virtual int WindowId => 61961; 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 DrawFooterHint() { } protected virtual void DrawFooterExtras() { } protected virtual float DrawTitleBarExtras(float x) { return x; } protected virtual void OnOpen() { } protected virtual void OnTabChanged(int index) { } protected virtual float LoadScale() { return 1f; } protected virtual void SaveScale(float value) { } protected virtual Rect? LoadPanelRect() { return null; } protected virtual void SavePanelRect(Rect rect) { } 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_012d: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_026f: 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_005f: 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_011d: 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) if (!_visible) { return; } if (!_scaleLoaded) { _scaleLoaded = true; _scale = Mathf.Clamp(LoadScale(), 0.6f, 2.5f); } if (!_rectLoaded) { _rectLoaded = true; Rect? val = LoadPanelRect(); if (val.HasValue) { Rect value = val.Value; ((Rect)(ref value)).width = Mathf.Clamp(((Rect)(ref value)).width, MinWidth, MaxWidth); ((Rect)(ref value)).height = Mathf.Clamp(((Rect)(ref value)).height, MinHeight, MaxHeight); float num = (float)Screen.width / _scale; float num2 = (float)Screen.height / _scale; ((Rect)(ref value)).x = Mathf.Clamp(((Rect)(ref value)).x, 0f - ((Rect)(ref value)).width + 120f, Mathf.Max(0f, num - 120f)); ((Rect)(ref value)).y = Mathf.Clamp(((Rect)(ref value)).y, 0f, Mathf.Max(0f, num2 - 40f)); _rect = value; } } 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 num3 = (float)Screen.width / _scale; float num4 = (float)Screen.height / _scale; ((Rect)(ref _rect)).x = Mathf.Clamp(((Rect)(ref _rect)).x, 0f - ((Rect)(ref _rect)).width + 120f, Mathf.Max(0f, num3 - 120f)); ((Rect)(ref _rect)).y = Mathf.Clamp(((Rect)(ref _rect)).y, 0f, Mathf.Max(0f, num4 - 40f)); Rect rect = _rect; _rect = GUI.Window(WindowId, _rect, new WindowFunction(DrawWindowInternal), GUIContent.none, PanelTheme.Window); if (_rect != rect) { _rectMoved = true; } if (_rectMoved && !_resizing && !Input.GetMouseButton(0)) { SavePanelRect(_rect); _rectMoved = false; } 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)); } 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 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) //IL_00fe: 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; SavePanelRect(_rect); 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>()); } } protected void KeyComboBindRow(string label, string current, Action<string> setter, object token, string hint = null) { 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 a combo...") : KeyComboUtil.Pretty(current), flag ? PanelTheme.ChipOn : PanelTheme.Button, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(21f) })) { if (flag) { CancelCapture(); } else { _comboSetter = setter; _captureToken = token; GUIUtility.keyboardControl = 0; Notify(Loc("可按住 Ctrl/Alt/Shift 再按主键;按 Esc 取消。", "Hold Ctrl/Alt/Shift then press a key; Esc cancels."), 4f); } } if (GUILayout.Button(Loc("清除", "Clear"), PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(46f), GUILayout.Height(21f) })) { setter?.Invoke(string.Empty); } 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_011d: 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) if (_captureToken == null) { return; } Event current = Event.current; if (current == null || (int)current.type != 4) { return; } KeyCode keyCode = current.keyCode; if ((int)keyCode == 0) { return; } if (_comboSetter != null) { if (KeyComboUtil.IsModifierKey(keyCode)) { return; } if ((int)keyCode == 27 && !HasAnyModifier(current)) { Notify(Loc("已取消按键设置。", "Key binding cancelled.")); } else { bool ctrl = current.control || KeyComboUtil.HeldCtrl(); bool alt = current.alt || KeyComboUtil.HeldAlt(); bool shift = current.shift || KeyComboUtil.HeldShift(); bool meta = current.command || KeyComboUtil.HeldMeta(); string text = KeyComboUtil.Format(ctrl, alt, shift, meta, keyCode); _comboSetter?.Invoke(text); Notify(Loc("已设置为 ", "Set to ") + text); } } else 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 static bool HasAnyModifier(Event e) { if (!e.control && !e.alt && !e.shift && !e.command && !KeyComboUtil.HeldCtrl() && !KeyComboUtil.HeldAlt() && !KeyComboUtil.HeldShift()) { return KeyComboUtil.HeldMeta(); } return true; } private void CancelCapture() { _captureSetter = null; _comboSetter = null; _captureToken = null; } } public 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; } public class PanelColorPreset { public string Name; public string NameEn; public string[] Hex; } public 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 PanelColorItem[] _items; private readonly PanelColorPreset[] _presets; private readonly PanelContrastPair[] _contrast; private string _pickerTarget; private float _pickerH; private float _pickerS; private float _pickerV; private bool _showContrast; public PanelColorPicker(PanelColorItem[] items, PanelColorPreset[] presets = null, PanelContrastPair[] contrast = null) { _items = items ?? new PanelColorItem[0]; _presets = presets ?? new PanelColorPreset[0]; _contrast = contrast ?? new PanelContrastPair[0]; } public void Draw() { //IL_012f: 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_015e: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) if (_presets.Length != 0) { PanelWidgets.BeginCard(L.T("预置配色", "Presets")); PanelColorPreset[] presets = _presets; foreach (PanelColorPreset panelColorPreset in presets) { if (PanelWidgets.BtnWide(L.T(panelColorPreset.Name, panelColorPreset.NameEn))) { ApplyPreset(panelColorPreset); } } PanelWidgets.EndCard(); } PanelWidgets.BeginCard(L.T("操作", "Actions")); PanelColorItem[] items; if (PanelWidgets.BtnWide(L.T("恢复默认配色", "Reset to defaults"))) { items = _items; foreach (PanelColorItem panelColorItem in items) { panelColorItem.Write(panelColorItem.Fallback); } PanelTheme.DeriveTokens(); } _showContrast = PanelWidgets.ToggleRow(_showContrast, L.T("显示对比度检查", "Show contrast check")); PanelWidgets.EndCard(); if (_showContrast && _contrast.Length != 0) { PanelWidgets.BeginCard(L.T("对比度检查(WCAG AA)", "Contrast check (WCAG AA)")); PanelContrastPair[] contrast = _contrast; foreach (PanelContrastPair panelContrastPair in contrast) { float num = PanelTheme.Contrast(panelContrastPair.Fore(), panelContrastPair.Back()); Color color = ((num >= panelContrastPair.Recommend) ? PanelTheme.TxtOk : PanelTheme.TxtBad); PanelWidgets.KVColored(L.T(panelContrastPair.Name, panelContrastPair.NameEn), num.ToString("0.00") + " : 1 (≥ " + panelContrastPair.Recommend + ")", color, 140f); } PanelWidgets.EndCard(); } PanelWidgets.BeginCard(L.T("自定义配色", "Custom colors")); items = _items; foreach (PanelColorItem item in items) { DrawColorRow(item); } PanelWidgets.EndCard(); if (!string.IsNullOrEmpty(_pickerTarget)) { DrawHsvPicker(); } } private void DrawColorRow(PanelColorItem item) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) string text = item.Read(); Color color; bool flag = PanelTheme.TryParse(text, out color); PanelWidgets.BeginCard(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(L.T(item.Name, item.NameEn), PanelTheme.Sub, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); GUILayout.Label(text, PanelTheme.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); Rect rect = GUILayoutUtility.GetRect(24f, 18f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) }); if (flag) { PanelTheme.FillRect(rect, color); GUI.Box(rect, GUIContent.none, PanelTheme.Border); } else { PanelTheme.FillRect(rect, PanelTheme.TxtBad); } if (GUILayout.Button(L.T("编辑", "Edit"), PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(46f), GUILayout.Height(18f) })) { OpenPicker(item, text); } if (GUILayout.Button(L.T("重置", "Reset"), PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(46f), GUILayout.Height(18f) })) { item.Write(item.Fallback); PanelTheme.DeriveTokens(); } GUILayout.EndHorizontal(); if (!string.IsNullOrEmpty(item.Note)) { PanelWidgets.Hint(L.T(item.Note, item.NoteEn)); } PanelWidgets.EndCard(); } private void OpenPicker(PanelColorItem item, string currentHex) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) _pickerTarget = item.Name; if (PanelTheme.TryParse(currentHex, out var color)) { Color.RGBToHSV(color, ref _pickerH, ref _pickerS, ref _pickerV); } else { _pickerH = (_pickerS = (_pickerV = 0f)); } GUIUtility.keyboardControl = 0; } private void DrawHsvPicker() { //IL_0108: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) PanelColorItem panelColorItem = Array.Find(_items, (PanelColorItem i) => i.Name == _pickerTarget); if (panelColorItem == null) { _pickerTarget = null; return; } PanelWidgets.BeginCard(L.T("拾色器", "Color Picker")); PanelWidgets.Hint(L.T("拖动滑条调整色相、饱和度、明度;点击空白处关闭。", "Drag sliders to adjust H/S/V; click outside to close.")); _pickerH = PanelWidgets.SliderRow(L.T("色相", "Hue"), _pickerH, 0f, 1f, "0.00", 80f, 50f); _pickerS = PanelWidgets.SliderRow(L.T("饱和度", "Saturation"), _pickerS, 0f, 1f, "0.00", 80f, 50f); _pickerV = PanelWidgets.SliderRow(L.T("明度", "Value"), _pickerV, 0f, 1f, "0.00", 80f, 50f); Color val = Color.HSVToRGB(_pickerH, _pickerS, _pickerV); Rect rect = GUILayoutUtility.GetRect(60f, 40f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); PanelTheme.FillRect(rect, val); GUI.Box(rect, GUIContent.none, PanelTheme.Border); GUILayout.Label(PanelTheme.ToHex(val), PanelTheme.Value, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (PanelWidgets.BtnWide(L.T("确定", "Apply"), PanelTheme.ButtonPrimary)) { panelColorItem.Write(PanelTheme.ToHex(val)); PanelTheme.DeriveTokens(); _pickerTarget = null; } if (PanelWidgets.BtnWide(L.T("取消", "Cancel"))) { _pickerTarget = null; } GUILayout.EndHorizontal(); PanelWidgets.EndCard(); Event current = Event.current; if (current != null && (int)current.type == 0) { ((Rect)(ref rect)).Contains(current.mousePosition); } } private void ApplyPreset(PanelColorPreset preset) { int val = _items.Length; string[] hex = preset.Hex; int num = Math.Min(val, (hex != null) ? hex.Length : 0); for (int i = 0; i < num; i++) { _items[i].Write(preset.Hex[i]); } PanelTheme.DeriveTokens(); } } 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown 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; GUIStyle val2 = val; GUILayout.Label(value, val2, 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), min, max); } GUILayout.Label(Fmt(value, format), PanelTheme.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(valueWidth) }); if (GUILayout.Button("+", PanelTheme.Mini, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(18f) })) { value = Mathf.Clamp(Mathf.Round(value + step), min, max); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); return value; } public static int ChipRow(string[] labels, int selected, float width = 62f) { int result = -1; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int i = 0; i < labels.Length; i++) { bool flag = selected == i; if (GUILayout.Button(labels[i], flag ? PanelTheme.ChipOn : PanelTheme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(20f) })) { result = i; } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); return result; } public static string Fmt(float value, string format) { return value.ToString(format, CultureInfo.InvariantCulture); } } internal static class StandardPalette { private static PanelColorItem[] _items; private static PanelColorPreset[] _presets; private static PanelContrastPair[] _contrast; public static bool Initialized => _items != null; public static void Initialize(ModConfigBase config) { _items = new PanelColorItem[15] { Item("窗口背景色", "Window background", config.ColorWindowBg, config.DefWindowBg, "控制面板窗口的底色。", "Background of the panel window."), Item("标题栏背景色", "Title bar", config.ColorTitleBar, config.DefTitleBar, "面板顶部标题栏的底色。", "Background of the title bar."), Item("导航栏背景色", "Nav bar", config.ColorNavBg, config.DefNavBg, "左侧页签栏的底色。", "Background of the tab column."), Item("卡片背景色", "Card", config.ColorCardBg, config.DefCardBg, "内容卡片的底色,正文与小字都显示在它上面。", "Background of the content cards."), Item("卡片描边色", "Card edge", config.ColorCardEdge, config.DefCardEdge, "卡片描边与分隔线。", "Card outlines and dividers."), Item("按钮背景色", "Button", config.ColorButtonBg, config.DefButtonBg, "普通按钮底色,悬停与按下时会自动变亮。", "Normal button colour; hover/press are derived."), Item("输入框背景色", "Field", config.ColorFieldBg, config.DefFieldBg, "输入框与滑条轨道的底色。", "Text fields and slider tracks."), Item("强调色", "Accent", config.ColorAccent, config.DefAccent, "关键功能色:数值、选中项、页签高亮、滑条滑块与主按钮都用它。", "Key colour: values, selection, active tab, sliders and primary buttons."), Item("主文字色", "Main text", config.ColorTextMain, config.DefTextMain, "标题、卡片标题、按钮上的文字。", "Titles, card headings and button captions."), Item("正文文字色", "Body text", config.ColorTextSub, config.DefTextSub, "说明文字与表单标签。", "Descriptions and form labels."), Item("小字文字色", "Hint text", config.ColorTextHint, config.DefTextHint, "脚注、提示、尺寸数值等小号文字。嫌看不清就把它调亮。", "Footnotes, tips and small values. Brighten it if it is hard to read."), Item("正常状态色", "OK", config.ColorOk, config.DefOk, "「显示中」「已开启」等正常状态。", "Normal states such as showing / on."), Item("警告状态色", "Warning", config.ColorWarn, config.DefWarn, "「未在局内」等需要注意的状态。", "States that need attention."), Item("错误状态色", "Error", config.ColorBad, config.DefBad, "异常与危险操作的文字。", "Errors and destructive actions."), Item("小窗描边色", "Window border", config.ColorVideoBorder, config.DefVideoBorder, "屏幕上小窗四周的描边,同时也是小窗标签的底色。", "Outline around each window, also the label background.") }; _presets = new PanelColorPreset[2] { new PanelColorPreset { Name = "高对比", NameEn = "High contrast", Hex = new string[15] { "#000000", "#14161B", "#0E1013", "#0B0B0D", "#7A828F", "#1C1F26", "#000000", "#FFD24A", "#FFFFFF", "#F0F3F8", "#D6DCE7", "#7FE8A8", "#FFB86B", "#FF8A8A", "#000000" } }, new PanelColorPreset { Name = "柔和暗色", NameEn = "Soft dark", Hex = new string[15] { "#101218", "#191E29", "#141821", "#181C26", "#333A48", "#222836", "#0C0E13", "#E8B95A", "#DDE2EA", "#B0B8C6", "#8E97A6", "#7CC79B", "#DFA063", "#D98282", "#0A0C11" } } }; _contrast = new PanelContrastPair[5] { Pair("小字 / 卡片", "Hint / card", () => PanelTheme.TxtWeak, () => PanelTheme.ColCard, 7f), Pair("正文 / 卡片", "Body / card", () => PanelTheme.TxtSub, () => PanelTheme.ColCard, 4.5f), Pair("主文字 / 卡片", "Main / card", () => PanelTheme.TxtMain, () => PanelTheme.ColCard, 7f), Pair("小字 / 窗口", "Hint / window", () => PanelTheme.TxtWeak, () => PanelTheme.ColWindow, 7f), Pair("强调色 / 卡片", "Accent / card", () => PanelTheme.TxtAccent, () => PanelTheme.ColCard, 4.5f) }; } public static PanelColorItem[] Items() { return _items ?? new PanelColorItem[0]; } public static PanelColorPreset[] Presets() { return _presets ?? new PanelColorPreset[0]; } public static PanelContrastPair[] Contrast() { return _contrast ?? new PanelContrastPair[0]; } public static bool Sync() { if (_items == null) { return false; } if ((0u | (Set(ref PanelTheme.ColWindow, 0, 0.97f) ? 1u : 0u) | (Set(ref PanelTheme.ColTitleBar, 1, 1f) ? 1u : 0u) | (Set(ref PanelTheme.ColNavBg, 2, 0.9f) ? 1u : 0u) | (Set(ref PanelTheme.ColCard, 3, 0.92f) ? 1u : 0u) | (Set(ref PanelTheme.ColCardEdge, 4, 1f) ? 1u : 0u) | (Set(ref PanelTheme.ColBtn, 5, 1f) ? 1u : 0u) | (Set(ref PanelTheme.ColPrimary, 7, 1f) ? 1u : 0u) | (Set(ref PanelTheme.TxtMain, 8, 1f) ? 1u : 0u) | (Set(ref PanelTheme.TxtSub, 9, 1f) ? 1u : 0u) | (Set(ref PanelTheme.TxtWeak, 10, 1f) ? 1u : 0u) | (Set(ref PanelTheme.TxtAccent, 7, 1f) ? 1u : 0u) | (Set(ref PanelTheme.TxtOk, 11, 1f) ? 1u : 0u) | (Set(ref PanelTheme.TxtWarn, 12, 1f) ? 1u : 0u) | (Set(ref PanelTheme.TxtBad, 13, 1f) ? 1u : 0u) | (Set(ref PanelTheme.ColVideoBorder, 14, 1f) ? 1u : 0u)) == 0) { return false; } PanelTheme.DeriveTokens(); return true; } private static bool Set(ref Color field, int index, float alpha) { if (index < 0 || index >= _items.Length) { return false; } string hex = _items[index].Read(); return PanelTheme.SetColor(ref field, hex, alpha); } private static PanelColorItem Item(string name, string nameEn, ConfigEntry<string> entry, string fallback, string note, string noteEn) { return new PanelColorItem { Name = name, NameEn = nameEn, Note = note, NoteEn = noteEn, Fallback = fallback, Read = () => (entry == null) ? fallback : entry.Value, Write = delegate(string hex) { if (entry != null) { entry.Value = hex; } } }; } private static PanelContrastPair Pair(string name, string nameEn, Func<Color> fore, Func<Color> back, float recommend) { return new PanelContrastPair { Name = name, NameEn = nameEn, Fore = fore, Back = back, Recommend = recommend }; } } internal sealed class WindowLayoutStore { private const float GripSize = 16f; private const float MinWidth = 120f; private const float MinHeight = 68f; private readonly Dictionary<int, Rect> _rects = new Dictionary<int, Rect>(); private int _activeId = -1; private bool _dragging; private bool _resizing; private Vector2 _startMouse; private Rect _startRect; public bool IsBusy