//表示を初期化 public void initDetails() { mMusicData = null; //曲名 mTitleText.text = ""; //難易度 mDifficultStars.set(0); //最高得点 mScoreDisplay.set(0); //音声 mAudioSource.clip = null; //サムネイル mThumbnailRenderer.sprite = null; }
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(); }
//楽曲の情報を表示 public void showMusic(MusicListFileData.MusicListElement aData) { mSelectedMusic = aData; mMusicData = DataFolder.loadScoreData(aData.file); //曲名 mTitleText.text = mMusicData.title; //選択中の難易度に合わせて表示更新 changeDifficult(mSelectedDifficult); //音声 playMusic(); //サムネイル DataFolder.loadThumbnailAsync(mMusicData.thumbnail, (aSprite) => { Sprite tSprite = SpriteCutter.setRatio(aSprite, 7, 6); mThumbnailRenderer.transform.localScale = new Vector3(7 / tSprite.bounds.size.x, 7 / tSprite.bounds.size.x, 1); mThumbnailRenderer.sprite = tSprite; }); }
void Start() { Arg tArg = MySceneManager.getArg("edit"); //デバッグ用 //Arg tArg = new Arg(new Dictionary<string, object>(){ // {"scoreData",DataFolder.loadScoreData("kawaikunaritai")} //}); MusicScoreFileData tData = tArg.get <MusicScoreFileData>("scoreData"); //譜面設定 mHandler = MyBehaviour.create <ScoreHandler>(); mHandler.set(tData, ScoreDifficult.edit); mHandler.show(new KeyTime(0)); mHandler.changeState(new ScoreHandler.EditModeState(mHandler)); //再生速度変更イベント Subject.addObserver(new Observer("changeAudioEventMonitor", (message) => { if (message.name != "audioSpeedListPushed") { return; } switch (message.getParameter <string>("selected")) { case "1倍速": mHandler.mPlayer.mPitch = 1; break; case "3/4倍速": mHandler.mPlayer.mPitch = 3f / 4f; break; case "1/2倍速": mHandler.mPlayer.mPitch = 1f / 2f; break; } })); }
//曲データセット static public void set(MusicScoreFileData aData) { mMusicDate = aData; setKeyTimeData(); }
//曲データロード static public void load(string aFileName) { mMusicDate = DataFolder.loadScoreData(aFileName); setKeyTimeData(); }
private void Start() { Arg tArg = MySceneManager.getArg("musicConfig"); //初期値設定 if (!tArg.get <bool>("new")) { GameObject.Find("title").GetComponentInChildren <InputField>().text = tArg.get <string>("title"); GameObject.Find("file").GetComponentInChildren <InputField>().text = tArg.get <string>("savePath"); GameObject.Find("music").GetComponentInChildren <InputField>().text = tArg.get <string>("music").Substring(0, tArg.get <string>("music").Length - 4); GameObject.Find("thumbnail").GetComponentInChildren <InputField>().text = tArg.get <string>("thumbnail"); GameObject.Find("back").GetComponentInChildren <InputField>().text = tArg.get <string>("back"); GameObject.Find("movie").GetComponentInChildren <InputField>().text = tArg.get <string>("movie"); } Subject.addObserver(new Observer("configMain", (message) => { if (message.name == "cancelButtonPushed") { MySceneManager.closeScene("musicConfig", new Arg(new Dictionary <string, object>() { { "ok", false } })); return; } if (message.name != "okButtonPushed") { return; } Arg tData = getData(); //必須のデータが入力されているか確認 //title if (tData.get <string>("title") == "") { AlartCreater.alart("タイトルが入力されていません"); return; } //file if (tData.get <string>("file") == "") { AlartCreater.alart("譜面ファイル名が入力されていません"); return; } if (tArg.get <bool>("new") || tData.get <string>("file") != tArg.get <string>("loadPath")) { if (DataFolder.existScoreData(tData.get <string>("file"))) { AlartCreater.alart("譜面ファイル名が既に使われています"); return; } } //music if (tData.get <string>("music") == ".wav") { AlartCreater.alart("音声ファイル名が入力されていません"); return; } if (!DataFolder.existMusic(tData.get <string>("music"))) { AlartCreater.alart("音声ファイルが見つかりません"); return; } //必須条件クリア //譜面データ作成 MusicScoreFileData tNewScore = new MusicScoreFileData(); tNewScore.title = tData.get <string>("title"); tNewScore.savePath = tData.get <string>("file"); tNewScore.music = tData.get <string>("music"); tNewScore.thumbnail = tData.get <string>("thumbnail"); tNewScore.back = tData.get <string>("back"); tNewScore.movie = tData.get <string>("movie"); Arg tArgument = new Arg(new Dictionary <string, object>() { { "ok", true }, { "scoreData", tNewScore } }); MySceneManager.closeScene("musicConfig", tArgument); })); }
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; } }