Ejemplo n.º 1
0
        private void CreateTreeNode(Node <EquipmentData> parent)
        {
            string           nodeIndex = parent.NodeIndex;
            SysBattleItemsVo dataById  = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(nodeIndex);

            if (StringUtils.CheckValid(dataById.consumption))
            {
                string[] stringValue = StringUtils.GetStringValue(dataById.consumption, ',');
                if (stringValue != null)
                {
                    string[] array = stringValue;
                    for (int i = 0; i < array.Length; i++)
                    {
                        string           text      = array[i];
                        SysBattleItemsVo dataById2 = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(text);
                        if (dataById2 != null)
                        {
                            EquipmentData        data = new EquipmentData(dataById2.items_id, dataById2.sale, dataById2.sell);
                            Node <EquipmentData> node = new Node <EquipmentData>(data, parent, text, dataById2.describe);
                            parent.AddChildNode(node);
                            this.AddNode(node);
                            this.CreateTreeNode(node);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private EquipmentTree(string name, int idx)
        {
            this.TreeName  = name;
            this.TreeIndex = idx;
            SysBattleItemsVo dataById = BaseDataMgr.instance.GetDataById <SysBattleItemsVo>(this.TreeName);

            if (dataById == null)
            {
                Debug.LogError("AI.Equipment EquipmentTree TreeName=" + this.TreeName + "  在SysBattleItemsVo中找不到");
                return;
            }
            EquipmentData        data = new EquipmentData(dataById.items_id, dataById.sale, dataById.sell);
            Node <EquipmentData> node = new Node <EquipmentData>(data, null, this.TreeName, dataById.describe);

            this.SetRootNode(node);
            this.CreateTreeNode(node);
        }