• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Legends.World类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LegendsViewer.Legends.World的典型用法代码示例。如果您正苦于以下问题:C# World类的具体用法?C# World怎么用?C# World使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



World类属于LegendsViewer.Legends命名空间,在下文中一共展示了World类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Duel

 public Duel(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_hfid": Attacker = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;
             case "defending_hfid": Defender = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;
         }
     //foreach (WorldEvent collectionEvent in Collection) this.AddEvent(collectionEvent);
     if (ParentCollection != null && ParentCollection.GetType() == typeof(Battle))
         foreach (HFDied death in Collection.OfType<HFDied>())
         {
             Battle battle = ParentCollection as Battle;
             if (battle.NotableAttackers.Contains(death.HistoricalFigure))
             {
                 battle.AttackerDeathCount++;
                 battle.Attackers.Single(squad => squad.Race == death.HistoricalFigure.Race).Deaths++;
                 (battle.ParentCollection as War).AttackerDeathCount++;
             }
             else if (battle.NotableDefenders.Contains(death.HistoricalFigure))
             {
                 battle.DefenderDeathCount++;
                 battle.Defenders.Single(squad => squad.Race == death.HistoricalFigure.Race).Deaths++;
                 (battle.ParentCollection as War).DefenderDeathCount++;
             }
             (ParentCollection.ParentCollection as War).DeathCount++;
         }
 }
开发者ID:RossM,项目名称:Legends-Viewer,代码行数:35,代码来源:Duel.cs


示例2: HistoricalFigureLink

        public HistoricalFigureLink(List<Property> properties, World world)
        {
            Strength = 0;
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                    case "hfid":
                        int id = Convert.ToInt32(property.Value);
                        HistoricalFigure = world.GetHistoricalFigure(id);
                        if (HistoricalFigure == null)
                            notYetLoadedHFID = id;
                        break;
                    case "link_strength": Strength = Convert.ToInt32(property.Value); break;
                    case "link_type":
                        HistoricalFigureLinkType linkType = HistoricalFigureLinkType.Unknown;
                        if (!Enum.TryParse(Formatting.InitCaps(property.Value), out linkType))
                        {
                            Type = HistoricalFigureLinkType.Unknown;
                            world.ParsingErrors.Report("Unknown HF Link Type: " + property.Value);
                        }
                        else
                            Type = linkType;
                        break;
                }
            }

            //XML states that deity links, that should be 100, are 0.
            if (Type == HistoricalFigureLinkType.Deity && Strength == 0)
                Strength = 100;
        }
开发者ID:RossM,项目名称:Legends-Viewer,代码行数:31,代码来源:Link.cs


示例3: EventCollection

 protected EventCollection(List<Property> properties, World world)
 {
     Initialize();
     World = world;
     foreach(Property property in properties)
         switch(property.Name)
         {
             case "id": this.ID = Convert.ToInt32(property.Value); property.Known = true; break;
             case "start_year": this.StartYear = Convert.ToInt32(property.Value); property.Known = true; break;
             case "start_seconds72": this.StartSeconds72 = Convert.ToInt32(property.Value); property.Known = true; break;
             case "end_year": this.EndYear = Convert.ToInt32(property.Value); property.Known = true; break;
             case "end_seconds72": this.EndSeconds72 = Convert.ToInt32(property.Value); property.Known = true; break;
             case "type": this.Type = Formatting.InitCaps(String.Intern(property.Value)); property.Known = true; break;
             case "event":
                 WorldEvent collectionEvent = world.GetEvent(Convert.ToInt32(property.Value));
                 //Some Events don't exist in the XML now with 34.01? 
                 ///TODO: Investigate EventCollection Events that don't exist in the XML, check if they exist in game or if this is just errors.
                 if (collectionEvent != null)
                 {
                     collectionEvent.ParentCollection = this;
                     this.Collection.Add(collectionEvent); property.Known = true;
                 }
                 break;
             case "eventcol": this.CollectionIDs.Add(Convert.ToInt32(property.Value)); property.Known = true; break;
             default: break;
         }
 }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:27,代码来源:EventCollections.cs


