Exemplo n.º 1
0
        private void NpcTalkForm_Paint(object sender, PaintEventArgs e)
        {
            BorderPainter.Draw(e.Graphics, "", Width, Height);

            if (showImage)
            {
                Font font2 = new Font("黑体", 12 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
                e.Graphics.DrawString(string.Format("{0}(Lv{1})", config.Name, eventLevel), font2, Brushes.White, Width / 2 - 40, 8);
                font2.Dispose();

                e.Graphics.DrawImage(SceneBook.GetSceneQuestImage(config.Id), 15, 40, 140, 140);
                Image border = PicLoader.Read("Border", "questb1.PNG"); //边框
                e.Graphics.DrawImage(border, 15, 40, 140, 140);
                border.Dispose();

                if (evtItem != null)
                {
                    evtItem.Draw(e.Graphics);
                }

                colorWord.Draw(e.Graphics);

                if (answerList != null && (evtItem == null || evtItem.RunningState != TalkEventItem.TalkEventState.Running))
                {
                    Font font = new Font("宋体", 11 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
                    int  id   = 0;
                    foreach (var word in answerList)
                    {
                        if (id == tar)
                        {
                            e.Graphics.FillRectangle(Brushes.DarkBlue, 10, id * 20 + Height - 10 - answerList.Count * 20, Width - 20, 20);
                        }

                        int textOff = 20;
                        if (!string.IsNullOrEmpty(word.Prefix))
                        {
                            string icon = "";
                            if (word.Prefix.StartsWith("quest"))
                            {
                                icon = "npc5";
                            }
                            if (word.Prefix.StartsWith("rival"))
                            {
                                icon = "tsk1";
                            }
                            if (icon != "")
                            {
                                e.Graphics.DrawImage(HSIcons.GetIconsByEName(icon), textOff, id * 20 + Height - 10 - answerList.Count * 20 + 2, 18, 18);
                                textOff += 20;
                            }
                        }
                        e.Graphics.DrawString(word.Script, font, Brushes.Wheat, textOff, id * 20 + Height - 10 - answerList.Count * 20 + 2);

                        id++;
                    }
                    font.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        public override void Draw(Graphics g, bool isTarget)
        {
            base.Draw(g, isTarget);

            if (Disabled && EventId == 0)
            {
                return;
            }

            Image markQuest  = PicLoader.Read("Map", MapSetting ? "SymEvent.PNG": "SymQuest.PNG");
            int   drawWidth  = markQuest.Width * Width / GameConstants.SceneTileStandardWidth;
            int   drawHeight = markQuest.Height * Height / GameConstants.SceneTileStandardHeight;
            var   destRect   = new Rectangle(X - drawWidth / 2 + Width / 8, Y - drawHeight / 2, drawWidth, drawHeight);

            if (Disabled)
            {
                g.DrawImage(markQuest, destRect, 0, 0, markQuest.Width, markQuest.Height, GraphicsUnit.Pixel, HSImageAttributes.ToGray);
                var config = ConfigData.GetSceneQuestConfig(EventId);
                g.DrawImage(SceneBook.GetSceneQuestImage(config.Id), new Rectangle(X, Y - Width / 2 + Height / 2, Width / 2, Width / 2), 0, 0, 180, 180, GraphicsUnit.Pixel, HSImageAttributes.ToGray);
            }
            else
            {
                g.DrawImage(markQuest, destRect, 0, 0, markQuest.Width, markQuest.Height, GraphicsUnit.Pixel);
                if (MapSetting)
                {
                    g.DrawImage(SceneBook.GetSceneQuestImage(EventId), new Rectangle(X, Y - Width / 2 + Height / 2, Width / 2, Width / 2), 0, 0, 180, 180, GraphicsUnit.Pixel);
                    var  config     = ConfigData.GetSceneQuestConfig(EventId);
                    var  targetName = config.Name;
                    Font fontName   = new Font("宋体", 11 * 1.33f, FontStyle.Bold, GraphicsUnit.Pixel);
                    g.DrawString(targetName, fontName, Brushes.Black, X - drawWidth / 2 + Width / 8 + 2, Y - drawHeight / 2 + 1);
                    g.DrawString(targetName, fontName, Brushes.Wheat, X - drawWidth / 2 + Width / 8, Y - drawHeight / 2);
                    fontName.Dispose();
                }
                else
                {
                    if (HasFlag(ScenePosFlagType.Detected))
                    {
                        if (EventId > 0)
                        {
                            g.DrawImage(SceneBook.GetSceneQuestImage(EventId), new Rectangle(X, Y - Width / 2 + Height / 2, Width / 2, Width / 2), 0, 0, 180, 180, GraphicsUnit.Pixel);
                        }
                        else
                        {
                            g.DrawImage(markQuest, destRect, 0, 0, markQuest.Width, markQuest.Height, GraphicsUnit.Pixel, HSImageAttributes.ToGray);
                        }
                    }
                }
            }

            markQuest.Dispose();
        }
Exemplo n.º 3
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);
            }
        }