refactor(editor): reorganize Editor directory and unify menu hierarchy
File directory changes (mirror Scripts/ module structure): - AbilityTypeDrawer.cs → Equipment/ - CharacterWizardWindow.cs → Character/ - FormEditorWindow.cs → Player/ - GMToolWindow.cs → Tools/ - SOManagerWindow.cs → Tools/ - Map/MapRoomDataEditor.cs → World/Map/ - Navigation/ (root) → Enemies/Navigation/ - Achievements/ → Progression/ Menu hierarchy changes (BaseGames/ top-level): - Data/: +Character Wizard (from Tools/), +Boss Skill Sequence (from Tools/) - Addressables/: +Addressable Batch Tool, +Asset Reference Graph, +Validate Address Keys (from Tools/Verification/) - Scene/Setup/: +Boot Flow Wizard, +Scaffold *, +Auto-Open Persistent (from Tools/) - Scene/: +Camera Area Setup (from Camera/), +Bake All NavSurfaces (from Tools/) - Events/: +Event Bus Monitor, +Event Chain Viewer, +Create/Reimport Event Channels (from Tools/) - Tools/Validation/: +Validate All SOs, +Apply/Validate Script Order (from Tools/ flat) - Tools/Maintenance/: +Missing Scripts/*, +Physics2D Layer Matrix/* (from Tools/ flat) Result: BaseGames/Tools/ reduced from 16 flat items to 4 items + 2 submenus Docs: update AssetFolderSpec §12 editor tool table with new menu paths Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -39,7 +39,7 @@ namespace BaseGames.Editor
|
||||
private static readonly Color ColDelay = new Color(0.25f, 0.25f, 0.30f, 0.50f);
|
||||
private static readonly Color ColWarn = new Color(0.95f, 0.10f, 0.10f, 0.85f);
|
||||
|
||||
[MenuItem("BaseGames/Tools/Boss Skill Sequence Viewer")]
|
||||
[MenuItem("BaseGames/Data/Boss Skill Sequence", priority = 110)]
|
||||
public static void OpenWindow()
|
||||
{
|
||||
var win = GetWindow<BossSkillSequenceWindow>("Boss Skill Sequence");
|
||||
|
||||
8
Assets/_Game/Scripts/Editor/Enemies/Navigation.meta
Normal file
8
Assets/_Game/Scripts/Editor/Enemies/Navigation.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8e429c47dfa7fe4da6d9687c02398ea
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using PathBerserker2d;
|
||||
|
||||
namespace BaseGames.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 快捷键:BaseGames → Tools → Bake All NavSurfaces(Ctrl+Shift+B)
|
||||
/// 烘焙当前场景中所有 PathBerserker2d NavSurface 的导航网格。
|
||||
/// 等效于在每个 NavSurface Inspector 中逐一点击 "Bake"。
|
||||
/// </summary>
|
||||
public static class NavSurfaceBakeShortcut
|
||||
{
|
||||
// NavSurface.StartBakeJob() 和 NavSurface.BakeJob 均为 internal,通过反射访问。
|
||||
private static readonly MethodInfo s_startBakeJobMethod =
|
||||
typeof(NavSurface).GetMethod("StartBakeJob", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
private static readonly PropertyInfo s_bakeJobProp =
|
||||
typeof(NavSurface).GetProperty("BakeJob", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
[MenuItem("BaseGames/Scene/Bake All NavSurfaces %#b", priority = 100)]
|
||||
public static void BakeAll()
|
||||
{
|
||||
var surfaces = Object.FindObjectsByType<NavSurface>(FindObjectsSortMode.None);
|
||||
if (surfaces.Length == 0)
|
||||
{
|
||||
Debug.Log("[NavSurfaceBake] 当前场景没有找到 NavSurface 组件。");
|
||||
return;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
foreach (var surface in surfaces)
|
||||
{
|
||||
if (surface == null) continue;
|
||||
|
||||
s_startBakeJobMethod?.Invoke(surface, null);
|
||||
EditorApplication.update -= MakeWatcher(surface);
|
||||
EditorApplication.update += MakeWatcher(surface);
|
||||
count++;
|
||||
}
|
||||
|
||||
Debug.Log($"[NavSurfaceBake] 开始烘焙 {count} 个 NavSurface……");
|
||||
}
|
||||
|
||||
[MenuItem("BaseGames/Scene/Bake All NavSurfaces %#b", validate = true)]
|
||||
private static bool BakeAllValidate()
|
||||
{
|
||||
// 仅在非 Play Mode 时可用(NavSurface.Bake 仅支持编辑器模式)
|
||||
return !Application.isPlaying;
|
||||
}
|
||||
|
||||
// ── 每个 NavSurface 独立监听烘焙完成 ──────────────────────────────
|
||||
|
||||
private static EditorApplication.CallbackFunction MakeWatcher(NavSurface surface)
|
||||
{
|
||||
EditorApplication.CallbackFunction watcher = null;
|
||||
watcher = () =>
|
||||
{
|
||||
if (surface == null)
|
||||
{
|
||||
EditorApplication.update -= watcher;
|
||||
return;
|
||||
}
|
||||
|
||||
var bakeJob = s_bakeJobProp?.GetValue(surface);
|
||||
if (bakeJob == null)
|
||||
{
|
||||
EditorApplication.update -= watcher;
|
||||
return;
|
||||
}
|
||||
|
||||
bool isFinished = (bool)bakeJob.GetType()
|
||||
.GetProperty("IsFinished")!.GetValue(bakeJob);
|
||||
if (isFinished)
|
||||
{
|
||||
EditorApplication.update -= watcher;
|
||||
EditorUtility.SetDirty(surface);
|
||||
float totalTime = (float)bakeJob.GetType()
|
||||
.GetProperty("TotalBakeTime")!.GetValue(bakeJob);
|
||||
Debug.Log($"[NavSurfaceBake] ✓ {surface.name} 烘焙完成({totalTime} ms)");
|
||||
}
|
||||
};
|
||||
return watcher;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 291f3b33fb176b8469ebaaa8afa317ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user