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:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using BaseGames.Core;
|
||||
using BaseGames.Core.Events;
|
||||
@@ -28,6 +29,7 @@ namespace BaseGames.World.Map
|
||||
private HashSet<string> _exploredRooms = new();
|
||||
private HashSet<string> _mappedRooms = new();
|
||||
private string _currentRegionId;
|
||||
private int _totalRoomCount = -1; // -1 = 未缓存;OnLoad 后重置
|
||||
private readonly CompositeDisposable _subs = new();
|
||||
|
||||
private void Awake()
|
||||
@@ -58,8 +60,9 @@ namespace BaseGames.World.Map
|
||||
|
||||
public void OnLoad(SaveData data)
|
||||
{
|
||||
_exploredRooms = data.Map.ExploredRooms != null ? new HashSet<string>(data.Map.ExploredRooms) : new HashSet<string>();
|
||||
_mappedRooms = data.Map.MappedRooms != null ? new HashSet<string>(data.Map.MappedRooms) : new HashSet<string>();
|
||||
_exploredRooms = data.Map.ExploredRooms != null ? new HashSet<string>(data.Map.ExploredRooms) : new HashSet<string>();
|
||||
_mappedRooms = data.Map.MappedRooms != null ? new HashSet<string>(data.Map.MappedRooms) : new HashSet<string>();
|
||||
_totalRoomCount = -1; // 强制下次调用 GetExplorationProgress 时重新计数
|
||||
}
|
||||
|
||||
// ── 事件驱动房间发现 ──────────────────────────────────────────────────
|
||||
@@ -94,8 +97,23 @@ namespace BaseGames.World.Map
|
||||
public bool IsExplored(string roomId) => _exploredRooms.Contains(roomId);
|
||||
public bool IsMapped(string roomId) => _mappedRooms.Contains(roomId);
|
||||
public string CurrentRegionId => _currentRegionId;
|
||||
public MapDatabaseSO Database => _database;
|
||||
public int ExploredRoomCount => _exploredRooms.Count;
|
||||
|
||||
public MapDatabaseSO Database => _database;
|
||||
public float GetExplorationProgress()
|
||||
{
|
||||
if (_database?.AllRooms == null || _database.AllRooms.Length == 0) return 0f;
|
||||
if (_totalRoomCount < 0)
|
||||
_totalRoomCount = _database.AllRooms.Count(r => r != null);
|
||||
return _totalRoomCount > 0 ? Mathf.Clamp01((float)_exploredRooms.Count / _totalRoomCount) : 0f;
|
||||
}
|
||||
|
||||
public MapRoomDataSO[] GetRoomsByRegion(string regionId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(regionId) || _database?.AllRooms == null)
|
||||
return System.Array.Empty<MapRoomDataSO>();
|
||||
return _database.AllRooms.Where(r => r != null && r.RegionId == regionId).ToArray();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user