예제 #1
0
        protected override void OnStart()
        {
            base.OnStart();

            _pagesController = _bootstrap.GetController(ControllerTypes.Page) as PagesController;
            _questionData    = _bootstrap.GetModel(ModelTypes.DynamicQuestions) as DynamicQuestionData;

            _registration = _bootstrap.GetController(ControllerTypes.Register) as RegisterController;

            _sfx = _bootstrap.GetController(ControllerTypes.SoundSFX) as SFXController;

            _timeController = _bootstrap.GetController(ControllerTypes.Time) as TimeController;

            if (_timeController != null)
            {
                _timeController.GameTimeout += GameTimeout;
            }
        }
        protected override void OnStart()
        {
            base.OnStart();

            _pagesController    = _bootstrap.GetController(ControllerTypes.Page) as PagesController;
            _scoreController    = _bootstrap.GetController(ControllerTypes.Score) as ScoreController;
            _timeController     = _bootstrap.GetController(ControllerTypes.Time) as TimeController;
            _sfxController      = _bootstrap.GetController(ControllerTypes.SoundSFX) as SFXController;
            _registerController = _bootstrap.GetController(ControllerTypes.Register) as RegisterController;

            _resources    = _bootstrap.GetModel(ModelTypes.Resources) as ResourcesDataBase;
            _images       = _bootstrap.GetModel(ModelTypes.Images) as ImagesDataBase;
            _gridDatabase = _bootstrap.GetModel(ModelTypes.Grid) as GridDatabase;

            _bootstrap.AppStarted += () =>
            {
                _grids = new List <GridCanvas2D>();
                List <Models.GridLayout> gList = _gridDatabase.GetGridsByGame(Type);

                for (int i = 0; i < gList.Count; i++)
                {
                    _grids.Add(new GridCanvas2D(gList[i]));
                }
            };

            _cardsPool = new List <List <Sprite> >();
            _cards     = new List <MemoryCard>();

            OnGamePrepare += GamePrepare;
            OnGameEnd     += GameEnded;

            if (hasTimer)
            {
                _timeController.GameTimeout += TimeOut;
            }

            _cardsPool = _images.GetImagesByCategory(ImageCategory.MemoryCard, true);
            _cardBack  = _images.GetImageByCategory(ImageCategory.MemoryBack);
        }