Пример #1
0
        protected bool GetUnuseTreeNodeHorizonalLine(out UWarTreeNodeHorizonalLineComponnet _nUnuseNode)
        {
            UWarTreeNodeHorizonalLineComponnet node;

            //先从缓冲中取
            if (UnuseTreeNodeHorizonalLineList.Count > 0)
            {
                node = UnuseTreeNodeHorizonalLineList[UnuseTreeNodeHorizonalLineList.Count - 1];
                UnuseTreeNodeHorizonalLineList.Remove(node);
                UseTreeNodeHorizonalLineList.Add(node);
                _nUnuseNode = node;

                return(true);
            }
            //没有的话实例化一个出来
            if (TreeNodeHorizonalLinePrefabRes == null)
            {
                Trace.LogError("没有节点横线预制体,不能实例化物品合成树节点横线");
                _nUnuseNode = null;
                return(false);
            }

            InstantiateTreeNodeHorizonalLine();

            node = UnuseTreeNodeHorizonalLineList[UnuseTreeNodeHorizonalLineList.Count - 1];
            UnuseTreeNodeHorizonalLineList.Remove(node);
            UseTreeNodeHorizonalLineList.Add(node);
            _nUnuseNode = node;

            return(true);
        }
Пример #2
0
        protected void InstantiateTreeNodeHorizonalLine()
        {
            UWarTreeNodeHorizonalLineComponnet newNode = TreeNodeHorizonalLinePrefabRes.InstanceMainRes <UWarTreeNodeHorizonalLineComponnet>();

            newNode.transform.SetParent(m_UnuseTreeNodeHorizonalLineContainner, false);
            UnuseTreeNodeHorizonalLineList.Add(newNode);

            newNode.SetVisible(false);
        }