示例#1
0
        protected override void OnStart()
        {
            base.OnStart();

            _scoreController = _bootstrap.GetController(ControllerTypes.Score) as ScoreController;
            _register        = _bootstrap.GetController(ControllerTypes.Register) as RegisterController;

            _resourcesData = _bootstrap.GetModel(ModelTypes.Resources) as ResourcesDataBase;

            _timeController = _bootstrap.GetController(ControllerTypes.Time) as TimeController;
            if (_timeController != null)
            {
                _timeController.GameTimeout += TimeOut;
            }

            _SoundController = _bootstrap.GetController(ControllerTypes.SoundSFX) as SoundController;
            _questionsData   = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
            _AssociationData = _bootstrap.GetModel(ModelTypes.Association) as AssociationData;
        }
        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);
        }