Пример #1
0
    private static Selectable GetNextSelectable(Selectable current, Vector3 dir)
    {
        Selectable next = current.FindSelectable(dir);

        if (next == null)
        {
            next = current.FindLoopSelectable(-dir);
        }
        return(next);
    }
Пример #2
0
    public static Selectable FindLoopSelectable(this Selectable current, Vector3 dir)
    {
        Selectable first = current.FindSelectable(dir);

        if (first != null)
        {
            current = first.FindLoopSelectable(dir);
        }
        return(current);
    }
Пример #3
0
    /// </summary>
    /// 循环寻找下一个UI组件
    /// <param name="current"></param>
    /// <param name="dir"></param>
    /// <returns></returns>
    public static Selectable FindLoopSelectable(this Selectable current, Vector3 dir)
    {
        Selectable first = current.FindSelectable(dir); //用一个向量Vector3去寻找第一个Selectable

        if (first != null)                              //如果下一个为null,用递归方法循环继续寻找第一个
        {
            current = first.FindLoopSelectable(dir);
        }
        return(current);
    }