コード例 #1
0
 private MetricMapper(PropertyInfo propertyInfo, MapAction metricSetter, string metricName, string metricUnits)
 {
     _propertyInfo = propertyInfo;
     _metricSetter = metricSetter;
     MetricName = metricName;
     MetricUnits = metricUnits;
 }
コード例 #2
0
        internal MetricMapper(PropertyInfo propertyInfo)
        {
            _propertyInfo = propertyInfo;

            var attribute = propertyInfo.GetCustomAttribute<MetricAttribute>();
            if (attribute != null && attribute.Ignore)
            {
                throw new ArgumentException(string.Format("The property {0}.{1} is marked to ignore and cannot be mapped.", propertyInfo.ReflectedType.FullName, propertyInfo.Name));
            }

            _metricSetter = GetMetricSetter(propertyInfo);

            if (_metricSetter == null)
            {
                throw new ArgumentException(string.Format("No convention-based mapping for {0} property {1}.{2}", propertyInfo.PropertyType.Name, propertyInfo.ReflectedType.FullName, propertyInfo.Name));
            }

            MetricName = GetMetricName(_propertyInfo, attribute);
            MetricUnits = attribute != null ? attribute.Units : null;
        }
コード例 #3
0
 private void TraverseMap(MapAction action, Entity entity, int targetX, int targetY)
 {
     CheckBounds(targetX, targetY);
     CheckBounds(targetX + entity.Width - 1, targetY + entity.Height - 1);
     List<Entity> collisions = new List<Entity>();
     for (var x = targetX; x < targetX + entity.Width; x++)
     {
         for (var y = targetY; y < targetY + entity.Height; y++)
         {
             switch (action)
             {
                 case MapAction.Check:
                     var mapEntity = GetEntity(x, y);
                     if (mapEntity != null)
                     {
                         //store all collisions and then decide what to do with them
                         collisions.Add(mapEntity);
                     }
                     break;
                 case MapAction.Add:
                     Rows[y][x] = entity;
                     break;
                 case MapAction.Remove:
                     if (Rows[y][x] == entity)
                     {
                         Rows[y][x] = null;
                     }
                     break;
             }
         }
     }
     if (collisions.Count > 0)
     {
         throw new CollisionException {Entities = collisions, Entity = collisions[0]};
     }
 }
コード例 #4
0
        private void TraverseMap(MapAction action, Entity entity, int targetX, int targetY)
        {
            CheckBounds(targetX, targetY);
            CheckBounds(targetX + entity.Width - 1, targetY + entity.Height - 1);

            for (var x = targetX; x < targetX + entity.Width; x++)
            {
                for (var y = targetY; y < targetY + entity.Height; y++)
                {
                    switch (action)
                    {
                        case MapAction.Check:
                            var mapEntity = GetEntity(x, y);
                            if (mapEntity != null)
                            {
                                throw new CollisionException {Entity = mapEntity};
                            }
                            break;
                        case MapAction.Add:
                            Rows[y][x] = entity;
                            break;
                        case MapAction.Remove:
                            Rows[y][x] = null;
                            break;
                    }
                }
            }
        }
コード例 #5
0
ファイル: Map.cs プロジェクト: jousonren/TileTerrainSystem
 public void Raise()
 {
     mapAction = MapAction.Raise;
 }
コード例 #6
0
ファイル: Map.cs プロジェクト: jousonren/TileTerrainSystem
 public void UseMaterial()
 {
     mapAction = MapAction.Spread;
 }
コード例 #7
0
 /// <summary>
 /// Called by Fix to let you set up your application
 /// </summary>
 /// <param name="use">Function to add middleware or apps to the pipeline.</param>
 /// <param name="map">Function to add middleware or apps only for URLs with a certain prefix.</param>
 /// <remarks>We have to use the <c>map</c> function to restrict SignalR otherwise it goes batshit and complains about protocols in every response.</remarks>
 public void Setup(UseAction use, MapAction map)
 {
     map("/signalr", OwinSignalR.Hub(_startupEnv));
     use(Statics.AddFileAlias("/index.html", "/").AddFolder("/Scripts"));
 }
コード例 #8
0
 private static async Task CheckOperation(this ICommandAdapter commandAdapter, MapAction mapAction)
 {
     await commandAdapter.Execute(() => {
         commandAdapter.Execute(new ActionCommand(Actions.Refresh));
         commandAdapter.Execute(new CheckDetailViewCommand <DevExpress.Persistent.BaseImpl.Task>((task => task.Description, mapAction.ToString())));
     });
 }