public void QuestNext(string qname) { int fromId = UserProfile.InfoBasic.Position; while (true) { int index = MathTool.GetRandom(sceneItems.Count); var targetCell = sceneItems[index]; if (targetCell.Id == fromId) { continue; } if (!targetCell.CanBeReplaced()) { continue; } int qId = SceneBook.GetSceneQuestByName(qname); sceneItems[index] = new SceneQuest(targetCell.Id, targetCell.X, targetCell.Y, targetCell.Width, targetCell.Height, qId); sceneItems[index].MapSetting = true; UserProfile.InfoWorld.UpdatePosInfo(targetCell.Id, qId); UserProfile.InfoWorld.UpdatePosMapSetting(targetCell.Id, true); break; } parent.Invalidate(); }
private static Image GetPreview(int id) { SceneConfig sceneConfig = ConfigData.GetSceneConfig(id); ControlPlus.TipImage tipData = new ControlPlus.TipImage(); tipData.AddTextNewLine(sceneConfig.Name, "Lime", 20); tipData.AddTextNewLine(string.Format("地图等级: {0}", sceneConfig.Level), sceneConfig.Level > UserProfile.InfoBasic.Level?"Red": "White"); string[] icons = SceneBook.GetNPCIconsOnMap(id); if (icons.Length > 0) { tipData.AddTextNewLine("设施", "Green"); foreach (string icon in icons) { tipData.AddImage(HSIcons.GetIconsByEName(icon)); } } if (sceneConfig.Func != "") { tipData.AddTextNewLine("特色", "Pink"); string[] funcs = sceneConfig.Func.Split(';'); foreach (string fun in funcs) { tipData.AddImage(HSIcons.GetIconsByEName(string.Format("npc{0}", fun.ToLower()))); } } return(tipData.Image); }
private void selectPanel_SelectedIndexChanged() { if (selectPanel.SelectIndex < 0) { return; } var questConfig = ConfigData.GetQuestConfig(questIds[selectPanel.SelectIndex]); if (!UserProfile.InfoQuest.IsQuestFinish(questConfig.Id)) { return; } colorWord.UpdateText(questConfig.Descript); virtualRegion.SetRegionKey(1,0); virtualRegion.SetRegionKey(2, 0); virtualRegion.SetRegionKey(3, 0); if (!string.IsNullOrEmpty(questConfig.Quest1)) virtualRegion.SetRegionKey(1, SceneBook.GetSceneQuestByName(questConfig.Quest1)); if (!string.IsNullOrEmpty(questConfig.Quest2)) virtualRegion.SetRegionKey(2, SceneBook.GetSceneQuestByName(questConfig.Quest2)); if (!string.IsNullOrEmpty(questConfig.Quest3)) virtualRegion.SetRegionKey(3, SceneBook.GetSceneQuestByName(questConfig.Quest3)); Invalidate(); }
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(); } } }
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(); }
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); } } }
public void HiddenWay() { int fromId = UserProfile.InfoBasic.Position; foreach (var sceneObject in sceneItems) { if (sceneObject is SceneQuest) { var config = ConfigData.GetSceneQuestConfig((sceneObject as SceneQuest).EventId); if (config.Ename == "hiddeway" && sceneObject.Id != fromId) { UserProfile.InfoBasic.Position = sceneObject.Id; parent.Invalidate(); return; } } } while (true) { int index = MathTool.GetRandom(sceneItems.Count); var targetCell = sceneItems[index]; if (targetCell.Id == fromId) { continue; } if (!targetCell.CanBeReplaced()) { continue; } int qId = SceneBook.GetSceneQuestByName("hiddeway"); sceneItems[index] = new SceneQuest(targetCell.Id, targetCell.X, targetCell.Y, targetCell.Width, targetCell.Height, qId); sceneItems[index].MapSetting = true; UserProfile.InfoBasic.Position = targetCell.Id; UserProfile.InfoWorld.UpdatePosInfo(targetCell.Id, qId); UserProfile.InfoWorld.UpdatePosMapSetting(targetCell.Id, true); parent.Invalidate(); break; } }
public MainWindow() { SetWindowTitle("MonoWorks Demo"); var adapter = new ViewportAdapter(this); this.SetCentralWidget(adapter); // create the scene space var sceneSpace = new SceneSpace(adapter.Viewport); adapter.Viewport.RootScene = sceneSpace; var book = new SceneBook(adapter.Viewport); sceneSpace.Root = book; // create the controls scene var controlsScene = new ControlsScene(adapter.Viewport); book.Add(controlsScene); ToolTip = "This is the MonoWorks demo for Qt"; Resize(800, 800); Show(); }
public static List <RLIdValue> GetDungeonQuestConfigData(int mapId) { var config = ConfigData.GetSceneConfig(mapId); List <RLIdValue> datas = new List <RLIdValue>(); if (!String.IsNullOrEmpty(config.QuestDungeon)) { string[] infos = config.QuestDungeon.Split('|'); foreach (var info in infos) { string[] questData = info.Split(';'); int qid = SceneBook.GetSceneQuestByName(questData[0]); if (IsQuestAvail(qid)) { datas.Add(new RLIdValue { Id = qid, Value = Int32.Parse(questData[1]) }); } } } return(datas); }
/// <summary> /// Default constructor. /// </summary> public MainWindow() : base(gtk.WindowType.Toplevel) { Title = "MonoWorks Demo"; DeleteEvent += OnDeleteEvent; // create the viewport adapter var adapter = new ViewportAdapter(); Add(adapter); // create the scene space var sceneSpace = new SceneSpace(adapter.Viewport); adapter.Viewport.RootScene = sceneSpace; var book = new SceneBook(adapter.Viewport); sceneSpace.Root = book; // create the cards scene var cards = new CardScene(adapter.Viewport); book.Add(cards); // create the controls scene var controls = new ControlsScene(adapter.Viewport); book.Add(controls); // create the controls scene var mwx = new MwxScene(adapter.Viewport); book.Add(mwx); // create the 2D plotting scene var plot2d = new Plot2dScene(adapter.Viewport); book.Add(plot2d); // create the 3D plotting scene var plot3d = new Plot3dScene(adapter.Viewport); book.Add(plot3d); ShowAll(); }
private void virtualRegion_RegionEntered(int id, int x, int y, int key) { if (selectPanel.SelectIndex < 0 || selectPanel.SelectIndex >= questIds.Count) { return; } var questConfig = ConfigData.GetQuestConfig(questIds[selectPanel.SelectIndex]); if (!UserProfile.InfoQuest.IsQuestFinish(questConfig.Id)) { return; } string sceneQuestId = ""; string subContext = ""; if (id ==1) { sceneQuestId = questConfig.Quest1; subContext = questConfig.SubDescript1; } if (id == 2) { sceneQuestId = questConfig.Quest2; subContext = questConfig.SubDescript2; } if (id == 3) { sceneQuestId = questConfig.Quest3; subContext = questConfig.SubDescript3; } if (!string.IsNullOrEmpty(sceneQuestId)) { var name = ConfigData.GetSceneQuestConfig(SceneBook.GetSceneQuestByName(sceneQuestId)).Name; Image image = DrawTool.GetImageByString(name, subContext, 150, Color.White); tooltip.Show(image, this, x, y); } }
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); } }
/// <summary> /// 获取一站地图的随机任务列表 /// </summary> public static List <RLIdValue> GetQuestConfigData(int mapId) { var config = ConfigData.GetSceneConfig(mapId); List <RLIdValue> datas = new List <RLIdValue>(); if (config.QPortal > 0)//地磁反转 { datas.Add(new RLIdValue { Id = 42000002, Value = config.QPortal }); } if (config.QCardChange > 0)//卡牌商人 { datas.Add(new RLIdValue { Id = 42000003, Value = config.QCardChange }); } if (config.QPiece > 0)//素材商人 { datas.Add(new RLIdValue { Id = 42000004, Value = config.QPiece }); } if (config.QMerchant > 0)//商人 { datas.Add(new RLIdValue { Id = 42000007, Value = config.QMerchant }); } if (config.QDoctor > 0)//医生 { datas.Add(new RLIdValue { Id = 42000005, Value = config.QDoctor }); } if (config.QAngel > 0)//天使 { datas.Add(new RLIdValue { Id = 42000006, Value = config.QAngel }); } if (!String.IsNullOrEmpty(config.Quest)) { string[] infos = config.Quest.Split('|'); foreach (var info in infos) { string[] questData = info.Split(';'); int qid = SceneBook.GetSceneQuestByName(questData[0]); if (IsQuestAvail(qid)) { datas.Add(new RLIdValue { Id = qid, Value = Int32.Parse(questData[1]) }); } } } if (!String.IsNullOrEmpty(config.QuestRandom)) { string[] infos = config.QuestRandom.Split('|'); foreach (var info in infos) { string[] questData = info.Split(';'); int rate = Int32.Parse(questData[1]); if (MathTool.GetRandom(100) < rate)//概率事件 { int qid = SceneBook.GetSceneQuestByName(questData[0]); if (IsQuestAvail(qid)) { datas.Add(new RLIdValue { Id = qid, Value = 1 }); } } } } return(datas); }