Example #1
0
    void Start()
    {
        Arg tArg = MySceneManager.getArg("measureBpm");

        mStartMeasureTime = tArg.get <float>("second");
        //テキストオブジェクト取得
        mMarginText    = GameObject.Find("measuredMarginLabel").GetComponent <MyBehaviour>().findChild <TextMesh>("value");
        mBpmText       = GameObject.Find("measuredBpmLabel").GetComponent <MyBehaviour>().findChild <TextMesh>("value");
        mStaticBpmText = GameObject.Find("measuredStaticMarginLabel").GetComponent <MyBehaviour>().findChild <TextMesh>("value");
        //audio用意
        mPlayer = MyBehaviour.create <MusicPlayer>();
        mPlayer.setAudio(DataFolder.loadMusic(MusicScoreData.mMusicFileName));
        //margin計算で固定で使うbpm
        mStaticBpm = tArg.get <float>("staticBpm");
        GameObject.Find("measuredStaticMarginLabel").GetComponent <MyBehaviour>().findChild <TextMesh>("bpm").text = "(" + mStaticBpm.ToString() + " BPM)";

        Subject.addObserver(new Observer("measureBpmMain", (message) => {
            if (message.name == "endMeasureBpmButtonPushed")
            {
                MySceneManager.closeScene("measureBpm");
                return;
            }
            if (message.name == "restartMeasureBpmButtonPushed")
            {
                restartMeasure();
                return;
            }
        }));
        restartMeasure();
    }
Example #2
0
    public void set(MusicScoreFileData aData, ScoreDifficult aDifficult)
    {
        //譜面
        mScore = MyBehaviour.create <MusicScore>();
        //曲情報ロード
        MusicScoreData.set(aData);
        MusicScoreData.mSelectedDifficult = aDifficult;
        //ミュージックプレイヤー
        MusicPlayer tPlayer = MyBehaviour.create <MusicPlayer>();

        tPlayer.setAudio(DataFolder.loadMusic(MusicScoreData.mMusicFileName));
        //譜面と曲を同期させるシステム
        mPlayer = new KeyNotePlayer(mScore, tPlayer);
        //背景
        resetScoreBackground();
    }
Example #3
0
    //曲の再生
    private void playMusic()
    {
        mAudioSource.Stop();
        //音声ファイルをロード
        mAudioSource.clip = DataFolder.loadMusic(mMusicData.music);
        //再生位置設定
        switch (mPlayPositionListButton.mSelected)
        {
        case "サビ":
            mAudioSource.time = mMusicData.rust;
            break;

        case "イントロ":
            mAudioSource.time = 0;
            break;

        default:
            mAudioSource.time = 0;
            break;
        }
        //再生
        mAudioSource.Play();
    }
