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


C# EventManager.LoadActionsFromFile方法代码示例

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


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

示例1: Game

        public Game(Logger logger, int numCharacters)
        {
            debugLogger = logger;
            eventManager = new EventManager();
            roomManager = new RoomManager();
            infoManager = new InformationManager();
            modifierManager = new ModifierManager();
            jobManager = new JobManager();
            cvManager = new CharacterVisualizationManager();
            random = new Random();

            CurrentTime = 0;

            maleNames = File.ReadAllLines("Names/male_names.txt");
            femaleNames = File.ReadAllLines("Names/female_names.txt");
            dynasties = new Dictionary<string, Dynasty>();
            familyNames = File.ReadAllLines("Names/family_names.txt");
            foreach (var fam in familyNames)
            {
                dynasties.Add(fam, new Dynasty(fam));
            }

            Counter<string> badTags = new Counter<string>();

            //Go load all the xml files in our events directory.
            foreach (var file in Directory.EnumerateFiles("Events", "*.xml"))
            {
                eventManager.LoadEventsFromFile(file, badTags);
            }

            //Go load all the xml files in our actions directory.
            foreach (var file in Directory.EnumerateFiles("Actions", "*.xml"))
            {
                eventManager.LoadActionsFromFile(file, badTags);
            }

            //Look for errors in the events and actions
            eventManager.Verify();

            //Go load all the xml files in our rooms directory.
            foreach (var file in Directory.EnumerateFiles("Rooms", "*.xml"))
            {
                roomManager.LoadRoomsFromFile(file, badTags);
            }

            //Go load all the xml files in our information directory.
            foreach (var file in Directory.EnumerateFiles("Informations", "*.xml"))
            {
                infoManager.LoadInformationsFromFile(file, badTags);
            }

            //Go load all the xml files in our traits directory.
            foreach (var file in Directory.EnumerateFiles("Traits", "*.xml"))
            {
                modifierManager.LoadTraitsFromFile(file, badTags);
            }

            //Go load all the xml files in our modifiers directory.
            foreach (var file in Directory.EnumerateFiles("Modifiers", "*.xml"))
            {
                modifierManager.LoadModifiersFromFile(file, badTags);
            }

            //Go load all the xml files in our jobs directory.
            foreach (var file in Directory.EnumerateFiles("Jobs", "*.xml"))
            {
                jobManager.LoadJobsFromFile(file, badTags);
            }

            cvManager.LoadFromDirectory("Graphics/Portraits_2", badTags);

            foreach (var pair in badTags)
            {
                Log(string.Format("Found unhandled xml tag <{0}> {1} times.", pair.Key, pair.Value));
            }

            CommonRooms = roomManager.GetCommonRooms();

            for (int iCharacter = 0; iCharacter < numCharacters; ++iCharacter)
            {
                characters.Add(GetRandomAICharacter());
            }
            OrderCharacters();
            jobManager.InitializeJobs(characters, this);
        }
开发者ID:jenn0108,项目名称:CourtIntrigue,代码行数:85,代码来源:Game.cs


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