Exemple #1
0
        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();
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
        /// <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);
        }