Example #4
0
        public override void getMessage(Message aMessage)
        {
            //logClickPosition(aMessage);
            if (aMessage.name == "editPlayButtonPushed")//編曲再生ボタン
            {
                parent.changeState(new EditPlayState(parent));
                return;
            }
            if (aMessage.name == "testPlayButtonPushed")//テスト再生ボタン
            {
                parent.changeState(new TestPlayState(parent));
                return;
            }
            if (aMessage.name == "measureBpmButtonPushed") //bpm測定ボタン
            {
                parent.changeState(new InitialState(parent));
                MySceneManager.openScene("measureBpm", new Arg(new Dictionary <string, object>()
                {
                    { "second", MusicScoreData.quarterBeatToMusicTime(parent.mScore.mCurrentQuarterBeat) },
                    { "staticBpm", MusicScoreData.getBpm(parent.mScore.mCurrentQuarterBeat) }
                }), null, (obj) => {
                    parent.changeState(new EditState(parent));
                });
                return;
            }
            if (aMessage.name == "editLyricsButtonPushed")//歌詞編集ボタン
            {
                parent.changeState(new InitialState(parent));
                MySceneManager.openScene("editLyrics", null, null, (aArg) => {
                    mCommandList.reset();
                    parent.mScore.resetBars();
                    parent.changeState(new EditState(parent));
                });
                return;
            }
            if (aMessage.name == "configButtonPushed")//File設定ボタン
            {
                parent.changeState(new InitialState(parent));
                MySceneManager.openScene("musicConfig", new Arg(new Dictionary <string, object>()
                {
                    { "new", false },
                    { "title", MusicScoreData.mTitle },
                    { "savePath", MusicScoreData.mSavePath },
                    { "music", MusicScoreData.mMusicFileName },
                    { "thumbnail", MusicScoreData.mThumbnail },
                    { "back", MusicScoreData.mBack },
                    { "movie", MusicScoreData.mMovie },
                    { "loadPath", MusicScoreData.mLoadPath }
                }), null, (aArg) => {
                    if (aArg.get <bool>("ok"))
                    {
                        MusicScoreFileData tData = aArg.get <MusicScoreFileData>("scoreData");
                        if (MusicScoreData.mMusicFileName != tData.music)//音声を変更
                        {
                            MusicPlayer tPlayer = MyBehaviour.create <MusicPlayer>();
                            tPlayer.setAudio(DataFolder.loadMusic(tData.music));
                            parent.mPlayer.changeMusic(tPlayer);
                        }
                        MusicScoreData.mTitle         = tData.title;
                        MusicScoreData.mSavePath      = tData.savePath;
                        MusicScoreData.mMusicFileName = tData.music;
                        MusicScoreData.mThumbnail     = tData.thumbnail;
                        MusicScoreData.mBack          = tData.back;
                        MusicScoreData.mMovie         = tData.movie;
                        //譜面の背景更新
                        parent.resetScoreBackground();
                    }
                    parent.changeState(new EditState(parent));
                });
                return;
            }
            if (aMessage.name == "selectRustFromScoreButtonPushed")//譜面からサビの開始位置を選択するボタン
            {
                parent.changeState(new SelectRustFromScoreState(parent));
                return;
            }
            if (aMessage.name == "applySettingButtonPushed") //設定適用ボタン
            {
                if (mSettingForm.isChanged())                //変更がある時だけ適用
                //marginが不正な値になっていないか
                {
                    if (mSettingForm.mMargin < 0)
                    {
                        AlartCreater.alart("Marginは0未満にできません");
                        return;
                    }
                    if (KeyTime.secondsToQuarterBeat(mSettingForm.mMargin, MusicScoreData.mInitialBpm) >= mSettingForm.mRhythm * 4)
                    {
                        AlartCreater.alart("Marginが第一小節の長さを超えています");
                        return;
                    }
                    //rustが不正な値になっていないか
                    if (mSettingForm.mRust < 0)
                    {
                        AlartCreater.alart("サビの位置は0以上で指定してください");
                        return;
                    }
                    if (parent.mPlayer.mMusicLength <= mSettingForm.mRust)
                    {
                        AlartCreater.alart("サビの位置が音声の長さを超えています");
                        return;
                    }
                    AlartCreater.alart("設定を適用しました");
                    mCommandList.run(new ApplySettingCommand(mSettingForm));
                    parent.mScore.resetBars();
                }
                else
                {
                    AlartCreater.alart("値が変更されていません");
                }
                return;
            }
            if (aMessage.name == "resetSettingButtonPushed")//設定リセットボタン
            {
                mSettingForm.reset();
                return;
            }
            if (aMessage.name == "saveButtonPushed")//保存ボタン
            {
                parent.changeState(new SaveState(parent));
                return;
            }
            //譜面クリック
            switch (mCreateObjectType)
            {
            case CreateObjectType.note:
                if (aMessage.name == "clickNote" || aMessage.name == "clickLyrics")
                {
                    tryCreateNote(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                if (aMessage.name == "RightClickNote" || aMessage.name == "RightClickLyrics")
                {
                    tryDeleteNote(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                break;

            case CreateObjectType.lyrics:
                if (aMessage.name == "clickNote" || aMessage.name == "clickLyrics")
                {
                    tryCreateLyrics(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                if (aMessage.name == "RightClickNote" || aMessage.name == "RightClickLyrics")
                {
                    tryDeleteLyrics(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                break;

            case CreateObjectType.changeBpm:
                if (aMessage.name == "clickNote" || aMessage.name == "clickLyrics")
                {
                    tryCreateChangeBpm(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                if (aMessage.name == "RightClickNote" || aMessage.name == "RightClickLyrics")
                {
                    tryDeleteChangeBpm(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                break;

            case CreateObjectType.triplet:
                if (aMessage.name == "clickNote" || aMessage.name == "clickLyrics")
                {
                    tryCreateTriplet(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                if (aMessage.name == "RightClickNote" || aMessage.name == "RightClickLyrics")
                {
                    tryDeleteTriplet(new KeyTime(aMessage.getParameter <float>("time")));
                    return;
                }
                break;
            }
        }