public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection collection = new PropertyDescriptorCollection(null);

            Walkable   = (VO_StageWalkable)value;
            collection = Walkable.GetProperties();
            return(collection);
        }
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            VO_StageWalkable walkable = Walkable;

            if (propertyValues["Title"] != null)
            {
                walkable.Title = propertyValues["Title"].ToString();
            }
            if (propertyValues["Location"] != null)
            {
                walkable.Location = (Point)propertyValues["Location"];
            }
            return(walkable);
        }
Пример #3
0
 public static VO_StageHotSpot CreateWalkableArea(VO_Layer layer, Point position)
 {
     if (layer.ListWalkableAreas.Count < GlobalConstants.PERF_MAX_WALK_PER_STAGE)
     {
         VO_StageWalkable newHotSpot = new VO_StageWalkable();
         newHotSpot.Id         = Guid.NewGuid();
         newHotSpot.Title      = GlobalConstants.WALK_NEW_ITEM;
         newHotSpot.ObjectType = Enums.StageObjectType.Walkables;
         newHotSpot.Stage      = layer.Stage;
         newHotSpot.Points     = new Point[1];
         newHotSpot.Points[0]  = position;
         newHotSpot.Layer      = layer.Id;
         newHotSpot.Event      = null;
         layer.ListWalkableAreas.Add(newHotSpot);
         return(newHotSpot);
     }
     MessageBox.Show(string.Format(Errors.STAGE_MAX_WALK, GlobalConstants.PERF_MAX_WALK_PER_STAGE), Errors.ERROR_BOX_TITLE);
     return(null);
 }