Exemplo n.º 1
0
        public void InitLabelCache(UnityEngine.Object[] assets)
        {
            HashSet <UnityEngine.Object> hashSet = new HashSet <UnityEngine.Object>(assets);

            if (this.m_CurrentAssetsSet == null || !this.m_CurrentAssetsSet.SetEquals(hashSet))
            {
                List <string> source;
                List <string> source2;
                this.GetLabelsForAssets(assets, out source, out source2);
                this.m_AssetLabels = new PopupList.InputData
                {
                    m_AllowCustom        = true,
                    m_OnSelectCallback   = new PopupList.OnSelectCallback(this.AssetLabelListCallback),
                    m_MaxCount           = 15,
                    m_SortAlphabetically = true
                };
                Dictionary <string, float> allLabels = AssetDatabase.GetAllLabels();
                foreach (KeyValuePair <string, float> pair in allLabels)
                {
                    PopupList.ListElement listElement = this.m_AssetLabels.NewOrMatchingElement(pair.Key);
                    if (listElement.filterScore < pair.Value)
                    {
                        listElement.filterScore = pair.Value;
                    }
                    listElement.selected          = source.Any((string label) => string.Equals(label, pair.Key, StringComparison.OrdinalIgnoreCase));
                    listElement.partiallySelected = source2.Any((string label) => string.Equals(label, pair.Key, StringComparison.OrdinalIgnoreCase));
                }
            }
            this.m_CurrentAssetsSet = hashSet;
            this.m_CurrentChanged   = false;
        }
 private void SetFunctions(Dictionary<string, int> functions)
 {
   this.m_FunctionsListInputData.m_ListElements.Clear();
   if (functions == null)
     this.m_FunctionsListInputData.NewOrMatchingElement("Querying instrumentable functions...").enabled = false;
   else if (functions.Count == 0)
   {
     this.m_FunctionsListInputData.NewOrMatchingElement("No instrumentable child functions found").enabled = false;
   }
   else
   {
     this.m_FunctionsListInputData.m_MaxCount = Mathf.Clamp(functions.Count + 1, 0, 30);
     if (this.m_ShowAllCheckbox)
     {
       this.m_AllCheckbox = new PopupList.ListElement(" All", false, float.MaxValue);
       this.m_FunctionsListInputData.m_ListElements.Add(this.m_AllCheckbox);
     }
     using (Dictionary<string, int>.Enumerator enumerator = functions.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         KeyValuePair<string, int> current = enumerator.Current;
         PopupList.ListElement listElement = new PopupList.ListElement(current.Key, current.Value != 0);
         listElement.ResetScore();
         this.m_FunctionsListInputData.m_ListElements.Add(listElement);
       }
     }
     if (!this.m_ShowAllCheckbox)
       return;
     this.UpdateAllCheckbox();
   }
 }
Exemplo n.º 3
0
 public void AssetLabelListCallback(PopupList.ListElement element)
 {
     this.m_ChangedLabel       = element.text;
     element.selected          = !element.selected;
     this.m_ChangeWasAdd       = element.selected;
     element.partiallySelected = false;
     this.m_CurrentChanged     = true;
     this.SaveLabels();
     InspectorWindow.RepaintAllInspectors();
 }
Exemplo n.º 4
0
 public void DeselectAll()
 {
     using (List <PopupList.ListElement> .Enumerator enumerator = this.m_ListElements.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             PopupList.ListElement current = enumerator.Current;
             current.selected          = false;
             current.partiallySelected = false;
         }
     }
 }
Exemplo n.º 5
0
 public PopupList.ListElement NewOrMatchingElement(string label)
 {
     foreach (PopupList.ListElement current in this.m_ListElements)
     {
         if (current.text.Equals(label, StringComparison.OrdinalIgnoreCase))
         {
             return(current);
         }
     }
     PopupList.ListElement listElement = new PopupList.ListElement(label, false, -1f);
     this.m_ListElements.Add(listElement);
     return(listElement);
 }
Exemplo n.º 6
0
 public PopupList.ListElement NewOrMatchingElement(string label)
 {
     using (List <PopupList.ListElement> .Enumerator enumerator = this.m_ListElements.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             PopupList.ListElement current = enumerator.Current;
             if (current.text.Equals(label, StringComparison.OrdinalIgnoreCase))
             {
                 return(current);
             }
         }
     }
     PopupList.ListElement listElement = new PopupList.ListElement(label, false, -1f);
     this.m_ListElements.Add(listElement);
     return(listElement);
 }
