private void CustomRestore(JSONArray currentStorables) { Dictionary <string, bool> dictionary = new Dictionary <string, bool>(); IEnumerator enumerator = currentStorables.GetEnumerator(); try { while (enumerator.MoveNext()) { JSONClass jSONClass = (JSONClass)enumerator.Current; string id = jSONClass["id"]; if (id == "geometry" || id == "textures") { JSONStorable storable = containingAtom.GetStorableByID(id); if (!dictionary.ContainsKey(id)) { dictionary.Add(id, value: true); } continue; } JSONStorable value = containingAtom.GetStorableByID(id); if (value != null) { value.RestoreFromJSON(jSONClass, false, true, null); if (!dictionary.ContainsKey(id)) { dictionary.Add(id, value: true); } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } JSONStorable[] array = containingAtom.GetStorableIDs().Select((id) => containingAtom.GetStorableByID(id)).ToArray(); JSONStorable[] array2 = array; foreach (JSONStorable jSONStorable in array2) { if (!jSONStorable.exclude && !dictionary.ContainsKey(jSONStorable.storeId) && (!jSONStorable.onlyStoreIfActive || jSONStorable.gameObject.activeInHierarchy)) { JSONClass jc2 = new JSONClass(); jSONStorable.RestoreFromJSON(jc2, false, true); } } }
private void AddPersonPoseAndAnimationData(JSONClass personJson) { foreach (string storableId in animationStorableIds) { string controlStorableId = animationStorableIdToControlId(storableId); JSONStorable controlStorable = containingAtom.GetStorableByID(controlStorableId); JSONClass controlJson = FindStorableFromPerson(personJson, controlStorableId); controlStorable.RestoreFromJSON(controlJson); JSONStorable storable = containingAtom.GetStorableByID(storableId); try { JSONClass json = FindStorableFromPerson(personJson, storableId); storable.RestoreFromJSON(json); } catch (Exception e) { //Log.Message($"{e}"); } } }