コード例 #1
0
ファイル: DeckEditorModel.cs プロジェクト: rajeshwarn/Mtgdb
        public DeckEditorModel()
        {
            MainDeck   = new DeckZoneModel();
            SideDeck   = new DeckZoneModel();
            SampleHand = new DeckZoneModel();

            CurrentZone = Zone.Main;
        }
コード例 #2
0
        private static int getInsertionIndex(Card card, Card at, DeckZoneModel zoneModel)
        {
            int index = zoneModel.CardsIds.IndexOf((at ?? card).Id);

            if (index < 0)
            {
                return(zoneModel.CardsIds.Count);
            }
            return(index);
        }
コード例 #3
0
        private static int countNonTokens(CardRepository repo, DeckZoneModel zone)
        {
            if (repo.IsLoadingComplete.Signaled)
            {
                return(zone.CountById
                       .Where(_ => !repo.CardsById.TryGet(_.Key)?.IsToken != false)
                       .Sum(_ => _.Value));
            }

            return(zone.CountById.Values.Sum());
        }
コード例 #4
0
 public static IEnumerable <string> NamesakeIds(this DeckZoneModel zone, Card card) =>
 zone.CardsIds.Where(id => id == card.Id || card.NamesakeIds.Contains(id));
コード例 #5
0
 public static bool Contains(this DeckZoneModel zone, Card c) =>
 zone.CountById.ContainsKey(c.Id);