Exemplo n.º 7
0
        public void InitLabelCache(UnityEngine.Object[] assets)
        {
            HashSet <UnityEngine.Object> objectSet = new HashSet <UnityEngine.Object>((IEnumerable <UnityEngine.Object>)assets);

            if (this.m_CurrentAssetsSet == null || !this.m_CurrentAssetsSet.SetEquals((IEnumerable <UnityEngine.Object>)objectSet))
            {
                List <string> all;
                List <string> partial;
                this.GetLabelsForAssets(assets, out all, out partial);
                this.m_AssetLabels = new PopupList.InputData()
                {
                    m_CloseOnSelection   = false,
                    m_AllowCustom        = true,
                    m_OnSelectCallback   = new PopupList.OnSelectCallback(this.AssetLabelListCallback),
                    m_MaxCount           = 15,
                    m_SortAlphabetically = true
                };
                Dictionary <string, float> allLabels = AssetDatabase.GetAllLabels();
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                LabelGUI.\u003CInitLabelCache\u003Ec__AnonStorey92 cacheCAnonStorey92 = new LabelGUI.\u003CInitLabelCache\u003Ec__AnonStorey92();
                using (Dictionary <string, float> .Enumerator enumerator = allLabels.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        // ISSUE: reference to a compiler-generated field
                        cacheCAnonStorey92.pair = enumerator.Current;
                        // ISSUE: reference to a compiler-generated field
                        PopupList.ListElement listElement = this.m_AssetLabels.NewOrMatchingElement(cacheCAnonStorey92.pair.Key);
                        // ISSUE: reference to a compiler-generated field
                        if ((double)listElement.filterScore < (double)cacheCAnonStorey92.pair.Value)
                        {
                            // ISSUE: reference to a compiler-generated field
                            listElement.filterScore = cacheCAnonStorey92.pair.Value;
                        }
                        // ISSUE: reference to a compiler-generated method
                        listElement.selected = all.Any <string>(new Func <string, bool>(cacheCAnonStorey92.\u003C\u003Em__164));
                        // ISSUE: reference to a compiler-generated method
                        listElement.partiallySelected = partial.Any <string>(new Func <string, bool>(cacheCAnonStorey92.\u003C\u003Em__165));
                    }
                }
            }
            this.m_CurrentAssetsSet = objectSet;
            this.m_CurrentChanged   = false;
        }
Exemplo n.º 8
0
        public void InitLabelCache(Object[] assets)
        {
            HashSet <Object> newAssetSet = new HashSet <Object>(assets);

            // Init only if new asset
            if (m_CurrentAssetsSet == null || !m_CurrentAssetsSet.SetEquals(newAssetSet))
            {
                List <string> all;
                List <string> partial;
                GetLabelsForAssets(assets, out all, out partial);

                m_AssetLabels = new PopupList.InputData
                {
                    m_CloseOnSelection   = false,
                    m_AllowCustom        = true,
                    m_OnSelectCallback   = AssetLabelListCallback,
                    m_MaxCount           = 15,
                    m_SortAlphabetically = true
                };

                Dictionary <string, float> allLabels = AssetDatabase.GetAllLabels();
                foreach (var pair in allLabels)
                {
                    PopupList.ListElement element = m_AssetLabels.NewOrMatchingElement(pair.Key);
                    if (element.filterScore < pair.Value)
                    {
                        element.filterScore = pair.Value;
                    }
                    element.selected          = all.Any(label => string.Equals(label, pair.Key, StringComparison.OrdinalIgnoreCase));
                    element.partiallySelected = partial.Any(label => string.Equals(label, pair.Key, StringComparison.OrdinalIgnoreCase));
                }
            }

            m_CurrentAssetsSet = newAssetSet;
            m_CurrentChanged   = false;
        }
Exemplo n.º 9
0
			public PopupList.ListElement NewOrMatchingElement(string label)
			{
				foreach (PopupList.ListElement current in this.m_ListElements)
				{
					if (current.text.Equals(label, StringComparison.OrdinalIgnoreCase))
					{
						return current;
					}
				}
				PopupList.ListElement listElement = new PopupList.ListElement(label, false, -1f);
				this.m_ListElements.Add(listElement);
				return listElement;
			}
Exemplo n.º 10
0
 public PopupList.ListElement NewOrMatchingElement(string label)
 {
   using (List<PopupList.ListElement>.Enumerator enumerator = this.m_ListElements.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       PopupList.ListElement current = enumerator.Current;
       if (current.text.Equals(label, StringComparison.OrdinalIgnoreCase))
         return current;
     }
   }
   PopupList.ListElement listElement = new PopupList.ListElement(label, false, -1f);
   this.m_ListElements.Add(listElement);
   return listElement;
 }