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


C# Architecture.LoadFromString方法代码示例

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


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

示例1: LoadGameDataFromDataBase


//.........这里部分代码省略.........
                person.Calmness = (short)reader["Calmness"];
                person.Loyalty = (short)reader["Loyalty"];
                person.BornRegion = (PersonBornRegion)((short)reader["BornRegion"]);
                person.AvailableLocation = (short)reader["AvailableLocation"];
                person.Strain = (short)reader["Strain"];
                fatherIds[person.ID] = (short)reader["Father"];
                motherIds[person.ID] = (short)reader["Mother"];
                spouseIds[person.ID] = (short)reader["Spouse"];

                String str = reader["Brother"].ToString();
                char[] separator = new char[] { ' ', '\n', '\r', '\t' };
                string[] strArray = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                int[] intArray = new int[strArray.Length];
                for (int i = 0; i < strArray.Length; i++)
                {
                    intArray[i] = int.Parse(strArray[i]);
                }
                brotherIds.Add(person.ID, intArray);

                person.Generation = (short)reader["Generation"];
                person.PersonalLoyalty = ((short)reader["PersonalLoyalty"]);
                person.Ambition = ((short)reader["Ambition"]);
                person.Qualification = (PersonQualification)((short)reader["Qualification"]);
                person.ValuationOnGovernment = (PersonValuationOnGovernment)((short)reader["ValuationOnGovernment"]);
                person.StrategyTendency = (PersonStrategyTendency)((short)reader["StrategyTendency"]);
                person.OldFactionID = (short)reader["OldFactionID"];
                person.RewardFinished = (bool)reader["RewardFinished"];
                person.WorkKind = (ArchitectureWorkKind)((short)reader["WorkKind"]);
                person.OldWorkKind = (ArchitectureWorkKind)((short)reader["OldWorkKind"]);
                person.RecruitmentMilitary = null;
                person.ArrivingDays = (short)reader["ArrivingDays"];
                person.TaskDays = (short)reader["TaskDays"];
                person.OutsideTask = (OutsideTaskKind)((short)reader["OutsideTask"]);
                person.OutsideDestination = StaticMethods.LoadFromString(reader["OutsideDestination"].ToString());
                person.ConvincingPersonID = (short)reader["ConvincingPerson"];
                person.InformationKindID = (short)reader["InformationKind"];

                str = reader["ClosePersons"].ToString();
                strArray = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                intArray = new int[strArray.Length];
                for (int i = 0; i < strArray.Length; i++)
                {
                    intArray[i] = int.Parse(strArray[i]);
                }
                closeIds.Add(person.ID, intArray);

                str = reader["HatedPersons"].ToString();
                strArray = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                intArray = new int[strArray.Length];
                for (int i = 0; i < strArray.Length; i++)
                {
                    intArray[i] = int.Parse(strArray[i]);
                }
                hatedIds.Add(person.ID, intArray);

                person.Skills.LoadFromString(this.GameCommonData.AllSkills, reader["Skills"].ToString());

                try
                {
                    person.LoadTitleFromString(reader["Title"].ToString(), this.GameCommonData.AllTitles);
                }
                catch
                {
                    Title t = this.GameCommonData.AllTitles.GetTitle((short)reader["PersonalTitle"]);
                    if (t != null)
                    {
开发者ID:ptmaster,项目名称:ZhongHuaSanGuoZhi,代码行数:67,代码来源:GameScenario.cs

示例2: LoadGameDataFromDataBase


//.........这里部分代码省略.........
                person.Sex = (bool)reader["Sex"];
                person.PictureIndex = (short)reader["Pic"];
                person.Ideal = (short)reader["Ideal"];
                person.IdealTendency = this.GameCommonData.AllIdealTendencyKinds.GetGameObject((short)reader["IdealTendency"]) as IdealTendencyKind;
                if (person.IdealTendency == null)
                {
                    errors.Add("出仕相性考虑ID" + (short)reader["IdealTendency"] + "不存在");
                }
                person.LeaderPossibility = (bool)reader["LeaderPossibility"];
                person.Character = this.GameCommonData.AllCharacterKinds[(short)reader["PCharacter"]];
                if (person.Character == null)
                {
                    errors.Add("性格ID" + (short)reader["PCharacter"] + "不存在");
                }
                person.YearAvailable = (short)reader["YearAvailable"];
                person.YearBorn = (short)reader["YearBorn"];
                person.YearDead = (short)reader["YearDead"];
                if ((short)reader["DeadReason"] >= Enum.GetNames(typeof(PersonDeadReason)).Length || (short)reader["DeadReason"] < 0)
                {
                    errors.Add("人物死亡原因必须在0至" + Enum.GetNames(typeof(PersonDeadReason)).Length + "之间");
                }
                else
                {
                    person.DeadReason = (PersonDeadReason)((short)reader["DeadReason"]);
                }
                person.BaseStrength = (short)reader["Strength"];
                person.BaseCommand = (short)reader["Command"];
                person.BaseIntelligence = (short)reader["Intelligence"];
                person.BasePolitics = (short)reader["Politics"];
                person.BaseGlamour = (short)reader["Glamour"];
                person.Reputation = (int)reader["Reputation"];
                try
                {
                    errors.AddRange(person.UniqueMilitaryKinds.LoadFromString(this.GameCommonData.AllMilitaryKinds, reader["UniqueMilitaryKinds"].ToString()));
                    errors.AddRange(person.UniqueTitles.LoadFromString(this.GameCommonData.AllTitles, reader["UniqueTitles"].ToString()));
                }
                catch
                {
                }
                person.StrengthExperience = (int)reader["StrengthExperience"];
                person.CommandExperience = (int)reader["CommandExperience"];
                person.IntelligenceExperience = (int)reader["IntelligenceExperience"];
                person.PoliticsExperience = (int)reader["PoliticsExperience"];
                person.GlamourExperience = (int)reader["GlamourExperience"];
                person.InternalExperience = (int)reader["InternalExperience"];
                person.TacticsExperience = (int)reader["TacticsExperience"];
                person.BubingExperience = (int)reader["BubingExperience"];
                person.NubingExperience = (int)reader["NubingExperience"];
                person.QibingExperience = (int)reader["QibingExperience"];
                person.ShuijunExperience = (int)reader["ShuijunExperience"];
                person.QixieExperience = (int)reader["QixieExperience"];
                person.StratagemExperience = (int)reader["StratagemExperience"];
                person.RoutCount = (int)reader["RoutCount"];
                person.RoutedCount = (int)reader["RoutedCount"];
                person.Braveness = (short)reader["Braveness"];
                person.Calmness = (short)reader["Calmness"];
                person.Loyalty = (short)reader["Loyalty"];
                if ((short)reader["DeadReason"] >= Enum.GetNames(typeof(PersonBornRegion)).Length || (short)reader["BornRegion"] < 0)
                {
                    errors.Add("人物出生地点必须在0至" + Enum.GetNames(typeof(PersonBornRegion)).Length + "之间");
                }
                else
                {
                    person.BornRegion = (PersonBornRegion)((short)reader["BornRegion"]);
                }
                person.AvailableLocation = (short)reader["AvailableLocation"];
开发者ID:hero1991,项目名称:ZhongHuaSanGuoZhi,代码行数:67,代码来源:GameScenario.cs


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