UI系统
This commit is contained in:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user