本文整理汇总了C#中LegendsViewer.Legends.World.GetEntity方法的典型用法代码示例。如果您正苦于以下问题:C# World.GetEntity方法的具体用法?C# World.GetEntity怎么用?C# World.GetEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LegendsViewer.Legends.World
的用法示例。
在下文中一共展示了World.GetEntity方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Theft
public Theft(List<Property> properties, World world)
: base(properties, world)
{
foreach (Property property in properties)
switch (property.Name)
{
case "ordinal": Ordinal = String.Intern(property.Value); break;
case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;
case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;
case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
}
foreach (ItemStolen theft in Collection.OfType<ItemStolen>())
{
theft.Site = Site;
Site.AddEvent(theft);
Site.Events = Site.Events.OrderBy(ev => ev.ID).ToList();
if (Attacker.SiteHistory.Count == 1)
{
theft.ReturnSite = Attacker.SiteHistory.First().Site;
theft.ReturnSite.AddEvent(theft);
theft.ReturnSite.Events = theft.ReturnSite.Events.OrderBy(ev => ev.ID).ToList();
}
}
}
示例2: SiteConquered
public SiteConquered(List<Property> properties, World world)
: base(properties, world)
{
Initialize();
foreach (Property property in properties)
switch (property.Name)
{
case "ordinal": Ordinal = Convert.ToInt32(property.Value); break;
case "war_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
}
if (Collection.OfType<PlunderedSite>().Any()) ConquerType = SiteConqueredType.Pillaging;
else if (Collection.OfType<DestroyedSite>().Any()) ConquerType = SiteConqueredType.Destruction;
else if (Collection.OfType<NewSiteLeader>().Any() || Collection.OfType<SiteTakenOver>().Any()) ConquerType = SiteConqueredType.Conquest;
else ConquerType = SiteConqueredType.Unknown;
if (ConquerType == SiteConqueredType.Pillaging) Notable = false;
Site.Warfare.Add(this);
if (ParentCollection != null)
{
(ParentCollection as War).DeathCount += Collection.OfType<HFDied>().Count();
if (Attacker == (ParentCollection as War).Attacker)
(ParentCollection as War).AttackerVictories.Add(this);
else
(ParentCollection as War).DefenderVictories.Add(this);
}
}
示例3: BeastAttack
public BeastAttack(List<Property> properties, World world)
: base(properties, world)
{
Initialize();
foreach (Property property in properties)
switch (property.Name)
{
case "ordinal": Ordinal = Convert.ToInt32(property.Value); break;
case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;
case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;
case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
}
Site.BeastAttacks.Add(this);
//--------Attacking Beast is calculated after parsing event collections in ParseXML()
//--------So that it can also look at eventsList from duel sub collections to calculate the Beast
//-------Fill in some missing event details with details from collection
//-------Filled in after parsing event collections in ParseXML()
}
示例4: Abduction
public Abduction(List<Property> properties, World world)
: base(properties, world)
{
foreach (Property property in properties)
switch (property.Name)
{
case "ordinal": Ordinal = String.Intern(property.Value); break;
case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;
case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;
case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;
case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;
case "attacking_enid": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
case "defending_enid": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
}
}
示例5: EntityEntityLink
public EntityEntityLink(List<Property> properties, World world)
{
Type = EntityEntityLinkType.Unknown;
foreach (Property property in properties)
{
switch (property.Name)
{
case "type":
switch (property.Value)
{
case "CHILD":
Type = EntityEntityLinkType.Child;
break;
case "PARENT":
Type = EntityEntityLinkType.Parent;
break;
default:
world.ParsingErrors.Report("Unknown Entity Entity Link Type: " + property.Value);
break;
}
break;
case "target":
Target = world.GetEntity(Convert.ToInt32(property.Value));
break;
case "strength":
Strength = Convert.ToInt32(property.Value);
break;
}
}
}
示例6: War
public War(List<Property> properties, World world)
: base(properties, world)
{
Initialize();
foreach (Property property in properties)
switch (property.Name)
{
case "name": Name = Formatting.InitCaps(property.Value); break;
case "aggressor_ent_id": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;
case "defender_ent_id": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;
}
Defender.Wars.Add(this);
if (Defender.Parent != null)
Defender.Parent.Wars.Add(this);
Attacker.Wars.Add(this);
if (Attacker.Parent != null)
Attacker.Parent.Wars.Add(this);
if (EndYear >= 0)
Length = EndYear - StartYear;
else if (world.Events.Count > 0)
Length = world.Events.Last().Year - StartYear;
}
示例7: EntityReputation
public EntityReputation(List<Property> properties, World world)
{
foreach (Property property in properties)
{
switch (property.Name)
{
case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;
case "unsolved_murders": UnsolvedMurders = Convert.ToInt32(property.Value); break;
case "first_ageless_year": FirstSuspectedAgelessYear = Convert.ToInt32(property.Value); break;
case "first_ageless_season_count": FirstSuspectedAglessSeason = Formatting.TimeCountToSeason(Convert.ToInt32(property.Value)); break;
}
}
}
示例8: EntityPopulation
public EntityPopulation(List<Property> properties, World world)
: base(properties, world)
{
foreach (Property property in properties)
{
switch (property.Name)
{
case "race":
var raceCount = property.Value.Split(':');
Race = raceCount[0];
Count = Convert.ToInt32(raceCount[1]);
break;
case "civ_id":
Entity = world.GetEntity(property.ValueAsInt());
break;
}
}
}
示例9: EntityLink
public EntityLink(List<Property> properties, World world)
{
Strength = 0;
StartYear = -1;
EndYear = -1;
foreach (Property property in properties)
{
switch (property.Name)
{
case "entity_id":
int id = Convert.ToInt32(property.Value);
Entity = world.GetEntity(id);
break;
case "position_profile_id": PositionID = Convert.ToInt32(property.Value); break;
case "start_year":
StartYear = Convert.ToInt32(property.Value);
Type = EntityLinkType.Position;
break;
case "end_year":
EndYear = Convert.ToInt32(property.Value);
Type = EntityLinkType.FormerPosition;
break;
case "link_strength": Strength = Convert.ToInt32(property.Value); break;
case "link_type":
EntityLinkType linkType = EntityLinkType.Unknown;
if (!Enum.TryParse(Formatting.InitCaps(property.Value), out linkType))
{
switch (property.Value)
{
case "former member": Type = EntityLinkType.FormerMember; break;
case "former prisoner": Type = EntityLinkType.FormerPrisoner; break;
case "former slave": Type = EntityLinkType.FormerSlave; break;
default:
Type = EntityLinkType.Unknown;
world.ParsingErrors.Report("Unknown Entity Link Type: " + property.Value);
break;
}
}
else
Type = linkType;
break;
}
}
}
示例10: EntityReputation
public EntityReputation(List<Property> properties, World world)
{
foreach (Property property in properties)
{
switch (property.Name)
{
case "entity_id": Entity = world.GetEntity(Convert.ToInt32(property.Value)); break;
case "unsolved_murders": UnsolvedMurders = Convert.ToInt32(property.Value); break;
case "first_ageless_year": FirstSuspectedAgelessYear = Convert.ToInt32(property.Value); break;
case "first_ageless_season_count": FirstSuspectedAgelessSeason = Formatting.TimeCountToSeason(Convert.ToInt32(property.Value)); break;
case "rep_enemy_fighter": Reputations.Add(ReputationType.EnemyFighter, Convert.ToInt32(property.Value)); break;
case "rep_trade_partner": Reputations.Add(ReputationType.TradePartner, Convert.ToInt32(property.Value)); break;
case "rep_killer": Reputations.Add(ReputationType.Killer, Convert.ToInt32(property.Value)); break;
case "rep_poet": Reputations.Add(ReputationType.Poet, Convert.ToInt32(property.Value)); break;
case "rep_bard": Reputations.Add(ReputationType.Bard, Convert.ToInt32(property.Value)); break;
case "rep_storyteller": Reputations.Add(ReputationType.Storyteller, Convert.ToInt32(property.Value)); break;
case "rep_dancer": Reputations.Add(ReputationType.Dancer, Convert.ToInt32(property.Value)); break;
}
}
}
示例11: SiteLink
public SiteLink(List<Property> properties, World world)
{
foreach (Property property in properties)
{
switch (property.Name)
{
case "link_type":
switch(property.Value)
{
case "lair": Type = SiteLinkType.Lair; break;
case "home site building": Type = SiteLinkType.HomeSiteBuilding; break;
case "home site underground": Type = SiteLinkType.HomeSiteUnderground; break;
case "home structure": Type = SiteLinkType.HomeStructure; break;
case "seat of power": Type = SiteLinkType.SeatOfPower; break;
default:
Type = SiteLinkType.Unknown;
world.ParsingErrors.Report("Unknown Site Link Type: " + property.Value);
break;
}
break;
case "site_id":
Site = world.GetSite(Convert.ToInt32(property.Value));
break;
case "sub_id":
SubID = Convert.ToInt32(property.Value);
break;
case "entity_id":
Entity = world.GetEntity(Convert.ToInt32(property.Value));
break;
}
}
}