public virtual IEnumerable <AssLine> Apply(AssKaraokeStepContext context) { foreach (AssSection singingSection in context.SingingSections) { if (!singingSection.CurrentWordForeColor.IsEmpty) { singingSection.ForeColor = singingSection.CurrentWordForeColor; } if (!singingSection.CurrentWordShadowColor.IsEmpty) { foreach (ShadowType shadowType in singingSection.ShadowColors.Keys.ToList()) { singingSection.ShadowColors[shadowType] = singingSection.CurrentWordShadowColor; } } if (!singingSection.CurrentWordOutlineColor.IsEmpty && singingSection.ShadowColors.ContainsKey(ShadowType.Glow)) { singingSection.ShadowColors[ShadowType.Glow] = singingSection.CurrentWordOutlineColor; } } return(new[] { context.StepLine }); }
public override IEnumerable <AssLine> Apply(AssKaraokeStepContext context) { base.Apply(context); int startCursorStepIdx = (int)(context.StepLine.Start - context.OriginalLine.Start).TotalMilliseconds / _intervalMs; int endCursorStepIdx = (int)(context.StepLine.End - context.OriginalLine.Start).TotalMilliseconds / _intervalMs; for (int cursorStepIdx = startCursorStepIdx; cursorStepIdx <= endCursorStepIdx; cursorStepIdx++) { AssLine cursorStepLine = (AssLine)context.StepLine.Clone(); if (cursorStepIdx > startCursorStepIdx) { cursorStepLine.Start = TimeUtil.RoundTimeToFrameCenter(context.OriginalLine.Start.AddMilliseconds(cursorStepIdx * _intervalMs)); } if (cursorStepIdx < endCursorStepIdx) { cursorStepLine.End = TimeUtil.RoundTimeToFrameCenter(context.OriginalLine.Start.AddMilliseconds((cursorStepIdx + 1) * _intervalMs)); } if (cursorStepLine.Start == cursorStepLine.End) { continue; } int cursorSectionIdx = _beforeSinging ? context.NumActiveSections - context.SingingSections.Count : context.NumActiveSections; AssSection initialFormatting = (AssSection)cursorStepLine.Sections[Math.Max(cursorSectionIdx - 1, 0)]; List <Section> cursorSections = GenerateCursor(context.Document, initialFormatting, _cursors[cursorStepIdx % _cursors.Count]); cursorStepLine.Sections.InsertRange(cursorSectionIdx, cursorSections); yield return(cursorStepLine); } }
public override IEnumerable <AssLine> Apply(AssKaraokeStepContext context) { AssSection singingSection = context.SingingSections.LastOrDefault(s => s.RubyPart == RubyPart.None || s.RubyPart == RubyPart.Text); if (singingSection == null || singingSection.Text.Length == 0) { return new List <AssLine> { context.StepLine } } ; base.Apply(context); DateTime glitchEndTime = TimeUtil.FrameToEndTime(TimeUtil.StartTimeToFrame(context.StepLine.Start) + 1); CharacterRange[] charRanges = GetGlitchKaraokeCharacterRanges(singingSection.Text[0]); singingSection.Animations.Add(new GlitchingCharAnimation(context.StepLine.Start, glitchEndTime, charRanges)); return(new[] { context.StepLine }); }
public IEnumerable <AssLine> Apply(AssKaraokeStepContext context) { ApplyFadeInKaraokeEffect(context.StepLine, context.SingingSections); ApplyFadeOutKaraokeEffect(context.OriginalLine, context.StepLine, context.ActiveSectionsPerStep, context.StepIndex); return(new[] { context.StepLine }); }