public static RuntimeNote[] CreateNotes(SourceNote note, Conductor[] conductors, SourceNote[] gameNotes, ref int currentID) { RuntimeNote[] notesToBeAdded; switch (note.Type) { case NoteType.Tap: notesToBeAdded = CreateTapNote(note, conductors, ref currentID); break; case NoteType.Flick: case NoteType.Hold: case NoteType.Slide: notesToBeAdded = CreateContinuousNotes(note, conductors, ref currentID); break; case NoteType.Special: notesToBeAdded = CreateSpecialNotes(note, conductors, gameNotes, ref currentID); break; default: throw new ArgumentOutOfRangeException(); } return(notesToBeAdded); }
private static void WritePolyPoints([NotNull] this TextWriter writer, [NotNull] SourceNote note, [CanBeNull, ItemNotNull] SourceNote[] notes) { writer.WriteLine(@" PolyPoint poly Array Array" ); var count = notes?.Length ?? 0; writer.WriteLine(" int size = "+ (count == 0 ? 0 : count + 1).ToString()); if (count > 0) { Debug.Assert(notes != null, nameof(notes) + " != null"); writer.WriteLine(@" [0] PolyPoint data int subtick = 0 float posx = " + note.EndX.ToString(CultureInfo.InvariantCulture)); for (var i = 0; i < notes.Length; ++i) { var subtick = (int)((notes[i].Ticks - note.Ticks) / (NoteBase.TicksPerBeat / 8)); writer.WriteLine($" [{i + 1}]"); writer.WriteLine(" PolyPoint data"); writer.WriteLine(" int subtick = "+ subtick.ToString()); writer.WriteLine(" float posx = "+ notes[i].EndX.ToString(CultureInfo.InvariantCulture)); } } }
public override int GetHashCode() { int hash = 1; if (entityId_ != null) { hash ^= EntityId.GetHashCode(); } if (sourceNote_ != null) { hash ^= SourceNote.GetHashCode(); } if (Category != 0) { hash ^= Category.GetHashCode(); } if (AdditionalNote.Length != 0) { hash ^= AdditionalNote.GetHashCode(); } if (IncludeOnConfirmation != false) { hash ^= IncludeOnConfirmation.GetHashCode(); } if (SourceNoteSubject.Length != 0) { hash ^= SourceNoteSubject.GetHashCode(); } if (guest_ != null) { hash ^= Guest.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (entityId_ != null) { hash ^= EntityId.GetHashCode(); } if (sourceNote_ != null) { hash ^= SourceNote.GetHashCode(); } if (Category != 0) { hash ^= Category.GetHashCode(); } if (AdditionalNote.Length != 0) { hash ^= AdditionalNote.GetHashCode(); } if (IncludeOnConfirmation != false) { hash ^= IncludeOnConfirmation.GetHashCode(); } if (lodgingReservation_ != null) { hash ^= LodgingReservation.GetHashCode(); } if (SourceNoteSubject.Length != 0) { hash ^= SourceNoteSubject.GetHashCode(); } if (IsFulfilled != false) { hash ^= IsFulfilled.GetHashCode(); } if (PermanentOnGuestRecord != false) { hash ^= PermanentOnGuestRecord.GetHashCode(); } if (incidentalItemId_ != null) { hash ^= IncidentalItemId.GetHashCode(); } if (incStartDate_ != null) { hash ^= IncStartDate.GetHashCode(); } if (incEndDate_ != null) { hash ^= IncEndDate.GetHashCode(); } return(hash); }
public static RuntimeNote[] CreateSpecialNotes(SourceNote note, Conductor[] conductors, SourceNote[] gamingNotes, ref int currentID) { var rn = new RuntimeNote(); rn.ID = ++currentID; rn.HitTime = TicksToSeconds(note.Ticks, conductors); rn.LeadTime = note.LeadTime; rn.RelativeSpeed = note.Speed; rn.Type = NoteType.Special; rn.StartX = note.StartX; rn.EndX = note.EndX; rn.ExtraInfo = null; var prepare = new RuntimeNote(); prepare.ID = ++currentID; // 0.8 seconds before the Special note. // Just a guess. // This value must keep the same as tap points' "transform" animation length. // See NoteReactor.Update() for more information. prepare.HitTime = rn.HitTime - 0.8f; prepare.LeadTime = rn.LeadTime; prepare.RelativeSpeed = rn.RelativeSpeed; prepare.Type = NoteType.SpecialPrepare; prepare.StartX = rn.StartX; prepare.EndX = rn.EndX; prepare.ExtraInfo = null; var end = new RuntimeNote(); end.ID = ++currentID; // 1.5 seconds before next valid note (tap, flick, hold, slide). // Just a guess. Didn't find any proof or ways to calculate this. // This value must keep the same as tap points' "fade in" animation length. // See NoteReactor.Update() for more information. var firstNoteAfterSpecial = gamingNotes.FirstOrDefault(n => n.Ticks > note.Ticks); if (firstNoteAfterSpecial == null) { throw new ArgumentException("Malformed score: no note after special note."); } end.HitTime = TicksToSeconds(firstNoteAfterSpecial.Ticks, conductors) - 1.5f; end.LeadTime = rn.LeadTime; end.RelativeSpeed = rn.RelativeSpeed; end.Type = NoteType.SpecialEnd; end.StartX = rn.StartX; end.EndX = rn.EndX; end.ExtraInfo = null; // The order here is not very important because later they will all be sorted by HitTime. return(new[] { rn, prepare, end }); }
private static RuntimeNote[] MyCreateTapNote(SourceNote note, Conductor[] conductors, ref int currentID) { var rns = ScoreCompileHelper.CreateTapNote(note, conductors, ref currentID); if (note.ExtraInfo != null && note.ExtraInfo.ContainsKey("abc")) { var dyn = note.ExtraInfo.Clone(); dyn.SetValue("def", 123); rns[0].ExtraInfo = dyn; } return(rns); }
public void MergeFrom(ReservationNote other) { if (other == null) { return; } if (other.entityId_ != null) { if (entityId_ == null) { entityId_ = new global::HOLMS.Types.Booking.Indicators.ReservationNoteIndicator(); } EntityId.MergeFrom(other.EntityId); } if (other.sourceNote_ != null) { if (sourceNote_ == null) { sourceNote_ = new global::HOLMS.Types.Operations.NoteRequests.NoteRequestIndicator(); } SourceNote.MergeFrom(other.SourceNote); } if (other.Category != 0) { Category = other.Category; } if (other.AdditionalNote.Length != 0) { AdditionalNote = other.AdditionalNote; } if (other.IncludeOnConfirmation != false) { IncludeOnConfirmation = other.IncludeOnConfirmation; } if (other.lodgingReservation_ != null) { if (lodgingReservation_ == null) { lodgingReservation_ = new global::HOLMS.Types.Booking.Indicators.ReservationIndicator(); } LodgingReservation.MergeFrom(other.LodgingReservation); } if (other.SourceNoteSubject.Length != 0) { SourceNoteSubject = other.SourceNoteSubject; } if (other.IsFulfilled != false) { IsFulfilled = other.IsFulfilled; } }
public void MergeFrom(ReservationNoteTemplate other) { if (other == null) { return; } if (other.entityId_ != null) { if (entityId_ == null) { entityId_ = new global::HOLMS.Types.CRM.Guests.ReservationNoteTemplateIndicator(); } EntityId.MergeFrom(other.EntityId); } if (other.sourceNote_ != null) { if (sourceNote_ == null) { sourceNote_ = new global::HOLMS.Types.Operations.NoteRequests.NoteRequestIndicator(); } SourceNote.MergeFrom(other.SourceNote); } if (other.Category != 0) { Category = other.Category; } if (other.AdditionalNote.Length != 0) { AdditionalNote = other.AdditionalNote; } if (other.IncludeOnConfirmation != false) { IncludeOnConfirmation = other.IncludeOnConfirmation; } if (other.SourceNoteSubject.Length != 0) { SourceNoteSubject = other.SourceNoteSubject; } if (other.guest_ != null) { if (guest_ == null) { guest_ = new global::HOLMS.Types.CRM.Guests.GuestIndicator(); } Guest.MergeFrom(other.Guest); } }
public static RuntimeNote[] CreateTapNote(SourceNote note, Conductor[] conductors, ref int currentID) { var rn = new RuntimeNote(); rn.Type = note.Type; rn.Size = note.Size; rn.FlickDirection = note.FlickDirection; rn.ID = ++currentID; rn.HitTime = TicksToSeconds(note.Ticks, conductors); rn.LeadTime = note.LeadTime; rn.RelativeSpeed = note.Speed; rn.StartX = note.StartX; rn.EndX = note.EndX; return(new[] { rn }); }
private static SourceNote[] GeneratePhantomNotes([NotNull] SourceScore sourceScore) { var result = new List <SourceNote>(); var maxMeasure = 224; var ticksFactor = NoteBase.TicksPerBeat / 8; for (var measure = 0; measure <= maxMeasure; ++measure) { var primary = new SourceNote { TrackIndex = -1, Type = (NoteType)(-1), Speed = 1, Measure = measure + 1, Beat = 1, Ticks = 1920 * measure * ticksFactor }; result.Add(primary); for (var j = 2; j <= 4; ++j) { var secondary = new SourceNote { TrackIndex = -1, Type = (NoteType)(-2), Speed = 1, Measure = measure + 1, Beat = j, Ticks = primary.Ticks + (480 * (j - 1)) * ticksFactor }; result.Add(secondary); } } return(result.ToArray()); }
public static RuntimeNote[] CreateContinuousNotes(SourceNote note, Conductor[] conductors, ref int currentID) { var noteType = note.Type; switch (noteType) { case NoteType.Flick: break; case NoteType.Hold: case NoteType.Slide: if (note.FollowingNotes == null) { throw new ArgumentException("A hold or slide note must have following note(s).", nameof(note)); } if (note.FollowingNotes.Length == 0) { throw new ArgumentException("A hold or slide note must have at least 1 following note.", nameof(note)); } break; default: throw new ArgumentOutOfRangeException(); } var rn = new RuntimeNote(); rn.ID = ++currentID; rn.HitTime = TicksToSeconds(note.Ticks, conductors); rn.LeadTime = note.LeadTime; rn.RelativeSpeed = note.Speed; rn.Type = noteType; rn.FlickDirection = note.FlickDirection; rn.StartX = note.StartX; rn.EndX = note.EndX; rn.Size = note.Size; rn.ExtraInfo = null; var followingNoteCount = note.FollowingNotes?.Length ?? 0; var ret = new RuntimeNote[followingNoteCount + 1]; ret[0] = rn; if (note.FollowingNotes != null) { for (var i = 0; i < followingNoteCount; ++i) { var following = note.FollowingNotes[i]; var n = new RuntimeNote(); n.ID = ++currentID; n.HitTime = TicksToSeconds(following.Ticks, conductors); n.LeadTime = following.LeadTime; n.RelativeSpeed = following.Speed; n.Type = following.Type; n.FlickDirection = following.FlickDirection; n.StartX = following.StartX; n.EndX = following.EndX; n.Size = following.Size; n.ExtraInfo = null; ret[i + 1] = n; } } for (var i = 0; i < ret.Length - 1; ++i) { switch (ret[i].Type) { case NoteType.Flick: ret[i + 1].PrevFlick = ret[i]; break; case NoteType.Hold: ret[i + 1].PrevHold = ret[i]; break; case NoteType.Slide: ret[i + 1].PrevSlide = ret[i]; break; default: throw new ArgumentOutOfRangeException(); } switch (ret[i + 1].Type) { case NoteType.Flick: ret[i].NextFlick = ret[i + 1]; break; case NoteType.Hold: ret[i].NextHold = ret[i + 1]; break; case NoteType.Slide: ret[i].NextSlide = ret[i + 1]; break; default: throw new ArgumentOutOfRangeException(); } } // Space reserved for GroupID which may be used in the future. return(ret); }
public SourceScore ReadSourceScore(Stream stream, string fileName, ReadSourceOptions sourceOptions) { var lines = ReadLines(stream); var c = 0; var offsetTimeSpan = TimeSpan.Parse(lines[c]); ++c; var leadTimeSpan = TimeSpan.Parse(lines[c]); ++c; var trackCount = Convert.ToInt32(lines[c]); ++c; var beatsPerMeasure = Convert.ToInt32(lines[c]); ++c; // splitter ++c; var notes = new List <SourceNote>(); while (!lines[c].StartsWith("---")) { var line = lines[c]; SourceNote[] sourceNotes; if (TapPattern.IsMatch(line)) { var tap = Tap.FromString(line); var sourceNote = new SourceNote { Type = NoteType.Tap }; FillHeader(sourceNote, tap.Header); sourceNote.Size = StrToSize(tap.Body.Size); sourceNotes = new[] { sourceNote }; } else if (HoldPairPattern.IsMatch(line)) { var holds = Hold.CreateHolds(line); var sourceNote = new SourceNote { Type = NoteType.Hold }; FillHeader(sourceNote, holds[0].Header); sourceNote.Size = StrToSize(holds[0].Body.Size); var holdEnd = new SourceNote { Type = NoteType.Hold }; FillHeader(holdEnd, holds[1].Header); holdEnd.Size = sourceNote.Size; holdEnd.FlickDirection = StrToDirection(holds[1].Body.Direction); sourceNote.FollowingNotes = new[] { holdEnd }; sourceNotes = new[] { sourceNote }; } else if (FlickPattern.IsMatch(line)) { var flick = Flick.FromString(line); var sourceNote = new SourceNote { Type = NoteType.Flick }; FillHeader(sourceNote, flick.Header); sourceNote.Size = StrToSize(flick.Body.Size); sourceNote.FlickDirection = StrToDirection(flick.Body.Direction); sourceNotes = new[] { sourceNote }; } else if (SlideSeriesPattern.IsMatch(line)) { var slides = Slide.CreateSlides(line); var sourceNote = new SourceNote { Type = NoteType.Slide }; FillHeader(sourceNote, slides[0].Header); var following = new List <SourceNote>(); for (var i = 1; i < slides.Count; ++i) { var nodeInSeries = new SourceNote { Type = NoteType.Slide }; FillHeader(nodeInSeries, slides[i].Header); if (i == slides.Count - 1) { nodeInSeries.FlickDirection = StrToDirection(slides[i].Body.Direction); } following.Add(nodeInSeries); } sourceNote.FollowingNotes = following.ToArray(); sourceNotes = new[] { sourceNote }; } else if (SpecialPattern.IsMatch(line)) { var special = Special.FromString(line); var sourceNote = new SourceNote { Type = NoteType.Special }; FillHeader(sourceNote, special.Header); sourceNotes = new[] { sourceNote }; } else { throw new FormatException("Error in simple format."); } notes.AddRange(sourceNotes); // next line ++c; } // Sort the added notes. notes.Sort((n1, n2) => n1.Ticks.CompareTo(n2.Ticks)); // splitter ++c; var conductors = new List <Conductor>(); for (; c < lines.Count; ++c) { var ss = lines[c].Split(':'); var measureIndex = Convert.ToInt32(ss[0]); var bpm = Convert.ToDouble(ss[1]); var conductor = new Conductor { Measure = measureIndex - 1, Tempo = bpm, Ticks = (measureIndex - 1) * beatsPerMeasure * NoteBase.TicksPerBeat, SignatureNumerator = beatsPerMeasure, SignatureDenominator = beatsPerMeasure }; conductors.Add(conductor); } conductors.Sort((n1, n2) => n1.Ticks.CompareTo(n2.Ticks)); var score = new SourceScore(); score.Conductors = conductors.ToArray(); score.Notes = notes.ToArray(); score.TrackCount = trackCount; score.MusicOffset = offsetTimeSpan.TotalSeconds; return(score); void FillHeader(SourceNote note, NoteHeader header) { var fraction = (float)(header.Nominator - 1) / header.Denominator; note.Beat = (int)(beatsPerMeasure * fraction); note.StartX = header.Start - 1; note.EndX = header.End - 1; note.Speed = header.Speed; note.LeadTime = leadTimeSpan.TotalSeconds; note.Measure = header.Measure - 1; note.Ticks = 60 * (long)(beatsPerMeasure * ((header.Measure - 1) + fraction) * NoteBase.TicksPerBeat); note.TrackIndex = (int)note.StartX; if (note.TrackIndex < 0 || note.TrackIndex >= trackCount) { Debug.Print("Warning: Invalid track index \"{0}\", changing into range [0, {1}].", note.TrackIndex, trackCount - 1); if (note.TrackIndex < 0) { note.TrackIndex = 0; } else if (note.TrackIndex >= trackCount) { note.TrackIndex = trackCount - 1; } } } NoteSize StrToSize(string str) { if (string.IsNullOrEmpty(str)) { return(NoteSize.Small); } else { switch (str) { case "small": return(NoteSize.Small); case "large": return(NoteSize.Large); default: throw new ArgumentOutOfRangeException(nameof(str), str, null); } } } FlickDirection StrToDirection(string str) { if (string.IsNullOrEmpty(str)) { return(FlickDirection.None); } else { switch (str) { case "left": return(FlickDirection.Left); case "right": return(FlickDirection.Right); case "up": return(FlickDirection.Up); default: throw new ArgumentOutOfRangeException(nameof(str), str, null); } } } }
internal static MltdNoteType GetMltdNoteType([NotNull] SourceNote note) { switch (note.Type) { case NoteType.Tap: switch (note.Size) { case NoteSize.Small: return(MltdNoteType.TapSmall); case NoteSize.Large: return(MltdNoteType.TapLarge); default: throw new ArgumentOutOfRangeException(); } case NoteType.Flick: switch (note.FlickDirection) { case FlickDirection.Left: return(MltdNoteType.FlickLeft); case FlickDirection.Up: return(MltdNoteType.FlickUp); case FlickDirection.Right: return(MltdNoteType.FlickRight); default: throw new ArgumentOutOfRangeException(); } case NoteType.Hold: switch (note.Size) { case NoteSize.Small: return(MltdNoteType.HoldSmall); case NoteSize.Large: return(MltdNoteType.HoldLarge); default: throw new ArgumentOutOfRangeException(); } case NoteType.Slide: return(MltdNoteType.SlideSmall); case NoteType.Special: return(MltdNoteType.Special); case (NoteType)(-1): return(MltdNoteType.PrimaryBeat); case (NoteType)(-2): return(MltdNoteType.SecondaryBeat); case NoteType.SpecialEnd: case NoteType.SpecialPrepare: case NoteType.ScorePrepare: throw new NotSupportedException($"Warning: not supported source note type: {note.Type}"); default: throw new ArgumentOutOfRangeException(); } }
private static SourceScore ToSourceScore([NotNull] Project project, [NotNull] Score score, [NotNull] ReadSourceOptions options) { var result = new SourceScore(); var sourceNotes = new List <SourceNote>(); var conductors = new List <Conductor>(); const int beatsPerMeasure = 4; var globalConductor = new Conductor(); globalConductor.Tempo = (float)project.Settings.BeatPerMinute; globalConductor.SignatureNumerator = project.Settings.Signature; globalConductor.SignatureDenominator = beatsPerMeasure; conductors.Add(globalConductor); var allNotes = score.GetAllNotes(); foreach (var note in allNotes) { SourceNote sourceNote = null; Conductor conductor = null; switch (note.Basic.Type) { case NoteType.TapOrFlick: sourceNote = new SourceNote(); FillTapOrFlick(note, sourceNote); break; case NoteType.Hold: if (!note.Helper.IsHoldStart) { continue; } sourceNote = new SourceNote(); FillHold(note, sourceNote); break; case NoteType.Slide: if (!note.Helper.IsSlideStart) { continue; } sourceNote = new SourceNote(); FillSlide(note, sourceNote); break; case NoteType.VariantBpm: { conductor = new Conductor(); FillCommonProperties(note, conductor); Debug.Assert(note.Params != null, "note.Params != null"); conductor.Tempo = (float)note.Params.NewBpm; conductor.SignatureNumerator = project.Settings.Signature; conductor.SignatureDenominator = beatsPerMeasure; } break; default: throw new ArgumentOutOfRangeException(); } if (sourceNote != null) { sourceNotes.Add(sourceNote); } if (conductor != null) { conductors.Add(conductor); } } result.MusicOffset = project.Settings.StartTimeOffset; result.TrackCount = CgssTrackCount; result.ScoreIndex = options.ScoreIndex; sourceNotes.Sort((n1, n2) => n1.Ticks.CompareTo(n2.Ticks)); conductors.Sort((n1, n2) => n1.Ticks.CompareTo(n2.Ticks)); result.Notes = sourceNotes.ToArray(); result.Conductors = conductors.ToArray(); return(result); void FillCommonProperties(Note note, NoteBase sourceNote) { var bar = note.Basic.Bar; sourceNote.Measure = bar.Basic.Index; var fraction = (float)note.Basic.IndexInGrid / bar.GetGridPerSignature() / beatsPerMeasure; sourceNote.Beat = (int)fraction; //sourceNote.GroupID = 0; sourceNote.Ticks = 60 * (long)(beatsPerMeasure * (sourceNote.Measure + fraction) * NoteBase.TicksPerBeat); } void FillSourceNoteProperties(Note note, SourceNote sourceNote) { FillCommonProperties(note, sourceNote); sourceNote.Size = NoteSize.Small; sourceNote.Speed = 1.0f; sourceNote.StartX = (float)(note.Basic.StartPosition - 1); sourceNote.EndX = (float)(note.Basic.FinishPosition - 1); sourceNote.TrackIndex = (int)sourceNote.StartX; if (sourceNote.TrackIndex < 0 || sourceNote.TrackIndex > (CgssTrackCount - 1)) { Debug.Print("Warning: Invalid track index \"{0}\", changing into range [0, {1}].", sourceNote.TrackIndex, CgssTrackCount - 1); if (sourceNote.TrackIndex < 0) { sourceNote.TrackIndex = 0; } else if (sourceNote.TrackIndex > (CgssTrackCount - 1)) { sourceNote.TrackIndex = (CgssTrackCount - 1); } } sourceNote.LeadTime = (float)DefaultLeadTime.TotalSeconds; } void FillTapOrFlick(Note note, SourceNote sourceNote) { FillSourceNoteProperties(note, sourceNote); switch (note.Basic.FlickType) { case NoteFlickType.None: sourceNote.Type = MilliSim.Contributed.Scores.NoteType.Tap; sourceNote.FlickDirection = FlickDirection.None; break; case NoteFlickType.Left: sourceNote.Type = MilliSim.Contributed.Scores.NoteType.Flick; sourceNote.FlickDirection = FlickDirection.Left; break; case NoteFlickType.Right: sourceNote.Type = MilliSim.Contributed.Scores.NoteType.Flick; sourceNote.FlickDirection = FlickDirection.Right; break; default: throw new ArgumentOutOfRangeException(); } } void FillHold(Note note, SourceNote sourceNote) { FillSourceNoteProperties(note, sourceNote); sourceNote.Type = MilliSim.Contributed.Scores.NoteType.Hold; var holdEnd = new SourceNote(); Debug.Assert(note.Editor.HoldPair != null, "note.Editor.HoldPair != null"); FillSourceNoteProperties(note.Editor.HoldPair, holdEnd); holdEnd.Type = MilliSim.Contributed.Scores.NoteType.Hold; switch (note.Editor.HoldPair.Basic.FlickType) { case NoteFlickType.None: holdEnd.FlickDirection = FlickDirection.None; break; case NoteFlickType.Left: holdEnd.FlickDirection = FlickDirection.Left; break; case NoteFlickType.Right: holdEnd.FlickDirection = FlickDirection.Right; break; default: throw new ArgumentOutOfRangeException(); } sourceNote.FollowingNotes = new[] { holdEnd }; } void FillSlide(Note note, SourceNote sourceNote) { FillSourceNoteProperties(note, sourceNote); sourceNote.Type = MilliSim.Contributed.Scores.NoteType.Slide; var following = new List <SourceNote>(); var nextSlideNode = note.Editor.NextSlide; while (nextSlideNode != null) { var node = new SourceNote(); FillSourceNoteProperties(nextSlideNode, node); node.Type = MilliSim.Contributed.Scores.NoteType.Slide; if (nextSlideNode.Helper.IsSlideEnd) { switch (nextSlideNode.Basic.FlickType) { case NoteFlickType.None: node.FlickDirection = FlickDirection.None; break; case NoteFlickType.Left: node.FlickDirection = FlickDirection.Left; break; case NoteFlickType.Right: node.FlickDirection = FlickDirection.Right; break; default: throw new ArgumentOutOfRangeException(); } } following.Add(node); nextSlideNode = nextSlideNode.Editor.NextSlide; } sourceNote.FollowingNotes = following.ToArray(); } }
private static SourceNote ToNote(EventNoteData noteData, int[] tracks) { var mltdNoteType = (MltdNoteType)noteData.Type; switch (mltdNoteType) { case MltdNoteType.PrimaryBeat: case MltdNoteType.SecondaryBeat: // We don't generate notes for these types. return(null); } var note = new SourceNote(); // MLTD tick is divided by 8. note.Ticks = noteData.Tick * (NoteBase.TicksPerBeat / 8); note.Measure = noteData.Measure - 1; note.Beat = noteData.Beat - 1; note.StartX = noteData.StartPositionX; note.EndX = noteData.EndPositionX; note.Speed = noteData.Speed; note.LeadTime = noteData.LeadTime; note.TrackIndex = noteData.Track - tracks[0]; switch (mltdNoteType) { case MltdNoteType.TapSmall: note.Type = NoteType.Tap; note.Size = NoteSize.Small; break; case MltdNoteType.TapLarge: note.Type = NoteType.Tap; note.Size = NoteSize.Large; break; case MltdNoteType.FlickLeft: note.Type = NoteType.Flick; note.FlickDirection = FlickDirection.Left; break; case MltdNoteType.FlickUp: note.Type = NoteType.Flick; note.FlickDirection = FlickDirection.Up; break; case MltdNoteType.FlickRight: note.Type = NoteType.Flick; note.FlickDirection = FlickDirection.Right; break; case MltdNoteType.HoldSmall: case MltdNoteType.HoldLarge: { note.Type = NoteType.Hold; note.Size = mltdNoteType == MltdNoteType.HoldSmall ? NoteSize.Small : NoteSize.Large; var n = new SourceNote(); var followingNotes = new[] { n }; n.StartX = note.StartX; n.EndX = note.EndX; // MLTD tick is divided by 8. n.Ticks = note.Ticks + noteData.Duration * (NoteBase.TicksPerBeat / 8); n.Speed = noteData.Speed; n.LeadTime = noteData.LeadTime; n.Type = note.Type; switch ((MltdNoteEndType)noteData.EndType) { case MltdNoteEndType.Tap: break; case MltdNoteEndType.FlickLeft: n.FlickDirection = FlickDirection.Left; break; case MltdNoteEndType.FlickUp: n.FlickDirection = FlickDirection.Up; break; case MltdNoteEndType.FlickRight: n.FlickDirection = FlickDirection.Right; break; default: throw new ArgumentOutOfRangeException(); } note.FollowingNotes = followingNotes; } break; case MltdNoteType.SlideSmall: { note.Type = NoteType.Slide; note.Size = NoteSize.Small; var followingNotes = new SourceNote[noteData.Polypoints.Length - 1]; for (var i = 1; i < noteData.Polypoints.Length; ++i) { var poly = noteData.Polypoints[i]; var followingNote = new SourceNote { StartX = noteData.Polypoints[i - 1].PositionX, EndX = poly.PositionX, // MLTD tick is divided by 8. Ticks = note.Ticks + poly.SubTick * (NoteBase.TicksPerBeat / 8), Speed = noteData.Speed, LeadTime = noteData.LeadTime, Type = note.Type }; if (i == noteData.Polypoints.Length - 1) { switch ((MltdNoteEndType)noteData.EndType) { case MltdNoteEndType.Tap: break; case MltdNoteEndType.FlickLeft: followingNote.FlickDirection = FlickDirection.Left; break; case MltdNoteEndType.FlickUp: followingNote.FlickDirection = FlickDirection.Up; break; case MltdNoteEndType.FlickRight: followingNote.FlickDirection = FlickDirection.Right; break; default: throw new ArgumentOutOfRangeException(); } } followingNotes[i - 1] = followingNote; } note.FollowingNotes = followingNotes; } break; case MltdNoteType.Special: note.Type = NoteType.Special; break; default: throw new ArgumentOutOfRangeException(); } return(note); }
public void MergeFrom(ReservationNote other) { if (other == null) { return; } if (other.entityId_ != null) { if (entityId_ == null) { entityId_ = new global::HOLMS.Types.Booking.Indicators.ReservationNoteIndicator(); } EntityId.MergeFrom(other.EntityId); } if (other.sourceNote_ != null) { if (sourceNote_ == null) { sourceNote_ = new global::HOLMS.Types.Operations.NoteRequests.NoteRequestIndicator(); } SourceNote.MergeFrom(other.SourceNote); } if (other.Category != 0) { Category = other.Category; } if (other.AdditionalNote.Length != 0) { AdditionalNote = other.AdditionalNote; } if (other.IncludeOnConfirmation != false) { IncludeOnConfirmation = other.IncludeOnConfirmation; } if (other.lodgingReservation_ != null) { if (lodgingReservation_ == null) { lodgingReservation_ = new global::HOLMS.Types.Booking.Indicators.ReservationIndicator(); } LodgingReservation.MergeFrom(other.LodgingReservation); } if (other.SourceNoteSubject.Length != 0) { SourceNoteSubject = other.SourceNoteSubject; } if (other.IsFulfilled != false) { IsFulfilled = other.IsFulfilled; } if (other.PermanentOnGuestRecord != false) { PermanentOnGuestRecord = other.PermanentOnGuestRecord; } if (other.incidentalItemId_ != null) { if (incidentalItemId_ == null) { incidentalItemId_ = new global::HOLMS.Types.Supply.IncidentalItems.IncidentalItemIndicator(); } IncidentalItemId.MergeFrom(other.IncidentalItemId); } if (other.incStartDate_ != null) { if (incStartDate_ == null) { incStartDate_ = new global::HOLMS.Types.Primitive.PbLocalDate(); } IncStartDate.MergeFrom(other.IncStartDate); } if (other.incEndDate_ != null) { if (incEndDate_ == null) { incEndDate_ = new global::HOLMS.Types.Primitive.PbLocalDate(); } IncEndDate.MergeFrom(other.IncEndDate); } }