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


C# GameObjectList.ReSort方法代码示例

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


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

示例1: NoFactionMove

 public void NoFactionMove()
 {
     if (((((this.BelongedFaction == null) && (this.ArrivingDays == 0)) && (this.LocationArchitecture != null)) && !this.IsCaptive) && GameObject.Chance((2 + (int) this.Ambition) + (this.LeaderPossibility ? 10 : 0)))
     {
         if (GameObject.Chance(50 + (this.LeaderPossibility ? 10 : 0)))
         {
             GameObjectList hirableFactionList = this.GetHirableFactionList();
             if (hirableFactionList.Count > 0)
             {
                 GameObjects.Faction faction = hirableFactionList[GameObject.Random(hirableFactionList.Count)] as GameObjects.Faction;
                 if (((faction.Leader != null) && (GetIdealOffset(faction.Leader, this) <= 10)) && ((faction.Capital != null) && (faction.Capital != this.LocationArchitecture)))
                 {
                     this.MoveToArchitecture(faction.Capital);
                     this.LocationArchitecture.RemoveNoFactionPerson(this);
                 }
             }
             else if (this.LeaderPossibility)
             {
                 GameObjectList list2 = new GameObjectList();
                 foreach (Architecture architecture in this.LocationArchitecture.GetClosestArchitectures(40))
                 {
                     if ((architecture.BelongedFaction == null) && (architecture.RecentlyAttacked <= 0))
                     {
                         list2.Add(architecture);
                     }
                 }
                 if (list2.Count > 0)
                 {
                     if (list2.Count > 1)
                     {
                         list2.PropertyName = "UnitPopulation";
                         list2.IsNumber = true;
                         list2.ReSort();
                     }
                     Architecture a = list2[GameObject.Random(list2.Count / 2)] as Architecture;
                     this.MoveToArchitecture(a);
                     this.LocationArchitecture.RemoveNoFactionPerson(this);
                 }
             }
         }
         else
         {
             if (this.LocationArchitecture.ClosestArchitectures == null)
             {
                 this.LocationArchitecture.GetClosestArchitectures();
             }
             if (this.LocationArchitecture.ClosestArchitectures.Count > 0)
             {
                 int maxValue = 20;
                 if (maxValue > this.LocationArchitecture.ClosestArchitectures.Count)
                 {
                     maxValue = this.LocationArchitecture.ClosestArchitectures.Count;
                 }
                 maxValue = GameObject.Random(maxValue);
                 this.MoveToArchitecture(this.LocationArchitecture.ClosestArchitectures[maxValue] as Architecture);
                 this.LocationArchitecture.RemoveNoFactionPerson(this);
             }
         }
     }
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:60,代码来源:Person1214.cs

示例2: RefreshWithPersonList

 public void RefreshWithPersonList(GameObjectList personList)
 {
     Point position = this.Position;
     Point destination = this.Destination;
     Point realDestination = this.RealDestination;
     Architecture startingArchitecture = this.StartingArchitecture;
     int iD = base.ID;
     Person leader = this.Leader;
     Stunt currentStunt = this.CurrentStunt;
     int stuntDayLeft = this.StuntDayLeft;
     this.Destroy();
     this.Destroyed = false;
     this.realDestination = realDestination;
     this.destination = destination;
     this.position = position;
     this.StartingArchitecture = startingArchitecture;
     base.ID = iD;
     this.Persons.Clear();
     if (!personList.HasGameObject(leader))
     {
         if (personList.Count > 1)
         {
             personList.PropertyName = "FightingForce";
             personList.IsNumber = true;
             personList.ReSort();
         }
         this.Leader = personList[0] as Person;
     }
     foreach (Person person2 in personList)
     {
         this.AddPerson(person2);
     }
     this.Persons.ApplyInfluences();
     if ((currentStunt != null) && (stuntDayLeft > 0))
     {
         this.CurrentStunt = currentStunt;
         this.StuntDayLeft = stuntDayLeft;
     }
     this.Initialize();
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:40,代码来源:Troop.cs

示例3: 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);
                 }
             }
//.........这里部分代码省略.........
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:Architecture_1.cs

