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));
    }
Exemple #2
0
    public override void Init(InGameControllerConfig config)
    {
        base.Init(config);

        _view = config.View as InGameView;

        _view.PauseButton.onClick.AddListener(OnPauseButton);

        InGameModel = new InGameModel();
        ResetScore();
    }
Exemple #3
0
 public void ResetScore()
 {
     InGameModel.ResetScore();
     UpdateView();
 }
Exemple #4
0
 public void IncreaseScore(int amount)
 {
     InGameModel.IncreaseScore(amount);
     UpdateView();
 }
Exemple #5
0
 protected GameModel()
 {
     _menu       = new MainMenuModel();
     _ingame     = new InGameModel();
     _playerName = "";
 }