示例4: UndergroundRegion

 public UndergroundRegion(List<Property> properties, World world)
     : base(properties, world)
 {
     Depth = 0;
     Type = "";
     Battles = new List<Battle>();
     Coordinates = new List<Location>();
     foreach (Property property in properties)
         switch(property.Name)
         {
             case "depth": Depth = Convert.ToInt32(property.Value); break;
             case "type": Type = Formatting.InitCaps(property.Value); break;
             case "coords":
                 string[] coordinateStrings = property.Value.Split(new char[] { '|' },
                     StringSplitOptions.RemoveEmptyEntries);
                 foreach (var coordinateString in coordinateStrings)
                 {
                     string[] xYCoordinates = coordinateString.Split(',');
                     int x = Convert.ToInt32(xYCoordinates[0]);
                     int y = Convert.ToInt32(xYCoordinates[1]);
                     Coordinates.Add(new Location(x, y));
                 }
                 break;
         }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:25,代码来源:UndergroundRegion.cs


示例5: 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


示例6: GetPrinter

        public static HTMLPrinter GetPrinter(object printObject, World world)
        {
            Type printType = printObject.GetType();
            if (printType == typeof(Battle))
                return new BattlePrinter(printObject as Battle, world);
            if (printType == typeof(BeastAttack))
                return new BeastAttackPrinter(printObject as BeastAttack, world);
            if (printType == typeof(Entity))
                return new EntityPrinter(printObject as Entity, world);
            if (printType == typeof(Era))
                return new EraPrinter(printObject as Era);
            if (printType == typeof(HistoricalFigure))
                return new HistoricalFigureHTMLPrinter(printObject as HistoricalFigure, world);
            if (printType == typeof(WorldRegion))
                return new RegionPrinter(printObject as WorldRegion, world);
            if (printType == typeof(SiteConquered))
                return new SiteConqueredPrinter(printObject as SiteConquered, world);
            if (printType == typeof(Site))
                return new SitePrinter(printObject as Site, world);
            if (printType == typeof(UndergroundRegion))
                return new UndergroundRegionPrinter(printObject as UndergroundRegion, world);
            if (printType == typeof(War))
                return new WarPrinter(printObject as War, world);
            if (printType == typeof(World))
                return new WorldStatsPrinter(world);
            if (printType == typeof(Artifact))
                return new ArtifactPrinter(printObject as Artifact);
            if (printType == typeof(WorldContruction))
                return new WorldConstructionPrinter(printObject as WorldContruction);

            if (printType == typeof(string))
                return new StringPrinter(printObject as string);

            throw new Exception("No HTML Printer for type: " + printObject.GetType().ToString());
        }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:35,代码来源:HTMLPrinter.cs


示例7: XMLParser

 public XMLParser(World world, string xmlFile)
 {
     World = world;
     StreamReader reader = new StreamReader(xmlFile, Encoding.GetEncoding("windows-1252"));
     XML = new XmlTextReader(reader);
     XML.WhitespaceHandling = WhitespaceHandling.Significant;
 }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:7,代码来源:XMLParser.cs


示例8: 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


示例9: 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


示例10: 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


示例11: WorldContruction

 public WorldContruction(List<Property> properties, World world)
     : base(properties, world)
 {
     Name = "Untitled";
     Coordinates = new List<Location>();
     foreach (Property property in properties)
     {
         switch (property.Name)
         {
             case "name": Name = Formatting.InitCaps(property.Value); break;
             case "type": Type = Formatting.InitCaps(property.Value); break;
             case "coords":
                 string[] coordinateStrings = property.Value.Split(new char[] { '|' },
                     StringSplitOptions.RemoveEmptyEntries);
                 foreach (var coordinateString in coordinateStrings)
                 {
                     string[] xYCoordinates = coordinateString.Split(',');
                     int x = Convert.ToInt32(xYCoordinates[0]);
                     int y = Convert.ToInt32(xYCoordinates[1]);
                     Coordinates.Add(new Location(x, y));
                 }
                 break;
         }
     }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:25,代码来源:WorldConstruction.cs


示例12: HTMLControl

 public HTMLControl(object htmlObject, DwarfTabControl tabControl, World world)
 {
     World = world;
     HTMLObject = htmlObject;
     Printer = HTMLPrinter.GetPrinter(htmlObject, world);
     Title = Printer.GetTitle();
     TabControl = tabControl;
 }
开发者ID:RossM,项目名称:Legends-Viewer,代码行数:8,代码来源:HTMLControl.cs


示例13: Journey

 public Journey(List<Property> properties, World world)
     : base(properties, world)
 {
     foreach (Property property in properties)
         switch (property.Name)
         {
             case "ordinal": Ordinal = String.Intern(property.Value); break;
         }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:9,代码来源:Journey.cs


示例14: dlgHF

        public dlgHF(World world)
        {
            InitializeComponent();

            var hfByRace = world.HistoricalFigures.GroupBy(hf => hf.Race).Select(hf => hf.Key).OrderBy(hf => hf);
            foreach (var race in hfByRace)
            {
                listHFRaces.Items.Add(race);
            }
        }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:10,代码来源:dlgHF.cs


示例15: WorldRegion

 public WorldRegion(List<Property> properties, World world)
     : base(properties, world)
 {
     Battles = new List<Battle>();
     foreach(Property property in properties)
         switch(property.Name)
         {
             case "name": Name = Formatting.InitCaps(property.Value); break;
             case "type": Type = String.Intern(property.Value); break;
         }
 }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:11,代码来源:Region.cs


示例16: XMLParser

 public XMLParser(World world, string xmlFile) : this(xmlFile)
 {
     World = world;
     string xmlPlusFile = xmlFile.Replace(".xml", "_plus.xml");
     if (File.Exists(xmlPlusFile))
     {
         xmlPlusParser = new XMLPlusParser(world, xmlPlusFile);
         World.Log.AppendLine("Found LEGENDS_PLUS.XML!");
         World.Log.AppendLine("Parsed additional data...\n");
     }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:11,代码来源:XMLParser.cs


示例17: WorldObject

 protected WorldObject(List<Property> properties, World world)
 {
     ID = -1;
     Events = new List<WorldEvent>();
     foreach(Property property in properties)
         switch(property.Name)
         {
             case "id": ID = Convert.ToInt32(property.Value); property.Known = true; break;
             default: break;
         }
 }
开发者ID:figment,项目名称:Legends-Viewer,代码行数:11,代码来源:WorldObject.cs


示例18: Artifact

        public Artifact(List<Property> properties, World world)
            : base(properties, world)
        {
            foreach(Property property in properties)
                switch(property.Name)
                {
                    case "name": Name = Formatting.InitCaps(property.Value); break;
                    case "item": Item = Formatting.InitCaps(property.Value); break;

                }
        }
开发者ID:22367rh,项目名称:Legends-Viewer,代码行数:11,代码来源:Artifact.cs


示例19: Era

 public Era(int startYear, int endYear, World world)
 {
     world.TempEras.Add(this);
     this.ID = world.Eras.Count - 1 + world.TempEras.Count;
     StartYear = startYear; EndYear = endYear; Name = "";
     Events = world.Events.Where(ev => ev.Year >= StartYear && ev.Year <= EndYear).OrderBy(events => events.Year).ToList();
     Wars = world.EventCollections.OfType<War>().Where(war => (war.StartYear >= StartYear && war.EndYear <= EndYear && war.EndYear != -1) //entire war between
                                                                                             || (war.StartYear >= StartYear && war.StartYear <= EndYear) //war started before & ended
                                                                                             || (war.EndYear >= StartYear && war.EndYear <= EndYear && war.EndYear != -1) //war started during
                                                                                             || (war.StartYear <= StartYear && war.EndYear >= EndYear) //war started before & ended after
                                                                                             || (war.StartYear <= StartYear && war.EndYear == -1)).ToList();
 }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:12,代码来源:Era.cs


示例20: Entity

 public Entity(World world)
 {
     ID = -1; Name = "INVALID ENTITY"; Race = "Unknown";
     Parent = null;
     Worshipped = new List<HistoricalFigure>();
     LeaderTypes = new List<string>();
     Leaders = new List<List<HistoricalFigure>>();
     Groups = new List<Entity>();
     SiteHistory = new List<OwnerPeriod>();
     Wars = new List<War>();
     Populations = new List<Population>();
 }
开发者ID:Riock,项目名称:Legends-Viewer,代码行数:12,代码来源:Entity.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Compiler.Context类代码示例发布时间:2022-05-26
下一篇:
C# Leap.Vector类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap