本文整理汇总了C#中GameObjects.ArchitectureList.ReSort方法的典型用法代码示例。如果您正苦于以下问题:C# ArchitectureList.ReSort方法的具体用法?C# ArchitectureList.ReSort怎么用?C# ArchitectureList.ReSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.ArchitectureList
的用法示例。
在下文中一共展示了ArchitectureList.ReSort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OutsideTacticsAI
private void OutsideTacticsAI()
{
ConvinceNoFactionAI();
if (this.PlanArchitecture == null && this.RecentlyAttacked <= 0 && this.HasPerson() && this.IsFundEnough)
{
Architecture architecture2;
int diplomaticRelation;
Person firstHalfPerson;
ArchitectureList unknownArch = new ArchitectureList();
ArchitectureList knownArch = new ArchitectureList();
foreach (Architecture architecture in this.GetClosestArchitectures(20, 40))
{
if (!this.BelongedFaction.IsArchitectureKnown(architecture))
{
unknownArch.Add(architecture);
}
else
{
knownArch.Add(architecture);
}
}
if (this.BelongedSection != null && (unknownArch.Count > 0) && this.BelongedSection.AIDetail.AllowInvestigateTactics)
{
if (unknownArch.Count > 1)
{
unknownArch.PropertyName = "Population";
unknownArch.IsNumber = true;
unknownArch.ReSort();
}
if ((((this.RecentlyAttacked <= 0) && (GameObject.Random(40) < GameObject.Random(unknownArch.Count))) && GameObject.Chance(20)) && this.InformationAvail())
{
architecture2 = unknownArch[GameObject.Random(unknownArch.Count / 2)] as Architecture;
if ((!this.BelongedFaction.IsArchitectureKnown(architecture2) || GameObject.Chance(20)) && ((architecture2.BelongedFaction != null) && (!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("InformationAbility");
if ((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100))
{
firstHalfPerson.CurrentInformationKind = this.GetFirstHalfInformationKind();
if (firstHalfPerson.CurrentInformationKind != null)
{
firstHalfPerson.GoForInformation(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
}
}
}
if ((this.BelongedSection != null) && ((knownArch.Count > 0) && (this.PlanArchitecture == null)) && this.BelongedSection.AIDetail.AllowPersonTactics)
{
if (knownArch.Count > 1)
{
knownArch.PropertyName = "PersonCount";
knownArch.IsNumber = true;
knownArch.ReSort();
}
if ((this.HasPerson() && (GameObject.Random(this.Fund) >= this.GossipArchitectureFund)) && GameObject.Chance(50))
{
ArchitectureList list3 = new ArchitectureList();
foreach (Architecture architecture in knownArch)
{
if ((architecture.BelongedFaction != this.BelongedFaction) && (architecture.BelongedFaction != null))
{
list3.Add(architecture);
}
}
if (list3.Count > 0)
{
architecture2 = list3[GameObject.Random(list3.Count / 2)] as Architecture;
if (GameObject.Chance(100 - architecture2.noEscapeChance * 2))
{
if ((!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10)) && ((architecture2.Fund < architecture2.EnoughFund) || ((architecture2.Fund < architecture2.AbundantFund) && GameObject.Chance(20))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("GossipAbility");
if (((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100)) && ((GameObject.Random(architecture2.GetGossipablePersonCount() + 4) >= 4) && (GameObject.Random(firstHalfPerson.GossipAbility) >= 200)))
{
firstHalfPerson.GoForGossip(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
}
}
}
if ((this.HasPerson() && (GameObject.Random(this.Fund) >= this.ConvincePersonFund)) && GameObject.Chance(50))
{
ArchitectureList list4 = new ArchitectureList();
foreach (Architecture architecture in knownArch)
{
if (((architecture.BelongedFaction != this.BelongedFaction) && (architecture.BelongedFaction != null)) && architecture.HasPerson())
{
list4.Add(architecture);
}
}
foreach (Architecture architecture in this.BelongedFaction.Architectures)
//.........这里部分代码省略.........
示例2: OutsideTacticsAI
private void OutsideTacticsAI()
{
if (((this.PlanArchitecture == null) || GameObject.Chance(10)) && (((this.RecentlyAttacked <= 0) && this.HasPerson()) && this.IsFundEnough))
{
Architecture architecture2;
int diplomaticRelation;
Person firstHalfPerson;
ArchitectureList list = new ArchitectureList();
ArchitectureList list2 = new ArchitectureList();
foreach (Architecture architecture in this.GetClosestArchitectures(20))
{
if (!this.BelongedFaction.IsArchitectureKnown(architecture))
{
list.Add(architecture);
}
else
{
list2.Add(architecture);
}
}
if ((list.Count > 0) && this.BelongedSection.AIDetail.AllowInvestigateTactics)
{
if (list.Count > 1)
{
list.PropertyName = "Population";
list.IsNumber = true;
list.ReSort();
}
if ((((this.RecentlyAttacked <= 0) && (GameObject.Random(40) < GameObject.Random(list.Count))) && GameObject.Chance(20)) && this.InformationAvail())
{
architecture2 = list[GameObject.Random(list.Count / 2)] as Architecture;
if ((!this.BelongedFaction.IsArchitectureKnown(architecture2) || GameObject.Chance(20)) && ((architecture2.BelongedFaction != null) && (!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("InformationAbility");
if ((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100))
{
firstHalfPerson.CurrentInformationKind = this.GetFirstHalfInformationKind();
if (firstHalfPerson.CurrentInformationKind != null)
{
firstHalfPerson.GoForInformation(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
}
}
if (((this.PlanArchitecture == null) && (GameObject.Random(40) < GameObject.Random(list.Count))) && (this.HasPerson() && (GameObject.Random(this.Fund) >= this.SpyArchitectureFund)))
{
architecture2 = list[GameObject.Random(list.Count / 2)] as Architecture;
if ((!architecture2.HasFactionSpy(this.BelongedFaction) || GameObject.Chance(20)) && (((architecture2.BelongedFaction != null) && (GameObject.Random(architecture2.AreaCount + 4) >= 4)) && (!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("SpyAbility");
if (((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100)) && (GameObject.Random(firstHalfPerson.SpyAbility) >= 200))
{
firstHalfPerson.GoForSpy(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
}
}
if (((list2.Count > 0) && (this.PlanArchitecture == null)) && this.BelongedSection.AIDetail.AllowPersonTactics)
{
if (list2.Count > 1)
{
list2.PropertyName = "PersonCount";
list2.IsNumber = true;
list2.ReSort();
}
if ((this.HasPerson() && (GameObject.Random(this.Fund) >= this.GossipArchitectureFund)) && GameObject.Chance(50))
{
ArchitectureList list3 = new ArchitectureList();
foreach (Architecture architecture in list2)
{
if ((architecture.BelongedFaction != this.BelongedFaction) && (architecture.BelongedFaction != null))
{
list3.Add(architecture);
}
}
if (list3.Count > 0)
{
architecture2 = list3[GameObject.Random(list3.Count / 2)] as Architecture;
if ((!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10)) && ((architecture2.Fund < architecture2.EnoughFund) || ((architecture2.Fund < architecture2.AbundantFund) && GameObject.Chance(20))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("GossipAbility");
if (((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100)) && ((GameObject.Random(architecture2.GetGossipablePersonCount() + 4) >= 4) && (GameObject.Random(firstHalfPerson.GossipAbility) >= 200)))
{
firstHalfPerson.GoForGossip(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
}
}
//.........这里部分代码省略.........
示例3: OutsideTacticsAI
private void OutsideTacticsAI()
{
if (((this.PlanArchitecture == null) || GameObject.Chance(10)) && (((this.RecentlyAttacked <= 0) && this.HasPerson()) && this.IsFundEnough))
{
Architecture architecture2;
int diplomaticRelation;
Person firstHalfPerson;
ArchitectureList list = new ArchitectureList();
ArchitectureList list2 = new ArchitectureList();
foreach (Architecture architecture in this.GetClosestArchitectures(20, 40))
{
if (!this.BelongedFaction.IsArchitectureKnown(architecture))
{
list.Add(architecture);
}
else
{
list2.Add(architecture);
}
}
/*if (this.BelongedSection != null && (list.Count > 0) && this.BelongedSection.AIDetail.AllowInvestigateTactics)
{
if (list.Count > 1)
{
list.PropertyName = "Population";
list.IsNumber = true;
list.ReSort();
}
if ((((this.RecentlyAttacked <= 0) && (GameObject.Random(40) < GameObject.Random(list.Count))) && GameObject.Chance(20)) && this.InformationAvail())
{
architecture2 = list[GameObject.Random(list.Count / 2)] as Architecture;
if ((!this.BelongedFaction.IsArchitectureKnown(architecture2) || GameObject.Chance(20)) && ((architecture2.BelongedFaction != null) && (!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("InformationAbility");
if ((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100))
{
firstHalfPerson.CurrentInformationKind = this.GetFirstHalfInformationKind();
if (firstHalfPerson.CurrentInformationKind != null)
{
firstHalfPerson.GoForInformation(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
}
}
if (((this.PlanArchitecture == null) && (GameObject.Random(40) < GameObject.Random(list.Count))) && (this.HasPerson() && (GameObject.Random(this.Fund) >= this.SpyArchitectureFund)))
{
architecture2 = list[GameObject.Random(list.Count / 2)] as Architecture;
if ((!architecture2.HasFactionSpy(this.BelongedFaction) || GameObject.Chance(20)) && (((architecture2.BelongedFaction != null) && (GameObject.Random(architecture2.AreaCount + 4) >= 4)) && (!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("SpyAbility");
if (((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100)) && (GameObject.Random(firstHalfPerson.SpyAbility) >= 200))
{
firstHalfPerson.GoForSpy(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
}
}*/
if ((this.BelongedSection != null) && ((list2.Count > 0) && (this.PlanArchitecture == null)) && this.BelongedSection.AIDetail.AllowPersonTactics)
{
if (list2.Count > 1)
{
list2.PropertyName = "PersonCount";
list2.IsNumber = true;
list2.ReSort();
}
if ((this.HasPerson() && (GameObject.Random(this.Fund) >= this.GossipArchitectureFund)) && GameObject.Chance(50))
{
ArchitectureList list3 = new ArchitectureList();
foreach (Architecture architecture in list2)
{
if ((architecture.BelongedFaction != this.BelongedFaction) && (architecture.BelongedFaction != null))
{
list3.Add(architecture);
}
}
if (list3.Count > 0)
{
architecture2 = list3[GameObject.Random(list3.Count / 2)] as Architecture;
if (GameObject.Chance(100 - architecture2.noEscapeChance * 2))
{
if ((!this.IsFriendly(architecture2.BelongedFaction) || GameObject.Chance(10)) && ((architecture2.Fund < architecture2.EnoughFund) || ((architecture2.Fund < architecture2.AbundantFund) && GameObject.Chance(20))))
{
diplomaticRelation = base.Scenario.GetDiplomaticRelation(this.BelongedFaction.ID, architecture2.BelongedFaction.ID);
if (((diplomaticRelation >= 0) && (GameObject.Random(diplomaticRelation + 200) <= GameObject.Random(50))) || ((diplomaticRelation < 0) && (GameObject.Random(Math.Abs(diplomaticRelation) + 100) >= GameObject.Random(100))))
{
firstHalfPerson = this.GetFirstHalfPerson("GossipAbility");
if (((((firstHalfPerson != null) && (!this.HasFollowedLeaderMilitary(firstHalfPerson) || GameObject.Chance(10))) && (GameObject.Random(firstHalfPerson.NonFightingNumber) > GameObject.Random(firstHalfPerson.FightingNumber))) && (GameObject.Random(firstHalfPerson.FightingNumber) < 100)) && ((GameObject.Random(architecture2.GetGossipablePersonCount() + 4) >= 4) && (GameObject.Random(firstHalfPerson.GossipAbility) >= 200)))
{
firstHalfPerson.GoForGossip(base.Scenario.GetClosestPoint(architecture2.ArchitectureArea, this.Position));
}
}
}
//.........这里部分代码省略.........
示例4: 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);
}
}
//.........这里部分代码省略.........