/// <summary> /// 展示人物信息 /// </summary> /// <param name="human"></param> public void ShowHumanInfo(Human human) { this.human = human; int sum = 0; foreach (var item in human.FiveElements) { if (item > 0) { sum++; } } label2.Text = sum + "灵根"; label1.Text = human.Last + human.Name + "\t年龄:" + human.Age + " / " + human.MaxAge; Sect sect = Globle.AllSectList.Find(obj => obj == human.Sect); pictureBox1.BackColor = sect.SectColor;//人物背景颜色和门派一致 pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; Image backimage = Image.FromFile(Application.StartupPath + "\\image\\flags\\flag (" + sect.SectFlagIndex + ").png"); pictureBox1.BackgroundImage = backimage; pictureBox1.BackgroundImageLayout = ImageLayout.None; string str = human.Sex == false ? "female" : "male"; pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\image\\human\\" + str + "\\" + str + " (" + human.PicIndex + ").png"); //pictureBox1.Refresh(); fiveGraph1.SetFiveGraph(human.FiveElements); }
/// <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); } } }
/// <summary> /// 生成门派按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { //double d= Draw.ComparePoints(Globle.AllPlaceList[29].Coordinate, Globle.AllPlaceList[30].Coordinate); if (Globle.AllSectList.Count > 0) { Globle.AllSectList = new List <Sect>(); Settings1.Default.Sect_UsedName = ""; } Sect.RandomCreateSectsPlace(Globle.AllPlaceList, 20, Globle.Seed, 10);//生成sect for (int i = 0; i < Globle.AllSectList.Count; i++) { Draw.DrawPlaceHexagon(Globle.G1, Globle.AllSectList[i].SectPlaceList[0]); } pictureBox1.Refresh();//刷新 }
/// <summary> /// 显示门派信息 /// </summary> /// <param name="sect"></param> public void ShowSectInfo(Sect sect) { currentSect = sect; if (sect == null) { pictureBox1.BackColor = Color.Gray; pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\image\\flags\\flag (0).png"); label1.Text = "无所属"; processExt1.Visible = false; return; } pictureBox1.BackColor = sect.SectColor; pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\image\\flags\\flag (" + sect.SectFlagIndex + ").png"); //pictureBox1.Refresh(); label1.Text = sect.SectName + sect.SectSuffix + "\n正邪:" + sect.SectJustice; processExt1.Visible = true; processExt1.Value = sect.SectJustice; resShow1.ShowResources(sect.SectResources); }
/// <summary> /// 鼠标单击事件,点击地块,找到地块和周围地块 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { if (Globle.AllPlaceList.Count <= 0) { return; } if (e.Button == MouseButtons.Left && e.X > 0 && e.Y > 0) { ///判断当前窗口,用于任务选择相应点 if (Globle.IsSelect == true) { string error = Globle.CurrentMission.JudgeError(currentPlace); if (error != null) { MessageBox.Show(error, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (var form in Application.OpenForms) { if (form is MissionForm) { ((MissionForm)form).SetSitePlace(currentPlace); ((MissionForm)form).Enabled = true; Globle.IsSelect = false; ((MissionForm)form).Show(); break; } else { //((Form)form).Enabled = true; ((Form)form).Show(); } } //DistrictForm dist = DistrictForm.CreateInstrance();//换place后应重新设置区划窗口内容 //dist.ShowDistrictInfo(item); return; } //Globle.SelectPlace = item; DistrictForm district = DistrictForm.CreateInstrance();//打开区划窗口 district.ShowDistrictInfo(currentPlace); district.Show(); Sect sect = Globle.AllSectList.Find(obj => obj.SectPlaceList[0].Index == currentPlace.Index); if (sect == null) { return; } //{ SectForm sectForm = SectForm.CreateInstrance();//打开门派窗口 sectForm.ShowSectInfo(sect); sectForm.Show(); //} //刷新人员窗口 if (Application.OpenForms["HumanList"] != null && sect != null) { ((HumanList)(Application.OpenForms["HumanList"])).ShowHumanList(Globle.AllHumansList.FindAll(obj => obj.Sect == sect)); } } else if (e.Button == MouseButtons.Right)//右键任务事件 { contextMenuStrip1.Items.Clear(); List <string> list = Mission.GetLocationMissionList(currentPlace); foreach (var str in list) { contextMenuStrip1.Items.Add(str); } contextMenuStrip1.Show(pictureBox1, e.X, e.Y); } }