GetTypeName() static private method

static private GetTypeName ( Object obj ) : string
obj Object
return string
Example #1
0
        public TypeSelectionList(Object[] objects)
        {
            // Create dictionary of lists of objects indexed by their type.
            Dictionary <string, List <Object> > types = new Dictionary <string, List <Object> >();

            foreach (Object o in objects)
            {
                string typeName = ObjectNames.GetTypeName(o);
                if (!types.ContainsKey(typeName))
                {
                    types[typeName] = new List <Object>();
                }
                types[typeName].Add(o);
            }

            // Create and store a TypeSelection per type.
            m_TypeSelections = new List <TypeSelection>();
            foreach (KeyValuePair <string, List <Object> > kvp in types)
            {
                m_TypeSelections.Add(new TypeSelection(kvp.Key, kvp.Value.ToArray()));
            }

            // Sort the TypeSelections
            m_TypeSelections.Sort();
        }
Example #2
0
        public TypeSelectionList(UnityEngine.Object[] objects)
        {
            Dictionary <string, List <UnityEngine.Object> > dictionary = new Dictionary <string, List <UnityEngine.Object> >();

            foreach (UnityEngine.Object obj2 in objects)
            {
                string typeName = ObjectNames.GetTypeName(obj2);
                if (!dictionary.ContainsKey(typeName))
                {
                    dictionary[typeName] = new List <UnityEngine.Object>();
                }
                dictionary[typeName].Add(obj2);
            }
            this.m_TypeSelections = new List <TypeSelection>();
            foreach (KeyValuePair <string, List <UnityEngine.Object> > pair in dictionary)
            {
                this.m_TypeSelections.Add(new TypeSelection(pair.Key, pair.Value.ToArray()));
            }
            this.m_TypeSelections.Sort();
        }
Example #3
0
        public TypeSelectionList(UnityEngine.Object[] objects)
        {
            Dictionary <string, List <UnityEngine.Object> > dictionary = new Dictionary <string, List <UnityEngine.Object> >();

            for (int i = 0; i < objects.Length; i++)
            {
                UnityEngine.Object @object  = objects[i];
                string             typeName = ObjectNames.GetTypeName(@object);
                if (!dictionary.ContainsKey(typeName))
                {
                    dictionary[typeName] = new List <UnityEngine.Object>();
                }
                dictionary[typeName].Add(@object);
            }
            this.m_TypeSelections = new List <TypeSelection>();
            foreach (KeyValuePair <string, List <UnityEngine.Object> > current in dictionary)
            {
                this.m_TypeSelections.Add(new TypeSelection(current.Key, current.Value.ToArray()));
            }
            this.m_TypeSelections.Sort();
        }
Example #4
0
        public TypeSelectionList(Object[] objects)
        {
            Dictionary <string, List <Object> > dictionary = new Dictionary <string, List <Object> >();

            foreach (Object @object in objects)
            {
                string typeName = ObjectNames.GetTypeName(@object);
                if (!dictionary.ContainsKey(typeName))
                {
                    dictionary[typeName] = new List <Object>();
                }
                dictionary[typeName].Add(@object);
            }
            this.m_TypeSelections = new List <TypeSelection>();
            using (Dictionary <string, List <Object> > .Enumerator enumerator = dictionary.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <string, List <Object> > current = enumerator.Current;
                    this.m_TypeSelections.Add(new TypeSelection(current.Key, current.Value.ToArray()));
                }
            }
            this.m_TypeSelections.Sort();
        }