public override void OnInit() { Timeline = Model; for (int i = 0; i < Timeline.Tracks.Count; i++) { AddTrackView(Timeline.Tracks[i]); } }
public override void ExportGraph(List <InternalTimelineGraphAsset> assets) { for (int i = 0; i < assets.Count; i++) { SkillTimelineGraphAsset asset = assets[i] as SkillTimelineGraphAsset; BaseTimelineGraph graphData = asset.DeserializeGraph(); //运行时数据结构 TimelineModel model = SerializeToTimelineModel(graphData, asset); string filePath = SkillDef.GetTimelineCnfPath(asset.timelineName); IOHelper.WriteText(JsonMapper.ToJson(model), filePath); Debug.Log($"实体配置生成成功>>>>{filePath}"); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
private TimelineModel SerializeToTimelineModel(BaseTimelineGraph graph, SkillTimelineGraphAsset asset) { TimelineModel timelineModel = new TimelineModel(); timelineModel.name = asset.timelineName; timelineModel.duration = graph.DurationTime; timelineModel.nodes = new List <TimelineFunc>(); for (int i = 0; i < graph.Tracks.Count; i++) { TrackModel track = graph.Tracks[i]; for (int j = 0; j < track.Clips.Count; j++) { TLSK_ClipData clip = track.Clips[j] as TLSK_ClipData; timelineModel.nodes.Add(clip.GetFunc()); } } return(timelineModel); }