public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection collection = new PropertyDescriptorCollection(null); Region = (VO_StageRegion)value; collection = Region.GetProperties(); return(collection); }
public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues) { VO_StageRegion region = Region; if (propertyValues["Title"] != null) { region.Title = propertyValues["Title"].ToString(); } if (propertyValues["Location"] != null) { region.Location = (Point)propertyValues["Location"]; } if (propertyValues["Ratio"] != null) { region.Ratio = Convert.ToDouble(propertyValues["Ratio"]); } return(region); }
public static VO_StageRegion CreateRegion(VO_Stage stage, Point position) { if (stage.ListHotSpots.Count < GlobalConstants.PERF_MAX_REGIONS_PER_STAGE) { VO_StageRegion newHotSpot = new VO_StageRegion(); newHotSpot.Id = Guid.NewGuid(); newHotSpot.Title = GlobalConstants.REGION_NEW_ITEM; newHotSpot.ObjectType = Enums.StageObjectType.Regions; newHotSpot.Stage = stage.Id; newHotSpot.Ratio = GlobalConstants.CHARACTERS_NORMAL_RATIO; newHotSpot.Points = new Point[1]; newHotSpot.Points[0] = position; newHotSpot.Event = null; newHotSpot.PlayerPositionPoint = new VO_Coords(); stage.ListRegions.Add(newHotSpot); return(newHotSpot); } MessageBox.Show(string.Format(Errors.STAGE_MAX_REGION, GlobalConstants.PERF_MAX_REGIONS_PER_STAGE), Errors.ERROR_BOX_TITLE); return(null); }