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


C# Troop.LoadPersonsFromString方法代码示例

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


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

示例1: LoadGameDataFromDataBase


//.........这里部分代码省略.........
            DbConnection.Close();
            DbConnection.Open();
            reader = new OleDbCommand("Select * From Architecture", DbConnection).ExecuteReader();
            while (reader.Read())
            {
                Architecture architecture = new Architecture();
                architecture.Scenario = this;
                architecture.ID = (short)reader["ID"];
                try
                {
                    architecture.CaptionID = (short)reader["CaptionID"];
                }
                catch
                {
                    architecture.CaptionID = 9999;

                }
                architecture.Name = reader["Name"].ToString();
                architecture.Kind = this.GameCommonData.AllArchitectureKinds.GetArchitectureKind((short)reader["Kind"]);
                architecture.IsStrategicCenter = (bool)reader["IsStrategicCenter"];
                architecture.LocationState = this.States.GetGameObject((short)reader["StateID"]) as State;
                architecture.LocationState.Architectures.Add(architecture);
                architecture.LocationState.LinkedRegion.Architectures.Add(architecture);
                if (architecture.LocationState.StateAdminID == architecture.ID)
                {
                    architecture.LocationState.StateAdmin = architecture;
                }
                if (architecture.LocationState.LinkedRegion.RegionCoreID == architecture.ID)
                {
                    architecture.LocationState.LinkedRegion.RegionCore = architecture;
                }
                architecture.Characteristics.LoadFromString(this.GameCommonData.AllInfluences, reader["Characteristics"].ToString());
                architecture.LoadFromString(architecture.ArchitectureArea, reader["Area"].ToString());
                architecture.LoadPersonsFromString(this.AllPersons, reader["Persons"].ToString());
                architecture.LoadMovingPersonsFromString(this.AllPersons, reader["MovingPersons"].ToString());
                architecture.LoadNoFactionPersonsFromString(this.AllPersons, reader["NoFactionPersons"].ToString());
                architecture.LoadNoFactionMovingPersonsFromString(this.AllPersons, reader["NoFactionMovingPersons"].ToString());
                architecture.LoadfeiziPersonsFromString(this.AllPersons, reader["feiziliebiao"].ToString());
                architecture.Population = (int)reader["Population"];
                architecture.Fund = (int)reader["Fund"];
                architecture.Food = (int)reader["Food"];
                architecture.Agriculture = (int)reader["Agriculture"];
                architecture.Commerce = (int)reader["Commerce"];
                architecture.Technology = (int)reader["Technology"];
                architecture.Domination = (int)reader["Domination"];
                architecture.Morale = (int)reader["Morale"];
                architecture.Endurance = (int)reader["Endurance"];
                architecture.AutoHiring = (bool)reader["AutoHiring"];
                architecture.AutoRewarding = (bool)reader["AutoRewarding"];
                architecture.AutoWorking = (bool)reader["AutoWorking"];
                architecture.AutoSearching = (bool)reader["AutoSearching"];
                architecture.HireFinished = (bool)reader["HireFinished"];
                architecture.FacilityEnabled = (bool)reader["FacilityEnabled"];

                try
                {
                    architecture.MilitaryPopulation = (int)reader["MilitaryPopulation"];
                }
                catch
                {
                }

                architecture.LoadMilitariesFromString(this.Militaries, reader["Militaries"].ToString());
                architecture.LoadFacilitiesFromString(this.Facilities, reader["Facilities"].ToString());
                architecture.BuildingFacility = (int)reader["BuildingFacility"];
                architecture.BuildingDaysLeft = (int)reader["BuildingDaysLeft"];
开发者ID:ptmaster,项目名称:ZhongHuaSanGuoZhi,代码行数:67,代码来源:GameScenario.cs

示例2: LoadGameDataFromDataBase


//.........这里部分代码省略.........
                }
                catch
                {
                    architecture.CaptionID = 9999;

                }
                architecture.Name = reader["Name"].ToString();
                architecture.Kind = this.GameCommonData.AllArchitectureKinds.GetArchitectureKind((short)reader["Kind"]);
                if (architecture.Kind == null)
                {
                    e.Add("建筑种类ID" + reader["Kind"] + "不存在");
                }
                architecture.IsStrategicCenter = (bool)reader["IsStrategicCenter"];
                architecture.LocationState = this.States.GetGameObject((short)reader["StateID"]) as State;
                if (architecture.LocationState == null)
                {
                    e.Add("州域ID" + reader["Kind"] + "不存在");
                }
                else
                {
                    architecture.LocationState.Architectures.Add(architecture);
                    architecture.LocationState.LinkedRegion.Architectures.Add(architecture);
                    if (architecture.LocationState.StateAdminID == architecture.ID)
                    {
                        architecture.LocationState.StateAdmin = architecture;
                    }
                    if (architecture.LocationState.LinkedRegion.RegionCoreID == architecture.ID)
                    {
                        architecture.LocationState.LinkedRegion.RegionCore = architecture;
                    }
                }
                e.AddRange(architecture.Characteristics.LoadFromString(this.GameCommonData.AllInfluences, reader["Characteristics"].ToString()));
                architecture.LoadFromString(architecture.ArchitectureArea, reader["Area"].ToString());
                e.AddRange(architecture.LoadPersonsFromString(this.AllPersons, reader["Persons"].ToString(), PersonStatus.Normal));
                e.AddRange(architecture.LoadPersonsFromString(this.AllPersons, reader["MovingPersons"].ToString(), PersonStatus.Moving));
                e.AddRange(architecture.LoadPersonsFromString(this.AllPersons, reader["NoFactionPersons"].ToString(), PersonStatus.NoFaction));
                e.AddRange(architecture.LoadPersonsFromString(this.AllPersons, reader["NoFactionMovingPersons"].ToString(), PersonStatus.NoFactionMoving));
                e.AddRange(architecture.LoadPersonsFromString(this.AllPersons, reader["feiziliebiao"].ToString(), PersonStatus.Princess));
                architecture.Population = (int)reader["Population"];
                architecture.Fund = (int)reader["Fund"];
                architecture.Food = (int)reader["Food"];
                architecture.Agriculture = (int)reader["Agriculture"];
                architecture.Commerce = (int)reader["Commerce"];
                architecture.Technology = (int)reader["Technology"];
                architecture.Domination = (int)reader["Domination"];
                architecture.Morale = (int)reader["Morale"];
                architecture.Endurance = (int)reader["Endurance"];
                architecture.AutoHiring = (bool)reader["AutoHiring"];
                architecture.AutoRewarding = (bool)reader["AutoRewarding"];
                architecture.AutoWorking = (bool)reader["AutoWorking"];
                architecture.AutoSearching = (bool)reader["AutoSearching"];

                try
                {
                    architecture.AutoRecruiting = (bool)reader["AutoRecruiting"];
                }
                catch
                {
                }

                architecture.HireFinished = (bool)reader["HireFinished"];
                architecture.FacilityEnabled = (bool)reader["FacilityEnabled"];

                try
                {
                    architecture.MilitaryPopulation = (int)reader["MilitaryPopulation"];
开发者ID:hero1991,项目名称:ZhongHuaSanGuoZhi,代码行数:67,代码来源:GameScenario.cs


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