private void Start() { inGameModel = GetComponent <InGameModel>(); inGameView = GetComponent <InGameView>(); // rankingWindowModel = GetComponent<RankingWindowModel>(); // Modelの値の変更を監視する //キー入力の通知をmodelに引き渡し、通知の値によって描画するセルを決定する inGameView.InputKeySubject.Subscribe(InputKeySubject => inGameModel.ObserveInputKey(InputKeySubject)); //modelのスコア判定をviewに伝え、描画する inGameModel.OnScore.Subscribe(OnScore => inGameView.SetScore(OnScore)); inGameModel.OnHighScore.Subscribe(OnHighScore => inGameView.SetHighScore(OnHighScore)); inGameModel.OnChangedState.Subscribe(OnChangedState => inGameView.Apply(OnChangedState.Item1, OnChangedState.Item2)); inGameModel.Initialize(); inGameView.SetHighScore(inGameModel.DataHighScore); //Restartmenuを開いたときの処理:キー入力禁止、リスタートボタンの実装 menuWindowPresenter.Initialize(); menuWindowPresenter.OnKeyOn.Subscribe(_ => inGameModel.CanInputKey()); menuWindowPresenter.OnRestart.Subscribe(_ => inGameModel.RestartGame()); inGameView.OnOpenMenu.Subscribe(_ => OpenMenu()); //rankingMenu //rankingWindowPresenter.SetRankingScore(inGameModel.DataHighScore); //TODO:ボタンを押した時に発火するようにする rankingWindowPresenter.Initialize(); //rankingWindowModel.PostRankingScore(inGameModel.DataHighScore); rankingWindowPresenter.PostRanking.Subscribe(_ => rankingWindowModel.PostRankingScore(inGameModel.DataHighScore)); }
private void Awake() { inGameModel.Initialize(); inGameView.IOStartPos.Subscribe(IOStartPos => inGameModel.Idle(IOStartPos)); inGameView.IOMovePos.Subscribe(IOMovePos => inGameModel.MoveBlock(IOMovePos)); inGameView.IOTransitionState.Subscribe(_ => inGameModel.TransitionState().Forget()); inGameView.IOMatchBlock.Subscribe(_ => inGameModel.MatchBlock().Forget()); inGameView.IOAddBlock.Subscribe(_ => inGameModel.AddBlock()); inGameView.IODestroyBlock.Subscribe(_ => inGameModel.DestroyBlockAnimation().Forget()); inGameView.IOChainBlock.Subscribe(_ => inGameModel.ChainBlock().Forget()); inGameModel.IOTimerCount.Subscribe(IOTimerCount => inGameView.SetTimer(IOTimerCount)); inGameModel.IOScore.Subscribe(IOScore => inGameView.SetScore(IOScore)); inGameModel.IOHighCombo.Subscribe(IOHighCombo => inGameView.SetHigheCombo(IOHighCombo)); inGameModel.IOSyntheticScore.Subscribe(IOSyntheticScore => inGameView.SetSyntheticScore(IOSyntheticScore)); inGameView.IOfeverBlock.Subscribe(_ => inGameModel.isFeverTime()); inGameView.IORequestUserScore.Subscribe(IORequestUserScore => playFabController.SubmitScore(IORequestUserScore)); inGameModel.IOFeverAnimation.Subscribe(_ => inGameView.SetFeverTextAnimation()); inGameModel.IODropCoinAnimationn.Subscribe(IODrop => dropCoinAnimation.AddCoins(IODrop.Item1, IODrop.Item2)); }