GetClassName() private method

private GetClassName ( Object obj ) : string
obj Object
return string
コード例 #1
0
        public virtual GUIContent GetPreviewTitle()
        {
            GUIContent gUIContent = new GUIContent();

            if (this.m_Targets.Length == 1)
            {
                gUIContent.text = this.target.name;
            }
            else
            {
                gUIContent.text = this.m_Targets.Length + " ";
                if (this.target is MonoBehaviour)
                {
                    GUIContent expr_58 = gUIContent;
                    expr_58.text += MonoScript.FromMonoBehaviour(this.target as MonoBehaviour).GetClass().Name;
                }
                else
                {
                    GUIContent expr_88 = gUIContent;
                    expr_88.text += ObjectNames.NicifyVariableName(ObjectNames.GetClassName(this.target));
                }
                GUIContent expr_A9 = gUIContent;
                expr_A9.text += "s";
            }
            return(gUIContent);
        }
コード例 #2
0
        // Like GetClassName but handles folders, scenes, GUISkins, and other default assets as separate types.
        internal static string GetTypeName(Object obj)
        {
            // Return "Object" when null so we have a icon in the inspector(null does not have an icon). case 707513.
            if (obj == null)
            {
                return("Object");
            }

            string pathLower = AssetDatabase.GetAssetPath(obj).ToLower();

            if (pathLower.EndsWith(".unity"))
            {
                return("Scene");
            }
            else if (pathLower.EndsWith(".guiskin"))
            {
                return("GUI Skin");
            }
            else if (System.IO.Directory.Exists(AssetDatabase.GetAssetPath(obj)))
            {
                return("Folder");
            }
            else if (obj.GetType() == typeof(Object))
            {
                return(System.IO.Path.GetExtension(pathLower) + " File");
            }
            return(ObjectNames.GetClassName(obj));
        }
コード例 #3
0
ファイル: Editor.cs プロジェクト: whutdyp/UnityCsReference
        public virtual GUIContent GetPreviewTitle()
        {
            GUIContent guiContent = new GUIContent();

            if (m_Targets.Length == 1)
            {
                guiContent.text = target.name;
            }
            else
            {
                guiContent.text = m_Targets.Length + " ";
                if (NativeClassExtensionUtilities.ExtendsANativeType(target))
                {
                    guiContent.text += MonoScript.FromScriptedObject(target).GetClass().Name;
                }
                else
                {
                    guiContent.text += ObjectNames.NicifyVariableName(ObjectNames.GetClassName(target));
                }

                guiContent.text += "s";
            }

            return(guiContent);
        }
コード例 #4
0
        private void ApplyProperty(object previousValue, int changedPropertyMask)
        {
            if (targets == null || targets.Length == 0)
            {
                throw new ArgumentException("No material targets provided");
            }

            Object[] mats = targets;
            string   targetTitle;

            if (mats.Length == 1)
            {
                targetTitle = mats[0].name;
            }
            else
            {
                targetTitle = mats.Length + " " + ObjectNames.NicifyVariableName(ObjectNames.GetClassName(mats[0])) + "s";
            }

            //@TODO: Maybe all this logic should be moved to C++
            // reduces api surface...
            bool didApply = false;

            if (m_ApplyPropertyCallback != null)
            {
                didApply = m_ApplyPropertyCallback(this, changedPropertyMask, previousValue);
            }

            if (!didApply)
            {
                ShaderUtil.ApplyProperty(this, changedPropertyMask, "Modify " + displayName + " of " + targetTitle);
            }
        }
コード例 #5
0
        private void ApplyProperty(object previousValue, int changedPropertyMask)
        {
            if (this.targets == null || this.targets.Length == 0)
            {
                throw new ArgumentException("No material targets provided");
            }
            UnityEngine.Object[] targets = this.targets;
            string str;

            if (targets.Length == 1)
            {
                str = targets[0].name;
            }
            else
            {
                str = string.Concat(new object[]
                {
                    targets.Length,
                    " ",
                    ObjectNames.NicifyVariableName(ObjectNames.GetClassName(targets[0])),
                    "s"
                });
            }
            bool flag = false;

            if (this.m_ApplyPropertyCallback != null)
            {
                flag = this.m_ApplyPropertyCallback(this, changedPropertyMask, previousValue);
            }
            if (!flag)
            {
                ShaderUtil.ApplyProperty(this, changedPropertyMask, "Modify " + this.displayName + " of " + str);
            }
        }
