当前位置: 首页>>代码示例>>C#>>正文


C# City.Parse方法代码示例

本文整理汇总了C#中City.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# City.Parse方法的具体用法?C# City.Parse怎么用?C# City.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在City的用法示例。


在下文中一共展示了City.Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MapCity

        public MapCity(SimulationWorld world, ConfigurationSection sect)
        {
            City city = new City(world);
            city.Parse(sect);

            LinkableCity = city.LinkableCityName;
            FarmCount = city.FarmLandCount;
            ProblemEnvironment = city.ProblemEnvironment;
            ProblemEducation = city.ProblemEducation;
            ProblemDisease = city.ProblemDisease;
            ProblemChild = city.ProblemChild;
            ProblemGender = city.ProblemGender;
            ProblemHunger = city.ProblemHunger;
            ProblemMaternal = city.ProblemMaternal;

            Name = city.Name;
            Size = city.Size;

            Longitude = city.Longitude;
            Latitude = city.Latitude;

            StartUp = city.StartUp;
        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:23,代码来源:MapObject.cs

示例2: Test

        public static void Test()
        {
            Player player = new Player("");
            SimulationRegion region = new SimulationRegion();

            City city = new City(region);
            City city2 = new City(region);

            IniSection sect = new IniSection("");
            sect.Add("Name", "HUST");
            sect.Add("Longitude", "0");
            sect.Add("Latitude", "0");
            sect.Add("Population", "150");
            sect.Add("Size", UrbanSize.Large.ToString());

            city.Parse(sect);



            sect = new IniSection("");
            sect.Add("Name", "Home");
            sect.Add("Longitude", "1");
            sect.Add("Latitude", "0");
            sect.Add("Population", "1");
            sect.Add("Size", UrbanSize.Small.ToString());

            city2.Parse(sect);

            region.Add(city);
            //region.Add(city2);

            //city.AddNearbyCity(city2);
            //city2.AddNearbyCity(city);



            OilField oilFld = new OilField(region);
            sect = new IniSection("");
            sect.Add("Amount", "100000");
            sect.Add("Latitude", "1");
            sect.Add("Longitude", "0");
            oilFld.Parse(sect);
            region.Add(oilFld);


            CityPluginType plgType = new CityPluginType();
            sect = new IniSection("");
            sect.Add("Cost", "100");
            sect.Add("HRCSpeed", "100");
            sect.Add("Behaviour", CityPluginBehaviourType.CollectorFactory.ToString());
            plgType.Parse(sect);

            CityPlugin plg = new CityPlugin(plgType, CityPluginTypeId.OilRefinary);
            city.Add(plg);



            plgType = new CityPluginType();
            sect = new IniSection("");
            sect.Add("Cost", "100");
            sect.Add("FoodConvRate", "0.50");
            sect.Add("FoodCostSpeed", "100");
            sect.Add("Behaviour", CityPluginBehaviourType.CollectorFactory.ToString());
            plgType.Parse(sect);
            plg = new CityPlugin(plgType, CityPluginTypeId.BiofuelFactory);
            city.Add(plg);



            //OilField oil = new OilField(region);
            //Forest forest = new Forest(region);
            float c = 0;
            while (true)
            {
                Console.Clear();
                Console.WriteLine("Energy Status:");
                Console.Write(" Current Food Storage   ");
                Console.WriteLine(region.EnergyStatus.CurrentFood);
                Console.Write(" Current HR Storage   ");
                Console.WriteLine(region.EnergyStatus.CurrentHR);
                Console.Write(" Current LR Storage   ");
                Console.WriteLine(region.EnergyStatus.CurrentLR);
                Console.Write(" Current Natural HR   ");
                Console.WriteLine(region.EnergyStatus.RemainingHR);
                Console.Write(" Current Natural LR   ");
                Console.WriteLine(region.EnergyStatus.RemainingLR);



                Console.WriteLine("City :" + city.Name);
                Console.WriteLine("City Status:");
                Console.Write(" Development   ");
                Console.WriteLine(city.Development);
                Console.Write(" Population   ");
                Console.WriteLine(city.Population);
                Console.Write(" Disease   ");
                Console.WriteLine(city.Disease);
                Console.Write(" Size   ");
                Console.WriteLine(city.Size);

//.........这里部分代码省略.........
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:101,代码来源:Program.cs


注:本文中的City.Parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。