Add independent review report for Minimap system Round 7

- Validate fixes from Round 6 and identify new issues
- Document findings including UX defects, editor integration flaws, and code quality concerns
- Propose solutions and prioritize issues based on severity
- Evaluate against standards of mature 2D Metroidvania games
This commit is contained in:
2026-05-25 14:44:31 +08:00
parent 5cb6c2a19d
commit e2bc324905
17 changed files with 1060 additions and 17 deletions

View File

@@ -29,10 +29,26 @@ namespace BaseGames.Editor.Map
/// </summary>
private readonly HashSet<string> _cachedErrorRoomIds = new();
/// <summary>错误行文本颜色样式,惰性初始化后复用,避免 OnInspectorGUI 每帧分配。</summary>
private GUIStyle _errorRowStyle;
private static readonly GUIContent LabelValidate = new GUIContent("重新验证", "检查重复 RoomId、出口目标缺失、房间网格重叠等问题");
private static readonly GUIContent LabelOpenEditor = new GUIContent("打开布局编辑器", "在独立窗口中预览全局地图布局");
private void OnEnable() => _database = (MapDatabaseSO)target;
private void OnEnable()
{
_database = (MapDatabaseSO)target;
_errorRowStyle = null; // 编辑器皮肤切换时(亮/暗模式)需重建
}
/// <summary>错误行 GUIStyle 惰性初始化,基于当前编辑器皮肤构建,避免 OnInspectorGUI 每帧分配。</summary>
private GUIStyle GetErrorRowStyle()
{
if (_errorRowStyle == null)
_errorRowStyle = new GUIStyle(EditorStyles.label)
{ normal = { textColor = new Color(1f, 0.35f, 0.35f) } };
return _errorRowStyle;
}
public override void OnInspectorGUI()
{
@@ -122,9 +138,7 @@ namespace BaseGames.Editor.Map
}
bool hasError = _cachedErrorRoomIds.Contains(room.RoomId);
var rowStyle = hasError
? new GUIStyle(EditorStyles.label) { normal = { textColor = new Color(1f, 0.35f, 0.35f) } }
: EditorStyles.label;
var rowStyle = hasError ? GetErrorRowStyle() : EditorStyles.label;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e42e54d73570d0245b6bb4e722c3b0f8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -59,6 +59,25 @@ namespace BaseGames.Editor.Map
// ── 主 GUI ────────────────────────────────────────────────────────────
private void OnEnable()
{
// 注册 Undo 回调SceneView 中拖拽房间后执行 Ctrl+Z窗口自动刷新
Undo.undoRedoPerformed += OnUndoRedo;
}
private void OnDisable()
{
Undo.undoRedoPerformed -= OnUndoRedo;
}
/// <summary>Undo/Redo 发生后清除验证缓存并触发重绘,确保布局视图与数据同步。</summary>
private void OnUndoRedo()
{
_validationErrors = null;
_errorRoomIds = null;
Repaint();
}
private void OnGUI()
{
DrawToolbar();

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5c889260fa9407545a7db0a014e1e176
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -39,7 +39,10 @@ namespace BaseGames.Editor.Map
EditorGUILayout.HelpBox(
"在 Scene View 中可直接拖拽房间角点调整 GridPosition / GridSize。\n" +
"拖动自动吸附到 1 格精度,支持 Undo。",
"拖动自动吸附到 1 格精度,支持 Undo。\n\n" +
"⚠ 坐标系说明Scene View 中 1 格 = 1 世界单位(编辑器可视化坐标)。\n" +
"运行时玩家追踪使用 worldUnitsPerCell默认 18 世界单位/格)。\n" +
"两者仅为独立坐标系互不影响——格子布局数据GridPosition/GridSize是统一的格子单位无需换算。",
MessageType.Info);
if (GUILayout.Button("居中 Scene View 到此房间", GUILayout.Height(28)))