This commit is contained in:
2026-06-07 11:49:55 +08:00
parent ff0f3bde54
commit 1897658a00
98 changed files with 9903 additions and 13907 deletions

View File

@@ -18,6 +18,10 @@ namespace BaseGames.UI
[DefaultExecutionOrder(100)]
public class UISelectionRestorer : MonoBehaviour
{
[Tooltip("始终保持选中:选中丢失(如鼠标点击空白处)即立即恢复,无需等待导航键。\n" +
"适合\"菜单始终有一项高亮\"的手感;关闭则仅在按下方向/确认键时恢复(避免抢占鼠标)。")]
[SerializeField] private bool _keepSelectionAlways = true;
private GameObject _lastSelected;
private void Update()
@@ -32,8 +36,8 @@ namespace BaseGames.UI
return;
}
// 选中已丢失:仅当出现导航/确认意图时恢复,避免抢占鼠标操作
if (!NavigationIntentThisFrame(es)) return;
// 选中已丢失:始终保持模式下立即恢复;否则仅在出现导航/确认意图时恢复
if (!_keepSelectionAlways && !NavigationIntentThisFrame(es)) return;
if (_lastSelected == null || !_lastSelected.activeInHierarchy) return;
var sel = _lastSelected.GetComponent<Selectable>();