Exemple #1
0
        public void RemoveSequence(SkillTimelineSequence sequence)
        {
            if (sequence == null)
            {
                return;
            }

            if (_scheduleSequences == null || _scheduleSequences.Count <= 0)
            {
                return;
            }

            if (_scheduleSequences.TryGetValue(sequence.StartFrame, out var sequenceSet))
            {
                sequenceSet.Remove(sequence);
                if (sequenceSet.Count <= 0)
                {
                    _scheduleSequences.Remove(sequence.StartFrame);
                }
            }

            _scheduleSequencesEndFrame?.Remove(sequence);

            RefreshExecuteFrame();
        }
Exemple #2
0
        private void PushSequenceInSchedulingList(SkillTimelineSequence sequence)
        {
            var schedulingSequences = GetSchedulingSequenceList();

            if (!schedulingSequences.Contains(sequence))
            {
                schedulingSequences.Add(sequence);
            }
        }
Exemple #3
0
        private void DequeueSequenceInSchedulingList(SkillTimelineSequence sequence)
        {
            if (_schedulingSequences == null || _schedulingSequences.Count <= 0)
            {
                return;
            }

            if (_schedulingSequences.Contains(sequence))
            {
                _schedulingSequences.Remove(sequence);
            }
        }
Exemple #4
0
        public void AddSequence(SkillTimelineSequence sequence)
        {
            if (sequence == null)
            {
                return;
            }

            var scheduleSequences = GetSequenceSortDict();
            HashSet <SkillTimelineSequence> sequenceSet;

            if (!scheduleSequences.TryGetValue(sequence.StartFrame, out sequenceSet))
            {
                sequenceSet = new HashSet <SkillTimelineSequence>();
                scheduleSequences.Add(sequence.StartFrame, sequenceSet);
            }
            sequenceSet.Add(sequence);

            GetLengthHeap().Add(sequence, sequence.EndFrame);

            RefreshExecuteFrame();
        }
        public static void ExportPlayableToJson(string playblePath, string savePath)
        {
            if (string.IsNullOrEmpty(playblePath))
            {
                return;
            }

            if (string.IsNullOrEmpty(savePath))
            {
                return;
            }

            var playable = AssetDatabase.LoadAssetAtPath <TimelineAsset>(playblePath);
            var bindings = playable.outputs;

            var skillTimelineSequence = new SkillTimelineSequence();

            skillTimelineSequence.name = playable.name;
            skillTimelineSequence.type = "_playable_";

            var skillTimelineData = new SkillTimelineData();

            foreach (var pb in bindings)
            {
                var track = pb.sourceObject as TrackAsset;
                if (track != null)
                {
                    if (track.muted)
                    {
                        continue;
                    }

                    SkillTimelineSequence skillTimelineTrack = new SkillTimelineSequence();
                    skillTimelineTrack.name = track.name;
                    skillTimelineTrack.type = "_track_";

                    foreach (TimelineClip clip in track.GetClips())
                    {
                        if (clip.asset is SkillTriggerPlayableClip)
                        {
                            var triggerClip       = clip.asset as SkillTriggerPlayableClip;
                            var skillTimelineClip = new SkillTimelineSequence();

                            skillTimelineClip.displayName = clip.displayName;
                            skillTimelineClip.name        = triggerClip.name;
                            skillTimelineClip.type        = triggerClip.type;
                            skillTimelineClip.args        = triggerClip.args;

                            skillTimelineClip.startTime    = clip.start;
                            skillTimelineClip.durationTime = clip.duration;

                            skillTimelineTrack.AddSequence(skillTimelineClip);
                        }
                    }
                    skillTimelineTrack.RefreshSequence();
                    skillTimelineSequence.AddSequence(skillTimelineTrack);
                }
            }
            skillTimelineSequence.RefreshSequence();

            skillTimelineData.sequences = new SkillTimelineSequence[] { skillTimelineSequence };
            SkillTimelineData.SaveToFile(skillTimelineData, savePath);
        }