public void RefreshCardsVisibility() { foreach (DeckCardView cardView in cardsManager.DeckList) { CardInfo card = cardRepository.Get(cardView.Id); cardView.Show(CanbeShowed()); bool CanbeShowed() { if (!card.ContainThisText(inputSearch.CurrentText)) { return(false); } if (visibilitySwitchView.IsOn) { return(true); } if (!unlockCardsRepository.IsThisCardUnlocked(card)) { return(false); } if (!cardSelectionFilter.IsThisCardAllowed(card, investigator)) { return(false); } return(true); } } }
/*******************************************************************/ public void Remove(string cardId, string investigatorId) { CardInfo card = cardRepository.Get(cardId); Investigator investigator = investigatorRepository.Get(investigatorId); UpdateModel(card, investigator); UpdateView(card, investigator); }
/*******************************************************************/ public void AddCard(string cardId, string investigatorId) { CardInfo card = cardsRepository.Get(cardId); Investigator investigator = investigatorsRepository.Get(investigatorId); updateXpUseCase.PayCardXp(investigator, card); UpdateModel(card, investigator); UpdateView(card, investigator); }
public IEnumerable <Card> Get() { var exists = _repo.Get(); if (exists == null) { throw new Exception("There are no Cards"); } return(exists); }
public void LoadProgress() { FullDTO repositoryDTO = applicationValues.CanContinue ? ContinueData() : NewGameData(); LoadCampaigns(repositoryDTO.CampaignsList, repositoryDTO.CurrentScenario); LoadInvestigators(repositoryDTO.InvestigatorsList); LoadSelectors(repositoryDTO.InvestigatorsSelectedList); LoadUnlockCards(repositoryDTO.UnlockCards); FullDTO NewGameData() => serializer.CreateDataFromResources <FullDTO>(gameFiles.PlayerProgressDefaultFilePath); FullDTO ContinueData() => serializer.CreateDataFromFile <FullDTO>(gameFiles.PlayerProgressFilePath); void LoadCampaigns(IEnumerable <CampaignDTO> campaigns, string currentScenario) { campaignRepository.Reset(); foreach (CampaignDTO campaign in campaigns) { Campaign newCampaing = new Campaign { Id = campaign.Id, State = campaign.State, FirstScenario = factory.CreateInstance <Scenario>(campaign.FirstScenario) }; campaignRepository.Add(newCampaing); campaignRepository.SetScenario(factory.CreateInstance <Scenario>(currentScenario)); } } void LoadInvestigators(IEnumerable <InvestigatorDTO> investigators) { investigatorRepository.Reset(); foreach (InvestigatorDTO investigator in investigators) { Investigator newInvestigator = new Investigator( investigator.PhysicTrauma, investigator.MentalTrauma, investigator.Xp, investigator.IsPlaying, investigator.IsRetired, cardRepository.Get(investigator.Id), factory.CreateInstance <DeckBuildingRules>(investigator.Id) ); investigator.MandatoryCards.ForEach(card => newInvestigator.AddToMandatory(cardRepository.Get(card))); investigator.Deck.ForEach(card => newInvestigator.AddToDeck(cardRepository.Get(card))); investigatorRepository.Add(newInvestigator); } } void LoadUnlockCards(IEnumerable <string> unlockCards) { unlockCardsRepository.Reset(); foreach (string cardId in unlockCards) { unlockCardsRepository.Add(cardRepository.Get(cardId)); } } void LoadSelectors(IEnumerable <string> investigatorsSelected) { selectorRepository.Reset(); foreach (string investigatorId in investigatorsSelected) { selectorRepository.Add(investigatorRepository.Get(investigatorId)); } } }