private static void LoadGlobalData() { if (MecanimEventManager.eventDataSources == null) { return; } MecanimEventManager.globalLoadedData = new Dictionary <int, Dictionary <int, Dictionary <int, List <MecanimEvent> > > >(); MecanimEventData[] array = MecanimEventManager.eventDataSources; for (int i = 0; i < array.Length; i++) { MecanimEventData mecanimEventData = array[i]; if (!(mecanimEventData == null)) { MecanimEventDataEntry[] data = mecanimEventData.data; MecanimEventDataEntry[] array2 = data; for (int j = 0; j < array2.Length; j++) { MecanimEventDataEntry mecanimEventDataEntry = array2[j]; int instanceID = mecanimEventDataEntry.animatorController.GetInstanceID(); if (!MecanimEventManager.globalLoadedData.ContainsKey(instanceID)) { MecanimEventManager.globalLoadedData[instanceID] = new Dictionary <int, Dictionary <int, List <MecanimEvent> > >(); } if (!MecanimEventManager.globalLoadedData[instanceID].ContainsKey(mecanimEventDataEntry.layer)) { MecanimEventManager.globalLoadedData[instanceID][mecanimEventDataEntry.layer] = new Dictionary <int, List <MecanimEvent> >(); } MecanimEventManager.globalLoadedData[instanceID][mecanimEventDataEntry.layer][mecanimEventDataEntry.stateNameHash] = new List <MecanimEvent>(mecanimEventDataEntry.events); } } } }
public MecanimEventDataEntry(MecanimEventDataEntry other) { this.animatorController = other.animatorController; this.layer = other.layer; this.stateNameHash = other.stateNameHash; if (other.events == null) { this.events = new MecanimEvent[0]; } else { this.events = new MecanimEvent[other.events.Length]; for (int i = 0; i < this.events.Length; i++) { this.events[i] = new MecanimEvent(other.events[i]); } } }
public MecanimEventDataEntry(MecanimEventDataEntry other) { this.animatorController = other.animatorController; this.layer = other.layer; this.stateNameHash = other.stateNameHash; if (other.events == null) this.events = new MecanimEvent[0]; else { this.events = new MecanimEvent[other.events.Length]; for (int i = 0; i < this.events.Length; i++) { this.events[i] = new MecanimEvent(other.events[i]); } } }
public void SaveData() { var targetData = target as MecanimEventData; Undo.RecordObject(target, "Mecanim Event Data"); var entries = new List <MecanimEventDataEntry>(); foreach (var controller in data.Keys) { foreach (var layer in data[controller].Keys) { foreach (var stateNameHash in data[controller][layer].Keys) { if (data[controller][layer][stateNameHash].Count == 0) { continue; } if (!IsValidState(controller.GetInstanceID(), layer, stateNameHash)) { continue; } var entry = new MecanimEventDataEntry(); entry.animatorController = controller; entry.layer = layer; entry.stateNameHash = stateNameHash; entry.events = data[controller][layer][stateNameHash].ToArray(); ; entries.Add(entry); } } } targetData.data = entries.ToArray(); EditorUtility.SetDirty(target); }
public static Dictionary <int, Dictionary <int, Dictionary <int, List <MecanimEvent> > > > LoadData(MecanimEventData data) { Dictionary <int, Dictionary <int, Dictionary <int, List <MecanimEvent> > > > dictionary = new Dictionary <int, Dictionary <int, Dictionary <int, List <MecanimEvent> > > >(); MecanimEventDataEntry[] data2 = data.data; MecanimEventDataEntry[] array = data2; for (int i = 0; i < array.Length; i++) { MecanimEventDataEntry mecanimEventDataEntry = array[i]; int instanceID = mecanimEventDataEntry.animatorController.GetInstanceID(); if (!dictionary.ContainsKey(instanceID)) { dictionary[instanceID] = new Dictionary <int, Dictionary <int, List <MecanimEvent> > >(); } if (!dictionary[instanceID].ContainsKey(mecanimEventDataEntry.layer)) { dictionary[instanceID][mecanimEventDataEntry.layer] = new Dictionary <int, List <MecanimEvent> >(); } dictionary[instanceID][mecanimEventDataEntry.layer][mecanimEventDataEntry.stateNameHash] = new List <MecanimEvent>(mecanimEventDataEntry.events); } return(dictionary); }
public void SaveData() { MecanimEventData targetData = target as MecanimEventData; Undo.RecordObject(target, "Mecanim Event Data"); List<MecanimEventDataEntry> entries = new List<MecanimEventDataEntry>(); foreach(AnimatorController controller in data.Keys) { foreach(int layer in data[controller].Keys) { foreach(int stateNameHash in data[controller][layer].Keys) { if (data[controller][layer][stateNameHash].Count == 0) continue; if (!IsValidState(controller.GetInstanceID(), layer, stateNameHash)) { continue; } MecanimEventDataEntry entry = new MecanimEventDataEntry(); entry.animatorController = controller; entry.layer = layer; entry.stateNameHash = stateNameHash; entry.events = data[controller][layer][stateNameHash].ToArray();; entries.Add(entry); } } } targetData.data = entries.ToArray(); EditorUtility.SetDirty(target); }