public void Init(int index, List <InterativaSystem.Models.GridLayout> gridList, GridDatabase db) { _gridDatabase = db; _index = index; _gridList = gridList; if (index >= 0) { _gridLayout = new InterativaSystem.Models.GridLayout(_gridList[index]); } else { _gridLayout = new InterativaSystem.Models.GridLayout(); } ResetList(); HasInitialized = true; }
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); }