Exemple #1
0
 public void Image_Changed(object obj)
 {
     if (CardUtils.IsFollower(CardDetailModel.Id)) // 随从具有进化卡图
     {
         CardDetailModel.ImageCurrentPath =
             CardDetailModel.ImageCurrentPath.Equals(CardDetailModel.ImagePathList[0])
                 ? CardDetailModel.ImagePathList[1]
                 : CardDetailModel.ImagePathList[0];
     }
     else // 非随从只具有
     {
         CardDetailModel.ImageCurrentPath = CardDetailModel.ImagePathList[0];
     }
     OnPropertyChanged(nameof(CardDetailModel));
 }
Exemple #2
0
        public void UpdateCardDetailModel(int id)
        {
            var cardModel        = CardUtils.GetCardModel(id);
            var isFollower       = CardUtils.IsFollower(id);
            var type             = Dic.TypeCodeDic.FirstOrDefault(dic => cardModel.TypeCode == dic.Key).Value;
            var camp             = Dic.CampCodeDic.FirstOrDefault(dic => cardModel.CampCode == dic.Key).Value;
            var rarity           = Dic.RarityCodeDic.FirstOrDefault(dic => cardModel.RarityCode == dic.Key).Value;
            var pack             = Dic.PackCodeDic.FirstOrDefault(dic => cardModel.PackCode == dic.Key).Value;
            var imageCostPath    = Dic.ImageCostDic.FirstOrDefault(dic => cardModel.Cost == dic.Key).Value;
            var imagePathList    = CardUtils.GetPicturePathList(cardModel.Id);
            var imageCurrentPath = imagePathList[0];
            var atk           = isFollower ? cardModel.Atk.ToString() : "";
            var evoAtk        = isFollower ? cardModel.EvoAtk.ToString() : "";
            var life          = isFollower ? cardModel.Life.ToString() : "";
            var evoLife       = isFollower ? cardModel.EvoLife.ToString() : "";
            var imageAtkPath  = isFollower ? PathManager.AtkPath : "";
            var imageLifePath = isFollower ? PathManager.LifePath : "";
            var skillList     = isFollower
                ? JsonUtils.Deserialize <List <string> >(cardModel.SkillJson)
                : new List <string> {
                cardModel.SkillJson
            };
            var flavourList = isFollower
                ? JsonUtils.Deserialize <List <string> >(cardModel.FlavourJosn)
                : new List <string>()
            {
                cardModel.FlavourJosn
            };
            var evoDescriptionList = isFollower
                ? new List <string> {
                "进化前", "进化后"
            }
                : new List <string> {
                "", ""
            };

            CardDetailModel = new CardDetailModel
            {
                Id                 = id,
                Camp               = camp,
                Type               = type,
                Rarity             = rarity,
                Pack               = pack,
                Name               = cardModel.Name,
                Cv                 = cardModel.Cv,
                Atk                = atk,
                EvoAtk             = evoAtk,
                Life               = life,
                EvoLife            = evoLife,
                SkillList          = skillList,
                FlavourList        = flavourList,
                ImagePathList      = imagePathList,
                ImageCurrentPath   = imageCurrentPath,
                EvoDescriptionList = evoDescriptionList,
                BgRarity           = GetBgRarity(cardModel.RarityCode),
                ImageCostPath      = imageCostPath,
                ImageAtkPath       = imageAtkPath,
                ImageLifePath      = imageLifePath,
            };
            OnPropertyChanged(nameof(CardDetailModel));
        }