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:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using BaseGames.Core;
|
||||
@@ -31,14 +32,18 @@ namespace BaseGames.World.Map
|
||||
private CanvasGroup _cg;
|
||||
private Coroutine _showCoroutine;
|
||||
private readonly CompositeDisposable _subs = new();
|
||||
private Dictionary<string, RegionNameEntry> _regionDict;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_cg = GetComponent<CanvasGroup>();
|
||||
_cg.alpha = 0f;
|
||||
gameObject.SetActive(false);
|
||||
BuildRegionDict();
|
||||
}
|
||||
|
||||
private void OnValidate() => BuildRegionDict();
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_onRegionChanged?.Subscribe(OnRegionChanged).AddTo(_subs);
|
||||
@@ -47,6 +52,14 @@ namespace BaseGames.World.Map
|
||||
private void OnDisable()
|
||||
{
|
||||
_subs.Clear();
|
||||
// 协程持有 this 引用且 SetActive(false) 不会自动停止——必须在 OnDisable 显式终止,
|
||||
// 否则禁用后重新启用时旧序列与新序列叠加,CanvasGroup.alpha 与 SetActive 状态不一致。
|
||||
if (_showCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_showCoroutine);
|
||||
_showCoroutine = null;
|
||||
}
|
||||
if (_cg != null) _cg.alpha = 0f;
|
||||
}
|
||||
|
||||
// ── 事件响应 ──────────────────────────────────────────────────────────
|
||||
@@ -87,14 +100,12 @@ namespace BaseGames.World.Map
|
||||
|
||||
// ── 辅助方法 ──────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>预建 RegionId → Entry 字典,将 ResolveDisplayName 从 O(N) 降至 O(1)。</summary>
|
||||
private void BuildRegionDict()
|
||||
=> _regionDict = MapServiceExtensions.BuildRegionDict(_regionNames);
|
||||
|
||||
private string ResolveDisplayName(string regionId)
|
||||
{
|
||||
if (_regionNames != null)
|
||||
foreach (var e in _regionNames)
|
||||
if (e.RegionId == regionId)
|
||||
return e.GetDisplayName();
|
||||
return regionId;
|
||||
}
|
||||
=> MapServiceExtensions.ResolveRegionDisplayName(_regionDict, regionId);
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
Reference in New Issue
Block a user