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


C# World.GetEntity方法代码示例

本文整理汇总了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();
                }

            }
        }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:30,代码来源:Theft.cs

示例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);
            }

        }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:35,代码来源:SiteConquered.cs

示例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()
        }
开发者ID:karv,项目名称:Legends-Viewer,代码行数:25,代码来源:BeastAttack.cs

示例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;
         }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:16,代码来源:Abduction.cs

示例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;
         }
     }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:30,代码来源:EntityEntityLink.cs

示例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;
 }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:22,代码来源:War.cs

示例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;
         }
     }
 }
开发者ID:karv,项目名称:Legends-Viewer,代码行数:13,代码来源:EntityReputation.cs

示例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;
         }
     }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:18,代码来源:EntityPopulation.cs

示例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;
         }
     }
 }
开发者ID:22367rh,项目名称:Legends-Viewer,代码行数:44,代码来源:Link.cs

示例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;
         }
     }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:20,代码来源:EntityReputation.cs

示例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;
         }
     }
 }
开发者ID:22367rh,项目名称:Legends-Viewer,代码行数:32,代码来源:Link.cs


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