Пример #1
0
        /// <summary>
        /// 初始化 卡牌-技能 关系列表
        /// </summary>
        public void CardData_InitSkillRelationLists()
        {
            //  1   卡牌所有技能列表
            foreach (var card in CardList)
            {
                var list = new List <ParsedSkillData>();
                list.AddRange(card.Skill.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
                list.AddRange(card.LockSkill1.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
                list.AddRange(card.LockSkill2.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
                CardData_AllSkills.TryAdd(card, list.ToArray());
            }

            //  1.1 卡牌所有技能展开形式列表(展开卡牌所有技能列表)
            foreach (var card in CardList)
            {
                var list = new List <ParsedSkillData>();
                foreach (var i in CardData_GetAllSkills(card))
                {
                    list.AddRange(SkillData_GetExpandSkills(i));
                }
                CardData_AllExpandSkills.TryAdd(card, list.ToArray());
            }

            //  1.2 战斗性卡牌列表(检查卡牌所有技能列表)
            foreach (var card in CardList)
            {
                var allskills = CardData_GetAllSkills(card);

                //  所有技能都不是战斗技能,则卡牌不是战斗卡牌。没有技能的卡牌算作战斗卡牌(如双子座幻影、九命猫神幻影)
                var isBattleCard = !(allskills.Length > 0 && allskills.All(m => !m.IsBattleSkill));

                CardData_IsBattleCard.Add(card, isBattleCard);
            }
        }
Пример #2
0
 /// <summary>
 /// 初始化 符文-技能 关系列表
 /// </summary>
 public void RuneData_InitSkillRelationLists()
 {
     //  1   初始化符文所有技能列表
     foreach (var rune in RuneList)
     {
         var list = new List <ParsedSkillData>();
         list.AddRange(rune.LockSkill1.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
         list.AddRange(rune.LockSkill2.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
         list.AddRange(rune.LockSkill3.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
         list.AddRange(rune.LockSkill4.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
         list.AddRange(rune.LockSkill5.Select(m => SkillList.FirstOrDefault(n => n.SkillId == m)).Where(m => m != null));
         RuneData_AllSkills.TryAdd(rune, list.ToArray());
     }
 }
        /// <summary>
        /// 初始化 卡牌、符文、技能-关卡 关系列表
        /// </summary>
        public void CardData_RuneData_SkillData_InitMapStageRelationLists()
        {
            var CardData  = new Dictionary <ParsedCardData, List <KeyValuePair <ParsedMapStageDetailLevelData, int> > >();
            var RuneData  = new Dictionary <ParsedRuneData, List <KeyValuePair <ParsedMapStageDetailLevelData, int> > >();
            var SkillData = new Dictionary <ParsedSkillData, List <KeyValuePair <ParsedMapStageDetailLevelData, int> > >();

            var CardRewardInMapStageLevelData     = new Dictionary <ParsedCardData, List <KeyValuePair <ParsedMapStageDetailLevelData, int> > >();
            var CardChipRewardInMapStageLevelData = new Dictionary <ParsedCardData, List <KeyValuePair <ParsedMapStageDetailLevelData, int> > >();
            var CardRewardInMapStageData          = new Dictionary <ParsedCardData, List <KeyValuePair <ParsedMapStageData, int> > >();
            var CardChipRewardInMapStageData      = new Dictionary <ParsedCardData, List <KeyValuePair <ParsedMapStageData, int> > >();

            var RuneRewardInMapStageLevelData = new Dictionary <ParsedRuneData, List <KeyValuePair <ParsedMapStageDetailLevelData, int> > >();
            var RuneRewardInMapStageData      = new Dictionary <ParsedRuneData, List <KeyValuePair <ParsedMapStageData, int> > >();

            void GetData(int difficulty, ParsedMapStageData[] MapStageList)
            {
                foreach (var ms in MapStageList)
                {
                    if (ms.OpenStatus == 0)
                    {
                        continue;
                    }
                    else
                    {
                        foreach (var msd in ms.MapStageDetails)
                        {
                            foreach (var msdl in msd.Levels)
                            {
                                //  遍历卡牌列表
                                foreach (var c in msdl.CardList)
                                {
                                    var a    = c.Split('_');
                                    var card = CardList.FirstOrDefault(m => m.CardId + "" == a[0] || m.CardName == a[0]);
                                    if (card == null)
                                    {
                                        continue;
                                    }
                                    else
                                    {
                                        //  添加卡牌
                                        if (CardData.ContainsKey(card))
                                        {
                                            CardData[card].Add(new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty));
                                        }
                                        else
                                        {
                                            CardData.Add(card, new List <KeyValuePair <ParsedMapStageDetailLevelData, int> > {
                                                new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty)
                                            });
                                        }

                                        //  添加技能
                                        if (a.Length > 2)
                                        {
                                            var skill = SkillList.FirstOrDefault(m => m.SkillId + "" == a[2] || m.Name == a[2]);
                                            if (skill == null)
                                            {
                                                continue;
                                            }
                                            else
                                            {
                                                if (SkillData.ContainsKey(skill))
                                                {
                                                    SkillData[skill].Add(new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty));
                                                }
                                                else
                                                {
                                                    SkillData.Add(skill, new List <KeyValuePair <ParsedMapStageDetailLevelData, int> > {
                                                        new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty)
                                                    });
                                                }
                                            }
                                        }
                                    }
                                }

                                //  遍历符文列表
                                foreach (var r in msdl.RuneList)
                                {
                                    var a    = r.Split('_');
                                    var rune = RuneList.FirstOrDefault(m => m.RuneId + "" == a[0] || m.RuneName == a[0]);
                                    if (rune == null)
                                    {
                                        continue;
                                    }
                                    else
                                    {
                                        if (RuneData.ContainsKey(rune))
                                        {
                                            RuneData[rune].Add(new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty));
                                        }
                                        else
                                        {
                                            RuneData.Add(rune, new List <KeyValuePair <ParsedMapStageDetailLevelData, int> > {
                                                new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty)
                                            });
                                        }
                                    }
                                }

                                //  奖励列表
                                {
                                    var list = new List <string>();
                                    list.AddRange(msdl.BonusExplore);
                                    list.AddRange(msdl.BonusLose);
                                    list.AddRange(msdl.BonusWin);
                                    list.AddRange(msdl.FirstBonusWin);
                                    foreach (var i in list.Distinct())
                                    {
                                        var a = i.ToLower().Split('_');
                                        switch (a[0])
                                        {
                                        case "card":
                                        {
                                            var card = CardList.FirstOrDefault(m => m.CardId + "" == a[1] || m.CardName == a[1]);
                                            //  添加卡牌
                                            if (CardRewardInMapStageLevelData.ContainsKey(card))
                                            {
                                                CardRewardInMapStageLevelData[card].Add(new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty));
                                            }
                                            else
                                            {
                                                CardRewardInMapStageLevelData.Add(card, new List <KeyValuePair <ParsedMapStageDetailLevelData, int> > {
                                                        new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty)
                                                    });
                                            }
                                            break;
                                        }

                                        case "rune":
                                        {
                                            var rune = RuneList.FirstOrDefault(m => m.RuneId + "" == a[1] || m.RuneName == a[1]);
                                            //  添加符文
                                            if (RuneRewardInMapStageLevelData.ContainsKey(rune))
                                            {
                                                RuneRewardInMapStageLevelData[rune].Add(new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty));
                                            }
                                            else
                                            {
                                                RuneRewardInMapStageLevelData.Add(rune, new List <KeyValuePair <ParsedMapStageDetailLevelData, int> > {
                                                        new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty)
                                                    });
                                            }
                                            break;
                                        }
                                        }
                                    }

                                    //  卡牌碎片奖励
                                    if (msdl.BonusChip > 0)
                                    {
                                        var card = CardList.FirstOrDefault(m => m.CardId == msdl.BonusChip);
                                        //  添加卡牌
                                        if (CardChipRewardInMapStageLevelData.ContainsKey(card))
                                        {
                                            CardChipRewardInMapStageLevelData[card].Add(new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty));
                                        }
                                        else
                                        {
                                            CardChipRewardInMapStageLevelData.Add(card, new List <KeyValuePair <ParsedMapStageDetailLevelData, int> > {
                                                new KeyValuePair <ParsedMapStageDetailLevelData, int>(msdl, difficulty)
                                            });
                                        }
                                        break;
                                    }
                                }
                            }
                        }

                        //  通关奖励
                        {
                            foreach (var i in ms.FinishAward)
                            {
                                var a = i.ToLower().Split('_');
                                switch (a[0])
                                {
                                case "card":
                                {
                                    var card = CardList.FirstOrDefault(m => m.CardId + "" == a[1] || m.CardName == a[1]);
                                    //  添加卡牌
                                    if (CardRewardInMapStageData.ContainsKey(card))
                                    {
                                        CardRewardInMapStageData[card].Add(new KeyValuePair <ParsedMapStageData, int>(ms, difficulty));
                                    }
                                    else
                                    {
                                        CardRewardInMapStageData.Add(card, new List <KeyValuePair <ParsedMapStageData, int> > {
                                                new KeyValuePair <ParsedMapStageData, int>(ms, difficulty)
                                            });
                                    }
                                    break;
                                }

                                case "rune":
                                {
                                    var rune = RuneList.FirstOrDefault(m => m.RuneId + "" == a[1] || m.RuneName == a[1]);
                                    //  添加符文
                                    if (RuneRewardInMapStageData.ContainsKey(rune))
                                    {
                                        RuneRewardInMapStageData[rune].Add(new KeyValuePair <ParsedMapStageData, int>(ms, difficulty));
                                    }
                                    else
                                    {
                                        RuneRewardInMapStageData.Add(rune, new List <KeyValuePair <ParsedMapStageData, int> > {
                                                new KeyValuePair <ParsedMapStageData, int>(ms, difficulty)
                                            });
                                    }
                                    break;
                                }
                                }
                            }

                            //  通关探索碎片
                            foreach (var i in ms.HideChip.Where(m => m > 0))
                            {
                                var card = CardList.FirstOrDefault(m => m.CardId == i);
                                //  添加卡牌
                                if (CardChipRewardInMapStageData.ContainsKey(card))
                                {
                                    CardChipRewardInMapStageData[card].Add(new KeyValuePair <ParsedMapStageData, int>(ms, difficulty));
                                }
                                else
                                {
                                    CardChipRewardInMapStageData.Add(card, new List <KeyValuePair <ParsedMapStageData, int> > {
                                        new KeyValuePair <ParsedMapStageData, int>(ms, difficulty)
                                    });
                                }
                                break;
                            }
                        }
                    }
                }
            }

            GetData(0, MapStageList);
            GetData(1, MapHardStageList);

            var blank1 = new KeyValuePair <ParsedMapStageDetailLevelData, int>[] { };
            var blank2 = new KeyValuePair <ParsedMapStageData, int>[] { };

            void CopyList(dynamic fromListDictionary, dynamic toArrayDictionary, dynamic item, dynamic blankItem)
            {
                if (fromListDictionary.ContainsKey(item))
                {
                    toArrayDictionary.Add(item, fromListDictionary[item].ToArray());
                }
                else
                {
                    toArrayDictionary.Add(item, blankItem);
                }
            }

            foreach (var c in CardList)
            {
                CopyList(CardData, CardData_ShowInMapStageLevel, c, blank1);

                CopyList(CardRewardInMapStageLevelData, CardData_RewardInMapStageLevel, c, blank1);
                CopyList(CardChipRewardInMapStageLevelData, CardData_ChipRewardInMapStageLevel, c, blank1);
                CopyList(CardRewardInMapStageData, CardData_RewardInMapStage, c, blank2);
                CopyList(CardChipRewardInMapStageData, CardData_ChipRewardInMapStage, c, blank2);
            }
            foreach (var r in RuneList)
            {
                CopyList(RuneData, RuneData_ShowInMapStageLevel, r, blank1);

                CopyList(RuneRewardInMapStageLevelData, RuneData_RewardInMapStageLevel, r, blank1);
                CopyList(RuneRewardInMapStageData, RuneData_RewardInMapStage, r, blank2);
            }
            foreach (var s in SkillList)
            {
                CopyList(SkillData, SkillData_ShowInMapStageLevel, s, blank1);
            }
        }
