Exemple #1
0
        private static void DumpAll()
        {
            string name = uConsole.GetString();

            System.Type type = System.Type.GetType(name + ",Assembly-CSharp", false, true);
            if (type == null)
            {
                type = System.Type.GetType(name + ",UnityEngine", false, true);
            }

            if (type == null)
            {
                Debug.LogError("Unknown type '" + name + "'.");
                return;
            }

            foreach (Object eachObject in Resources.FindObjectsOfTypeAll(type))
            {
                if (eachObject is Component)
                {
                    GameObject gameObject = ((Component)eachObject).gameObject;
                    Debug.Log(DumpUtils.FormatGameObject(null, gameObject));
                }
                else
                {
                    Debug.Log(DumpUtils.FormatValue(null, eachObject));
                }
            }
        }
Exemple #2
0
        private static void PrintDetails()
        {
            if (!HasSelection())
            {
                Debug.Log("Current selection is empty.");
                return;
            }

            GameObject gameObject = CurrentGameObject();

            if (gameObject != null)
            {
                Debug.Log(DumpUtils.FormatGameObject(gameObject.name, gameObject));
                return;
            }

            System.Collections.IEnumerable enumerable = CurrentSelection() as System.Collections.IEnumerable;
            if (enumerable != null)
            {
                foreach (object value in enumerable)
                {
                    Debug.Log(DumpUtils.FormatValue(null, value));
                }
                return;
            }

            Debug.Log("Cannot print details of " + CurrentSelection());
        }
Exemple #3
0
        internal static string FormatSerializable(string name, object serializable, int indent = 0, List <object> visitedObjects = null)
        {
            if (visitedObjects != null)
            {
                if (visitedObjects.Contains(serializable))
                {
                    return(FormatString(name, serializable.ToString() + " [RECURSION]", indent));
                }

                visitedObjects.Add(serializable);
            }

            StringWriter writer = new StringWriter();

            writer.Write(GetIndentation(indent));
            WriteName(name, writer);
            writer.WriteLine(serializable.ToString());

            FieldInfo[] fieldInfos = serializable.GetType().GetFields();
            foreach (FieldInfo eachFieldInfo in fieldInfos)
            {
                if (skip(serializable, eachFieldInfo.Name))
                {
                    continue;
                }

                object value = eachFieldInfo.GetValue(serializable);
                writer.WriteLine(DumpUtils.FormatValue(eachFieldInfo.Name, value, indent + 1, visitedObjects));
            }

            PropertyInfo[] propertyInfos = serializable.GetType().GetProperties();
            foreach (PropertyInfo eachPropertyInfo in propertyInfos)
            {
                if (eachPropertyInfo.GetCustomAttributes(false).OfType <ObsoleteAttribute>().Count() > 0)
                {
                    continue;
                }

                if (skip(serializable, eachPropertyInfo.Name))
                {
                    continue;
                }

                if (eachPropertyInfo.CanRead)
                {
                    MethodInfo methodInfo = eachPropertyInfo.GetGetMethod();
                    if (methodInfo.GetParameters().Length > 0)
                    {
                        Debug.Log(methodInfo);
                        continue;
                    }

                    object value = GetMethodResult(serializable, methodInfo);
                    writer.WriteLine(DumpUtils.FormatValue(eachPropertyInfo.Name, value, indent + 1, visitedObjects));
                }
            }

            return(writer.ToString());
        }
Exemple #4
0
        private static void Dump()
        {
            string name = uConsole.GetString();

            GameObject gameObject = (GameObject)Resources.Load(name);

            Debug.Log(DumpUtils.FormatGameObject(gameObject.name, gameObject));
        }
Exemple #5
0
        private static void Clouds()
        {
            UniStormWeatherSystem uniStorm = GameManager.GetUniStorm();

            Debug.Log(DumpUtils.FormatGameObject("m_lightClouds1", uniStorm.m_LightClouds1));
            Debug.Log(DumpUtils.FormatGameObject("m_lightClouds2", uniStorm.m_LightClouds2));
            Debug.Log(DumpUtils.FormatGameObject("m_HighClouds1", uniStorm.m_HighClouds1));
            Debug.Log(DumpUtils.FormatGameObject("m_MostlyCloudyClouds", uniStorm.m_MostlyCloudyClouds));
        }
