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


C# IDefinitionManager.GetDefinitions方法代码示例

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


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

示例1: ControllerMapper

		public ControllerMapper(ITypeFinder typeFinder, IDefinitionManager definitionManager)
		{
			IList<ControlsAttribute> controllerDefinitions = FindControllers(typeFinder);
			foreach (ItemDefinition id in definitionManager.GetDefinitions())
			{
				IAdapterDescriptor controllerDefinition = GetControllerFor(id, controllerDefinitions);
				if(controllerDefinition != null)
				{
					ControllerMap[id.ItemType] = controllerDefinition.ControllerName;

					// interacting with static context is tricky, here I made the assumtion that the last
					// finder is the most relevat and takes the place of previous ones, this makes a few 
					// tests pass and doesn't seem to be called in production
					foreach (var finder in PathDictionary.GetFinders(id.ItemType).Where(f => f is ActionResolver))
						PathDictionary.RemoveFinder(id.ItemType, finder);

					// Use MVC's ReflectedControllerDescriptor to find all actions on the Controller
					var methods = new ReflectedControllerDescriptor(controllerDefinition.AdapterType)
						.GetCanonicalActions()
						.Select(m => m.ActionName).ToArray();
					var actionResolver = new ActionResolver(this, methods);

					_controllerActionMap[controllerDefinition.ControllerName] = methods;

					PathDictionary.PrependFinder(id.ItemType, actionResolver);
				}
			}
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:28,代码来源:ControllerMapper.cs

示例2: GetDefinition

 public virtual ItemDefinition GetDefinition(IDefinitionManager definitions)
 {
     foreach (ItemDefinition definition in definitions.GetDefinitions())
         if (definition.Discriminator == ItemDiscriminator)
             return definition;
     return null;
 }
开发者ID:brianmatic,项目名称:n2cms,代码行数:7,代码来源:MagicLocation.cs

示例3: Populate

        public override void Populate(IDefinitionManager definitionManager, IPlanet planet, IChunkColumn column00, IChunkColumn column10, IChunkColumn column01, IChunkColumn column11)
        {
            // Tree Definitions initialisieren
            if (treeDefinitions == null)
            {
                treeDefinitions = definitionManager.GetDefinitions<ITreeDefinition>().OrderBy(d => d.Order).ToArray();
                foreach (var treeDefinition in treeDefinitions)
                    treeDefinition.Init(definitionManager);
            }

            int salt = (column00.Index.X & 0xffff) + ((column00.Index.Y & 0xffff) << 16);
            Random random = new Random(planet.Seed + salt);

            Index3 sample = new Index3(column00.Index.X * Chunk.CHUNKSIZE_X, column00.Index.Y * Chunk.CHUNKSIZE_Y, column00.Heights[0, 0]);
            foreach (var treeDefinition in treeDefinitions)
            {
                int density = treeDefinition.GetDensity(planet, sample);
                if (density <= 0) continue;

                for (int i = 0; i < density; i++)
                {
                    int x = random.Next(Chunk.CHUNKSIZE_X / 2, Chunk.CHUNKSIZE_X * 3 / 2);
                    int y = random.Next(Chunk.CHUNKSIZE_Y / 2, Chunk.CHUNKSIZE_Y * 3 / 2);
                    int z = LocalBuilder.GetSurfaceHeight(column00, column10, column01, column11, x, y);

                    LocalBuilder builder = new LocalBuilder(x, y, z + 1, column00, column10, column01, column11);
                    treeDefinition.PlantTree(definitionManager, planet, new Index3(x, y, z), builder, random.Next(int.MaxValue));
                }
            }
        }
开发者ID:reicheltp,项目名称:octoawesome,代码行数:30,代码来源:TreePopulator.cs

示例4: Execute

        public override void Execute()
        {
            this.definitions = Engine.Resolve<IDefinitionManager>();
            this.finder = Engine.Resolve<IItemFinder>();

            foreach (var definition in definitions.GetDefinitions())
            {
                definition.NumberOfItems = finder.Where.Type.Eq(definition.ItemType).Count();
            }
        }
开发者ID:cherylhanlon,项目名称:Tigers,代码行数:10,代码来源:NumberOfItemsScheduledAction.cs


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