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:
@@ -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(
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e42e54d73570d0245b6bb4e722c3b0f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c889260fa9407545a7db0a014e1e176
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user