Exemple #1
0
        public void SaveLabels()
        {
            if (!this.m_CurrentChanged || this.m_AssetLabels == null || this.m_CurrentAssetsSet == null)
            {
                return;
            }
            bool flag1 = false;

            using (HashSet <UnityEngine.Object> .Enumerator enumerator = this.m_CurrentAssetsSet.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    UnityEngine.Object current = enumerator.Current;
                    bool          flag2        = false;
                    List <string> list         = ((IEnumerable <string>)AssetDatabase.GetLabels(current)).ToList <string>();
                    if (this.m_ChangeWasAdd)
                    {
                        if (!list.Contains(this.m_ChangedLabel))
                        {
                            list.Add(this.m_ChangedLabel);
                            flag2 = true;
                        }
                    }
                    else if (list.Contains(this.m_ChangedLabel))
                    {
                        list.Remove(this.m_ChangedLabel);
                        flag2 = true;
                    }
                    if (flag2)
                    {
                        AssetDatabase.SetLabels(current, list.ToArray());
                        if (LabelGUI.s_AssetLabelsForObjectChangedDelegates != null)
                        {
                            this.m_IgnoreNextAssetLabelsChangedCall = true;
                            LabelGUI.s_AssetLabelsForObjectChangedDelegates(current);
                        }
                        flag1 = true;
                    }
                }
            }
            if (flag1)
            {
                EditorApplication.Internal_CallAssetLabelsHaveChanged();
            }
            this.m_CurrentChanged = false;
        }
Exemple #2
0
 public void SaveLabels()
 {
     if (this.m_CurrentChanged && this.m_AssetLabels != null && this.m_CurrentAssetsSet != null)
     {
         bool flag = false;
         foreach (UnityEngine.Object current in this.m_CurrentAssetsSet)
         {
             bool          flag2  = false;
             string[]      labels = AssetDatabase.GetLabels(current);
             List <string> list   = labels.ToList <string>();
             if (this.m_ChangeWasAdd)
             {
                 if (!list.Contains(this.m_ChangedLabel))
                 {
                     list.Add(this.m_ChangedLabel);
                     flag2 = true;
                 }
             }
             else
             {
                 if (list.Contains(this.m_ChangedLabel))
                 {
                     list.Remove(this.m_ChangedLabel);
                     flag2 = true;
                 }
             }
             if (flag2)
             {
                 AssetDatabase.SetLabels(current, list.ToArray());
                 if (LabelGUI.s_AssetLabelsForObjectChangedDelegates != null)
                 {
                     this.m_IgnoreNextAssetLabelsChangedCall = true;
                     LabelGUI.s_AssetLabelsForObjectChangedDelegates(current);
                 }
                 flag = true;
             }
         }
         if (flag)
         {
             EditorApplication.Internal_CallAssetLabelsHaveChanged();
         }
         this.m_CurrentChanged = false;
     }
 }