Example #1
0
        // Token: 0x060004F1 RID: 1265 RVA: 0x00019588 File Offset: 0x00017788
        public static global::VRGIN.Helpers.JSONNode Deserialize(global::System.IO.BinaryReader aReader)
        {
            global::VRGIN.Helpers.JSONBinaryTag jsonbinaryTag = (global::VRGIN.Helpers.JSONBinaryTag)aReader.ReadByte();
            global::VRGIN.Helpers.JSONNode      result;
            switch (jsonbinaryTag)
            {
            case global::VRGIN.Helpers.JSONBinaryTag.Array:
            {
                int num = aReader.ReadInt32();
                global::VRGIN.Helpers.JSONArray jsonarray = new global::VRGIN.Helpers.JSONArray();
                for (int i = 0; i < num; i++)
                {
                    jsonarray.Add(global::VRGIN.Helpers.JSONNode.Deserialize(aReader));
                }
                result = jsonarray;
                break;
            }

            case global::VRGIN.Helpers.JSONBinaryTag.Class:
            {
                int num2 = aReader.ReadInt32();
                global::VRGIN.Helpers.JSONClass jsonclass = new global::VRGIN.Helpers.JSONClass();
                for (int j = 0; j < num2; j++)
                {
                    string aKey = aReader.ReadString();
                    global::VRGIN.Helpers.JSONNode aItem = global::VRGIN.Helpers.JSONNode.Deserialize(aReader);
                    jsonclass.Add(aKey, aItem);
                }
                result = jsonclass;
                break;
            }

            case global::VRGIN.Helpers.JSONBinaryTag.Value:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadString());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.IntValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadInt32());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.DoubleValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadDouble());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.BoolValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadBoolean());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.FloatValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadSingle());
                break;

            default:
                throw new global::System.Exception("Error deserializing JSON. Unknown tag: " + jsonbinaryTag.ToString());
            }
            return(result);
        }
Example #2
0
 // Token: 0x0600062C RID: 1580 RVA: 0x0001D980 File Offset: 0x0001BB80
 public static void DumpScene(string path, bool onlyActive = false)
 {
     global::UnityEngine.Debug.Log("Dumping scene...");
     global::VRGIN.Helpers.JSONArray jsonarray = new global::VRGIN.Helpers.JSONArray();
     foreach (global::UnityEngine.GameObject go2 in global::System.Linq.Enumerable.Where <global::UnityEngine.GameObject>(global::UnityEngine.Object.FindObjectsOfType <global::UnityEngine.GameObject>(), (global::UnityEngine.GameObject go) => go.transform.parent == null))
     {
         jsonarray.Add(global::EscalationVR.UnityHelper.AnalyzeNode(go2, onlyActive));
     }
     global::System.IO.File.WriteAllText(path, jsonarray.ToJSON(0));
     global::UnityEngine.Debug.Log("Done!");
 }
Example #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);
 }