Beispiel #1
0
 /// <summary>
 /// District单例模式
 /// </summary>
 /// <returns></returns>
 public static DistrictForm CreateInstrance()
 {
     if (frm == null || frm.IsDisposed)
     {
         frm = new DistrictForm();
     }
     return(frm);
 }
Beispiel #2
0
        /// <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);
            }
        }