Add independent review reports for Minimap system (Rounds 8, 9, and 26)

- Round 8 report highlights improvements in architecture, editor usability, and data robustness, with a total score of 80/100.
- Round 9 report focuses on editor extension capabilities, identifying issues with room data indexing and layout editing, resulting in a score of 76/100.
- Round 26 report evaluates the system against commercial standards, noting new issues and confirming previous fixes, with a score of 95.8/100.
This commit is contained in:
2026-05-25 23:15:12 +08:00
parent e2bc324905
commit f74d7f1877
53 changed files with 6825 additions and 270 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
@@ -20,6 +21,7 @@ namespace BaseGames.World.Map
[SerializeField] private Image _icon;
[SerializeField] private RawImage _outlineImage; // 可选:房间非矩形轮廓纹理
[SerializeField] private Image _highlight; // 可选:当前房间高亮描边(玩家所在时激活)
[SerializeField] private Image _fogOverlay; // 可选未知房间雾效覆盖层R12-FD
// 实例颜色(默认值与原硬编码保持一致);可通过 SetColors 统一覆盖
private Color _colExplored = Color.white;
@@ -37,25 +39,17 @@ namespace BaseGames.World.Map
private void Awake() => RT = GetComponent<RectTransform>();
/// <summary>
/// 初始化格子(位置、可见性、图标、Tooltip 回调)。
/// 初始化格子可见性、图标、Tooltip 回调)。
/// <para>R11-N8不再在 Setup 中设置位置/尺寸,调用方按需调用
/// <see cref="SetGridLayout"/> 或直接操作 <see cref="RT"/>。</para>
/// </summary>
/// <param name="pixelsPerCell">
/// 每格像素数,默认 <see cref="MapGridConstants.FullMapCellPixels"/>32f
/// MinimapHUD 调用后会立即通过 <c>PlaceCell</c> 按自身比例覆盖位置/尺寸。
/// </param>
public void Setup(MapRoomDataSO room, RoomVisibility visibility, Sprite icon,
Action<string> onHover = null, Action onHoverExit = null,
float pixelsPerCell = MapGridConstants.FullMapCellPixels)
Action<string> onHover = null, Action onHoverExit = null)
{
_displayName = room.DisplayName;
_onHover = onHover;
_onHoverExit = onHoverExit;
RT.anchoredPosition = new Vector2(room.GridPosition.x * pixelsPerCell,
room.GridPosition.y * pixelsPerCell);
RT.sizeDelta = new Vector2(room.GridSize.x * pixelsPerCell,
room.GridSize.y * pixelsPerCell);
// 房间轮廓纹理(非矩形形状,覆盖在矩形背景上方)
if (_outlineImage != null)
{
@@ -72,6 +66,19 @@ namespace BaseGames.World.Map
}
}
/// <summary>
/// R11-N8 独立布局接口:根据房间格子坐标与单格像素数设定位置和尺寸。
/// <para>MapPanel.BuildGrid 与 MinimapHUD.PlaceCell 均通过此接口定位,
/// 两者互不干扰,消除 Setup 中的重复赋值。</para>
/// </summary>
public void SetGridLayout(MapRoomDataSO room, float pixelsPerCell)
{
RT.anchoredPosition = new Vector2(room.GridPosition.x * pixelsPerCell,
room.GridPosition.y * pixelsPerCell);
RT.sizeDelta = new Vector2(room.GridSize.x * pixelsPerCell,
room.GridSize.y * pixelsPerCell);
}
/// <summary>覆盖此格子的三级可见性颜色(通常由 MapPanel / MinimapHUD 在创建后统一调用)。</summary>
public void SetColors(Color explored, Color mapped, Color unknown)
{
@@ -91,6 +98,9 @@ namespace BaseGames.World.Map
RoomVisibility.Mapped => _colMapped,
_ => _colUnknown,
};
// R12-FD 雾效覆盖层:仅在完全未知时显示
if (_fogOverlay != null)
_fogOverlay.enabled = v == RoomVisibility.Unknown;
}
/// <summary>向后兼容:直接传 bool 时等同于 Explored / Unknown。</summary>
@@ -103,6 +113,25 @@ namespace BaseGames.World.Map
if (_highlight != null) _highlight.enabled = v;
}
/// <summary>
/// 新发现房间时播放闪白淡出动画R12-FC
/// 由 MapPanel.OnRoomMappedAnim 调用;协程安全:组件被销毁后 Unity 自动终止。
/// </summary>
public IEnumerator PlayRevealAnim(Color flashColor, float duration)
{
if (_bg == null) yield break;
var original = _bg.color;
_bg.color = flashColor;
float elapsed = 0f;
while (elapsed < duration)
{
_bg.color = Color.Lerp(flashColor, original, elapsed / duration);
elapsed += Time.unscaledDeltaTime;
yield return null;
}
_bg.color = original;
}
public void OnPointerEnter(PointerEventData _)
{
if (!string.IsNullOrEmpty(_displayName)) _onHover?.Invoke(_displayName);