public TimelineClipManager.ClipSettings buildTimeline(List <TimelineClipManager.ClipSettings> mapToTiming) { TimelineClipManager.ClipSettings clip = new TimelineClipManager.ClipSettings(); clip.timelineTrack = currentTrack; clip.triggers = triggers; if (mapToTiming.Contains(clip)) { return(clip); } mapToTiming.Add(clip); for (int i = 0; i < dynamicConnectionPorts.Count; i++) { Node n = dynamicConnectionPorts[i].connection(0).body; if (n != null && n is TimelineNode) { if (((TimelineNode)n).currentTrack == null) { Debug.LogError("missing current track"); return(null); } TriggerMapping curTrigger = triggers[i]; curTrigger.targetTrack = ((TimelineNode)n).buildTimeline(mapToTiming); triggers[i] = curTrigger; } } return(clip); }
public override void NodeGUI() { if (triggers == null) { triggers = new List <TriggerMapping>(); } if (dynamicConnectionPorts.Count != triggers.Count) { // Make sure labels and ports are synchronised while (dynamicConnectionPorts.Count > triggers.Count) { DeleteConnectionPort(dynamicConnectionPorts.Count - 1); } while (dynamicConnectionPorts.Count < triggers.Count) { CreateValueConnectionKnob(dynaCreationAttribute); } } GUILayout.Label("This is a timeline node"); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); inputKnob.DisplayLayout(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); currentTrack = EditorGUILayout.ObjectField("timeline clip", currentTrack, typeof(PlayableDirector), true) as PlayableDirector; GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (GUILayout.Button("Add", GUILayout.ExpandWidth(false))) { triggers.Add(new TriggerMapping()); CreateValueConnectionKnob(dynaCreationAttribute); } for (int i = 0; i < triggers.Count; i++) { // Display label and delete button GUILayout.BeginHorizontal(); GUILayout.Label("trigger " + i); ((ValueConnectionKnob)dynamicConnectionPorts[i]).SetPosition(); if (GUILayout.Button("x", GUILayout.ExpandWidth(false))) { // Remove current label triggers.RemoveAt(i); DeleteConnectionPort(i); i--; } GUILayout.EndHorizontal(); TriggerMapping curTrigger = triggers[i]; curTrigger.trigger = EditorGUILayout.ObjectField("timeline clip", curTrigger.trigger, typeof(TimelineTrigger), true) as TimelineTrigger; curTrigger.type = (TriggerType)EditorGUILayout.EnumPopup("trigger type", curTrigger.type); triggers[i] = curTrigger; GUILayout.Space(10); } }
//public float timeToJumpTo; public override bool Equals(object obj) { if (!(obj is TriggerMapping)) { return(false); } TriggerMapping other = (TriggerMapping)obj; return(this.trigger == other.trigger && this.type == other.type && this.targetTrack == other.targetTrack); }
public static void LoadObjectGroups(AssetInfo info, Map map, int tileWidth, int tileHeight, EventLayout eventLayout, List <TriggerInfo> triggers, List <MapNpc> npcs, List <MapEventZone> zones, List <AutomapInfo> markers, List <byte> markerTiles) { ushort ResolveEntryPoint(string name) { var(isChain, id) = ScriptConstants.ParseEntryPoint(name); return(isChain ? eventLayout.Chains[id] : id); } var mapObjects = map.ObjectGroups.SelectMany(x => x.Objects); var pathParser = NpcPathBuilder.BuildParser(mapObjects, tileWidth, tileHeight); foreach (var objectGroup in map.ObjectGroups) { foreach (var obj in objectGroup.Objects) { if (TypeName.Trigger.Equals(obj.Type, StringComparison.OrdinalIgnoreCase)) { triggers.Add(TriggerMapping.ParseTrigger(obj, tileWidth, tileHeight, ResolveEntryPoint)); } if (TypeName.Npc.Equals(obj.Type, StringComparison.OrdinalIgnoreCase)) { npcs.Add(NpcMapping.ParseNpc(obj, tileWidth, tileHeight, ResolveEntryPoint, pathParser)); } if (TypeName.Marker.Equals(obj.Type, StringComparison.OrdinalIgnoreCase)) { var(marker, tile) = AutomapMapping.ParseMarker(obj, tileWidth, tileHeight); markers.Add(marker); markerTiles.Add(tile); } } } TriggerMapping.LoadZones(zones, info.AssetId, triggers, map); }
public static List <ObjectGroup> BuildObjectGroups( BaseMapData map, int tileWidth, int tileHeight, NpcMapping.GetTileFunc getTileFunc, Dictionary <ushort, string> functionsByEventId, ref int nextObjectGroupId, ref int nextObjectId) { var results = new[] { TriggerMapping.BuildTriggers(map, tileWidth, tileHeight, functionsByEventId, ref nextObjectGroupId, ref nextObjectId), NpcMapping.BuildNpcs(map, tileWidth, tileHeight, getTileFunc, functionsByEventId, ref nextObjectGroupId, ref nextObjectId), }.SelectMany(x => x); if (map is MapData3D map3d) { results = results.Concat(AutomapMapping.BuildMarkers(map3d, tileWidth, tileHeight, ref nextObjectGroupId, ref nextObjectId)); } return(results.ToList()); }