Пример #1
0
        protected override LabeledSpritePoint DrawValueInternal(Rect rect, LabeledSpritePoint value)
        {
            string  label    = value.GetLabel();
            Vector2 position = value.GetPosition();

            EditProperty_Single_Value sprite_property = GetProperty().GetTarget().ForcePropertyValue("target_asset");

            Rect label_rect;
            Rect position_rect;

            rect.SplitByXLeftPercent(0.4f, out rect, out position_rect);
            rect.SplitByYBottomOffset(LINE_HEIGHT, out label_rect, out rect);

            label = EditorGUIExtensions.TextField(label_rect, label);

            if (sprite_property != null)
            {
                Sprite sprite;

                if (sprite_property.TryGetContentValues <Sprite>(out sprite))
                {
                    position_rect = GUIExtensions.DrawSprite(position_rect, sprite);

                    position = EditorGUIExtensions.XYControl(
                        position_rect,
                        position,
                        new FloatRange(0.0f, 1.0f),
                        new FloatRange(0.0f, 1.0f)
                        );
                }
            }

            return(new LabeledSpritePoint(label, position));
        }
Пример #2
0
        protected override void DrawElementInternal(int draw_id, Rect view)
        {
            Rect rect = GetElementRect();

            if (vectorizer != null)
            {
                Sprite sprite = vectorizer.GetTestSprite();

                if (sprite != null)
                {
                    Rect info_rect;

                    rect.SplitByYTopOffset(LINE_HEIGHT, out rect, out info_rect);

                    float line_thickness = vectorizer.GetTestLineThickness();
                    float point_size     = vectorizer.GetTestPointSize();

                    Vector2 divisor = sprite.GetTextureSize() / rect.size.GetMinComponent();
                    List <List <Vector2> > paths = vectorizer.VectorizeSprite(sprite)
                                                   .Convert(l => l.Convert(p => p.GetWithFlippedY().GetComponentDivide(divisor) + rect.center).ToList())
                                                   .ToList();

                    GUIExtensions.DrawSprite(rect, sprite);
                    GUI.Label(info_rect, "Number Vertexs: " + paths.Convert(p => p.Count).Sum());

                    GUI.color = Color.white;
                    paths.Process(p => GUIExtensions.DrawLoop(p, line_thickness, point_size));
                }
            }
        }
Пример #3
0
        protected override Sprite DrawValueInternal(Rect rect, Sprite value)
        {
            Rect field_rect;

            rect.SplitByXRightOffset(64.0f, out field_rect, out rect);

            value = EditorGUIExtensions.ObjectField <Sprite>(field_rect, value);
            GUIExtensions.DrawSprite(rect, value);

            return(value);
        }
Пример #4
0
        static public Sprite SpriteDropZone(Rect rect, Sprite value)
        {
            GUIExtensions.DrawSprite(rect, value);

            return(DropZoneSingle(rect, value));
        }