/// <summary> /// 展示任务 /// </summary> public void ShowMission(string type, Place place, Human human) { this.name = type; this.typeIndex = Globle.Split(MissionInfo.Default.Name).ToList().IndexOf(type); this.desc = Globle.Split(MissionInfo.Default.Desc)[typeIndex]; button2.Enabled = true; currentMission = new Mission(typeIndex, place); Globle.CurrentMission = currentMission; label1.Text = "任务类型:" + name; label3.Text = "任务描述:" + desc; Random random = new Random(); pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\image\\mission\\0 (" + random.Next(1, 17) + ").jpg"); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; checkedListBox1.Items.Clear(); if (place == null) { return; } if (human != null) { humen = new List <Human>() { human }; } else { //目前是传入当地块无任务的弟子 humen = Globle.AllHumansList.FindAll(obj => obj.SetPlace == place).FindAll(o => o.Mission == null); } foreach (var h in humen) { if (h.Mission == null) { string temp = h.Last + h.Name + " " /*+ (h.Sex == false ? "女" : "男") + " " */ + h.GetLevel(); temp = StringAlign(temp); checkedListBox1.Items.Add(temp, false); } } if (humen.Count == 1) { checkedListBox1.SetItemChecked(0, true);//只有一个默认选中 checkedListBox1.Enabled = false; } else { checkedListBox1.Enabled = true; } }
/// <summary> /// 展示任务 /// </summary> /// <param name="mType">任务类别名称</param> /// <param name="place">任务地点</param> public void ShowMission(string mType, Place place) { int typeIndex = Globle.Split(MissionInfo.Default.Name).ToList().FindIndex(o => o == mType); currentMission = new Mission(typeIndex, place); label1.Text = "任务类型:" + currentMission.Name; label2.Text = "任务地点:" + currentMission.Place.PlaceName; label3.Text = "任务描述:" + currentMission.Desc; label4.Text = "任务工量:" + currentMission.MaxProgress; label5.Text = "历练奖励:" + currentMission.Exp; button2.Enabled = false; Random random = new Random(); pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\image\\mission\\" + typeIndex + " (" + random.Next(1, 6) + ").jpg"); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; checkedListBox1.Items.Clear(); if (place.Sect != null) { foreach (var h in place.Sect.SectMember) { if (h.Mission != null) { continue; } //跳过有任务的 string temp = h.Last + h.Name + " " /*+ (h.Sex == false ? "女" : "男") + " "*/ + h.GetLevel() + " " + (h.SetPlace == place ? "本地" : ""); //判断是否本地人 temp = StringAlign(temp); checkedListBox1.Items.Add(temp, false); } } else { //测试用,找最近的门派弟子 Sect sect = Sect.GetLatelySect(place); if (sect == null) { return; } foreach (var h in sect.SectMember) { if (h.Mission != null) { continue; } //跳过有任务的 string temp = h.Last + h.Name + " " /*+ (h.Sex == false ? "女" : "男") + " " */ + h.GetLevel() + " " + (h.SetPlace == place ? "本地" : ""); //判断是否本地人 temp = StringAlign(temp); checkedListBox1.Items.Add(temp, false); } } }