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 void StartGame()
 {
     PlayerController.GetInstance().StartGame();
     ChangeGameState(GameState.InGame);
     LevelGenerator.sharedInstance.CreateInitialBlocks();
     InGameView.GetInstance().ShowHighestScore();
 }
Exemple #3
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 #4
0
 public void SetUp()
 {
     _inGameGameObject           = new GameObject();
     _inGameView                 = _inGameGameObject.AddComponent <InGameView>();
     _endGameGameObject          = new GameObject();
     _inGameView.EndGameImage    = _endGameGameObject;
     _inGameView.CurrentWordText = _inGameGameObject.AddComponent <Text>();
     _victoryImageGameObject     = new GameObject();
     _victoryImageGameObject.transform.SetParent(_endGameGameObject.transform);
     _inGameView.VictoryImage = _victoryImageGameObject.AddComponent <Image>();
     _gameOverImageGameObject = new GameObject();
     _gameOverImageGameObject.transform.SetParent(_endGameGameObject.transform);
     _inGameView.GameOverImage     = _gameOverImageGameObject.AddComponent <Image>();
     _restartGameGameObject        = new GameObject();
     _inGameView.RestartGameButton = _restartGameGameObject.AddComponent <Button>();
     _inGameViewModel = new InGameViewModel();
     _inGameView.SetModel(_inGameViewModel);
 }
Exemple #5
0
 private void Awake()
 {
     sharedInstance = this;
 }
Exemple #6
0
 public void CollectCoins()
 {
     collectedCoins++;
     InGameView.GetInstance().UpdateCoins();
 }
Exemple #7
0
 private void Awake()
 {
     instance = this;
 }