예제 #1
0
 // Token: 0x060005D1 RID: 1489 RVA: 0x0001C49C File Offset: 0x0001A69C
 public static T CopyComponent <T>(T original, global::UnityEngine.GameObject destination) where T : global::UnityEngine.Component
 {
     global::System.Type                   type      = original.GetType();
     global::UnityEngine.Component         component = destination.AddComponent(type);
     global::System.Reflection.FieldInfo[] fields    = type.GetFields();
     foreach (global::System.Reflection.FieldInfo fieldInfo in fields)
     {
         fieldInfo.SetValue(component, fieldInfo.GetValue(original));
     }
     return(component as T);
 }
예제 #2
0
 // Token: 0x0600062F RID: 1583 RVA: 0x0001DA94 File Offset: 0x0001BC94
 public static global::VRGIN.Helpers.JSONClass AnalyzeComponent(global::UnityEngine.Component c)
 {
     global::VRGIN.Helpers.JSONClass jsonclass = new global::VRGIN.Helpers.JSONClass();
     foreach (global::System.Reflection.FieldInfo fieldInfo in c.GetType().GetFields(20))
     {
         try
         {
             string text = global::EscalationVR.UnityHelper.FieldToString(fieldInfo.Name, fieldInfo.GetValue(c));
             bool   flag = text != null;
             if (flag)
             {
                 jsonclass[fieldInfo.Name] = text;
             }
         }
         catch (global::System.Exception ex)
         {
             global::UnityEngine.Debug.LogWarningFormat("Failed to get field {0}", new object[]
             {
                 fieldInfo.Name
             });
         }
     }
     foreach (global::System.Reflection.PropertyInfo propertyInfo in c.GetType().GetProperties(20))
     {
         try
         {
             bool flag2 = propertyInfo.GetIndexParameters().Length == 0;
             if (flag2)
             {
                 string text2 = global::EscalationVR.UnityHelper.FieldToString(propertyInfo.Name, propertyInfo.GetValue(c, null));
                 bool   flag3 = text2 != null;
                 if (flag3)
                 {
                     jsonclass[propertyInfo.Name] = text2;
                 }
             }
         }
         catch (global::System.Exception ex2)
         {
             global::UnityEngine.Debug.LogWarningFormat("Failed to get prop {0}", new object[]
             {
                 propertyInfo.Name
             });
         }
     }
     return(jsonclass);
 }
예제 #3
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);
 }
예제 #4
0
 // Token: 0x06000586 RID: 1414 RVA: 0x0001B891 File Offset: 0x00019A91
 public static void SendMessageUpwardsToAll(this global::UnityEngine.Component component, string methodName, params object[] parameters)
 {
     component.gameObject.SendMessageUpwardsToAll(methodName, parameters);
 }
예제 #5
0
 // Token: 0x06000582 RID: 1410 RVA: 0x0001B7FD File Offset: 0x000199FD
 public static void BroadcastToAll(this global::UnityEngine.Component component, string methodName, params object[] parameters)
 {
     component.gameObject.BroadcastToAll(methodName, parameters);
 }
 // Token: 0x060005FF RID: 1535 RVA: 0x0001D30C File Offset: 0x0001B50C
 public static string GetPath(this global::UnityEngine.Component component)
 {
     return(component.transform.parent ? (component.transform.parent.GetPath() + "/" + component.name) : component.name);
 }