Exemplo n.º 1
0
        void InitCache()
        {
            var itemList = DicItemMgr.GetAll();

            _itemTypeLinkDic = new Dictionary <int, Dictionary <int, DicItemEntity> >();
            _itemsDic        = itemList.ToDictionary(d => d.ItemCode, d => d);
            foreach (var dicItem in itemList)
            {
                if (!_itemTypeLinkDic.ContainsKey(dicItem.ItemType))
                {
                    _itemTypeLinkDic.Add(dicItem.ItemType, new Dictionary <int, DicItemEntity>());
                }
                _itemTypeLinkDic[dicItem.ItemType].Add(dicItem.LinkId, dicItem);
            }
        }
Exemplo n.º 2
0
 private void UserControl_Loaded_1(object sender, RoutedEventArgs e)
 {
     if (_isLoad)
     {
         return;
     }
     try
     {
         itemType  = 1;
         _itemList = DicItemMgr.GetAll();
         BindItem();
     }
     catch (Exception ex)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendFormat("应用程序出现了异常,{0}\n", ex.Message);
         stringBuilder.AppendFormat("\n {0}", ex.StackTrace);
         MessageBox.Show(stringBuilder.ToString());
     }
     _isLoad = true;
 }
Exemplo n.º 3
0
        void InitCache()
        {
            _itemList               = DicItemMgr.GetAllForCache();
            _itemsDic               = _itemList.ToDictionary(d => d.ItemCode, d => d);
            _itemListNoSystem       = new List <DicItemEntity>();
            _itemTypesDic           = new Dictionary <int, List <DicItemEntity> >();
            _itemTypeLinkDic        = new Dictionary <int, Dictionary <int, DicItemEntity> >();
            _ballsoulLevelupDic     = new Dictionary <int, Dictionary <int, int> >();
            _ballsoulMultiColorList = new List <int>();
            _ballsoulOtherColorList = new List <int>();
            _prpoSellDic            = new Dictionary <int, ConfigPrposellEntity>();
            _ballsoulColorLevelDic  = new Dictionary <int, List <int> >();

            foreach (var dicItem in _itemList)
            {
                if (dicItem.ItemType != (int)EnumItemType.PlayerCard)
                {
                    _itemListNoSystem.Add(dicItem);
                }
                else if (dicItem.PlayerCardLevel != (int)EnumPlayerCardLevel.White)
                {
                    _itemListNoSystem.Add(dicItem);
                }
                if (!_itemTypesDic.ContainsKey(dicItem.ItemType))
                {
                    _itemTypesDic.Add(dicItem.ItemType, new List <DicItemEntity>());
                }
                _itemTypesDic[dicItem.ItemType].Add(dicItem);

                if (!_itemTypeLinkDic.ContainsKey(dicItem.ItemType))
                {
                    _itemTypeLinkDic.Add(dicItem.ItemType, new Dictionary <int, DicItemEntity>());
                }
                _itemTypeLinkDic[dicItem.ItemType].Add(dicItem.LinkId, dicItem);
            }
            _ballsoulMultiColorCount = _ballsoulMultiColorList.Count;
            _ballsoulOtherColorCount = _ballsoulOtherColorList.Count;

            var list2 = DicItemtypeMgr.GetAll();

            _itemTypeLapoverDic = list2.ToDictionary(d => d.Idx, d => d.LapoverCount);

            var equipmentWashStoneList = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.EquipmentWashStoneList);
            var ss = equipmentWashStoneList.Split(',');

            _washStoneLevelupDic = new Dictionary <int, int>(ss.Length - 1);
            for (int i = 0; i < ss.Length - 1; i++)
            {
                _washStoneLevelupDic.Add(ConvertHelper.ConvertToInt(ss[i]), ConvertHelper.ConvertToInt(ss[i + 1]));
            }
            list2 = null;

            var itemNewPackCodes = AppsettingCache.Instance.GetAppSetting(EnumAppsetting.ItemNewPackCodes);
            var ii = itemNewPackCodes.Split(',');

            _itemNewPackCodeDic = new Dictionary <int, int>(ii.Length);
            foreach (var s in ii)
            {
                _itemNewPackCodeDic.Add(ConvertHelper.ConvertToInt(s), 0);
            }
            _legendPlayerList = _itemTypesDic[1].FindAll(d => d.PlayerCardLevel == 1 || d.PlayerCardLevel == 7);

            _theContractList = DicItemMgr.GetContractItem();

            var list3 = ConfigPrposellMgr.GetAll();

            foreach (var item in list3)
            {
                var key = PrpoSellKey(item.ItemType, item.Quality);
                if (!_prpoSellDic.ContainsKey(key))
                {
                    _prpoSellDic.Add(key, item);
                }
                else
                {
                    _prpoSellDic[key] = item;
                }
            }
        }
Exemplo n.º 4
0
        public static ItemTipsEntity ExportItemTips()
        {
            var            itemList      = DicItemMgr.GetAll();
            var            playerList    = DicPlayerMgr.GetAll();
            var            equipmentList = DicEquipmentMgr.GetAll();
            var            mallList      = DicMallitemMgr.GetAll().FindAll(d => d.MallType != 5);
            var            ballList      = DicBallsoulMgr.GetAll();
            var            willList      = DicManagerwillMgr.GetAll();
            var            starskillList = DicStarskillsMgr.GetAll();
            ItemTipsEntity itemTips      = new ItemTipsEntity();

            itemTips.PlayerCard = new List <PlayerCardDescriptionEntity>(playerList.Count);
            itemTips.Equipment  = new List <EquipmentDescriptionEntity>(equipmentList.Count);
            itemTips.Ballsoul   = new List <BallsoulDescriptionEntity>(0);
            itemTips.MallItem   = new List <MallItemDescriptionEntity>(mallList.Count);
            foreach (var itemEntity in itemList)
            {
                switch (itemEntity.ItemType)
                {
                case (int)EnumItemType.PlayerCard:
                    var playerd = BuildPlayerCardDescription(itemEntity,
                                                             playerList.Find(d => d.Idx == itemEntity.LinkId));
                    var star = starskillList.FindAll(d => d.PlayerId == playerd.PlayerId);
                    if (star.Count > 0)
                    {
                        playerd.Starskill     = "";
                        playerd.StarskillCode = "";
                        foreach (var entity in star)
                        {
                            playerd.Starskill     += entity.Name + ",";
                            playerd.StarskillCode += entity.SkillCode + ",";
                        }
                        playerd.Starskill     = playerd.Starskill.TrimEnd(',');
                        playerd.StarskillCode = playerd.StarskillCode.TrimEnd(',');
                    }


                    var wills =
                        willList.FindAll(d => d.DriveFlag == 1 && d.PartMap.Contains(playerd.PlayerId.ToString()));
                    if (wills != null && wills.Count > 0)
                    {
                        foreach (var entity in wills)
                        {
                            playerd.CombSkill = entity.SkillName + ",";
                        }
                        playerd.CombSkill = playerd.CombSkill.TrimEnd(',');
                    }
                    itemTips.PlayerCard.Add(playerd);
                    break;

                case (int)EnumItemType.Equipment:
                    var equipd = BuildEquipmentDescription(itemEntity,
                                                           equipmentList.Find(d => d.Idx == itemEntity.LinkId));
                    itemTips.Equipment.Add(equipd);
                    break;

                case (int)EnumItemType.MallItem:
                    var malld = BuildMallDescription(itemEntity, mallList.Find(d => d.MallCode == itemEntity.LinkId));
                    itemTips.MallItem.Add(malld);
                    break;
                }
            }
            return(itemTips);
        }