示例4: AIFoodTransfer

 private void AIFoodTransfer()
 {
     Routeway connectedRouteway;
     int food;
     if (this.IsFoodAbundant || ((!this.HostileLine && (!this.FrontLine || !GameObject.Chance(20))) && !GameObject.Chance(1)))
     {
         if (this.TransferFoodArchitecture != null)
         {
             LinkNode node = null;
             this.AIAllLinkNodes.TryGetValue(this.TransferFoodArchitecture.ID, out node);
             if (node != null)
             {
                 connectedRouteway = this.GetRouteway(node, true);
                 if ((connectedRouteway != null) && (connectedRouteway.LastPoint != null))
                 {
                     if (this.BelongedFaction != this.TransferFoodArchitecture.BelongedFaction)
                     {
                         connectedRouteway.RemoveAfterClose = true;
                         connectedRouteway.Close();
                         this.TransferFoodArchitecture = null;
                     }
                     else
                     {
                         connectedRouteway.DestinationToEnd();
                         if (connectedRouteway.EndArchitecture == this.TransferFoodArchitecture)
                         {
                             food = this.Food - this.EnoughFood;
                             if ((food >= 0x186a0) || (food > this.TransferFoodArchitecture.FoodCostPerDayOfAllMilitaries))
                             {
                                 if (connectedRouteway.IsActive)
                                 {
                                     int abundantFood = this.TransferFoodArchitecture.AbundantFood;
                                     if (food > abundantFood)
                                     {
                                         food = abundantFood;
                                     }
                                     this.DecreaseFood(food);
                                     this.TransferFoodArchitecture.IncreaseFood((int) (food * (1f - (connectedRouteway.LastPoint.ConsumptionRate * this.BelongedFaction.RateOfFoodTransportBetweenArchitectures))));
                                     this.TransferFoodArchitecture = null;
                                 }
                                 else if ((connectedRouteway.LastPoint.BuildFundCost * 2) <= this.Fund)
                                 {
                                     connectedRouteway.Building = true;
                                 }
                             }
                             else
                             {
                                 this.TransferFoodArchitecture = null;
                             }
                         }
                         else
                         {
                             this.TransferFoodArchitecture = null;
                         }
                     }
                 }
                 else
                 {
                     this.TransferFoodArchitecture = null;
                 }
             }
             else
             {
                 this.TransferFoodArchitecture = null;
             }
         }
     }
     else
     {
         GameObjectList list = new GameObjectList();
         foreach (LinkNode node in this.AIAllLinkNodes.Values)
         {
             if (node.Level > 3)
             {
                 break;
             }
             if (node.A.BelongedFaction == this.BelongedFaction)
             {
                 if (node.A.BelongedSection == this.BelongedSection)
                 {
                     list.Add(node.A);
                 }
                 else if (node.A.BelongedSection.AIDetail.AllowFoodTransfer && ((node.A.BelongedSection.OrientationSection == this.BelongedSection) || (node.A.BelongedSection.OrientationSection == null)))
                 {
                     list.Add(node.A);
                 }
             }
         }
         if (list.Count > 1)
         {
             list.PropertyName = "Food";
             list.IsNumber = true;
             list.ReSort();
         }
         foreach (Architecture architecture in list)
         {
             connectedRouteway = architecture.GetConnectedRouteway(this);
             if ((connectedRouteway == null) || (connectedRouteway.LastPoint == null))
             {
                 connectedRouteway = this.GetConnectedRouteway(architecture);
//.........这里部分代码省略.........
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:Architecture_1.cs

示例5: BuildSectionByArchitectureList

 private void BuildSectionByArchitectureList(GameObjectList architecturelist)
 {
     if (architecturelist.Count != 0)
     {
         Section section;
         GameObjectList list;
         if (architecturelist.Count == 1)
         {
             section = new Section();
             section.ID = base.Scenario.Sections.GetFreeGameObjectID();
             section.Scenario = base.Scenario;
             this.AddSection(section);
             base.Scenario.Sections.AddSectionWithEvent(section);
             list = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.无, true, false, true, true, false);
             if (list.Count > 0)
             {
                 section.AIDetail = list[GameObject.Random(list.Count)] as SectionAIDetail;
             }
             else
             {
                 section.AIDetail = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailList()[0] as SectionAIDetail;
             }
             section.AddArchitecture(architecturelist[0] as Architecture);
         }
         else
         {
             architecturelist.PropertyName = "Population";
             architecturelist.IsNumber = true;
             architecturelist.ReSort();
             int count = 0;
             int num2 = 2 + (this.ArchitectureCount / 8);
             if (architecturelist.Count < ((num2 * 3) / 2))
             {
                 count = architecturelist.Count;
             }
             else
             {
                 count = num2;
             }
             section = new Section();
             section.ID = base.Scenario.Sections.GetFreeGameObjectID();
             section.Scenario = base.Scenario;
             this.AddSection(section);
             base.Scenario.Sections.AddSectionWithEvent(section);
             list = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailsByConditions(SectionOrientationKind.无, true, false, true, true, false);
             if (list.Count > 0)
             {
                 section.AIDetail = list[GameObject.Random(list.Count)] as SectionAIDetail;
             }
             else
             {
                 section.AIDetail = base.Scenario.GameCommonData.AllSectionAIDetails.GetSectionAIDetailList()[0] as SectionAIDetail;
             }
             Architecture architecture = architecturelist[0] as Architecture;
             section.AddArchitecture(architecture);
             if (architecture.ClosestArchitectures == null)
             {
                 architecture.GetClosestArchitectures();
             }
             if (architecture.AIAllLinkNodes.Count == 0)
             {
                 architecture.GenerateAllAILinkNodes(2);
             }
             foreach (LinkNode node in architecture.AIAllLinkNodes.Values)
             {
                 if (node.Level > 2)
                 {
                     break;
                 }
                 if ((node.A.BelongedFaction == this) && architecturelist.HasGameObject(node.A))
                 {
                     section.AddArchitecture(node.A);
                 }
                 if (section.ArchitectureCount >= count)
                 {
                     break;
                 }
             }
             if (count == architecturelist.Count)
             {
                 if (section.ArchitectureCount < count)
                 {
                     foreach (Architecture architecture2 in section.Architectures)
                     {
                         architecturelist.Remove(architecture2);
                     }
                     if (this.SectionCount == 1)
                     {
                         foreach (Architecture architecture2 in architecturelist)
                         {
                             this.FirstSection.AddArchitecture(architecture2);
                         }
                     }
                     else
                     {
                         foreach (Architecture architecture2 in architecturelist)
                         {
                             int num3 = 0x7fffffff;
                             Section section2 = null;
                             foreach (Section section3 in this.Sections)
//.........这里部分代码省略.........
开发者ID:kanjianlema,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:Faction.cs


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