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


C# Person.GetClosePersons方法代码示例

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


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

示例1: SavePersonBasicData

        private void SavePersonBasicData(Person p)
        {
            try
            {
                p.SurName = this.tbSurName.Text;
                p.GivenName = this.tbGivenName.Text;
                p.CalledName = this.tbCalledName.Text;
                p.PictureIndex = int.Parse(this.tbPic.Text);
                p.Ideal = int.Parse(this.tbIdeal.Text);
                p.IdealTendency = this.cbIdealTendency.SelectedItem as IdealTendencyKind;
                p.BornRegion = (PersonBornRegion) this.cbBornRegion.SelectedIndex;
                p.AvailableLocation = int.Parse(this.tbAvailableLocation.Text);
                p.YearAvailable = int.Parse(this.tbAvailableYear.Text);
                p.YearBorn = int.Parse(this.tbBornYear.Text);
                p.YearDead = int.Parse(this.tbDeadYear.Text);
                p.DeadReason = (PersonDeadReason) this.cbDeadReason.SelectedIndex;
                p.Strength = int.Parse(this.tbStrength.Text);
                p.Command = int.Parse(this.tbCommand.Text);
                p.Intelligence = int.Parse(this.tbIntelligence.Text);
                p.Politics = int.Parse(this.tbPolitics.Text);
                p.Glamour = int.Parse(this.tbGlamour.Text);
                p.StrengthExperience = int.Parse(this.tbStrengthExperience.Text);
                p.CommandExperience = int.Parse(this.tbCommandExperience.Text);
                p.IntelligenceExperience = int.Parse(this.tbIntelligenceExperience.Text);
                p.PoliticsExperience = int.Parse(this.tbPoliticsExperience.Text);
                p.GlamourExperience = int.Parse(this.tbGlamourExperience.Text);
                p.Braveness = int.Parse(this.tbBraveness.Text);
                p.Calmness = int.Parse(this.tbCalmness.Text);
                p.Loyalty = int.Parse(this.tbLoyalty.Text);
                p.Character = p.Scenario.GameCommonData.AllCharacterKinds[this.cbCharacter.SelectedIndex];
                p.Strain = int.Parse(this.tbStrain.Text);
                int t;
                int.TryParse(this.tbFather.Text, out t);
                p.Father = p.Scenario.Persons.GetGameObject(t) as Person;
                int.TryParse(this.tbMother.Text, out t);
                p.Mother = p.Scenario.Persons.GetGameObject(t) as Person;
                int.TryParse(this.tbSpouse.Text, out t);
                p.Spouse = p.Scenario.Persons.GetGameObject(t) as Person;

                p.Brothers.Clear();
                char[] separator = new char[] { ' ', '\n', '\r', '\t' };
                string[] strArray = this.tbBrother.Text.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                foreach (String s in strArray)
                {
                    int.TryParse(s, out t);
                    Person q = this.Persons.GetGameObject(t) as Person;
                    p.Brothers.Add(q);
                }

                p.Generation = int.Parse(this.tbGeneration.Text);
                p.PersonalLoyalty = (int) this.cbPersonalLoyalty.SelectedIndex;
                p.Ambition = (int) this.cbAmbition.SelectedIndex;
                p.Qualification = (PersonQualification) this.cbQualification.SelectedIndex;
                p.ValuationOnGovernment = (PersonValuationOnGovernment) this.cbValuationOnGovernment.SelectedIndex;
                p.StrategyTendency = (PersonStrategyTendency) this.cbStrategyTendency.SelectedIndex;
                try
                {
                    StaticMethods.LoadFromString(p.JoinFactionID, this.tbOldFactionID.Text);
                }
                catch
                {
                }

                PersonList pl = p.GetClosePersons();
                foreach (Person q in pl)
                {
                    p.RemoveClose(q);
                }
                pl = p.GetHatedPersons();
                foreach (Person q in pl)
                {
                    p.RemoveHated(q);
                }

                foreach (string str in this.lbClosePersons.Items)
                {
                    int id = int.Parse(str.Substring(0, str.IndexOf(" ")));
                    p.AddClose(p.Scenario.Persons.GetGameObject(id) as Person);
                }

                foreach (string str in this.lbHatedPersons.Items)
                {
                    int id = int.Parse(str.Substring(0, str.IndexOf(" ")));
                    p.AddHated(p.Scenario.Persons.GetGameObject(id) as Person);
                }
            }
            catch
            {
                MessageBox.Show("请输入正确的数据格式。");
            }
        }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:91,代码来源:frmEditPerson.cs

示例2: createChildren


//.........这里部分代码省略.........
                    calmness = b.Calmness;
                    personalLoyalty = b.PersonalLoyalty;
                    ambition = b.Ambition;

                    if (b.Text.Count > 0)
                    {
                        adjectives.Add(b.Text[GameObject.Random(b.Text.Count)]);
                    }
                    if (b.SuffixText.Count > 0)
                    {
                        suffixes.Add(b.SuffixText[GameObject.Random(b.SuffixText.Count)]);
                    }
                }
            }
            if (adjectives.Count > 0)
            {
                foreach (String s in adjectives)
                {
                    biography += s + ",";
                }
                biography = biography.Substring(0, biography.Length - 1);
                if (adjectives.Count > 0)
                {
                    biography += "的" + (suffixes.Count > 0 ? suffixes[GameObject.Random(suffixes.Count)] : "將領");
                }
                biography += "。";
            }

            Biography bio = new Biography();
            bio.Brief = biography;
            bio.ID = r.ID;
            Biography fatherBio = father.Scenario.GameCommonData.AllBiographies.GetBiography(father.ID);
            if (fatherBio != null)
            {
                bio.FactionColor = fatherBio.FactionColor;
                bio.MilitaryKinds = fatherBio.MilitaryKinds;
            }
            else
            {
                bio.FactionColor = 52;
                bio.MilitaryKinds.AddBasicMilitaryKinds(father.Scenario);
            }
            father.Scenario.GameCommonData.AllBiographies.AddBiography(bio);
            r.PersonBiography = bio;

            /*r.LocationArchitecture = father.BelongedArchitecture; //mother has no location arch!
            r.BelongedFaction = r.BelongedArchitecture.BelongedFaction;
            r.Available = true;*/
            r.Alive = true;

            father.Scenario.Persons.Add(r);

            r.Scenario = father.Scenario;

            foreach (Person p in father.Scenario.Persons)
            {
                int fatherRel = father.GetRelation(p);
                int motherRel = mother.GetRelation(p);

                if (fatherRel != 0 && motherRel != 0)
                {
                    int rel = GameObject.Random(Math.Abs(fatherRel - motherRel)) + Math.Min(fatherRel, motherRel);
                    p.SetRelation(p, rel);
                }
            }

            foreach (Person p in father.GetClosePersons())
            {
                if (!GameObject.Chance((int)r.personalLoyalty * 25))
                {
                    r.AddClose(p);
                }
            }
            foreach (Person p in father.GetClosePersons())
            {
                if (!GameObject.Chance((int)r.personalLoyalty * 25))
                {
                    r.AddClose(p);
                }
            }

            foreach (Person p in father.GetHatedPersons())
            {
                if (!GameObject.Chance((int)r.personalLoyalty * 25))
                {
                    r.AddHated(p);
                }
            }
            foreach (Person p in father.GetHatedPersons())
            {
                if (!GameObject.Chance((int)r.personalLoyalty * 25))
                {
                    r.AddHated(p);
                }
            }

            ExtensionInterface.call("CreateChildren", new Object[] { father.Scenario, r });

            return r;
        }
开发者ID:ptmaster,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:Person.cs


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