private bool OnCallback(BEquip_node node, int level)
        {
            bool result = false;

            if (node != null && node.Data != null)
            {
                RItemData data = node.Data;
                int       num  = this._hasItems.IndexOf(data.ID);
                if (data.Possessed && num != -1)
                {
                    this._hasItems.RemoveAt(num);
                }
                else if (!data.Afford)
                {
                    result = true;
                }
                else if (this.num == 6 && data.Price <= data.RealPrice)
                {
                    result = true;
                }
                else
                {
                    this.InsertItem(data);
                }
            }
            return(result);
        }
 public void Reset(RItemData targetItem, List <string> hasItems)
 {
     this._targetItem = targetItem;
     this.realPrice   = targetItem.Config.sell;
     this._hasItems.Clear();
     this._hasItems.AddRange(hasItems);
 }
 public void GenerateTree(RItemData data)
 {
     if (data != null)
     {
         this.root = new BEquip_node(data, 0);
         this.root.GenerateChilren(0);
     }
 }
示例#4
0
        private bool OnCallback(BEquip_node node, int level)
        {
            RItemData data = node.Data;

            if (data != null)
            {
                data.Afford = (this._money >= data.RealPrice);
            }
            return(true);
        }
示例#5
0
        private bool OnCallback(BEquip_node node, int level)
        {
            bool      result = false;
            RItemData data   = node.Data;

            if (data != null)
            {
                this.curTarget    = data.ID;
                data.PossessedNum = this._hasItems.Count(new Func <string, bool>(this.Selector));
                result            = !data.Possessed;
            }
            return(result);
        }
示例#6
0
 private void UpdateRItemsSub_Tree(string rootItem)
 {
     if (string.IsNullOrEmpty(rootItem))
     {
         if (this.tree != null)
         {
             this.tree.DestroyTree();
         }
     }
     else
     {
         if (this.tree == null)
         {
             this.tree = new BattleEquipTools_Tree();
         }
         BEquip_node root = this.tree.GetRoot();
         if (root == null || !root.Data.ID.Equals(rootItem))
         {
             this.tree.DestroyTree();
             RItemData rItemData = new RItemData(rootItem, this.data.DicShops);
             this.tree.GenerateTree(rItemData);
         }
     }
 }
 private void InsertItem(RItemData item)
 {
     if (!this.listRItems.Contains(item))
     {
         if (this.listRItems.Count > 0)
         {
             for (int i = this.listRItems.Count - 1; i >= 0; i--)
             {
                 if (this.listRItems[i].CompareTo(item) <= 0)
                 {
                     this.listRItems.Insert(i + 1, item);
                 }
                 else if (i == 0)
                 {
                     this.listRItems.Insert(i, item);
                 }
             }
         }
         else
         {
             this.listRItems.Add(item);
         }
     }
 }
 public RecommendItem_price(RItemData targetItem, List <string> hasItems)
 {
     this._targetItem = targetItem;
     this.realPrice   = targetItem.Config.sell;
     this._hasItems   = new List <string>(hasItems);
 }
示例#9
0
 public BEquip_node(RItemData d, int level)
 {
     this.data   = d;
     this._level = level;
 }