コード例 #1
0
ファイル: GoodsEquip.cs プロジェクト: wuhuolong/MaxBooks
 public void Clear()
 {
     RealNum = 0;
     if (CostGoods != null)
     {
         CostGoods.Clear();
     }
     if (SuitAttrs != null)
     {
         SuitAttrs.Clear();
     }
     _lv      = 0;
     Id       = 0;
     EquipPos = GameConst.POS_WEAPON;;
     RealNum  = 0;
 }
コード例 #2
0
ファイル: GoodsEquip.cs プロジェクト: wuhuolong/MaxBooks
        public void Update(uint lv)
        {
            _lv = lv;
            if (CostGoods == null)
            {
                CostGoods = new List <Goods>();
            }
            else
            {
                CostGoods.Clear();
            }

            ///很傻逼的设计 如果0级要读1级的 其他的读当前等级说了很久服务端跟策划不改
            uint currentLv = 0;

            if (_lv == 0)
            {
                currentLv = 1;
            }
            else
            {
                currentLv = _lv;
            }

            DBSuit.DBSuitInfo dbSuitInfo = DBManager.Instance.GetDB <DBSuit>().GetOneInfo(Id, currentLv);
            if (dbSuitInfo != null)
            {
                if (currentLv == dbSuitInfo.Lv)
                {
                    Name        = dbSuitInfo.Name;
                    PreviewName = dbSuitInfo.PreviewName;
                    SuitId      = dbSuitInfo.SuitId;
                    UpgradeNeed = dbSuitInfo.NeedInfos;
                    List <GoodsItem> costGoods = dbSuitInfo.GetCostGoods(EquipPos);
                    foreach (GoodsItem goods in costGoods)
                    {
                        CostGoods.Add(goods);
                    }
                }
            }

            if (SuitAttrs == null)
            {
                SuitAttrs = new Dictionary <uint, ActorAttribute>();
            }
            else
            {
                SuitAttrs.Clear();
            }

            MaxNum = 0;

            var attrInfos = DBManager.Instance.GetDB <DBSuitAttr>().GetAttrInfos(Id, Lv);

            if (attrInfos != null)
            {
                foreach (var info in attrInfos)
                {
                    SuitAttrs.Add(info.Num, info.BasicAttrs);

                    if (info.Num > MaxNum)
                    {
                        MaxNum = info.Num;
                    }
                }
            }
        }