Beispiel #1
0
        //bpm変更イベントを削除
        protected bool tryDeleteChangeBpm(KeyTime aTime)
        {
            if (aTime.mQuarterBeat < 0)
            {
                return(false);
            }
            if (aTime.mQuarterBeat < 1)
            {
                AlartCreater.alart("先頭のBPMは削除できません");
                return(false);
            }
            List <Arg> tList = MusicScoreData.getChangeBpmInBar(aTime);

            foreach (Arg tData in tList)
            {
                if (tData.get <float>("time") != aTime.mQuarterBeat)
                {
                    continue;
                }
                //削除するイベントが見つかった
                mCommandList.run(new DeleteChangeBpmCommand(aTime));
                parent.mScore.resetBars();
                return(true);
            }
            return(false);
        }
Beispiel #2
0
    //小節生成
    private Bar createBar(KeyTime aBarNum)
    {
        Bar tBar = MyBehaviour.createObjectFromPrefab <Bar>("score/bar" + MusicScoreData.mRhythm.ToString());

        tBar.mTime = aBarNum;
        //音符追加
        List <Arg> tNotes = MusicScoreData.getNotesInBar(aBarNum);

        foreach (Arg tNoteData in tNotes)
        {
            tBar.addNote(tNoteData);
        }
        //歌詞追加
        List <Arg> tLyrics = MusicScoreData.getLyricsInBar(aBarNum);

        foreach (Arg tLyricsData in tLyrics)
        {
            tBar.addLyrics(tLyricsData);
        }
        //bpm変化を示すオブジェクト追加
        List <Arg> tBpms = MusicScoreData.getChangeBpmInBar(aBarNum);

        foreach (Arg tBpm in tBpms)
        {
            tBar.addChangeBpm(tBpm);
        }
        //位置調整
        tBar.transform.parent        = gameObject.transform;
        tBar.transform.localPosition = new Vector3(0, convertToPositionY(tBar.mTime.mBarNum), 0);
        tBar.transform.localScale    = new Vector3(1f, 1f, 1f);
        tBar.name = "bar:" + aBarNum.mBarNum;
        return(tBar);
    }
    public override void run()
    {
        mPreRhythm             = MusicScoreData.mRhythm;
        mPreMargin             = MusicScoreData.mMargin;
        mPreRust               = MusicScoreData.mRust;
        MusicScoreData.mRhythm = mRhythm;
        MusicScoreData.mMargin = mMargin;
        MusicScoreData.mRust   = mRust;
        mForm.reset();
        //音源再生位置より手前のbpm変更イベント削除
        float mPlayMusicQuarterBeat = MusicScoreData.mStartPlayMusicTime.mQuarterBeat;

        mBpms = new List <Arg>();
        //削除するbpm変更イベントを探す
        List <Arg> tBpms = MusicScoreData.getChangeBpmInBar(new KeyTime(0));

        foreach (Arg tData in tBpms)
        {
            if (tData.get <float>("time") < 1)
            {
                continue;                              //先頭のbpm変更イベントはそのままにする
            }
            if (mPlayMusicQuarterBeat <= tData.get <float>("time"))
            {
                continue;                                                   //音源再生位置以降
            }
            mBpms.Add(tData);
        }
        //見つけたbpm変更イベントを削除
        foreach (Arg tData in mBpms)
        {
            MusicScoreData.deleteChangeBpm(tData.get <float>("time"));
        }
    }
Beispiel #4
0
        //bpm変更イベントを生成
        protected bool tryCreateChangeBpm(KeyTime aTime)
        {
            if (aTime.mQuarterBeat < 0)
            {
                return(false);
            }
            if (1 <= aTime.mQuarterBeat && aTime.mQuarterBeat < MusicScoreData.mStartPlayMusicTime.mQuarterBeat)
            {
                AlartCreater.alart("音声再生位置より前には配置できません");
                return(false);
            }
            //編集画面の操作を無効にする
            parent.changeState(new InitialState(parent));
            //変更前の値があるなら取得する
            float      tPreBpm = -1;
            List <Arg> tList   = MusicScoreData.getChangeBpmInBar(aTime);

            foreach (Arg tData in tList)
            {
                if (tData.get <float>("time") != aTime.mQuarterBeat)
                {
                    continue;
                }
                //イベントが見つかった
                tPreBpm = tData.get <float>("bpm");
                break;
            }
            //bpm値の入力を受け付ける
            MySceneManager.openScene("inputChangeBpmValueForm", new Arg(new Dictionary <string, object>()
            {
                { "defaultValue", tPreBpm }
            }), null, (aArg) => {
                if (aArg.get <bool>("change"))
                {
                    mCommandList.run(new CreateChangeBpmCommand(aTime, aArg.get <float>("bpm")));
                    parent.mScore.resetBars();
                }
                parent.changeState(new EditState(parent));
            });
            return(true);
        }