private UnitySceneData(OneToListMap <MonoBehaviourProperty, MonoBehaviourPropertyValue> propertiesData, OneToSetMap <string, FileID> eventHandlers, OneToSetMap <string, string> scriptMapping, SceneHierarchy sceneHierarchy) { PropertiesData = propertiesData; SceneHierarchy = sceneHierarchy; ShortNameToScriptFileId = eventHandlers; ScriptMapping = scriptMapping; }
public static SceneHierarchy Read(UnsafeReader reader) { var element = new SceneHierarchy(); var count = reader.ReadInt32(); for (int i = 0; i < count; i++) { var id = FileID.ReadFrom(reader); element.Elements.Add(id, reader.ReadPolymorphic <IUnityHierarchyElement>()); } return(element); }
public static UnitySceneData Build(IUnityYamlFile file) { Assertion.Assert(file.IsValid(), "file.IsValid()"); Assertion.Assert(file.GetSolution().Locks.IsReadAccessAllowed(), "ReadLock is required"); var interruptChecker = new SeldomInterruptChecker(); var unityPropertyValueCacheItem = new OneToListMap <MonoBehaviourProperty, MonoBehaviourPropertyValue>(); var sceneHierarchy = new SceneHierarchy(); var anchorToEventHandler = new OneToSetMap <string, string>(); var scriptMapping = new OneToSetMap <string, string>(); var eventHandlerToScriptTarget = new OneToSetMap <string, FileID>(); foreach (var document in file.DocumentsEnumerable) { interruptChecker.CheckForInterrupt(); var buffer = document.GetTextAsBuffer(); if (ourPrefabModificationSearcher.Find(buffer, 0, Math.Min(buffer.Length, 100)) > 0) { sceneHierarchy.AddPrefabModification(buffer); } else { var simpleValues = new Dictionary <string, string>(); var referenceValues = new Dictionary <string, FileID>(); UnitySceneDataUtil.ExtractSimpleAndReferenceValues(buffer, simpleValues, referenceValues, eventHandlerToScriptTarget); FillProperties(simpleValues, referenceValues, unityPropertyValueCacheItem); FillScriptMapping(simpleValues, referenceValues, scriptMapping); sceneHierarchy.AddSceneHierarchyElement(simpleValues, referenceValues); } } if (unityPropertyValueCacheItem.Count == 0 && sceneHierarchy.Elements.Count == 0) { return(null); } return(new UnitySceneData(unityPropertyValueCacheItem, eventHandlerToScriptTarget, scriptMapping, sceneHierarchy)); }
private UnitySceneData(OneToListMap <MonoBehaviourProperty, MonoBehaviourPropertyValue> propertiesData, SceneHierarchy sceneHierarchy) { PropertiesData = propertiesData; SceneHierarchy = sceneHierarchy; }