protected void RegisterManagedObject(ManagedObjectInfo objectInfo) { UnityEngine.Object Object = objectInfo.GetObject(); if (objectInfo.GetPostSignificanceType() == PostSignificanceType.Sequntial) { ++managedObjectsWithSequentialPostWork; } if (viewpoints.Count > 0) { objectInfo.UpdateSignificance(viewpoints, bSortSignificanceAscending); if (objectInfo.GetPostSignificanceType() == PostSignificanceType.Sequntial) { FManagedObjectPostSignificanceFunction PostSignificanceFunction = objectInfo.GetPostSignificanceFunction(); PostSignificanceFunction(objectInfo, 1.0f, objectInfo.GetSignificance(), false); } } managedObjects.Add(Object, objectInfo); List <ManagedObjectInfo> managedObjectInfos = FindOrAdd(objectInfo.GetTag(), managedObjectsByTag); if (managedObjectInfos.Count > 0) { int LowIndex = 0; int HighIndex = managedObjectInfos.Count - 1; while (true) { int MidIndex = LowIndex + (HighIndex - LowIndex) / 2; if (CompareBySignificanceAscending(objectInfo, managedObjectInfos[MidIndex])) { if (LowIndex == MidIndex) { managedObjectInfos.Insert(LowIndex, objectInfo); break; } else { HighIndex = MidIndex - 1; } } else if (LowIndex == HighIndex) { managedObjectInfos.Insert(LowIndex + 1, objectInfo); break; } else { LowIndex = MidIndex + 1; } } } else { managedObjectInfos.Add(objectInfo); } }
public void UnregisterObject(UnityEngine.Object InObject) { ManagedObjectInfo objectInfo = RemoveAndReturnValue(InObject, managedObjects); if (objectInfo != null) { if (objectInfo.GetPostSignificanceType() == PostSignificanceType.Sequntial) { --managedObjectsWithSequentialPostWork; } if (managedObjectsByTag.ContainsKey(objectInfo.GetTag())) { List <ManagedObjectInfo> ObjectsWithTag = managedObjectsByTag[objectInfo.GetTag()]; if (ObjectsWithTag.Count == 1) { managedObjectsByTag.Remove(objectInfo.GetTag()); } else { ObjectsWithTag.Remove(objectInfo); } FManagedObjectPostSignificanceFunction ManagedObjectPostSignificanceFunction = objectInfo.GetPostSignificanceFunction(); if (ManagedObjectPostSignificanceFunction != null) { ManagedObjectPostSignificanceFunction(objectInfo, objectInfo.GetSignificance(), 1.0f, true); } } objectInfo = null; } }