diff --git a/Runtime/UXComponent/Selectable/UXSelectable.cs b/Runtime/UXComponent/Selectable/UXSelectable.cs index f0024c0..e625c09 100644 --- a/Runtime/UXComponent/Selectable/UXSelectable.cs +++ b/Runtime/UXComponent/Selectable/UXSelectable.cs @@ -113,5 +113,65 @@ namespace UnityEngine.UI } } } + + public override Selectable FindSelectableOnLeft() + { + if (navigation.mode == Navigation.Mode.Explicit && navigation.selectOnLeft != null && navigation.selectOnLeft.interactable) + { + return navigation.selectOnLeft; + } + + if ((navigation.mode & Navigation.Mode.Horizontal) != 0) + { + return FindSelectable(transform.rotation * Vector3.left); + } + + return null; + } + + public override Selectable FindSelectableOnRight() + { + if (navigation.mode == Navigation.Mode.Explicit && navigation.selectOnRight != null && navigation.selectOnRight.interactable) + { + return navigation.selectOnRight; + } + + if ((navigation.mode & Navigation.Mode.Horizontal) != 0) + { + return FindSelectable(transform.rotation * Vector3.right); + } + + return null; + } + + public override Selectable FindSelectableOnUp() + { + if (navigation.mode == Navigation.Mode.Explicit && navigation.selectOnUp != null && navigation.selectOnUp.interactable) + { + return navigation.selectOnUp; + } + + if ((navigation.mode & Navigation.Mode.Vertical) != 0) + { + return FindSelectable(transform.rotation * Vector3.up); + } + + return null; + } + + public override Selectable FindSelectableOnDown() + { + if (navigation.mode == Navigation.Mode.Explicit && navigation.selectOnDown != null && navigation.selectOnDown.interactable) + { + return navigation.selectOnDown; + } + + if ((navigation.mode & Navigation.Mode.Vertical) != 0) + { + return FindSelectable(transform.rotation * Vector3.down); + } + + return null; + } } }