Ejemplo n.º 1
0
    /// <summary>
    /// Draw the atlas and sprite selection fields.
    /// </summary>

    protected virtual bool ShouldDrawProperties()
    {
        GUILayout.BeginHorizontal();
        if (UGUIEditorTools.DrawPrefixButton("Atlas"))
        {
            ComponentSelector.Show <UGUIAtlas>(OnSelectAtlas);
        }
        SerializedProperty atlas = UGUIEditorTools.DrawProperty("", serializedObject, "mAtlas", GUILayout.MinWidth(20f));

        if (GUILayout.Button("Edit", GUILayout.Width(40f)))
        {
            if (atlas != null)
            {
                UGUIAtlas atl = atlas.objectReferenceValue as UGUIAtlas;
                UGUISettings.atlas = atl;
                UGUIEditorTools.Select(atl.gameObject);
            }
        }
        GUILayout.EndHorizontal();

        UGUISprite uguiSprite = target as UGUISprite;
        string     spriteName = uguiSprite.sprite == null ? "" : uguiSprite.sprite.name;

        UGUIEditorTools.DrawAdvancedSpriteField(atlas.objectReferenceValue as UGUIAtlas, spriteName, SelectSprite, true);
        return(true);
    }