示例#1
0
        public static ShapeProperty Inspect(ShapeProperty shape)
        {
            shape.color = EditorGUILayout.ColorField("Color", shape.color);

            var border = shape.border;

            // Circle Style
            border.style = (BorderStyle)EditorGUILayout.EnumPopup("Style", border.style);

            if (border.style != BorderStyle.None)
            {
                border.color     = EditorGUILayout.ColorField("Border Color", border.color);
                border.position  = (BorderPosition)EditorGUILayout.EnumPopup("Border Position", border.position);
                border.thickness = EditorGUILayout.FloatField("Border Thickness",
                                                              border.thickness * 100f) / 100f;
                if (border.style == BorderStyle.Dash)
                {
                    border.dashLength = EditorGUILayout.FloatField("Dash Length", border.dashLength);
                    border.gapLength  = EditorGUILayout.FloatField("Gap Length", border.gapLength);
                }
            }

            shape.border = border;

            return(shape);
        }
示例#2
0
 public static void Apply(ShapeProperty p)
 {
     /*
      * if (p.GetType() == typeof(LineProperty)) {
      *  ApplyToLine((LineProperty)p);
      * } else
      */
     if (p.GetType() == typeof(RectProperty))
     {
         ApplyToRect((RectProperty)p);
     }
     else if (p.GetType() == typeof(CircleProperty))
     {
         ApplyToCircle((CircleProperty)p);
     }
 }
示例#3
0
        public static ShapeRenderer UpdateShapeProperty(ShapeRenderer renderer, ShapeProperty property)
        {
            switch (property.shapeType)
            {
            case ShapeType.Circle:
                ((CircleRenderer)renderer).property = (CircleProperty)property;
                break;

            case ShapeType.Line:
                ((LineRenderer)renderer).property = (LineProperty)property;
                break;

            case ShapeType.Rect:
                ((RectRenderer)renderer).property = (RectProperty)property;
                break;

            default:
                break;
            }
            return(renderer);
        }
示例#4
0
        public static ShapeRenderer InstantiateShape(ShapeProperty property)
        {
            ShapeRenderer shape = null;

            switch (property.shapeType)
            {
            case ShapeType.Circle:
                shape = InstantiateCircle((CircleProperty)property);
                break;

            case ShapeType.Line:
                shape = InstantiateLine((LineProperty)property);
                break;

            case ShapeType.Rect:
                shape = InstantiateRect((RectProperty)property);
                break;

            default:
                break;
            }
            return(shape);
        }
示例#5
0
 protected override void SetProperty(ShapeProperty newProperty)
 {
     property = newProperty as RectProperty;
 }
 // Property setter
 protected abstract void SetProperty(ShapeProperty property);