private void picMap_MouseMove(object sender, MouseEventArgs e)
        {
            var mouseCoord = new Point(e.X / siteSize.Width, e.Y / siteSize.Height);

            lblMapCoords.Text = string.Format("({0}, {1})", mouseCoord.X, mouseCoord.Y);
            if (sitesToolStripMenuItem.Checked)
            {
                selectedSite = GetSiteAt(mouseCoord);
                if (selectedSite != null)
                {
                    lblMapName.Text    = selectedSite.ToString();
                    lblMapAltName.Text = selectedSite.AltName;

                    lblMapOwner.Text = selectedSite.Owner != null?selectedSite.Owner.ToString() : "";

                    lblMapParentCiv.Text = selectedSite.Parent != null?selectedSite.Parent.ToString() : "";

                    lblMapType.Text = WorldClasses.Site.Types[selectedSite.Type];
                    lblMapNickNameCaption.Visible = true;
                    lblMapOwnerCaption.Visible    = true;
                    lblMapParentCaption.Visible   = true;
                }
                else
                {
                    lblMapName.Text      = "";
                    lblMapAltName.Text   = "";
                    lblMapOwner.Text     = "";
                    lblMapParentCiv.Text = "";
                    lblMapType.Text      = "";
                }
            }
            else if (regionsToolStripMenuItem.Checked)
            {
                selectedRegion = GetRegionAt(mouseCoord);
                if (selectedRegion != null)
                {
                    lblMapName.Text = selectedRegion.ToString();
                    lblMapType.Text = WorldClasses.Region.Types[selectedRegion.Type];
                    lblMapNickNameCaption.Visible = true;
                    lblMapOwnerCaption.Visible    = true;
                    lblMapParentCaption.Visible   = true;
                }
                else
                {
                    lblMapName.Text = "";
                    lblMapType.Text = "";
                }
            }
        }
Beispiel #2
0
        public void RegionXML_Parses()
        {
            var world = LoadingWorld.GetTestWorld();
            var xdoc  = new XDocument(new XElement("region",
                                                   new XElement("id", 0),
                                                   new XElement("name", "the ocean of luster"),
                                                   new XElement("type", "Ocean")
                                                   )
                                      );

            var region = new Region(xdoc, world);

            Assert.AreEqual(region.Name, "the ocean of luster");
            Assert.AreEqual(Region.Types[region.Type], "Ocean");
        }