Esempio n. 1
0
        public static void Show(SpriteAtlas spriteAtlas, string defaultSpriteName, OnSpriteSelected callback)
        {
            if (spriteSelector != null)
            {
                spriteSelector.Close();
                spriteSelector = null;
            }
            AtlasSpriteSelector selector = ScriptableWizard.DisplayWizard <AtlasSpriteSelector>("Select a Sprite");

            selector.atlas = spriteAtlas;
            selector.mSelectedSpriteName       = defaultSpriteName;
            selector.mSpriteSeletectedCallback = callback;
        }
Esempio n. 2
0
        private void DrawSpritePopup(SpriteAtlas atlas, SerializedProperty spriteProperty)
        {
            GUIContent label      = new GUIContent(spriteProperty.displayName, spriteProperty.tooltip);
            string     spriteName = string.IsNullOrEmpty(spriteProperty.stringValue) ? "----" : spriteProperty.stringValue;

            using (new EditorGUI.DisabledGroupScope(!atlas))
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.PrefixLabel(label);
                    if (GUILayout.Button(string.IsNullOrEmpty(spriteName) ? "-" : spriteName, "minipopup") && atlas)
                    {
                        AtlasSpriteSelector.Show(atlas, spriteName, (selectedSpriteName) =>
                        {
                            OnSpriteSelectedCallback(spriteProperty, selectedSpriteName);
                        });
                    }
                }
            }
        }
Esempio n. 3
0
 void OnDisable()
 {
     spriteSelector = null;
 }
Esempio n. 4
0
 void OnEnable()
 {
     spriteSelector = this;
 }