Пример #4
0
        /// <summary>
        /// 初始化 技能-技能 关系列表
        /// </summary>
        public void SkillData_InitSkillRelationLists()
        {
            //  1   初始化子技能表
            foreach (var skill in SkillList)
            {
                var list = new List <ParsedSkillData>();
                switch (skill.AffectType[0])
                {
                default:
                {
                    list.Add(skill);
                    break;
                }

                case 122:
                {
                    //  多重技能
                    list.AddRange(skill.AffectValue.Select(m => SkillList.FirstOrDefault(n => n.SkillId + "" == m)).Where(m => m != null));
                    break;
                }

                case 158:
                {
                    //  双向觉醒
                    list.AddRange(skill.AffectValue2.Select(m => SkillList.FirstOrDefault(n => n.SkillId + "" == m)).Where(m => m != null));
                    break;
                }
                }
                SkillData_ExpandSkills.TryAdd(skill, list.ToArray());
            }

            //  1.1 初始化父技能表(反查子技能列表)
            foreach (var skill in SkillList)
            {
                var expandSkills = SkillData_ExpandSkills.Where(m => !m.Value.Contains(m.Key) && m.Value.Contains(skill)).Select(m => m.Key).ToArray();
                SkillData_IncludedSkills.TryAdd(skill, expandSkills);
            }

            ////  1.2   初始化后代技能列表(处理多级调用)
            //foreach (var skill in SkillList)
            //{

            //    //  正序遍历树结构
            //    var list = new List<ParsedSkillData>();
            //    var stack = new Stack<ParsedSkillData>();

            //    stack.Push(skill);
            //    while (stack.Count > 0)
            //    {
            //        var i = stack.Pop();

            //        var expand = SkillData_ExpandSkills[i];
            //        if (expand.Length == 1 && expand[0] == i)
            //        {
            //            list.Add(i);
            //        }
            //        else
            //        {
            //            expand.Reverse().ToList().ForEach(m =>
            //            {
            //                if (m != i)
            //                {
            //                    stack.Push(m);
            //                }
            //            });
            //        }
            //    }
            //    SkillData_AllSkills.TryAdd(skill, list.ToArray());
            //}
        }