限时事件测试工具

This commit is contained in:
zhang hongbo 2026-04-16 15:21:16 +08:00
parent 747949fd95
commit 99e493412b
9 changed files with 198 additions and 2 deletions

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fedbb597aba616b4d88aa86737be5cb2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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": ""
}
]
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a45b7870bad18cd4fb1482e822220324
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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",

8
Art_SO/LimitedEvent.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 044a93c02bee8b74fb36bf5c048745e3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a13168dcae760c54889d34579ab03060
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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<UnityEngine.Object> draggedObjects = new List<UnityEngine.Object>();
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>("批量导入图片");
BatchImportByDragWindow[] existingWindows = Resources.FindObjectsOfTypeAll<BatchImportByDragWindow>();
foreach (BatchImportByDragWindow existingWindow in existingWindows)
{
existingWindow.Close();
}
var window = CreateInstance<BatchImportByDragWindow>();
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);