Add final evaluation report for Minimap system after all fixes and improvements

- Summarized the evolution of scores across five review rounds
- Detailed the status of each evaluation dimension post-fixes
- Highlighted remaining issues and recommended future work for further enhancements
- Compared current system against industry benchmarks
This commit is contained in:
2026-05-25 14:25:19 +08:00
parent a1f9122153
commit 5cb6c2a19d
64 changed files with 2358 additions and 32937 deletions

View File

@@ -40,6 +40,12 @@ namespace BaseGames.World.Map
"建议在关卡内容基本定型后更新此值。0 = 未填写,将跳过内存预算检查。")]
[Min(0)]
public int EstimatedMemoryKB;
private void OnValidate()
{
// 保证 GridSize 每轴最小为 1防止零尺寸房间导致碰撞和渲染异常
GridSize = new Vector2Int(Mathf.Max(1, GridSize.x), Mathf.Max(1, GridSize.y));
}
}
[Serializable]
@@ -84,5 +90,67 @@ namespace BaseGames.World.Map
}
private void OnDisable() => _index = null; // SO 卸载时清理缓存
private void OnValidate() => _index = null; // 编辑器中修改 AllRooms 后强制重建索引
// ── 配置验证 ──────────────────────────────────────────────────────────
/// <summary>
/// 检查数据库中的常见配置错误RoomId 重复、格子重叠、出口悬空)。
/// 编辑器侧调用;运行时不应调用(有 O(N²) 开销)。
/// 返回错误描述列表;空列表表示无错误。
/// </summary>
public List<string> ValidateAll()
{
var errors = new List<string>();
if (AllRooms == null) return errors;
// ① null / 空 RoomId
for (int i = 0; i < AllRooms.Length; i++)
{
if (AllRooms[i] == null) { errors.Add($"AllRooms[{i}] 为 null"); continue; }
if (string.IsNullOrEmpty(AllRooms[i].RoomId))
errors.Add($"AllRooms[{i}]{AllRooms[i].name}RoomId 为空");
}
// ② RoomId 重复
var seenIds = new Dictionary<string, string>();
foreach (var room in AllRooms)
{
if (room == null || string.IsNullOrEmpty(room.RoomId)) continue;
if (seenIds.TryGetValue(room.RoomId, out var first))
errors.Add($"RoomId '{room.RoomId}' 重复({first} 与 {room.name}");
else
seenIds[room.RoomId] = room.name;
}
// ③ 格子重叠
var cellOwner = new Dictionary<Vector2Int, string>();
foreach (var room in AllRooms)
{
if (room == null) continue;
for (int x = 0; x < room.GridSize.x; x++)
for (int y = 0; y < room.GridSize.y; y++)
{
var cell = new Vector2Int(room.GridPosition.x + x, room.GridPosition.y + y);
if (cellOwner.TryGetValue(cell, out var other))
errors.Add($"'{room.RoomId}' 与 '{other}' 在格子 {cell} 重叠");
else
cellOwner[cell] = room.RoomId;
}
}
// ④ 出口目标不存在(单向验证)
var validIds = new HashSet<string>(seenIds.Keys);
foreach (var room in AllRooms)
{
if (room?.Exits == null) continue;
foreach (var exit in room.Exits)
if (!string.IsNullOrEmpty(exit.TargetRoomId) && !validIds.Contains(exit.TargetRoomId))
errors.Add($"'{room.RoomId}' 出口指向不存在的房间 '{exit.TargetRoomId}'");
}
return errors;
}
}
}