示例#1
0
    void SpriteList()
    {
        GUILayout.Label("Sprites", "HeaderLabel");

        bool hasMissingTextures = false;

        EditorGUI.BeginChangeCheck();

        MadGUI.Indent(() => {
            for (int i = 0; i < atlas.ListItems().Count; ++i)
            {
                MadAtlas.Item item = atlas.ListItems()[i];

                EditorGUILayout.BeginHorizontal();
                var texture = MadAtlasUtil.GetItemOrigin(item);
                bool valid  = MadGUI.Validate(() => texture != null, () => {
                    item.name = EditorGUILayout.TextField(item.name);
                });

                GUI.enabled = valid;
                GUI.color   = Color.yellow;
                if (GUILayout.Button("Ping", GUILayout.Width(40)))
                {
                    EditorGUIUtility.PingObject(texture);
                }
                GUI.enabled = true;

                GUI.color = Color.red;
                if (GUILayout.Button("X", GUILayout.Width(20)))
                {
                    MadAtlasBuilder.RemoveFromAtlas(atlas, item);
                }
                GUI.color = Color.white;

                EditorGUILayout.EndHorizontal();

                if (!valid)
                {
                    hasMissingTextures = true;
                }
            }

            if (hasMissingTextures)
            {
                MadGUI.Error("There are sprites with missing origin texture. This will for them to dissapear on edit.");
            }
        });

        if (EditorGUI.EndChangeCheck())
        {
            EditorUtility.SetDirty(atlas);
        }
    }
示例#2
0
        protected void FieldAtlasSprite(string guid, string label, MadAtlasBrowser.Changed guidChangedCallback)
        {
            var atlas = energyBar3DBase.atlas;

            MadAtlasUtil.AtlasField(guid, atlas, label, guidChangedCallback, this);
        }
示例#3
0
//    protected void AtlasTexture(SerializedProperty spriteName, SerializedProperty color) {
//        EditorGUILayout.BeginHorizontal();
//
//        FieldAtlasSprite(spriteName, "Sprite");
//
//        EditorGUILayout.PropertyField(color, new GUIContent(""), GUILayout.MaxWidth(100));
//        EditorGUILayout.EndHorizontal();
//    }
//
        protected void FieldAtlasSprite(SerializedProperty guid, string label)
        {
            var atlas = energyBar3DBase.atlas;

            MadAtlasUtil.AtlasField(guid, atlas, label, this);
        }