コード例 #1
0
        private static void LoadRegions(XmlElement xml, Map map, Region parent)
        {
            foreach (XmlElement xmlReg in xml.SelectNodes("region"))
            {
                Type type = DefaultRegionType;

                ReadType(xmlReg, "type", ref type, false);

                if (!typeof(Region).IsAssignableFrom(type))
                {
                    Console.WriteLine("Invalid region type '{0}' in regions.xml", type.FullName);
                    continue;
                }

                Region region = null;
                try
                {
                    region = (Region)Activator.CreateInstance(type, new object[] { xmlReg, map, parent });
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error during the creation of region type '{0}': {1}", type.FullName, ex);
                    continue;
                }

                region.Register();

                LoadRegions(xmlReg, map, region);
            }
        }
コード例 #2
0
 public static void AddRegion(Region region)
 {
     Region.m_Regions.Add(region);
     region.Register();
     region.Map.Regions.Add(region);
     region.Map.Regions.Sort();
 }
コード例 #3
0
        public static void AddRegion( Region region )
        {
            m_Regions.Add( region );

            region.Register();
            region.Map.Regions.Add( region );
            region.Map.Regions.Sort();
        }
コード例 #4
0
ファイル: BaseRegion.cs プロジェクト: zerodowned/angelisland
		public static void AddRegion(Region region)
		{
			//Plasma: add in ref check to prevent duplicate regions being added! lol.
			//PS - yes, yes duplicates do get added ;p
			foreach (Region r in Regions)
				if (ReferenceEquals(r, region)) return;

			m_Regions.Add(region);

			region.Register();
			region.Map.Regions.Add(region);
			region.Map.Regions.Sort();
		}