Beispiel #1
0
    public static void AtlasField(string guid, MadAtlas atlas, string label, MadAtlasBrowser.Changed callback) {
        string spriteName = "";
        if (!string.IsNullOrEmpty(guid)) {
            var guids = atlas.ListItemGUIDs();
            var index = guids.FindIndex((s) => s == guid);

            if (index != -1) {
                spriteName = atlas.items[index].name;
            }
        }

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.TextField(label, spriteName);
        if (GUILayout.Button("Browse", GUILayout.Width(55))) {
            MadAtlasBrowser.Show(atlas, guid, callback);
        }
        EditorGUILayout.EndHorizontal();
    }
Beispiel #2
0
    public static void AtlasField(string guid, MadAtlas atlas, string label, MadAtlasBrowser.Changed callback, ScriptableObject parent)
    {
        string spriteName = "";

        if (!string.IsNullOrEmpty(guid))
        {
            var guids = atlas.ListItemGUIDs();
            var index = guids.FindIndex((s) => s == guid);

            if (index != -1)
            {
                spriteName = atlas.items[index].name;
            }
        }

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.TextField(label, spriteName);
        if (GUILayout.Button("Browse", GUILayout.Width(55)))
        {
            MadAtlasBrowser.Show(atlas, guid, callback, parent);
        }
        EditorGUILayout.EndHorizontal();
    }
Beispiel #3
0
    public static void AtlasField(SerializedProperty textureField, MadAtlas atlas, string label, ScriptableObject parent)
    {
        string guid       = textureField.stringValue;
        string spriteName = "";

        if (!string.IsNullOrEmpty(guid) && atlas != null)
        {
            var item = atlas.GetItem(guid);
            if (item != null)
            {
                spriteName = item.name;
            }
        }

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.TextField(label, spriteName);
        MadGUI.ConditionallyEnabled(atlas != null, () => {
            if (GUILayout.Button("Browse", GUILayout.Width(55)))
            {
                MadAtlasBrowser.Show(atlas, textureField, parent);
            }
        });
        EditorGUILayout.EndHorizontal();
    }