Exemplo n.º 1
0
    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));
    }
Exemplo n.º 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();
    }
Exemplo n.º 3
0
 public void ResetScore()
 {
     InGameModel.ResetScore();
     UpdateView();
 }
Exemplo n.º 4
0
 public void IncreaseScore(int amount)
 {
     InGameModel.IncreaseScore(amount);
     UpdateView();
 }
Exemplo n.º 5
0
 protected GameModel()
 {
     _menu       = new MainMenuModel();
     _ingame     = new InGameModel();
     _playerName = "";
 }