本文整理汇总了C#中GameObjects.PersonList.ReSort方法的典型用法代码示例。如果您正苦于以下问题:C# PersonList.ReSort方法的具体用法?C# PersonList.ReSort怎么用?C# PersonList.ReSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.PersonList
的用法示例。
在下文中一共展示了PersonList.ReSort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: meichushengdehaiziliebiao
public PersonList meichushengdehaiziliebiao()
{
PersonList haiziliebiao = new PersonList();
foreach (Person person in this.Scenario.Persons)
{
if (person.Alive && !person.Available && person.Father == this.ID)
{
haiziliebiao.Add(person);
}
}
haiziliebiao.PropertyName = "YearBorn";
haiziliebiao.IsNumber = true;
haiziliebiao.SmallToBig = true;
haiziliebiao.ReSort();
return haiziliebiao;
}
示例2: ReSortAllWeighingList
private void ReSortAllWeighingList(PersonList zhenzaiPersons, PersonList agriculturePersons, PersonList commercePersons,
PersonList technologyPersons, PersonList dominationPersons, PersonList moralePersons, PersonList endurancePersons,
PersonList recruitmentPersons, PersonList trainingPersons, MilitaryList weighingMilitaries)
{
PersonList pl = this.Persons;
zhenzaiPersons.Clear();
if (this.kezhenzai())
{
foreach (Person person in pl)
{
zhenzaiPersons.Add(person);
}
zhenzaiPersons.IsNumber = true;
zhenzaiPersons.PropertyName = "zhenzaiWeighing";
zhenzaiPersons.ReSort();
}
agriculturePersons.Clear();
if (this.Kind.HasAgriculture)
{
foreach (Person person in pl)
{
agriculturePersons.Add(person);
}
agriculturePersons.IsNumber = true;
agriculturePersons.PropertyName = "AgricultureWeighing";
agriculturePersons.ReSort();
}
commercePersons.Clear();
if (this.Kind.HasCommerce)
{
foreach (Person person in pl)
{
commercePersons.Add(person);
}
commercePersons.IsNumber = true;
commercePersons.PropertyName = "CommerceWeighing";
commercePersons.ReSort();
}
technologyPersons.Clear();
if (this.Kind.HasTechnology)
{
foreach (Person person in pl)
{
technologyPersons.Add(person);
}
technologyPersons.IsNumber = true;
technologyPersons.PropertyName = "TechnologyWeighing";
technologyPersons.ReSort();
}
dominationPersons.Clear();
if (this.Kind.HasDomination)
{
foreach (Person person in pl)
{
dominationPersons.Add(person);
}
dominationPersons.IsNumber = true;
dominationPersons.PropertyName = "DominationWeighing";
dominationPersons.ReSort();
}
moralePersons.Clear();
if (this.Kind.HasMorale)
{
foreach (Person person in pl)
{
moralePersons.Add(person);
}
moralePersons.IsNumber = true;
moralePersons.PropertyName = "MoraleWeighing";
moralePersons.ReSort();
}
endurancePersons.Clear();
if (this.Kind.HasEndurance)
{
foreach (Person person in pl)
{
endurancePersons.Add(person);
}
endurancePersons.IsNumber = true;
endurancePersons.PropertyName = "EnduranceWeighing";
endurancePersons.ReSort();
}
trainingPersons.Clear();
foreach (Person person in pl)
{
trainingPersons.Add(person);
}
trainingPersons.IsNumber = true;
trainingPersons.PropertyName = "TrainingWeighing";
trainingPersons.ReSort();
recruitmentPersons.Clear();
foreach (Person person in this.Persons)
{
recruitmentPersons.Add(person);
}
recruitmentPersons.IsNumber = true;
recruitmentPersons.PropertyName = "RecruitmentWeighing";
recruitmentPersons.ReSort();
weighingMilitaries.Clear();
foreach (Military military in this.Militaries)
//.........这里部分代码省略.........
示例3: AIHouGong
private void AIHouGong()
{
if (base.Scenario.IsPlayer(this.BelongedFaction)) return;
if (this.HasHostileTroopsInView()) return;
if (GlobalVariables.getChildrenRate <= 0) return;
Person leader = this.BelongedFaction.Leader;
int uncruelty = leader.Uncruelty;
//build hougong
int unAmbition = Enum.GetNames(typeof(PersonAmbition)).Length - (int)leader.Ambition;
if (this.BelongedFaction.meinvkongjian() - this.BelongedFaction.feiziCount() <= 0 && (this.BuildingFacility < 0) && (this.PlanFacilityKind == null || this.PlanFacilityKind.rongna <= 0)
&& GameObject.Random((int)(GameObject.Square(unAmbition) * Parameters.AIBuildHougongUnambitionProbWeight + GameObject.Square(this.BelongedFaction.meinvkongjian()) * unAmbition * Parameters.AIBuildHougongSpaceBuiltProbWeight)) == 0)
{
if (((!this.FrontLine && !this.noFactionFrontline) || GameObject.Chance(Parameters.AILeaveFrontlineForHougongChance))
&& (!this.HostileLine || GameObject.Chance(Parameters.AILeaveHostilelineForHougongChance))
&& this.Kind.FacilityPositionUnit > 0 &&
this.Agriculture >= this.AgricultureCeiling * 9 / 10 && this.Commerce >= this.CommerceCeiling * 9 / 10 &&
this.Technology >= this.TechnologyCeiling * 9 / 10 && this.Endurance >= this.EnduranceCeiling * 9 / 10 &&
this.Domination >= this.DominationCeiling * 9 / 10 && this.Morale >= this.MoraleCeiling * 9 / 10)
{
int maxHgSize = (12 - uncruelty) + Math.Max(0, this.FacilityPositionCount / this.Kind.FacilityPositionUnit - 5) + Parameters.AIBuildHougongMaxSizeAdd;
FacilityKind hougong = null;
foreach (FacilityKind fk in base.Scenario.GameCommonData.AllFacilityKinds.FacilityKinds.Values)
{
if ((((!fk.PopulationRelated || this.Kind.HasPopulation) && ((this.Technology >= fk.TechnologyNeeded)))
&& ((!fk.UniqueInArchitecture || !this.ArchitectureHasFacilityKind(kind.ID)) && (!fk.UniqueInFaction || !this.FactionHasFacilityKind(kind.ID)))))
{
if (fk.rongna > 0 && fk.rongna < maxHgSize && GameObject.Chance(Parameters.AIBuildHougongSkipSizeChance))
{
if (hougong == null || hougong.rongna < fk.rongna)
{
hougong = fk;
}
}
}
}
if (hougong != null)
{
int facilityPositionLeft = this.FacilityPositionLeft;
if (facilityPositionLeft < hougong.PositionOccupied && this.FacilityPositionCount >= hougong.PositionOccupied)
{
FacilityList fl = new FacilityList();
foreach (Facility f in this.Facilities)
{
if (!f.Kind.bukechaichu)
{
fl.Add(f);
}
}
int totalRemovableSpace = 0;
foreach (Facility f in fl)
{
totalRemovableSpace += f.PositionOccupied;
}
if (totalRemovableSpace >= hougong.PositionOccupied && this.BelongedSection.AIDetail.AllowFacilityRemoval)
{
fl.PropertyName = "AIValue";
fl.IsNumber = true;
fl.SmallToBig = true;
fl.ReSort();
while (this.FacilityPositionLeft < hougong.PositionOccupied && fl.Count > 0)
{
Facility f = fl[0] as Facility;
if (this.FacilityEnabled || f.MaintenanceCost <= 0)
{
f.Influences.PurifyInfluence(this, Applier.Facility, f.ID);
}
this.Facilities.Remove(f);
base.Scenario.Facilities.Remove(f);
fl.Remove(f);
}
}
/*foreach (Facility facility in this.Facilities.GetList())
{
if ((((this.Technology > facility.TechnologyNeeded) && this.FacilityIsPossibleOverTechnology(facility.TechnologyNeeded))
&& ((this.Fund > (facility.FundCost * 10)) && (this.BelongedFaction.TechniquePoint > (facility.PointCost * 10))))
&& (GameObject.Random(facility.Days * facility.PositionOccupied) < 20 * hougong.PositionOccupied)
&& !facility.Kind.bukechaichu)
{
if (this.FacilityEnabled)
{
facility.Influences.PurifyInfluence(this);
}
this.Facilities.Remove(facility);
base.Scenario.Facilities.Remove(facility);
}
}*/
facilityPositionLeft = this.FacilityPositionLeft;
}
if (facilityPositionLeft >= hougong.PositionOccupied)
{
if ((this.Fund >= hougong.FundCost) && ((this.BelongedFaction.TechniquePoint + this.BelongedFaction.TechniquePointForFacility) >= hougong.PointCost))
{
this.PlanFacilityKind = null;
this.BelongedFaction.DepositTechniquePointForFacility(hougong.PointCost);
this.BeginToBuildAFacility(hougong);
}
//.........这里部分代码省略.........
示例4: GetFirstHalfPersonList
private PersonList GetFirstHalfPersonList(string propertyName)
{
PersonList list = new PersonList();
if (this.Persons.Count > 0)
{
foreach (Person p in this.Persons)
{
list.Add(p);
}
if (list.Count > 1)
{
list.PropertyName = propertyName;
list.IsNumber = true;
list.ReSort();
}
list.GameObjects.RemoveRange(list.Count / 2, list.Count - list.Count / 2);
return (list);
}
return new PersonList();
}
示例5: CallInstigate
private void CallInstigate()
{
if (this.WillArchitecture.Endurance >= (this.WillArchitecture.EnduranceCeiling * 0.2))
{
Person current;
PersonList list = new PersonList();
foreach (LinkNode node in this.WillArchitecture.AIAllLinkNodes.Values)
{
if ((((node.A.BelongedFaction == this.BelongedFaction) && (node.A.Fund >= node.A.InstigateArchitectureFund)) && node.A.BelongedSection.AIDetail.AllowOffensiveTactics) && (node.A.RecentlyAttacked <= 0))
{
//using (IEnumerator enumerator2 = node.A.Persons.GetEnumerator())
IEnumerator enumerator2 = node.A.Persons.GetEnumerator();
{
while (enumerator2.MoveNext())
{
current = (Person) enumerator2.Current;
list.Add(current);
}
}
if (list.Count >= 10)
{
break;
}
}
}
if (list.Count > 0)
{
if (list.Count > 1)
{
list.PropertyName = "InstigateAbility";
list.IsNumber = true;
list.ReSort();
}
current = list[GameObject.Random(list.Count / 2)] as Person;
if (GameObject.Chance(GameObject.Random(current.InstigateAbility - 150)) && (GameObject.Random(current.NonFightingNumber) > GameObject.Random(current.FightingNumber)))
{
current.GoForInstigate(this.WillArchitecture.Position);
}
}
}
}
示例6: AIPersonTransfer
private void AIPersonTransfer()
{
int num2;
if ((this.MilitaryCount == 0) && ((this.IsImportant || (this.AreaCount > 1)) || (this.Population > this.RecruitmentPopulationBoundary)))
{
this.AIRecruitment(false);
}
if ((((this.BelongedFaction.ArchitectureCount > 1) && (this.PersonCount > this.MilitaryCount)) && (this.RecentlyAttacked > 0)) && ((this.Endurance == 0) || ((this.Endurance < 30) && GameObject.Chance(0x21))))
{
int num = this.PersonCount - this.MilitaryCount;
GameObjectList list = new GameObjectList();
list = this.Persons.GetList();
if (list.Count > 1)
{
list.IsNumber = true;
list.SmallToBig = true;
list.PropertyName = "FightingForce";
list.ReSort();
}
Architecture capital = this.BelongedFaction.Capital;
if (capital == this)
{
ArchitectureList otherArchitectureList = this.GetOtherArchitectureList();
if (otherArchitectureList.Count > 1)
{
otherArchitectureList.IsNumber = true;
otherArchitectureList.PropertyName = "ArmyScaleWeighing";
otherArchitectureList.ReSort();
}
capital = otherArchitectureList[0] as Architecture;
}
num2 = 0;
while (num2 < num)
{
(list[num2] as Person).MoveToArchitecture(capital);
this.RemovePerson(list[num2] as Person);
if (GameObject.Chance(20))
{
break;
}
num2++;
}
}
else if (((this.PersonCount + this.MovingPersons.Count) < this.MilitaryCount) || (this.PlanArchitecture != null))
{
if (this.RecentlyAttacked > 0)
{
int num3 = (this.MilitaryCount - this.PersonCount) - this.MovingPersons.Count;
PersonList list3 = new PersonList();
foreach (Architecture architecture2 in GameObject.Chance(20) ? this.BelongedFaction.Architectures : this.BelongedSection.Architectures)
{
if ((architecture2 != this) && (((architecture2.BelongedSection.AIDetail != null) && architecture2.BelongedSection.AIDetail.AutoRun) && (((architecture2.RecentlyAttacked <= 0) && ((architecture2.PersonCount + architecture2.MovingPersons.Count) >= architecture2.MilitaryCount)) || (((architecture2.Fund < (100 * this.AreaCount)) && (architecture2.Domination >= (architecture2.DominationCeiling * 0.8))) && (architecture2.Endurance >= (architecture2.EnduranceCeiling * 0.2f))))))
{
foreach (Person person in architecture2.Persons)
{
if ((!architecture2.HasFollowedLeaderMilitary(person) && (GameObject.Chance(10) || !architecture2.HasExperiencedLeaderMilitary(person))) && (person.Command >= 40))
{
list3.Add(person);
}
}
}
}
if (list3.Count > 0)
{
if (list3.Count > 1)
{
list3.IsNumber = true;
list3.PropertyName = "FightingForce";
list3.ReSort();
}
for (num2 = 0; (num2 < num3) && (num2 < list3.Count); num2++)
{
Architecture locationArchitecture = (list3[num2] as Person).LocationArchitecture;
(list3[num2] as Person).MoveToArchitecture(this);
locationArchitecture.RemovePerson(list3[num2] as Person);
}
}
}
}
else if (this.HasPerson() && GameObject.Chance(10))
{
PersonList list4 = new PersonList();
if (this.Kind.HasPopulation && (this.Population < (0x3e8 * this.AreaCount)))
{
if (this.IsCapital && (this.Fund >= this.ChangeCapitalCost))
{
Architecture newCapital = this.BelongedFaction.SelectNewCapital();
if (newCapital != this)
{
this.DecreaseFund(this.ChangeCapitalCost);
this.BelongedFaction.ChangeCapital(newCapital);
}
}
foreach (Person person in this.Persons)
{
if (!this.HasFollowedLeaderMilitary(person) && (GameObject.Chance(10) || !this.HasExperiencedLeaderMilitary(person)))
{
list4.Add(person);
}
}
//.........这里部分代码省略.........
示例7: ChildrenCanBeSelectedAsPrince
public PersonList ChildrenCanBeSelectedAsPrince()
{
PersonList haiziliebiao = new PersonList();
foreach (Person person in this.Scenario.Persons)
{
if (person.Alive && person.Available && person.Father == this.ID && person.BelongedCaptive == null && person.sex == false)
{
haiziliebiao.Add(person);
}
}
haiziliebiao.PropertyName = "YearBorn";
haiziliebiao.IsNumber = true;
haiziliebiao.SmallToBig = true;
haiziliebiao.ReSort();
return haiziliebiao;
}
示例8: ChangeLeaderAfterLeaderDeath
public Faction ChangeLeaderAfterLeaderDeath()
{
Person leader = this.Leader;
Architecture locationArchitecture = this.Leader.LocationArchitecture;
this.Leader.Status = GameObjects.PersonDetail.PersonStatus.None;
this.Leader.Available = false;
//base.Scenario.Persons.Remove(this.Leader);
base.Scenario.AvailablePersons.Remove(this.Leader);
Person person2 = null;
PersonList list = new PersonList();
if (person2 == null)
{
foreach (Person person3 in this.Persons)
{
if ((person3.Father >= 0) && (person3.Sex == this.Leader.Sex) && ((this.Leader.Father == person3.Father) || (person3.Father == this.Leader.ID)))
{
list.Add(person3);
}
}
if (list.Count > 0)
{
if (list.Count > 1)
{
list.PropertyName = "YearBorn";
list.IsNumber = true;
list.SmallToBig = true;
list.ReSort();
}
person2 = list[0] as Person;
}
}
if (person2 == null)
{
list.Clear();
foreach (Person person3 in this.Persons)
{
if ((person3.Strain >= 0) && (person3.Sex == this.Leader.Sex) && (this.Leader.Strain == person3.Strain))
{
list.Add(person3);
}
}
if (list.Count > 0)
{
if (list.Count > 1)
{
list.PropertyName = "YearBorn";
list.IsNumber = true;
list.SmallToBig = true;
list.ReSort();
}
person2 = list[0] as Person;
}
}
if (person2 == null)
{
list.Clear();
foreach (Person person3 in this.Persons)
{
if ((person3.Brother >= 0) && (person3.Sex == this.Leader.Sex) && (this.Leader.Brother == person3.Brother))
{
list.Add(person3);
}
}
if (list.Count > 0)
{
if (list.Count > 1)
{
list.PropertyName = "Glamour";
list.IsNumber = true;
list.ReSort();
}
person2 = list[0] as Person;
}
}
if (person2 == null)
{
foreach (Person person3 in this.Persons)
{
if ((person3.Mother >= 0) && (person3.Sex == this.Leader.Sex) && ((this.Leader.Mother == person3.Mother) || (person3.Mother == this.Leader.ID)))
{
list.Add(person3);
}
}
if (list.Count > 0)
{
if (list.Count > 1)
{
list.PropertyName = "YearBorn";
list.IsNumber = true;
list.SmallToBig = true;
list.ReSort();
}
person2 = list[0] as Person;
}
}
if (GlobalVariables.PermitFactionMerge)
{
Faction maxFriendlyDiplomaticRelation = this.MaxFriendlyDiplomaticRelation;
if (maxFriendlyDiplomaticRelation != null)
{
//.........这里部分代码省略.........