Exemple #6
0
 private static void PrintWeapons()
 {
     using (StreamWriter writer = new StreamWriter(@"C:\Users\st_dg\OneDrive\TLD\vp_FPSWeapon.txt"))
     {
         foreach (Component eachItem in Resources.FindObjectsOfTypeAll <vp_FPSWeapon>())
         {
             writer.WriteLine(DumpUtils.FormatComponent(eachItem.name, eachItem));
         }
     }
 }
Exemple #7
0
 private static void PrintCameras()
 {
     using (StreamWriter writer = new StreamWriter(@"C:\Users\st_dg\OneDrive\TLD\Camera.txt"))
     {
         foreach (Component eachItem in Resources.FindObjectsOfTypeAll <Camera>())
         {
             writer.WriteLine(DumpUtils.FormatGameObject(eachItem.name, eachItem.gameObject));
         }
     }
 }
Exemple #8
0
        private static void UniStorm()
        {
            UniStormWeatherSystem uniStormWeatherSystem = GameManager.GetUniStorm();
            GameObject            starSphere            = uniStormWeatherSystem.m_StarSphere;

            Debug.Log(DumpUtils.FormatGameObject("starSphere", starSphere));

            ObjExporter.DoExport(starSphere, true);

            Renderer starSphereRenderer = starSphere.GetComponent <Renderer>();
            Material material           = starSphereRenderer.material;

            Debug.Log(DumpUtils.FormatValue("material", material));
            Debug.Log(DumpUtils.FormatValue("mainTexture", material.mainTexture));
        }
