Пример #1
0
            public Note ToNote(Bar bar)
            {
                var guid = StarlightID.GetGuidFromInt32(ID);
                var note = new Note(bar, guid);
                var b    = note.Basic;

                b.IndexInGrid    = IndexInGrid;
                b.Type           = Type;
                b.StartPosition  = StartPosition;
                b.FinishPosition = FinishPosition;
                b.FlickType      = FlickType;
                var t = note.Temporary;

                t.PrevFlickNoteID = StarlightID.GetGuidFromInt32(PrevFlickNoteID);
                t.NextFlickNoteID = StarlightID.GetGuidFromInt32(NextFlickNoteID);
                t.HoldTargetID    = StarlightID.GetGuidFromInt32(HoldTargetID);
                return(note);
            }
Пример #2
0
        private static void ReadScore(SQLiteConnection connection, Score score, int projectVersion)
        {
            using (var table = new DataTable()) {
                SQLiteHelper.ReadNotesTable(connection, score.Difficulty, table);
                // v0.3.1: "note_type"
                // Only flick existed when there is a flick-alike relation. Now, both flick and slide are possible.
                var hasNoteTypeColumn = projectVersion == ProjectVersion.V0_3_1;
                foreach (DataRow row in table.Rows)
                {
                    var id        = (int)(long)row[SldprojDbNames.Column_ID];
                    var barIndex  = (int)(long)row[SldprojDbNames.Column_BarIndex];
                    var grid      = (int)(long)row[SldprojDbNames.Column_IndexInGrid];
                    var start     = (NotePosition)(long)row[SldprojDbNames.Column_StartPosition];
                    var finish    = (NotePosition)(long)row[SldprojDbNames.Column_FinishPosition];
                    var flick     = (NoteFlickType)(long)row[SldprojDbNames.Column_FlickType];
                    var prevFlick = (int)(long)row[SldprojDbNames.Column_PrevFlickNoteID];
                    var nextFlick = (int)(long)row[SldprojDbNames.Column_NextFlickNoteID];
                    var hold      = (int)(long)row[SldprojDbNames.Column_HoldTargetID];
                    var noteType  = hasNoteTypeColumn ? (NoteType)(long)row[SldprojDbNames.Column_NoteType] : NoteType.TapOrFlick;

                    EnsureBarIndex(score, barIndex);
                    var bar  = score.Bars[barIndex];
                    var note = bar.AddNote(id, grid, finish);
                    if (note != null)
                    {
                        note.Basic.StartPosition       = start;
                        note.Basic.Type                = noteType;
                        note.Basic.FlickType           = flick;
                        note.Temporary.PrevFlickNoteID = StarlightID.GetGuidFromInt32(prevFlick);
                        note.Temporary.NextFlickNoteID = StarlightID.GetGuidFromInt32(nextFlick);
                        note.Temporary.HoldTargetID    = StarlightID.GetGuidFromInt32(hold);
                    }
                    else
                    {
                        Debug.Print("Note with ID '{0}' already exists.", id);
                    }
                }
            }
        }
Пример #3
0
        public static Note AddSpecialNote([NotNull] this Bar bar, int id, NoteType specialNoteType)
        {
            var guid = StarlightID.GetGuidFromInt32(id);

            return(AddSpecialNote(bar, guid, specialNoteType));
        }
Пример #4
0
        public static Note AddNote([NotNull] this Bar bar, int id, int row, NotePosition column)
        {
            var guid = StarlightID.GetGuidFromInt32(id);

            return(AddNote(bar, guid, row, column));
        }
Пример #5
0
        public static Bar AppendBar([NotNull] this Score score, int id)
        {
            var guid = StarlightID.GetGuidFromInt32(id);

            return(AppendBar(score, guid));
        }
Пример #6
0
        public static Bar InsertBar(this Score score, [NotNull] Bar beforeBar, int id)
        {
            var guid = StarlightID.GetGuidFromInt32(id);

            return(InsertBar(score, beforeBar, guid));
        }