Beispiel #1
0
        public bool Valid(TaggedAsset asset)
        {
            foreach (string tag in requiredTags)
            {
                if (!asset.HasTag(tag))
                {
                    return(false);
                }
            }

            foreach (string tag in excludedTags)
            {
                if (asset.HasTag(tag))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
0
        private int OnTagListGUI(TaggedAsset taggedAsset, int selectedTag)
        {
            string addedTag;

            GUILayout.BeginHorizontal();
            GUILayout.Space(30.0f);

            addedTag = Resources.PulldownPopup("Add tag", new ArrayList(Editor.Instance.Collection.Tags), "No tags in collection") as string;
            if (addedTag != null)
            {
                taggedAsset.AddTag(addedTag);
                Editor.Instance.SaveCollection();
            }

            if (taggedAsset.HasTag(selectedTag) && GUILayout.Button("Delete", GUILayout.Height(15.0f)))
            {
                taggedAsset.RemoveTag(selectedTag);
                Editor.Instance.SaveCollection();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(30.0f);
            GUILayout.BeginVertical();
            if (taggedAsset.Tags.Length == 0)
            {
                GUILayout.Label("No tags added");
            }
            else
            {
                selectedTag = ( int )Resources.SelectList(taggedAsset.Tags, selectedTag, OnTagListItemGUI);
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            return(selectedTag);
        }
Beispiel #3
0
        public bool Valid( TaggedAsset asset )
        {
            foreach( string tag in requiredTags )
            {
                if( !asset.HasTag( tag ) )
                {
                    return false;
                }
            }

            foreach( string tag in excludedTags )
            {
                if( asset.HasTag( tag ) )
                {
                    return false;
                }
            }

            return true;
        }
Beispiel #4
0
        private int OnTagListGUI( TaggedAsset taggedAsset, int selectedTag )
        {
            string addedTag;

            GUILayout.BeginHorizontal();
                Spacer();

                addedTag = Resources.PulldownPopup( "Add tag", new ArrayList( Editor.Instance.Collection.Tags ), "No tags in collection" ) as string;
                if( addedTag != null )
                {
                    taggedAsset.AddTag( addedTag );
                    Editor.Instance.SaveCollection();
                }

                if( taggedAsset.HasTag( selectedTag ) && GUILayout.Button( "Delete", GUILayout.Height( 15.0f ) ) )
                {
                    taggedAsset.RemoveTag( selectedTag );
                    Editor.Instance.SaveCollection();
                }

                GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
                Spacer();
                GUILayout.BeginVertical();
                    if( taggedAsset.Tags.Length == 0 )
                    {
                        GUILayout.Label( "No tags added" );
                    }
                    else
                    {
                        selectedTag = ( int )Resources.SelectList( taggedAsset.Tags, selectedTag, OnTagListItemGUI );
                    }
                GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            return selectedTag;
        }