Ejemplo n.º 1
0
    public GameObject GetNavi(GameObject fromObj, UINaviNodeRelation relation)
    {
        GameObject toObj    = null;
        UINaviNode naviNode = GetActiveNaviNode(fromObj);

        switch (relation)
        {
        case UINaviNodeRelation.Left:
            toObj = naviNode.leftObj;
            break;

        case UINaviNodeRelation.Right:
            toObj = naviNode.rightObj;
            break;

        case UINaviNodeRelation.Up:
            toObj = naviNode.upObj;
            break;

        case UINaviNodeRelation.Down:
            toObj = naviNode.downObj;
            break;
        }
        return(toObj);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 添加一个导航信息
    /// </summary>
    public void AddNavi(GameObject fromObj, GameObject toObj, UINaviNodeRelation relation)
    {
        if (fromObj == null || toObj == null)
        {
            return;
        }

        UINaviNode naviNode = GetActiveNaviNode(fromObj);

        switch (relation)
        {
        case UINaviNodeRelation.Left:
            naviNode.leftObj = toObj;
            break;

        case UINaviNodeRelation.Right:
            naviNode.rightObj = toObj;
            break;

        case UINaviNodeRelation.Up:
            naviNode.upObj = toObj;
            break;

        case UINaviNodeRelation.Down:
            naviNode.downObj = toObj;
            break;
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 获取一个有效的节点
    /// </summary>
    /// <param name="groupName"></param>
    /// <param name="fromObj"></param>
    /// <returns></returns>
    UINaviNode GetActiveNaviNode(GameObject fromObj)
    {
        UINaviNode node;

        if (!m_NaviMap.TryGetValue(fromObj, out node))
        {
            node = new UINaviNode();
            m_NaviMap.Add(fromObj, node);
        }
        return(node);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 移除一个导航
    /// </summary>
    /// <param name="obj"></param>
    public void RemoveNavi(GameObject obj)
    {
        UINaviNode naviNode = GetActiveNaviNode(obj);

        naviNode.Clear();
    }