Exemple #9
0
        internal static string FormatLODGroup(string name, LODGroup lodGroup, int indent, List <object> visitedObjects = null)
        {
            StringWriter writer = new StringWriter();

            writer.Write(GetIndentation(indent));
            WriteName(name, writer);
            writer.WriteLine(lodGroup.ToString());

            writer.WriteLine(DumpUtils.FormatValue("animateCrossFading", lodGroup.animateCrossFading, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("fadeMode", lodGroup.fadeMode, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("localReferencePoint", lodGroup.localReferencePoint, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("LODs", lodGroup.GetLODs(), indent + 1, visitedObjects));

            return(writer.ToString());
        }
Exemple #10
0
        private static void PrintPath()
        {
            if (!HasSelection())
            {
                Debug.Log("Current selection is empty.");
                return;
            }

            GameObject gameObject = CurrentGameObject();

            if (gameObject == null)
            {
                Debug.Log("Cannot print hierarchy if the turrent selection is not a GameObject.");
                return;
            }

            Debug.Log(DumpUtils.FormatPath(gameObject));
        }
Exemple #11
0
        internal static string FormatTransform(string name, Transform transform, int indent, List <System.Object> visitedObjects = null)
        {
            StringWriter writer = new StringWriter();

            writer.Write(GetIndentation(indent));
            WriteName(name, writer);
            writer.WriteLine(transform.ToString());

            writer.WriteLine(DumpUtils.FormatValue("instanceID", transform.gameObject.GetInstanceID(), indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("localPosition", transform.localPosition, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("localRotation", transform.localRotation, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("localScale", transform.localScale, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("position", transform.position, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("rotation", transform.rotation, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("lossyScale", transform.lossyScale, indent + 1, visitedObjects));
            writer.WriteLine(DumpUtils.FormatValue("parent", transform.parent, indent + 1, visitedObjects));

            return(writer.ToString());
        }
Exemple #12
0
        internal static string FormatRenderer(string name, Renderer renderer, int indent, List <object> visitedObjects = null)
        {
            StringWriter writer = new StringWriter();

            writer.Write(GetIndentation(indent));
            WriteName(name, writer);
            writer.WriteLine(renderer.ToString());

            if (renderer != null)
            {
                writer.WriteLine(DumpUtils.FormatValue("isPartOfStaticBatch", renderer.isPartOfStaticBatch, indent + 1, visitedObjects));
                writer.WriteLine(DumpUtils.FormatValue("bounds", renderer.bounds.ToString("F3"), indent + 1, visitedObjects));
                writer.WriteLine(DumpUtils.FormatValue("enabled", renderer.enabled, indent + 1, visitedObjects));
                writer.WriteLine(DumpUtils.FormatValue("isVisible", renderer.isVisible, indent + 1, visitedObjects));
                writer.WriteLine(DumpUtils.FormatValue("materials", renderer.materials, indent + 1, visitedObjects));
            }

            return(writer.ToString());
        }
Exemple #13
0
        internal static string FormatPlayerStateTransitions(string name, PlayerStateTransitions playerStateTransitions, int indent = 0)
        {
            StringWriter writer = new StringWriter();

            writer.Write(GetIndentation(indent));
            WriteName(name, writer);
            writer.WriteLine();

            FieldInfo fieldInfo = playerStateTransitions.GetType().GetField("m_ValidTransitions", BindingFlags.NonPublic | BindingFlags.Instance);
            object    value     = fieldInfo.GetValue(playerStateTransitions);

            writer.WriteLine(DumpUtils.FormatValue(fieldInfo.Name, value, indent + 1));

            fieldInfo = playerStateTransitions.GetType().GetField("m_InvalidTransitions", BindingFlags.NonPublic | BindingFlags.Instance);
            value     = fieldInfo.GetValue(playerStateTransitions);
            writer.WriteLine(DumpUtils.FormatValue(fieldInfo.Name, value, indent + 1));

            return(writer.ToString());
        }
Exemple #14
0
        private static void LoadResource()
        {
            if (uConsole.GetNumParameters() != 1)
            {
                Debug.Log("  Resource name required");
                return;
            }

            string name = uConsole.GetString();

            Debug.Log("  Loading " + name);
            Object resource = Resources.Load(name);

            if (resource == null)
            {
                Debug.Log("  Not found");
                return;
            }

            Debug.Log(DumpUtils.FormatValue(name, resource));
        }
Exemple #15
0
 private static void Location()
 {
     Debug.Log(DumpUtils.FormatComponent(null, GameManager.GetPlayerTransform()));
 }
Exemple #16
0
        private static string FormatComponent(string name, Component component, int indent = 0, List <object> visitedObjects = null)
        {
            if (component is Transform)
            {
                return(FormatTransform(name, component as Transform, indent, visitedObjects));
            }

            if (component is Renderer)
            {
                return(FormatRenderer(name, component as Renderer, indent, visitedObjects));
            }

            if (component is LODGroup)
            {
                return(FormatLODGroup(name, component as LODGroup, indent, visitedObjects));
            }

            if (visitedObjects != null)
            {
                if (visitedObjects.Contains(component))
                {
                    return(FormatString(name, component.ToString() + " [RECURSION]", indent));
                }

                visitedObjects.Add(component);
            }

            StringWriter writer = new StringWriter();

            writer.Write(GetIndentation(indent));
            WriteName(name, writer);
            writer.WriteLine(component.ToString());

            FieldInfo[] fieldInfos = component.GetType().GetFields();
            foreach (FieldInfo eachFieldInfo in fieldInfos)
            {
                if (skip(component, eachFieldInfo.Name))
                {
                    continue;
                }

                object value = eachFieldInfo.GetValue(component);
                writer.WriteLine(DumpUtils.FormatValue(eachFieldInfo.Name, value, indent + 1, visitedObjects));
            }

            PropertyInfo[] propertyInfos = component.GetType().GetProperties();
            foreach (PropertyInfo eachPropertyInfo in propertyInfos)
            {
                if (eachPropertyInfo.GetCustomAttributes(false).OfType <ObsoleteAttribute>().Count() > 0)
                {
                    continue;
                }

                if (skip(component, eachPropertyInfo.Name))
                {
                    continue;
                }

                if (eachPropertyInfo.CanRead)
                {
                    MethodInfo methodInfo = eachPropertyInfo.GetGetMethod();
                    if (methodInfo.GetParameters().Length > 0)
                    {
                        Debug.Log(methodInfo);
                        continue;
                    }

                    object value = GetMethodResult(component, methodInfo);
                    writer.WriteLine(DumpUtils.FormatValue(eachPropertyInfo.Name, value, indent + 1, visitedObjects));
                }
            }

            return(writer.ToString());
        }
Exemple #17
0
        private static void CameraEffects()
        {
            CameraEffects cameraEffects = GameManager.GetUniStorm().m_MainCamera.GetComponentInChildren <CameraEffects>();

            Debug.Log(DumpUtils.FormatGameObject(null, cameraEffects.gameObject));
        }