JD2022-TU1/main/tools/framework/JD.Timeline/Dance/DanceTapeExtensions.cs

40 lines
No EOL
1.4 KiB
C#

using System.Linq;
using JD.Timeline.Model.Utility;
using JD.Serialization;
namespace JD.Timeline.Model
{
public static class DanceTapeExtensions
{
public static void SetClock(this Tape tape)
{
if (!tape.Id.EndsWith(FileExtensions.DanceTape))
return;
tape.TapeClock = Tape.TapeClock_Enum.TapeClock_ConductorGameplay;
}
public static void AddTracksForGhostClips(this Tape tape)
{
if (!tape.Id.EndsWith(FileExtensions.DanceTape))
return;
var trackIds = tape.Tracks.Select(x => x.Id);
var ghostClipTracks = tape.Clips.Where(x => !trackIds.Contains(x.TrackId)).Select(x => new {TrackId = x.TrackId, Type = x.Type}).Distinct();
foreach (var ghostClip in ghostClipTracks)
{
if (ghostClip.Type == typeof(MotionClip))
{
tape.GetOrCreateTrack<MoveTrack>("Missing track").Id = ghostClip.TrackId;
}
if (ghostClip.Type == typeof(PictogramClip))
{
tape.GetOrCreateTrack<PictoTrack>("Missing track").Id = ghostClip.TrackId;
}
if (ghostClip.Type == typeof(GoldEffectClip))
{
tape.GetOrCreateTrack<GoldEffectTrack>("Missing track").Id = ghostClip.TrackId;
}
}
}
}
}