Example #1
0
        public void RefreshData(CardProduct pro)
        {
            show = pro.Id != 0;
            product = pro;
            if (product.Id != 0)
            {
                virtualRegion.SetRegionInfo(1, product.Cid);
            }

            string effectName = "";
            var card =  CardAssistant.GetCard(product.Cid);
            if (card.GetCardType() == CardTypes.Monster)
            {
                MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(product.Cid);
                foreach (var skill in MonsterBook.GetSkillList(monsterConfig.Id))
                {
                    int skillId = skill.Id;
                    SkillConfig skillConfig = ConfigData.GetSkillConfig(skillId);
                    if (skillConfig.Cover != null)
                    {
                        effectName = skillConfig.Cover;
                    }
                }
                if (monsterConfig.Cover != "")
                {
                    effectName = monsterConfig.Cover;
                }
            }

            string nowEffectName = "";
            if (coverEffect != null)
            {
                nowEffectName = coverEffect.Name;
            }

            if (effectName != nowEffectName)
            {
                if (effectName == "")
                {
                    coverEffect = null;
                }
                else
                {
                    coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(x + 12, y + 14), new Size(64, 84));
                }
            }

            parent.Invalidate(new Rectangle(x+12, y+14, 64, 84));
        }
Example #2
0
        public void SetInfo(DeckCard dcard)
        {
            cid = dcard.BaseId;
            level = dcard.Level;
            lastCell = -1;
            skills = new List<MonsterSkill>();
            string effectName = "";
            if (cid > 0)
            {
                card = CardAssistant.GetCard(cid);
                virtualRegion.SetRegionInfo(3, CardConfigManager.GetCardConfig(cid).Quality+1);
                var jobId = CardConfigManager.GetCardConfig(cid).JobId;
                if (jobId > 0)
                {
                    jobId = ConfigData.GetJobConfig(jobId).JobIndex;
                }
                virtualRegion.SetRegionInfo(4, jobId);
                card.SetData(dcard);
                if (card.GetCardType() == CardTypes.Monster)
                {
                    MonsterCard monsterCard = card as MonsterCard;
                    if (monsterCard != null)
                    {
                        CheckMonster(monsterCard, ref effectName);
                    }
                }
            }

            string nowEffectName = "";
            if (coverEffect != null)
            {
                nowEffectName = coverEffect.Name;
            }

            if (effectName != nowEffectName)
            {
                if (effectName == "")
                {
                    coverEffect = null;
                }
                else
                {
                    coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(X + 20, Y + 20), new Size(160, 180));
                }
            }

            tooltip.Hide(parent);

            if (Invalidate != null)
            {
                Invalidate();
            }
        }
Example #3
0
        private void OnVRegionClick(int info, int x, int y, MouseButtons button)
        {
            if (info > 0)//说明是button
            {
                var hasOpen = cardOpenArray[info - 1];
                if (hasOpen == 0)
                {
                    int cardId = UseScard();
                    vRegion.SetRegionInfo(info, cardId);
                    var card = UserProfile.InfoCard.AddCard(cardId);
                    if (card.Exp != 0) //不是新卡
                    {
                        IRegionDecorator decorator = new RegionCoverDecorator(Color.FromArgb(150, Color.Black));
                        vRegion.SetRegionDecorator(info, 0, decorator);
                        decorator = new RegionTextDecorator(18, 50, 16, Color.White, true);
                        decorator.SetState("EXP+1");
                        vRegion.SetRegionDecorator(info, 1, decorator);
                    }
                    cardOpenArray[info - 1] = cardId;
                    coverEffect[info-1] = new CoverEffect(EffectBook.GetEffect("transmit"), new Point(cardPos[(info - 1) * 2], cardPos[(info - 1) * 2+1]), new Size(120, 150));
                    coverEffect[info - 1].PlayOnce = true;
                    Invalidate();

                    var pos = vRegion.GetRegionPosition(info);
                    OnVRegionEntered(info, pos.X, pos.Y, cardId);
                }
            }
        }