コード例 #6
0
ファイル: ObjectNames.cs プロジェクト: zzrx79/UnityDecompiled
        internal static string GetTypeName(UnityEngine.Object obj)
        {
            string result;

            if (obj == null)
            {
                result = "Object";
            }
            else
            {
                string text = AssetDatabase.GetAssetPath(obj).ToLower();
                if (text.EndsWith(".unity"))
                {
                    result = "Scene";
                }
                else if (text.EndsWith(".guiskin"))
                {
                    result = "GUI Skin";
                }
                else if (Directory.Exists(AssetDatabase.GetAssetPath(obj)))
                {
                    result = "Folder";
                }
                else if (obj.GetType() == typeof(UnityEngine.Object))
                {
                    result = Path.GetExtension(text) + " File";
                }
                else
                {
                    result = ObjectNames.GetClassName(obj);
                }
            }
            return(result);
        }
コード例 #7
0
        public virtual GUIContent GetPreviewTitle()
        {
            GUIContent guiContent = new GUIContent();

            if (m_Targets.Length == 1)
            {
                guiContent.text = target.name;
            }
            else
            {
                guiContent.text = m_Targets.Length + " ";
                if (target is MonoBehaviour)
                {
                    guiContent.text += MonoScript.FromMonoBehaviour(target as MonoBehaviour).GetClass().Name;
                }
                else
                {
                    guiContent.text += ObjectNames.NicifyVariableName(ObjectNames.GetClassName(target));
                }

                guiContent.text += "s";
            }

            return(guiContent);
        }
コード例 #8
0
        internal static string GetTypeName(UnityEngine.Object obj)
        {
            if (obj == (UnityEngine.Object)null)
            {
                return("Object");
            }
            string lower = AssetDatabase.GetAssetPath(obj).ToLower();

            if (lower.EndsWith(".unity"))
            {
                return("Scene");
            }
            if (lower.EndsWith(".guiskin"))
            {
                return("GUI Skin");
            }
            if (Directory.Exists(AssetDatabase.GetAssetPath(obj)))
            {
                return("Folder");
            }
            if (obj.GetType() == typeof(UnityEngine.Object))
            {
                return(Path.GetExtension(lower) + " File");
            }
            return(ObjectNames.GetClassName(obj));
        }
コード例 #9
0
        internal static string GetTypeName(Object obj)
        {
            if (obj == null)
            {
                return("Object");
            }

            string pathLower = AssetDatabase.GetAssetPath(obj).ToLower();

            if (pathLower.EndsWith(".unity"))
            {
                return("Scene");
            }
            else if (pathLower.EndsWith(".guiskin"))
            {
                return("GUI Skin");
            }
            else if (System.IO.Directory.Exists(AssetDatabase.GetAssetPath(obj)))
            {
                return("Folder");
            }
            else if (obj.GetType() == typeof(Object))
            {
                return(System.IO.Path.GetExtension(pathLower) + " File");
            }
            return(ObjectNames.GetClassName(obj));
        }
コード例 #10
0
        public virtual GUIContent GetPreviewTitle()
        {
            GUIContent content = new GUIContent();

            if (this.m_Targets.Length == 1)
            {
                content.text = this.target.name;
                return(content);
            }
            content.text = this.m_Targets.Length + " ";
            if (this.target is MonoBehaviour)
            {
                content.text = content.text + MonoScript.FromMonoBehaviour(this.target as MonoBehaviour).GetClass().Name;
            }
            else
            {
                content.text = content.text + ObjectNames.NicifyVariableName(ObjectNames.GetClassName(this.target));
            }
            content.text = content.text + "s";
            return(content);
        }