public TimelineObj(string skillId, TimelineModel model, SkillCom ower) { this.skillId = skillId; this.model = model; this.ower = ower; this._timeScale = 1.00f; }
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(); }
public bool GetTimelineModel(string timelineName, out TimelineModel model) { if (timelineModelCache.ContainsKey(timelineName)) { model = timelineModelCache[timelineName]; return(true); } string jsonStr = LoadHelper.LoadString(SkillDef.GetTimelineCnfName(timelineName)); if (string.IsNullOrEmpty(jsonStr)) { model = default; return(false); } model = JsonMapper.ToObject <TimelineModel>(jsonStr); timelineModelCache.Add(timelineName, model); return(true); }
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); }