From 99e493412bf500d4051d23c684551987640f392d Mon Sep 17 00:00:00 2001 From: zhang hongbo Date: Thu, 16 Apr 2026 15:21:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E6=97=B6=E4=BA=8B=E4=BB=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Art_Bytes/ArtResourceConfig.bytes | Bin 758227 -> 758438 bytes Art_Json/LimitedEvent.meta | 8 ++ Art_Json/LimitedEvent/LimitedEventIcon.json | 14 ++ .../LimitedEvent/LimitedEventIcon.json.meta | 7 + Art_Json/art_table_manifest.json | 1 + Art_SO/LimitedEvent.meta | 8 ++ Art_SO/LimitedEvent/LimitedEventIcon.asset | 25 ++++ .../LimitedEvent/LimitedEventIcon.asset.meta | 8 ++ Editor/Art_Tools/ArtResourceConfigEditor.cs | 129 +++++++++++++++++- 9 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 Art_Json/LimitedEvent.meta create mode 100644 Art_Json/LimitedEvent/LimitedEventIcon.json create mode 100644 Art_Json/LimitedEvent/LimitedEventIcon.json.meta create mode 100644 Art_SO/LimitedEvent.meta create mode 100644 Art_SO/LimitedEvent/LimitedEventIcon.asset create mode 100644 Art_SO/LimitedEvent/LimitedEventIcon.asset.meta diff --git a/Art_Bytes/ArtResourceConfig.bytes b/Art_Bytes/ArtResourceConfig.bytes index c786d6bfb4f9a8d5c020af89323d760fef189679..4166aca782c1aec1af73a2df17720858ae09122f 100644 GIT binary patch delta 219 zcmcb-SZ~=Lw6OfXGsw&CMO^q+eOpf<; zit>)n1S+4N_?F4e7}*egr_#)vl+3(zx74!KB7Iysr*FK#EWN!*hub+-?m?I`HvGHy4=pGa`(;db2G32bqO087@6rBnCKdsDj1qrnVMS}n=$|ZgYFXb diff --git a/Art_Json/LimitedEvent.meta b/Art_Json/LimitedEvent.meta new file mode 100644 index 00000000..8a61e285 --- /dev/null +++ b/Art_Json/LimitedEvent.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fedbb597aba616b4d88aa86737be5cb2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Json/LimitedEvent/LimitedEventIcon.json b/Art_Json/LimitedEvent/LimitedEventIcon.json new file mode 100644 index 00000000..8e3d0a4a --- /dev/null +++ b/Art_Json/LimitedEvent/LimitedEventIcon.json @@ -0,0 +1,14 @@ +{ + "TableId": 75, + "TableName": "LimitedEventIcon", + "Items": [ + { + "Id": 1, + "Name": "Limitedtime_pic_MBZK_icon", + "Desc": "", + "SpritePath": "Assets/Art_SubModule/Art_Resource/Art_UISprites/LimitedEvent/BuildingFever/Limitedtime_pic_MBZK_icon.png", + "SpineAssetPath": "", + "SpineAnimName": "" + } + ] +} \ No newline at end of file diff --git a/Art_Json/LimitedEvent/LimitedEventIcon.json.meta b/Art_Json/LimitedEvent/LimitedEventIcon.json.meta new file mode 100644 index 00000000..37fea4cf --- /dev/null +++ b/Art_Json/LimitedEvent/LimitedEventIcon.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a45b7870bad18cd4fb1482e822220324 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_Json/art_table_manifest.json b/Art_Json/art_table_manifest.json index 48274d40..bf77a624 100644 --- a/Art_Json/art_table_manifest.json +++ b/Art_Json/art_table_manifest.json @@ -67,6 +67,7 @@ "Assets/Art_SubModule/Art_Json/DecorateScene/Scene7Resource.json", "Assets/Art_SubModule/Art_Json/DecorateScene/Scene8Resource.json", "Assets/Art_SubModule/Art_Json/DecorateScene/Scene9Resource.json", + "Assets/Art_SubModule/Art_Json/LimitedEvent/LimitedEventIcon.json", "Assets/Art_SubModule/Art_Json/Scene/LauncherMergeStoryPic.json", "Assets/Art_SubModule/Art_Json/Scene/SceneDataPic.json", "Assets/Art_SubModule/Art_Json/Scene/SceneExpression.json", diff --git a/Art_SO/LimitedEvent.meta b/Art_SO/LimitedEvent.meta new file mode 100644 index 00000000..5427fb0a --- /dev/null +++ b/Art_SO/LimitedEvent.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 044a93c02bee8b74fb36bf5c048745e3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Art_SO/LimitedEvent/LimitedEventIcon.asset b/Art_SO/LimitedEvent/LimitedEventIcon.asset new file mode 100644 index 00000000..bdd9d11a --- /dev/null +++ b/Art_SO/LimitedEvent/LimitedEventIcon.asset @@ -0,0 +1,25 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c3a207709ab52e44890f2994488620cc, type: 3} + m_Name: LimitedEventIcon + m_EditorClassIdentifier: + TableId: 75 + TableName: LimitedEventIcon + Items: + - Id: 1 + Name: Limitedtime_pic_MBZK_icon + Desc: + Sprite: {fileID: 21300000, guid: 0c6ea03e6c405964aa305d7846cb1c3f, type: 3} + SpritePath: Assets/Art_SubModule/Art_Resource/Art_UISprites/LimitedEvent/BuildingFever/Limitedtime_pic_MBZK_icon.png + SpineAsset: {fileID: 0} + SpineAssetPath: + SpineAnimName: diff --git a/Art_SO/LimitedEvent/LimitedEventIcon.asset.meta b/Art_SO/LimitedEvent/LimitedEventIcon.asset.meta new file mode 100644 index 00000000..850ac0a0 --- /dev/null +++ b/Art_SO/LimitedEvent/LimitedEventIcon.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a13168dcae760c54889d34579ab03060 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Art_Tools/ArtResourceConfigEditor.cs b/Editor/Art_Tools/ArtResourceConfigEditor.cs index fbfcd8a3..7aab4b4f 100644 --- a/Editor/Art_Tools/ArtResourceConfigEditor.cs +++ b/Editor/Art_Tools/ArtResourceConfigEditor.cs @@ -1,8 +1,11 @@ using UnityEngine; using UnityEditor; +using System; using System.Collections.Generic; using System.Linq; using System.IO; +using System.Runtime.InteropServices; +using System.Text; using ArtResource; using Spine.Unity; using UnityEngine.U2D; @@ -2519,16 +2522,138 @@ namespace EditorArt_Tools private ArtResourceConfigEditor parentEditor; private List draggedObjects = new List(); private Vector2 scrollPos; + private static readonly Vector2 DefaultWindowSize = new Vector2(400, 500); + +#if UNITY_EDITOR_WIN + private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1); + private const uint SWP_NOSIZE = 0x0001; + private const uint SWP_NOMOVE = 0x0002; + private const uint SWP_NOACTIVATE = 0x0010; + private const uint SWP_SHOWWINDOW = 0x0040; +#endif public static void Show(ArtResourceConfigEditor editor) { - var window = GetWindow("批量导入图片"); + BatchImportByDragWindow[] existingWindows = Resources.FindObjectsOfTypeAll(); + foreach (BatchImportByDragWindow existingWindow in existingWindows) + { + existingWindow.Close(); + } + + var window = CreateInstance(); + window.titleContent = new GUIContent("批量导入图片"); window.parentEditor = editor; window.draggedObjects.Clear(); - window.minSize = new Vector2(400, 500); + window.minSize = DefaultWindowSize; + window.position = GetCenteredRect(editor != null ? editor.position : new Rect(200, 200, DefaultWindowSize.x, DefaultWindowSize.y), DefaultWindowSize); window.ShowUtility(); + window.Focus(); + window.ScheduleTopMostPin(); } + private static Rect GetCenteredRect(Rect ownerRect, Vector2 windowSize) + { + float x = ownerRect.x + (ownerRect.width - windowSize.x) * 0.5f; + float y = ownerRect.y + (ownerRect.height - windowSize.y) * 0.5f; + return new Rect(x, y, windowSize.x, windowSize.y); + } + + private void OnEnable() + { + ScheduleTopMostPin(); + } + + private void OnDisable() + { +#if UNITY_EDITOR_WIN + EditorApplication.delayCall -= FocusAndQueueTopMost; + EditorApplication.delayCall -= ApplyTopMostToFocusedWindow; +#endif + } + + private void OnFocus() + { + ScheduleTopMostPin(); + } + + private void ScheduleTopMostPin() + { +#if UNITY_EDITOR_WIN + EditorApplication.delayCall -= FocusAndQueueTopMost; + EditorApplication.delayCall -= ApplyTopMostToFocusedWindow; + EditorApplication.delayCall += FocusAndQueueTopMost; +#endif + } + +#if UNITY_EDITOR_WIN + private void FocusAndQueueTopMost() + { + EditorApplication.delayCall -= FocusAndQueueTopMost; + if (this == null) + { + return; + } + + Focus(); + EditorApplication.delayCall -= ApplyTopMostToFocusedWindow; + EditorApplication.delayCall += ApplyTopMostToFocusedWindow; + } + + private void ApplyTopMostToFocusedWindow() + { + EditorApplication.delayCall -= ApplyTopMostToFocusedWindow; + if (this == null) + { + return; + } + + IntPtr windowHandle = GetForegroundWindow(); + if (windowHandle == IntPtr.Zero) + { + return; + } + + string expectedTitle = titleContent != null ? titleContent.text : string.Empty; + string currentTitle = GetNativeWindowTitle(windowHandle); + if (!string.IsNullOrEmpty(expectedTitle) && !currentTitle.Contains(expectedTitle)) + { + return; + } + + SetWindowPos( + windowHandle, + HWND_TOPMOST, + 0, + 0, + 0, + 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); + } + + private static string GetNativeWindowTitle(IntPtr windowHandle) + { + StringBuilder builder = new StringBuilder(256); + GetWindowText(windowHandle, builder, builder.Capacity); + return builder.ToString(); + } + + [DllImport("user32.dll")] + private static extern IntPtr GetForegroundWindow(); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + private static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count); + + [DllImport("user32.dll", SetLastError = true)] + private static extern bool SetWindowPos( + IntPtr hWnd, + IntPtr hWndInsertAfter, + int x, + int y, + int cx, + int cy, + uint uFlags); +#endif + private void OnGUI() { EditorGUILayout.LabelField("批量导入图片", EditorStyles.boldLabel);