예제 #1
0
        /// <summary>
        /// PartからGameNotesを作成します。
        /// </summary>
        /// <param name="scorePart"></param>
        /// <returns></returns>
        private IEnumerable <GameNote> CreateGameNotes(ScorePart scorePart)
        {
            long currentTick = 0;

            var gamePart     = new GamePart();
            var gameNoteList = new List <GameNote>();

            foreach (var measure in scorePart.MeasureList)
            {
                foreach (var note in measure.Notes)
                {
                    GameNote?gameNote = null;
                    if (note.IsRest)
                    {
                        //フェルマータがついている休符のみ休符として追加する
                        if (note.HasFermata)
                        {
                            gameNote = new GameNote(x: GetX(currentTick), tick: currentTick, type: note.Type, isRest: note.IsRest, hasDot: note.HasDot);
                        }
                    }
                    else
                    {
                        gameNote = new GameNote(x: GetX(currentTick), tick: currentTick, type: note.Type, isRest: note.IsRest, hasDot: note.HasDot);
                    }

                    //消費分すすめる
                    currentTick += GetTicks(note);

                    if (gameNote != null)
                    {
                        yield return(gameNote.Value);
                    }
                }
            }
        }
예제 #2
0
        private IEnumerable <GamePart> CreateGameParts(Score score)
        {
            var gameParts = new List <GamePart>();

            int partIndex = 0;

            foreach (var part in score.ScoreParts)
            {
                partIndex++;
                //TODO: 最初のパートは無視する
                //if (partIndex == 1) continue;

                var gamePart = new GamePart();
                gamePart.Notes = CreateGameNotes(part).ToArray();

                yield return(gamePart);
            }
        }