增加Navigation Skip
This commit is contained in:
parent
a3afd178bd
commit
f6cb7dde18
@ -211,7 +211,7 @@ namespace UnityEngine.UI
|
||||
|
||||
foreach (Transform layerRoot in _interactiveLayerRoots)
|
||||
{
|
||||
if (layerRoot == null)
|
||||
if (layerRoot == null || IsNavigationSkipped(layerRoot))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -220,7 +220,9 @@ namespace UnityEngine.UI
|
||||
for (int i = 0; i < holders.Length; i++)
|
||||
{
|
||||
UIHolderObjectBase holder = holders[i];
|
||||
if (holder == null || holder.GetComponent<UXNavigationScope>() != null)
|
||||
if (holder == null
|
||||
|| holder.GetComponent<UXNavigationScope>() != null
|
||||
|| IsNavigationSkipped(holder.transform))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -287,7 +289,14 @@ namespace UnityEngine.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
return TryGetInteractiveLayerRoot(scope.transform, out _);
|
||||
return !IsNavigationSkipped(scope.transform)
|
||||
&& scope.HasAvailableSelectable()
|
||||
&& TryGetInteractiveLayerRoot(scope.transform, out _);
|
||||
}
|
||||
|
||||
private static bool IsNavigationSkipped(Transform current)
|
||||
{
|
||||
return current != null && current.GetComponentInParent<UXNavigationSkip>(true) != null;
|
||||
}
|
||||
|
||||
private bool TryGetInteractiveLayerRoot(Transform current, out Transform layerRoot)
|
||||
|
||||
@ -160,6 +160,26 @@ namespace UnityEngine.UI
|
||||
return null;
|
||||
}
|
||||
|
||||
internal bool HasAvailableSelectable()
|
||||
{
|
||||
RefreshSelectableCache();
|
||||
|
||||
if (IsSelectableValid(_defaultSelectable))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _cachedSelectables.Count; i++)
|
||||
{
|
||||
if (IsSelectableValid(_cachedSelectables[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void RecordSelection(GameObject selectedObject)
|
||||
{
|
||||
if (!_rememberLastSelection || selectedObject == null)
|
||||
|
||||
10
Runtime/UXComponent/Navigation/UXNavigationSkip.cs
Normal file
10
Runtime/UXComponent/Navigation/UXNavigationSkip.cs
Normal file
@ -0,0 +1,10 @@
|
||||
#if INPUTSYSTEM_SUPPORT
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("UI/UX Navigation Skip")]
|
||||
public sealed class UXNavigationSkip : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Runtime/UXComponent/Navigation/UXNavigationSkip.cs.meta
Normal file
11
Runtime/UXComponent/Navigation/UXNavigationSkip.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d9f2572962f46368405e4b5abf32d2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue
Block a user