From f158b8947412ad473653bd959d6127b769f0032a Mon Sep 17 00:00:00 2001 From: hevinci Date: Sun, 3 Apr 2022 11:29:24 +0800 Subject: [PATCH] Update Editor tools --- Assets/YooAsset/Editor/EditorExtension.cs | 12 +++++++ .../YooAsset/Editor/EditorExtension.cs.meta | 11 +++++++ Assets/YooAsset/Editor/EditorTools.cs | 32 +++++++++---------- 3 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 Assets/YooAsset/Editor/EditorExtension.cs create mode 100644 Assets/YooAsset/Editor/EditorExtension.cs.meta diff --git a/Assets/YooAsset/Editor/EditorExtension.cs b/Assets/YooAsset/Editor/EditorExtension.cs new file mode 100644 index 0000000..e6de8f0 --- /dev/null +++ b/Assets/YooAsset/Editor/EditorExtension.cs @@ -0,0 +1,12 @@ +#if UNITY_2019_4 +namespace YooAsset.Editor +{ + public static partial class UnityEngine_UIElements_ListView_Extension + { + public static void ClearSelection(this UnityEngine.UIElements.ListView o) + { + o.selectedIndex = -1; + } + } +} +#endif \ No newline at end of file diff --git a/Assets/YooAsset/Editor/EditorExtension.cs.meta b/Assets/YooAsset/Editor/EditorExtension.cs.meta new file mode 100644 index 0000000..218f894 --- /dev/null +++ b/Assets/YooAsset/Editor/EditorExtension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8e4a86c3bd8c8947a947776891e14b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/YooAsset/Editor/EditorTools.cs b/Assets/YooAsset/Editor/EditorTools.cs index b0d722e..9e9eb6c 100644 --- a/Assets/YooAsset/Editor/EditorTools.cs +++ b/Assets/YooAsset/Editor/EditorTools.cs @@ -15,7 +15,7 @@ namespace YooAsset.Editor /// public static class EditorTools { - #region Assembly +#region Assembly /// /// 调用私有的静态方法 /// @@ -49,9 +49,9 @@ namespace YooAsset.Editor } return methodInfo.Invoke(null, parameters); } - #endregion +#endregion - #region EditorUtility +#region EditorUtility /// /// 搜集资源 /// @@ -156,9 +156,9 @@ namespace YooAsset.Editor { EditorUtility.ClearProgressBar(); } - #endregion +#endregion - #region EditorWindow +#region EditorWindow public static void FocusUnitySceneWindow() { EditorWindow.FocusWindowIfItsOpen(); @@ -188,9 +188,9 @@ namespace YooAsset.Editor System.Type T = Assembly.Load("UnityEditor").GetType("UnityEditor.ConsoleWindow"); EditorWindow.GetWindow(T, false, "Console", true); } - #endregion +#endregion - #region 控制台 +#region 控制台 private static MethodInfo _clearConsoleMethod; private static MethodInfo ClearConsoleMethod { @@ -213,9 +213,9 @@ namespace YooAsset.Editor { ClearConsoleMethod.Invoke(new object(), null); } - #endregion +#endregion - #region 文件 +#region 文件 /// /// 创建文件所在的目录 /// @@ -409,9 +409,9 @@ namespace YooAsset.Editor else return Encoding.UTF8.GetString(bytes.ToArray()); } - #endregion +#endregion - #region 路径 +#region 路径 private static string YooAssetPath; /// @@ -504,9 +504,9 @@ namespace YooAsset.Editor } return string.Empty; } - #endregion +#endregion - #region 字符串 +#region 字符串 /// /// 是否含有中文 /// @@ -567,9 +567,9 @@ namespace YooAsset.Editor else return content.Substring(startIndex + key.Length); } - #endregion +#endregion - #region 玩家偏好 +#region 玩家偏好 // 枚举 public static void PlayerSetEnum(string key, T value) { @@ -581,6 +581,6 @@ namespace YooAsset.Editor string enumName = EditorPrefs.GetString(key, defaultValue.ToString()); return StringUtility.NameToEnum(enumName); } - #endregion +#endregion } } \ No newline at end of file