// Token: 0x06000581 RID: 1409 RVA: 0x0001B7C8 File Offset: 0x000199C8
 public static void BroadcastToAll(this global::UnityEngine.GameObject gameobject, string methodName, params object[] parameters)
 {
     global::UnityEngine.MonoBehaviour[] components = gameobject.GetComponents <global::UnityEngine.MonoBehaviour>();
     foreach (global::UnityEngine.MonoBehaviour objectToCheck in components)
     {
         objectToCheck.InvokeIfExists(methodName, parameters);
     }
 }
Beispiel #2
0
 // Token: 0x06000631 RID: 1585 RVA: 0x0001DCE4 File Offset: 0x0001BEE4
 public static global::VRGIN.Helpers.JSONClass AnalyzeNode(global::UnityEngine.GameObject go, bool onlyActive = false)
 {
     global::VRGIN.Helpers.JSONClass jsonclass = new global::VRGIN.Helpers.JSONClass();
     jsonclass["name"]   = go.name;
     jsonclass["active"] = go.activeSelf.ToString();
     jsonclass["tag"]    = go.tag;
     jsonclass["layer"]  = global::UnityEngine.LayerMask.LayerToName(go.gameObject.layer);
     jsonclass["pos"]    = go.transform.localPosition.ToString();
     jsonclass["rot"]    = go.transform.localEulerAngles.ToString();
     jsonclass["scale"]  = go.transform.localScale.ToString();
     global::VRGIN.Helpers.JSONClass jsonclass2 = new global::VRGIN.Helpers.JSONClass();
     foreach (global::UnityEngine.Component component in go.GetComponents <global::UnityEngine.Component>())
     {
         bool flag = component == null;
         if (flag)
         {
             string text = "NULL component: ";
             global::UnityEngine.Component component2 = component;
             global::UnityEngine.Debug.LogWarningFormat(text + ((component2 != null) ? component2.ToString() : null), global::System.Array.Empty <object>());
         }
         else
         {
             jsonclass2[component.GetType().Name] = global::EscalationVR.UnityHelper.AnalyzeComponent(component);
         }
     }
     global::VRGIN.Helpers.JSONArray jsonarray = new global::VRGIN.Helpers.JSONArray();
     foreach (global::UnityEngine.GameObject gameObject in go.Children())
     {
         bool flag2 = !onlyActive || gameObject.activeInHierarchy;
         if (flag2)
         {
             jsonarray.Add(global::EscalationVR.UnityHelper.AnalyzeNode(gameObject, onlyActive));
         }
     }
     jsonclass["Components"] = jsonclass2;
     jsonclass["Children"]   = jsonarray;
     return(jsonclass);
 }
 // Token: 0x060005F9 RID: 1529 RVA: 0x0001D154 File Offset: 0x0001B354
 public static global::System.Collections.Generic.IEnumerable <global::UnityEngine.MonoBehaviour> GetCameraEffects(this global::UnityEngine.GameObject go)
 {
     return(global::System.Linq.Enumerable.Where <global::UnityEngine.MonoBehaviour>(go.GetComponents <global::UnityEngine.MonoBehaviour>(), new global::System.Func <global::UnityEngine.MonoBehaviour, bool>(global::EscalationVR.GameObjectExtensions.IsCameraEffect)));
 }
Beispiel #4
0
        // Token: 0x06000589 RID: 1417 RVA: 0x0001B8F8 File Offset: 0x00019AF8
        private global::System.Collections.IEnumerator Measure()
        {
            global::System.Collections.Generic.List <global::UnityEngine.GameObject> queue = global::System.Linq.Enumerable.ToList <global::UnityEngine.GameObject>(global::System.Linq.Enumerable.Where <global::UnityEngine.GameObject>(global::System.Linq.Enumerable.Except <global::UnityEngine.GameObject>(global::VRGIN.Helpers.UnityHelper.GetRootNodes(), new global::UnityEngine.GameObject[]
            {
                base.gameObject
            }), (global::UnityEngine.GameObject n) => !n.name.StartsWith("VRGIN") && !n.name.StartsWith("[")));
            yield return(base.StartCoroutine(this.MeasureFramerate(30)));

            double startInterval = this._CurrentInterval;

            global::VRGIN.Core.VRLog.Info("Starting to profile! This might take a while...", global::System.Array.Empty <object>());
            while (queue.Count > 0)
            {
                global::UnityEngine.GameObject obj = global::System.Linq.Enumerable.First <global::UnityEngine.GameObject>(queue);
                queue.RemoveAt(0);
                bool flag = !obj.activeInHierarchy;
                if (!flag)
                {
                    obj.SetActive(false);
                    yield return(base.StartCoroutine(this.MeasureFramerate(30)));

                    obj.SetActive(true);
                    double impact = startInterval / this._CurrentInterval;
                    global::VRGIN.Core.VRLog.Info("{0}{1}: {2:0.00}", new object[]
                    {
                        string.Join("", global::System.Linq.Enumerable.ToArray <string>(global::System.Linq.Enumerable.Repeat <string>(" ", obj.transform.Depth()))),
                        obj.name,
                        impact
                    });
                    bool flag2 = impact > 1.1499999761581421;
                    if (flag2)
                    {
                        queue.InsertRange(0, obj.Children());
                        foreach (global::UnityEngine.Behaviour component in global::System.Linq.Enumerable.Where <global::UnityEngine.Behaviour>(obj.GetComponents <global::UnityEngine.Behaviour>(), (global::UnityEngine.Behaviour c) => c.enabled))
                        {
                            component.enabled = false;
                            yield return(base.StartCoroutine(this.MeasureFramerate(30)));

                            component.enabled = true;
                            impact            = startInterval / this._CurrentInterval;
                            global::VRGIN.Core.VRLog.Info("{0}{1} [{2}]: {3:0.000}", new object[]
                            {
                                string.Join("", global::System.Linq.Enumerable.ToArray <string>(global::System.Linq.Enumerable.Repeat <string>(" ", obj.transform.Depth()))),
                                obj.name,
                                component.GetType().Name,
                                impact
                            });
                            component = null;
                        }
                        global::System.Collections.Generic.IEnumerator <global::UnityEngine.Behaviour> enumerator = null;
                    }
                    yield return(null);

                    obj = null;
                }
            }
            global::VRGIN.Core.VRLog.Info("Done!", global::System.Array.Empty <object>());
            this._Callback();
            global::UnityEngine.Object.Destroy(base.gameObject);
            yield break;
            yield break;
        }