private ImportedUnityEventData ProcessPrefabModifications(IPsiSourceFile currentFile, AssetDocument document) { var result = new ImportedUnityEventData(); if (document.HierarchyElement is IPrefabInstanceHierarchy prefabInstanceHierarchy) { var assetMethodDataToModifiedFields = new OneToSetMap <(LocalReference, string, int), string>(); foreach (var modification in prefabInstanceHierarchy.PrefabModifications) { if (!(modification.Target is ExternalReference externalReference)) { continue; } if (!modification.PropertyPath.Contains("m_PersistentCalls")) { continue; } var location = new LocalReference(currentFile.PsiStorage.PersistentIndex, PrefabsUtil.GetImportedDocumentAnchor(prefabInstanceHierarchy.Location.LocalDocumentAnchor, externalReference.LocalDocumentAnchor)); var parts = modification.PropertyPath.Split('.'); var unityEventName = parts[0]; var dataPart = parts.FirstOrDefault(t => t.StartsWith("data")); if (dataPart == null) { continue; } if (!int.TryParse(dataPart.RemoveStart("data[").RemoveEnd("]"), out var index)) { continue; } result.UnityEventToModifiedIndex.Add((location, unityEventName), index); var last = parts.Last(); if (last.Equals("m_MethodName") && modification.Value is AssetSimpleValue assetSimpleValue) { result.AssetMethodNameInModifications.Add(assetSimpleValue.SimpleValue); } assetMethodDataToModifiedFields.Add((location, unityEventName, index), last); } foreach (var(_, set) in assetMethodDataToModifiedFields) { if (!set.Contains("m_MethodName")) { result.HasEventModificationWithoutMethodName = true; } } } return(result); }
private UnityEventsDataElement(List <UnityEventData> unityEventData, ImportedUnityEventData importedUnityEventData) { UnityEvents = unityEventData; ImportedUnityEventData = importedUnityEventData; }
public UnityEventsBuildResult(ImportedUnityEventData modificationDescription, LocalList <UnityEventData> unityEventData) { ModificationDescription = modificationDescription; UnityEventData = unityEventData; }