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
        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})({2})", config.Name, eventLevel, config.Script), font2, Brushes.White, Width / 2 - 40, 8);
                font2.Dispose();

                e.Graphics.DrawImage(SceneQuestBook.GetSceneQuestImageBig(config.Id), 20, 60, 300, 300);
                Image border = PicLoader.Read("Border", "scenequestbg.png"); //边框
                e.Graphics.DrawImage(border, 20, 60, 300, 300);
                border.Dispose();

                if (config.TriggerRate > 0 && config.TriggerRate <= 30)
                {//稀有
                    Image rareImg = PicLoader.Read("System", "sqrare2.png");
                    e.Graphics.DrawImage(rareImg, 20 + 16, 60 + 16, 64, 32);
                    rareImg.Dispose();
                }
                else if (config.TriggerRate > 0 && config.TriggerRate <= 60)
                {//罕见
                    Image rareImg = PicLoader.Read("System", "sqrare1.png");
                    e.Graphics.DrawImage(rareImg, 20 + 16, 60 + 16, 64, 32);
                    rareImg.Dispose();
                }

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

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

                if (answerList != null && (evtItem == null || evtItem.RunningState != TalkEventItem.TalkEventState.Running))
                {
                    int id       = 0;
                    var bgTarget = PicLoader.Read("System", "WordBack1.png");
                    var bgCommon = PicLoader.Read("System", "WordBack2.png");
                    foreach (var word in answerList)
                    {
                        var rect   = word.Rect;
                        var bgRect = new Rectangle(rect.X, rect.Y, rect.Width - 20, 24);
                        if (id == tar)
                        {
                            e.Graphics.DrawImage(bgTarget, bgRect);
                        }
                        else
                        {
                            e.Graphics.DrawImage(bgCommon, bgRect);
                        }

                        word.Draw(e.Graphics);
                        id++;
                    }
                    bgTarget.Dispose();
                    bgCommon.Dispose();
                }
            }
        }