void OnWaapiChildAdded(string json) { var added = AkWaapiUtilities.ParseChildAddedOrRemoved(json); if (added.childInfo.type == WwiseObjectType.None) { return; } var parent = Find(added.parentInfo.objectGUID); // New object created, but parent is not loaded yet, so we can ignore it if (parent == null) { return; } var child = Find(added.childInfo.objectGUID); if (child == null) { child = new AkWwiseTreeViewItem(added.childInfo, GenerateUniqueID(), parent.depth + 1); } else { child.numChildren = added.childInfo.childrenCount; child.displayName = added.childInfo.name; } parent.AddWwiseItemChild(child); Data.Add(child); parent.numChildren = added.parentInfo.childrenCount; child.depth = parent.depth + 1; if (!CheckIfFullyLoaded(parent)) { AkWaapiUtilities.GetResultListDelegate <WwiseObjectInfoJsonObject> callback = (List <WwiseObjectInfoJsonObject> items) => { UpdateParentWithLoadedChildren(parent.objectGuid, AkWaapiUtilities.ParseObjectInfo(items)); }; AkWaapiUtilities.GetChildren(parent.objectGuid, waapiWwiseObjectOptions, callback); } if (!CheckIfFullyLoaded(child)) { AkWaapiUtilities.GetResultListDelegate <WwiseObjectInfoJsonObject> callback = (List <WwiseObjectInfoJsonObject> items) => { UpdateParentWithLoadedChildren(child.objectGuid, AkWaapiUtilities.ParseObjectInfo(items)); }; AkWaapiUtilities.GetChildren(child.objectGuid, waapiWwiseObjectOptions, callback); } ScheduleRebuild(); }
void OnWaapiChildRemoved(string json) { var removed = AkWaapiUtilities.ParseChildAddedOrRemoved(json); toRequeue.Enqueue(new TreeViewCommand(() => Remove(removed.parentInfo, removed.childInfo))); }