Ejemplo n.º 1
0
    private void DrawInspector()
    {
        bool resizeOnStart   = EditorGUILayout.Toggle("Resize on Start()", this.m_EditedLoader.ResizeOnStart);
        bool updateTransform = EditorGUILayout.Toggle("Update transform", this.m_EditedLoader.UpdateTransform);

        string atlasName = (this.m_EditedLoader.Atlas != null) ? this.m_EditedLoader.Atlas.name : "<select>";

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.PrefixLabel("Atlas");
            if (GUILayout.Button(atlasName, "DropDown"))
            {
                SVGAtlasSelector.Show("", this.OnAtlasSelect);
            }
        }
        EditorGUILayout.EndHorizontal();

        if (this.m_EditedLoader.Atlas != null && this.m_EditedLoader.SpriteReference != null)
        {
            SVGSpriteAssetFile spriteAsset = this.m_EditedLoader.Atlas.GetGeneratedSprite(this.m_EditedLoader.SpriteReference);
            string             buttonText  = (spriteAsset != null) ? spriteAsset.SpriteData.Sprite.name : "<select>";

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.PrefixLabel("Sprite");
                if (GUILayout.Button(buttonText, "DropDown"))
                {
                    SVGSpriteSelector.Show(this.m_EditedLoader.Atlas, "", this.OnSpriteSelect);
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        if (this.m_EditedLoader.ResizeOnStart != resizeOnStart)
        {
            this.m_EditedLoader.ResizeOnStart = resizeOnStart;
            SVGUtils.MarkObjectDirty(this.m_EditedLoader);
        }

        if (this.m_EditedLoader.UpdateTransform != updateTransform)
        {
            this.m_EditedLoader.UpdateTransform = updateTransform;
            SVGUtils.MarkObjectDirty(this.m_EditedLoader);
        }
    }
    private void DrawInspector()
    {
        bool resizeOnStart;

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.PrefixLabel("Resize on Start()");
            resizeOnStart = EditorGUILayout.Toggle(this.m_EditedLoader.ResizeOnStart);
        }
        EditorGUILayout.EndHorizontal();

        SVGUIAtlas uiAtlas = this.m_EditedLoader.UIAtlas;

        if ((uiAtlas != null) && (this.m_EditedLoader.SpriteReference != null))
        {
            SVGSpriteAssetFile spriteAsset = uiAtlas.GetGeneratedSprite(this.m_EditedLoader.SpriteReference);
            string             buttonText  = (spriteAsset != null) ? spriteAsset.SpriteData.Sprite.name : "<select>";

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.PrefixLabel("Sprite");
                if (GUILayout.Button(buttonText, "DropDown"))
                {
                    SVGSpriteSelector.Show(uiAtlas, "", this.OnSpriteSelect);
                }
                if (GUILayout.Button("Edit", GUILayout.Width(80)))
                {
                    // show pivot editor
                    SVGPivotEditor.Show(spriteAsset, this.OnSpriteEdited);
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        if (this.m_EditedLoader.ResizeOnStart != resizeOnStart)
        {
            this.m_EditedLoader.ResizeOnStart = resizeOnStart;
            SVGUtils.MarkObjectDirty(this.m_EditedLoader);
        }
    }