Ejemplo n.º 1
0
        private void ShopWindow_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            if (NpcId > 0)
            {
                Image bgImage = PicLoader.Read("System", "TalkBack.PNG");
                e.Graphics.DrawImage(bgImage, 0, 0, bgImage.Width, bgImage.Height);
                bgImage.Dispose();
                e.Graphics.DrawImage(SceneBook.GetSceneNpcImage(NpcId), 24, 0, 70, 70);

                Font font = new Font("宋体", 11 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
                e.Graphics.DrawString(ConfigData.GetNpcConfig(NpcId).Name, font, Brushes.Chocolate, 131, 50);
                font.Dispose();

                foreach (ShopItem ctl in itemControls)
                {
                    ctl.Draw(e.Graphics);
                }
            }
        }
Ejemplo n.º 2
0
        public override void Draw(Graphics g)
        {
            if (nid > 0)
            {
                Image            img    = null;
                HsActionCallback action = null;
                if (type == PictureRegionCellType.Npc)
                {
                    img = SceneBook.GetSceneNpcImage(nid);
                }
                else if (type == PictureRegionCellType.Item)
                {
                    img    = DataType.Items.HItemBook.GetHItemImage(nid);
                    action = () =>
                    {
                        var itemConfig = ConfigData.GetHItemConfig(nid);
                        var pen        = new Pen(Color.FromName(HSTypes.I2RareColor(itemConfig.Rare)), 2);
                        g.DrawRectangle(pen, X, Y, Width, Height);
                        pen.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.Equip)
                {
                    img    = DataType.Equips.EquipBook.GetEquipImage(nid);
                    action = () =>
                    {
                        var equipConfig = ConfigData.GetEquipConfig(nid);
                        var pen         = new Pen(Color.FromName(HSTypes.I2QualityColor(equipConfig.Quality)), 2);
                        g.DrawRectangle(pen, X, Y, Width, Height);
                        pen.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.Card)
                {
                    img    = DataType.Cards.CardAssistant.GetCardImage(nid, 60, 60);
                    action = () =>
                    {
                        var    cardData   = CardConfigManager.GetCardConfig(nid);
                        string cardBorder = DataType.Cards.CardAssistant.GetCardBorder(cardData);
                        g.DrawImage(PicLoader.Read("Border", cardBorder), X, Y, Width, Height);
                    };
                }
                else if (type == PictureRegionCellType.SkillAttr)
                {
                    img = DataType.HeroSkills.HeroSkillAttrBook.GetHeroSkillAttrImage(nid);
                }
                else if (type == PictureRegionCellType.Achieve)
                {
                    img = DataType.Achieves.AchieveBook.GetAchieveImage(nid);
                }
                else if (type == PictureRegionCellType.People)
                {
                    img = DataType.Peoples.PeopleBook.GetPersonImage(nid);
                }
                else if (type == PictureRegionCellType.HeroSkill)
                {
                    img = DataType.HeroSkills.HeroPowerBook.GetImage(nid);
                }
                else if (type == PictureRegionCellType.CardQual)
                {
                    img = HSIcons.GetIconsByEName("gem" + nid);
                }
                else if (type == PictureRegionCellType.Job)
                {
                    img    = HSIcons.GetIconsByEName("job" + nid);
                    action = () =>
                    {
                        var jobConfig = ConfigData.GetJobConfig(nid + JobConfig.Indexer.NewBie);
                        Pen pen       = new Pen(Color.FromName(jobConfig.Color));
                        g.DrawRectangle(pen, X, Y, Width, Height);
                        pen.Dispose();
                    };
                }
                else if (type == PictureRegionCellType.Bless)
                {
                    img = DataType.Blesses.BlessBook.GetBlessImage(nid);
                }
                else if (type == PictureRegionCellType.SceneQuest)
                {
                    img = SceneBook.GetSceneQuestImage(nid);
                }
                if (img != null)
                {
                    if (Scale == 1)
                    {
                        g.DrawImage(img, X, Y, Width, Height);
                    }
                    else
                    {
                        int realWidth  = (int)(Width * Scale);
                        int realHeight = (int)(Height * Scale);
                        g.DrawImage(img, X + (Width - realWidth) / 2, Y + (Height - realHeight) / 2, realWidth, realHeight);
                    }
                }
                if (action != null)
                {
                    action();
                }
            }

            foreach (IRegionDecorator decorator in decorators)
            {
                decorator.Draw(g, X, Y, Width, Height);
            }
        }