public void SetResetDeck() { Decks.Clear(); for (int j = 0; j < NumOfDecks; j++) { //Generate cards for deck that are numbers for (int i = 2; i < 11; i++) { for (int NumofSuits = 1; NumofSuits < 5; NumofSuits++) { Decks.Add(i.ToString()); } } //Generate Face cards string[] FaceCards = { "J", "Q", "K", "A" }; for (int i = 0; i < (FaceCards.Length); i++) { for (int NumofSuits = 1; NumofSuits < 5; NumofSuits++) { Decks.Add(FaceCards[i]); } } } }
public override async Task Update() { IsLoadingDecks = true; Note = _repository.GetGameNote()?.ToString(); var deck = _repository.GetOpponentDeck(); Cards.Clear(); deck.Cards.ForEach(c => Cards.Add(c)); PlayerClass = deck.Class.ToString(); Decks.Clear(); await Task.Run(() => { var alldecks = _repository .GetAllDecksWithTag(Strings.ArchetypeTag) .Select(d => new ArchetypeDeck(d)) .ToList(); var results = ViewModelHelper.MatchArchetypes(deck, alldecks); results.ForEach(r => Decks.Add(r)); results.ForEach(r => _log.Info($"{r.Deck.Name} [{r.Similarity}, {r.Containment}]")); var firstDeck = Decks.FirstOrDefault(); if (firstDeck != null && firstDeck.Similarity > MatchResult.THRESHOLD) { DeckSelected(firstDeck); } IsLoadingDecks = false; IsNoteFocused = true; }); }
private void UpdateDecks(List <DeckInformation> listDeck) { Decks.Clear(); foreach (var deck in listDeck) { Decks.Add(deck); } }
public void GetAllDeckInformation() { ResetCardsCount(); Decks.Clear(); foreach (var deck in dueDeckList) { AddNewDeck(deck); } UpdatePrimaryTile(); }
public async Task DeckInitializing() { var oldDeckList = await DeckDataSource.GetDecksAsync(); Decks.Clear(); foreach (var deck in oldDeckList) { foreach (var item in deck.items) { FindCardImage(item.card); } } oldDeckList.ForEach(p => Decks.Add(p)); }
public override async Task Update() { IsNoteFocused = true; IsLoadingDecks = true; Note = _repository.GetGameNote()?.ToString(); Deck deck; if (EndGame.Settings.Get(Strings.DeveloperMode).Bool) { deck = _repository.GetOpponentDeckLive(); } else { deck = _repository.GetOpponentDeck(); } Cards.Clear(); deck.Cards.ForEach(c => Cards.Add(c)); PlayerClass = deck.Class.ToString(); Decks.Clear(); if (Cards.Count <= 0) { EndGame.Logger.Debug("NoteVM: Opponent deck is empty, skipping"); IsLoadingDecks = false; return; } await Task.Run(() => { var alldecks = _repository .GetAllDecksWithTag(Strings.ArchetypeTag) .Select(d => new ArchetypeDeck(d)) .ToList(); var format = EndGame.Data.GetGameFormat(); var results = ViewModelHelper.MatchArchetypes(format, deck, alldecks); results.ForEach(r => Decks.Add(r)); results.ForEach(r => _log.Debug($"Archetype: ({r.Similarity}, {r.Containment}) " + $"{r.Deck.DisplayName} ({r.Deck.Class})")); var firstDeck = Decks.FirstOrDefault(); if (firstDeck != null && firstDeck.Similarity > MatchResult.THRESHOLD) { DeckSelected(firstDeck); } IsLoadingDecks = false; }); }
private void RefreshDecks() { // deckManager.ClearCache(); var oldSelected = SelectedDeck; var d = deckManager.GetDecks(SelectedServer.Name, ShowHiddenDecks); Decks.Clear(); Decks.AddRange(d.ToModel()); if (oldSelected != null) { SelectedDeck = Decks.FirstOrDefault(x => x.Id == oldSelected.Id); } RefreshAvailableDecks(); }
internal void UpdateObservableDeckList(List <SharedDeckInfo> deckList) { lock (this) { Decks.Clear(); foreach (var g in deckList.GroupBy(x => x.GameId)) { var dg = new SharedDeckGroup(g.Key, IsMe); Decks.Add(dg); foreach (var d in g) { dg.Decks.Add(new SharedDeckInfoWithOwner(d, IsMe)); } } } }
public void GetAllDeckInformation() { ResetCardsCount(); var deckList = Collection.Deck.All(); Decks.Clear(); foreach (var deck in deckList) { AddNewDeck(deck); } if (sortBy == SortBy.DateAdded) { SortByDateAdded(); } else { SortByName(); } }
public async Task FilterDecks(GameMode mode, GameFormat format) { Decks.Clear(); var allDecks = await GetAllDecks(); allDecks.Where(d => { var include = true; switch (mode) { case GameMode.ALL: include = include && true; break; case GameMode.ARENA: include = include && d.IsArena; break; default: include = include && !d.IsArena; break; } switch (format) { case GameFormat.ANY: include = include && true; break; case GameFormat.STANDARD: include = include && d.IsStandard; break; case GameFormat.WILD: include = include && !d.IsStandard; break; } return(include); }) .OrderBy(d => d.Name) .ToList() .ForEach(d => Decks.Add(d)); Decks.Insert(0, ALL_DECK); Decks.Insert(1, Deck.None); SelectedDeck = ALL_DECK; }
public void LoadDecks(string file = null) { List <ArchetypeDeck> decks = new List <ArchetypeDeck>(); try { decks = JsonConvert.DeserializeObject <List <ArchetypeDeck> >( File.ReadAllText(file ?? DECKS_FILE)); } catch (Exception e) { Log.Error(e); } if (decks.Count > 0) { Decks.Clear(); foreach (var d in decks) { AddDeck(d); } } }
private void Update() { Note = _repository.GetGameNote()?.ToString(); var deck = _repository.GetOpponentDeck(); Cards.Clear(); deck.Cards.ForEach(c => Cards.Add(c)); PlayerClass = deck.Klass.ToString(); Decks.Clear(); var alldecks = _repository.GetAllArchetypeDecks(); var results = ViewModelHelper.MatchArchetypes(deck, alldecks); results.ForEach(r => Decks.Add(r)); results.ForEach(r => _log.Info($"{r.Deck.Name} [{r.Similarity}, {r.Containment}]")); var firstDeck = Decks.FirstOrDefault(); if (firstDeck != null && firstDeck.Similarity > MatchResult.THRESHOLD) { DeckSelected(firstDeck); } }
public static void Reset() { Decks.Clear(); Cards.Clear(); LoadDecks(); }