本文整理汇总了C#中GameObjects.PersonList类的典型用法代码示例。如果您正苦于以下问题:C# PersonList类的具体用法?C# PersonList怎么用?C# PersonList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersonList类属于GameObjects命名空间,在下文中一共展示了PersonList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: architecture_OnHirePerson
private void architecture_OnHirePerson(PersonList personList)
{
if (personList.Count > 0)
{
(personList[0] as Person).Scenario.GameScreen.ArchitectureHirePerson(personList);
}
}
示例2: CallInformation
internal void CallInformation()
{
if (!this.InformationDestination.HasValue)
{
PersonList list = new PersonList();
foreach (LinkNode node in this.WillArchitecture.AIAllLinkNodes.Values)
{
if ((((node.A.BelongedFaction == this.BelongedFaction) && node.A.BelongedSection != null &&
node.A.BelongedSection.AIDetail.AllowInvestigateTactics) && node.A.InformationAvail()) &&
(node.A.RecentlyAttacked <= 0))
{
foreach (Person person in node.A.Persons)
{
if (person.LocationArchitecture != null)
{
list.Add(person);
}
}
if (list.Count >= 10)
{
break;
}
}
}
if (list.Count > 0)
{
Person person = list[GameObject.Random(list.Count)] as Person;
InformationKindList availList = base.Scenario.GameCommonData.AllInformationKinds.GetAvailList(person.LocationArchitecture);
if (availList.Count > 0)
{
if (availList.Count > 1)
{
if (this.WillArchitecture.BelongedFaction == null)
{
availList.PropertyName = "CostFund";
availList.SmallToBig = true;
}
else
{
availList.PropertyName = "FightingWeighing";
}
availList.IsNumber = true;
availList.ReSort();
}
this.SetInformationPosition();
if (this.InformationDestination.HasValue)
{
person.CurrentInformationKind = availList[GameObject.Random(availList.Count / 2)] as InformationKind;
person.GoForInformation(this.InformationDestination.Value);
}
}
}
}
}
示例3: HireNoFactionPerson
public void HireNoFactionPerson()
{
PersonList personList = new PersonList();
PersonList recruitablePeople = new PersonList();
foreach (Person person in this.NoFactionPersons.GetList())
{
if ((person.BelongedFaction != null) || (person.LocationArchitecture != this))
{
//this.RemoveNoFactionPerson(person);
}
else
{
int idealOffset = Person.GetIdealOffset(person, this.BelongedFaction.Leader);
if (
((!GlobalVariables.IdealTendencyValid || (idealOffset <= person.IdealTendency.Offset + (double)this.BelongedFaction.Reputation / this.BelongedFaction.MaxPossibleReputation * 75))
&& (!this.BelongedFaction.IsAlien || (int)person.PersonalLoyalty < 2)
&& (!person.HatedPersons.Contains(this.BelongedFaction.LeaderID)))
|| (!base.Scenario.IsPlayer(this.BelongedFaction) && GlobalVariables.AIAutoTakeNoFactionPerson)
)
{
recruitablePeople.Add(person);
}
}
}
if (recruitablePeople.Count > 0)
{
foreach (Person toRecruit in recruitablePeople.GetRandomList())
{
this.DecreaseFund(this.HirePersonFund);
if (!((toRecruit.BelongedFaction != null) || (toRecruit.LocationArchitecture != this)))
{
int idealOffset = Person.GetIdealOffset(toRecruit, this.BelongedFaction.Leader);
if (
((!GlobalVariables.IdealTendencyValid || (idealOffset <= toRecruit.IdealTendency.Offset + (double)this.BelongedFaction.Reputation / this.BelongedFaction.MaxPossibleReputation * 75))
&& (GameObject.Random(idealOffset * idealOffset + 100) < 100)
&& (!this.BelongedFaction.IsAlien || (int)toRecruit.PersonalLoyalty < 2)
&& (!toRecruit.HatedPersons.Contains(this.BelongedFaction.LeaderID)))
|| (!base.Scenario.IsPlayer(this.BelongedFaction) && GlobalVariables.AIAutoTakeNoFactionPerson)
)
{
if (toRecruit.ProhibitedFactionID != this.BelongedFaction.ID)
{
personList.Add(toRecruit);
}
}
}
if (this.Fund < this.HirePersonFund)
{
break;
}
/*if (GameObject.Random(recruitablePeople.Count) < 0)
{
break;
}*/
}
}
foreach (Person person in personList)
{
person.ChangeFaction(this.BelongedFaction);
ExtensionInterface.call("HirePerson", new Object[] { this.Scenario, this, person });
this.Scenario.GameScreen.xianshishijiantupian(person, this.Name, "ArchitectureHirePerson", "", "", this.BelongedFaction.Name, false);
}
if (personList.Count > 0)
{
/*
if (this.OnHirePerson != null)
{
this.OnHirePerson(personList);
}
*/
if (this.HasSpy)
{
this.CreateHireNewPersonSpyMessage(personList[GameObject.Random(personList.Count)] as Person);
}
}
else if (personList.Count == 0)
{
if ((this.Scenario.CurrentPlayer != null) && this.BelongedFaction == this.Scenario.CurrentPlayer)
{
//this.shoudongluyongshibai = true;
}
}
this.HireFinished = true;
}
示例4: TroopGetNewCaptive
public virtual void TroopGetNewCaptive(Troop troop, PersonList personlist)
{
}
示例5: ArchitectureHirePerson
public virtual void ArchitectureHirePerson(PersonList personList)
{
}
示例6: AISelectPersonIntoTroop_inner
private PersonList AISelectPersonIntoTroop_inner(Person leader, PersonList otherPersons, bool markSelected)
{
PersonList persons = new PersonList();
persons.Add(leader);
if (markSelected)
{
leader.Selected = true;
}
return persons;
}
示例7: IsSelfFoodEnoughForOffensive
internal bool IsSelfFoodEnoughForOffensive(LinkNode node, Routeway routeway)
{
MilitaryList cropConsumptionOrderedList = Militaries;
cropConsumptionOrderedList.PropertyName = "FoodCostPerDay";
cropConsumptionOrderedList.IsNumber = true;
cropConsumptionOrderedList.ReSort();
PersonList leaderablePersonList = new PersonList();
foreach (Person p in this.Persons)
{
if (p.Command >= 40)
{
leaderablePersonList.Add(p);
}
}
switch (node.Kind)
{
case LinkKind.None:
return false;
case LinkKind.Land:
{
int crop = 0;
int troopCnt = 0;
foreach (Military m in cropConsumptionOrderedList)
{
if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale) && m.Kind.Type != MilitaryType.水军)
{
crop += m.FoodCostPerDay;
troopCnt++;
if (troopCnt >= leaderablePersonList.Count) break;
}
}
if (routeway.LastPoint == null) return false;
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * (routeway.Length + 6)));
}
case LinkKind.Water:
{
int crop = 0;
int troopCnt = 0;
foreach (Military m in cropConsumptionOrderedList)
{
if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale) && m.Kind.Type == MilitaryType.水军)
{
crop += m.FoodCostPerDay;
troopCnt++;
if (troopCnt >= leaderablePersonList.Count) break;
}
}
if (routeway.LastPoint == null) return false;
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * (routeway.Length + 6)));
}
case LinkKind.Both:
{
int crop = 0;
int troopCnt = 0;
foreach (Military m in cropConsumptionOrderedList)
{
if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale))
{
crop += m.FoodCostPerDay;
troopCnt++;
if (troopCnt >= leaderablePersonList.Count) break;
}
}
if (routeway.LastPoint == null) return false;
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * ((routeway.Length + 6) - (this.ArmyScale / 8))));
}
}
return false;
}
示例8: younvxingwujiang
/*
private bool younvxingwujiang()
{
foreach (Person person in this.Persons)
{
if (person.Sex != person.BelongedFaction.Leader.Sex)
{
return true;
}
}
return false;
}
*/
public PersonList nvxingwujiang()
{
PersonList nvxingwujiangliebiao = new PersonList();
foreach (Person person in this.Persons)
{
if (person.BelongedFaction.Leader.isLegalFeiZi(person))
{
nvxingwujiangliebiao.Add(person);
}
}
return nvxingwujiangliebiao;
}
示例9: SelectSubOfficersToTroop
private PersonList SelectSubOfficersToTroop(Troop t)
{
int personCnt = 1;
PersonList result = new PersonList();
result.Add(t.Leader);
if (t.TroopIntelligence < (0x4b - t.Leader.Calmness))
{
foreach (Person person in this.Persons)
{
if (person.WaitForFeiZi != null) continue;
if ((!person.Selected && (person.Intelligence >= (0x4b - t.Leader.Calmness))) && (!t.Persons.HasGameObject(person) && ((((person.Strength < t.TroopStrength) && ((person.Intelligence - t.TroopIntelligence) >= 10)) && (person.FightingForce < t.Leader.FightingForce)) && !person.HasLeaderValidTitle)))
{
person.Selected = true;
result.Add(person);
personCnt++;
break;
}
}
}
if (t.TroopStrength < 0x4b)
{
foreach (Person person in this.Persons)
{
if (person.WaitForFeiZi != null) continue;
if (!person.Selected && person.Strength >= 0x4b && !t.Persons.HasGameObject(person) && person.Closes(t.Leader) &&
person.Strength - t.TroopStrength >= 10 && person.FightingForce < t.Leader.FightingForce &&
!person.HasLeaderValidTitle)
{
person.Selected = true;
result.Add(person);
personCnt++;
break;
}
}
}
if (t.TroopCommand < 0x4b)
{
foreach (Person person in this.Persons)
{
if (person.WaitForFeiZi != null) continue;
if (!person.Selected && person.Command >= 0x4b && !t.Persons.HasGameObject(person) && person.Closes(t.Leader) &&
person.Command - t.TroopCommand >= 10 && person.FightingForce < t.Leader.FightingForce &&
!person.HasLeaderValidTitle)
{
person.Selected = true;
result.Add(person);
personCnt++;
break;
}
}
}
foreach (Person person in this.Persons)
{
if (person.WaitForFeiZi != null) continue;
if ((!person.Selected && !t.Persons.HasGameObject(person)) && ((person.FightingForce < t.Leader.FightingForce) && !person.HasLeaderValidTitle))
{
int incrementPerDayOfCombativity = t.IncrementPerDayOfCombativity;
bool immunityOfCaptive = t.ImmunityOfCaptive;
int routIncrementOfCombativity = t.RoutIncrementOfCombativity;
int attackDecrementOfCombativity = t.AttackDecrementOfCombativity;
int count = t.CombatMethods.Count;
int chanceIncrementOfCriticalStrike = t.ChanceIncrementOfCriticalStrike;
int chanceDecrementOfCriticalStrike = t.ChanceDecrementOfCriticalStrike;
int chanceIncrementOfChaosAfterCriticalStrike = t.ChanceIncrementOfChaosAfterCriticalStrike;
int avoidSurroundedChance = t.AvoidSurroundedChance;
int chaosAfterSurroundAttackChance = t.ChaosAfterSurroundAttackChance;
int chanceIncrementOfStratagem = t.ChanceIncrementOfStratagem;
int chanceDecrementOfStratagem = t.ChanceDecrementOfStratagem;
int chanceIncrementOfChaosAfterStratagem = t.ChanceIncrementOfChaosAfterStratagem;
foreach (Skill s in person.Skills.GetSkillList())
{
s.Influences.PurifyInfluence(this, Applier.Skill, s.ID);
}
foreach (Title i in person.Titles)
{
i.Influences.PurifyInfluence(this, Applier.Title, i.ID);
}
person.ApplySkills();
person.ApplyTitles();
if (((((((t.IncrementPerDayOfCombativity > incrementPerDayOfCombativity) || (t.ImmunityOfCaptive != immunityOfCaptive)) || ((t.RoutIncrementOfCombativity > routIncrementOfCombativity) || (t.AttackDecrementOfCombativity > attackDecrementOfCombativity))) || ((t.CombatMethods.Count > count) || (((t.TroopStrength >= 70) && (t.ChanceIncrementOfCriticalStrike > chanceIncrementOfCriticalStrike)) && (t.ChanceIncrementOfCriticalStrike <= 50)))) || (((((t.TroopCommand >= 70) && (t.ChanceDecrementOfCriticalStrike > chanceDecrementOfCriticalStrike)) && (t.ChanceDecrementOfCriticalStrike <= 50)) || (((t.ChanceIncrementOfCriticalStrike >= 10) && (t.ChanceIncrementOfChaosAfterCriticalStrike > chanceIncrementOfChaosAfterCriticalStrike)) && (t.ChanceIncrementOfChaosAfterCriticalStrike <= 100))) || (((t.AvoidSurroundedChance <= 80) && (t.AvoidSurroundedChance > avoidSurroundedChance)) || ((t.ChaosAfterSurroundAttackChance <= 20) && (t.ChaosAfterSurroundAttackChance > chaosAfterSurroundAttackChance))))) || ((((t.TroopIntelligence >= 70) && (t.ChanceIncrementOfStratagem > chanceIncrementOfStratagem)) && (t.ChanceIncrementOfStratagem <= 30)) || (((t.TroopIntelligence >= 70) && (t.ChanceDecrementOfStratagem > chanceDecrementOfStratagem)) && (t.ChanceDecrementOfStratagem <= 30)))) || (((t.TroopIntelligence >= 0x55) && (t.ChanceIncrementOfChaosAfterStratagem > chanceIncrementOfChaosAfterStratagem)) && (t.ChanceIncrementOfChaosAfterStratagem <= 100)))
{
person.Selected = true;
result.Add(person);
personCnt++;
}
}
if (personCnt >= 5) break;
}
return result;
}
示例10: 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)
//.........这里部分代码省略.........
示例11: ReleaseAllCaptive
private void ReleaseAllCaptive()
{
if (this.HasCaptive())
{
PersonList persons = new PersonList();
foreach (Captive captive in this.Captives.GetList())
{
if (((captive.CaptivePerson != null) && (captive.CaptiveFaction != null)) && (captive.CaptiveFaction.Capital != null))
{
Architecture moveTo = captive.CaptiveFaction.Capital;
persons.Add(captive.CaptivePerson);
Person p = captive.CaptivePerson;
captive.CaptivePerson.BelongedCaptive = null;
p.Status = PersonStatus.Normal;
p.MoveToArchitecture(moveTo);
}
}
if ((persons.Count > 0) && (this.OnReleaseCaptiveAfterOccupied != null))
{
this.OnReleaseCaptiveAfterOccupied(this, persons);
}
}
}
示例12: 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();
}
示例13: BuildTroopForTransfer
private Troop BuildTroopForTransfer(Military military, Architecture destination, LinkKind linkkind)
{
if (linkkind == LinkKind.None)
{
return null;
}
if (!this.isArmyNavigableTo(linkkind, military))
{
return null;
}
if (this.Persons.Count == 0) return null;
TroopList list = new TroopList();
this.Persons.ClearSelected();
if ((military.Scales > 5) && (military.Morale >= 80) && (military.Combativity >= 80) && (military.InjuryQuantity < military.Kind.MinScale) && !military.IsFewScaleNeedRetreat)
{
PersonList list2;
Military military2 = military;
if ((military2.FollowedLeader != null) && this.Persons.HasGameObject(military2.FollowedLeader) && military2.FollowedLeader.WaitForFeiZi == null && military2.FollowedLeader.LocationTroop == null)
{
list2 = new PersonList();
list2.Add(military2.FollowedLeader);
military2.FollowedLeader.Selected = true;
Point? nullable = this.GetRandomStartingPosition(military2);
if (!nullable.HasValue)
{
return null;
}
Troop troop = this.CreateTroop(list2, military2.FollowedLeader, military2, -1, nullable.Value);
troop.WillArchitecture = destination;
Legion legion = this.BelongedFaction.GetLegion(destination);
if (legion == null)
{
legion = this.CreateOffensiveLegion(destination);
}
legion.AddTroop(troop);
return troop;
}
if ((((military2.Leader != null) && (military2.LeaderExperience >= 10)) && (((military2.Leader.Strength >= 80) || (military2.Leader.Command >= 80)) || military2.Leader.HasLeaderValidTitle))
&& this.Persons.HasGameObject(military2.Leader) && military2.Leader.WaitForFeiZi == null && military2.Leader.LocationTroop == null)
{
list2 = new PersonList();
list2.Add(military2.Leader);
military2.Leader.Selected = true;
Point? nullable = this.GetRandomStartingPosition(military2);
if (!nullable.HasValue)
{
return null;
}
Troop troop = this.CreateTroop(list2, military2.Leader, military2, -1, nullable.Value);
troop.WillArchitecture = destination;
Legion legion = this.BelongedFaction.GetLegion(destination);
if (legion == null)
{
legion = this.CreateOffensiveLegion(destination);
}
legion.AddTroop(troop);
return troop;
}
GameObjectList sortedList = this.Persons.GetList() as GameObjectList;
sortedList.PropertyName = "FightingForce";
sortedList.IsNumber = true;
sortedList.SmallToBig = true;
sortedList.ReSort();
foreach (Person person in sortedList)
{
if (!person.Selected && person.WaitForFeiZi == null && person.LocationTroop == null)
{
list2 = new PersonList();
list2.Add(person);
person.Selected = true;
Point? nullable = this.GetRandomStartingPosition(military2);
if (!nullable.HasValue)
{
break;
}
Troop troop = this.CreateTroop(list2, person, military2, -1, nullable.Value);
troop.WillArchitecture = destination;
Legion legion = this.BelongedFaction.GetLegion(destination);
if (legion == null)
{
legion = this.CreateOffensiveLegion(destination);
}
legion.AddTroop(troop);
return troop;
}
}
}
return null;
}
示例14: BuildTransportTroop
private Troop BuildTransportTroop(Architecture destination, Military military, int food, int fund)
{
Troop troop;
int min = int.MaxValue;
PersonList leader = new PersonList();
foreach (Person p in this.Persons)
{
if (p.Merit < min)
{
leader.Clear();
leader.Add(p);
min = p.Merit;
}
}
if (leader.Count <= 0) return null;
troop = Troop.CreateSimulateTroop(leader, military, this.Position);
Point? nullable = this.GetRandomStartingPosition(troop);
if (!nullable.HasValue)
{
return null;
}
troop.Destroy(true, false);
troop = this.CreateTroop(leader, leader[0] as Person, military, food, nullable.Value);
troop.WillArchitecture = destination;
troop.zijin = fund;
this.Fund -= fund;
Legion legion = this.BelongedFaction.GetLegion(destination);
if (legion == null)
{
legion = this.CreateOffensiveLegion(destination);
}
legion.AddTroop(troop);
this.PostCreateTroop(troop, false);
return troop;
}
示例15: LoadPersonIdFromString
public void LoadPersonIdFromString(PersonList persons, string data)
{
char[] separator = new char[] { ' ', '\n', '\r' };
string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries);
this.person = new Dictionary<int, List<Person>>();
for (int i = 0; i < strArray.Length; i += 2)
{
int n = int.Parse(strArray[i]);
int pid = int.Parse(strArray[i + 1]);
if (!this.person.ContainsKey(n))
{
this.person[n] = new List<Person>();
}
if (pid != -1)
{
this.person[n].Add(persons.GetGameObject(pid) as Person);
}
else
{
this.person[n].Add(null);
}
}
}