Ejemplo n.º 1
0
 /// <summary>获取实例</summary>
 public static PoolManagerSingltonAuto <T> GetIns()
 {
     if (Ins == null)
     {
         lock (objLock)
         {
             Ins = new PoolManagerSingltonAuto <T>();
         }
     }
     return(Ins);
 }
Ejemplo n.º 2
0
    List <UITreeItemNode> CreateTreeNodes()
    {
        if (UITreeCtrl == null)
        {
            NZQLA.Log.LogAtUnityEditorError("NULL");
            return(null);
        }

        List <UITreeItemNode> nodes = new List <UITreeItemNode>();
        int rootNodeCount           = Random.Range(1, RootNodeCountMax);

        //添加根节点
        for (int i = 0; i < rootNodeCount; i++)
        {
            nodes.Add(PoolManagerSingltonAuto <UITreeItemNode> .GetIns().GetOneItem());
        }
        NodeCount -= rootNodeCount;

        int indexRootNode = 0;

        while (--NodeCount >= 0)
        {
            UITreeItemNode tempNode = RandOneNode(nodes, RandChildPower);
            if (tempNode == null)
            {
                NZQLA.Log.LogAtUnityEditorError("ERROR");
                break;
            }

            if (tempNode.m_children == null)
            {
                tempNode.m_children = new List <UITreeItemNode>();
            }
            tempNode.m_children.Add(PoolManagerSingltonAuto <UITreeItemNode> .GetIns().GetOneItem());
        }

        return(nodes);
    }