Exemple #1
0
 public BlockerDamageAssignments(Attacker attacker)
 {
     _assignments = attacker.Blockers
                    .OrderBy(x => x.DamageAssignmentOrder)
                    .Select(x => Bindable.Create <BlockerDamageAssignment>(x))
                    .ToList();
 }
Exemple #2
0
        public ViewModel(IEnumerable <ITarget> targets, int amount)
        {
            _amount       = amount;
            _toBeAssigned = amount;

            foreach (var target in targets)
            {
                _targets.Add(Bindable.Create <TargetWithValue>(target));
            }
        }
Exemple #3
0
        public ViewModel(Attacker attacker, DamageAssignmentOrder assignmentOrder)
        {
            _attacker = attacker;

            _blockerAssignments =
                attacker.Blockers.Select(
                    blocker => Bindable.Create <BlockerAssignment>(blocker)).ToList();

            _assignmentOrder = assignmentOrder;
        }
Exemple #4
0
        public override void Initialize()
        {
            Deck = _existing == null
        ? ViewModels.Deck.Create()
        : ViewModels.Deck.Create(_existing);

            Deck.OnAdd    = OnAdd;
            Deck.OnRemove = OnRemove;

            var uniqueCards = _library
                              .Distinct()
                              .ToList();

            _cardsWithSetAndRarity = uniqueCards
                                     .Select(x =>
            {
                var card    = Cards.Create(x.Name);
                card.Rarity = x.Rarity;
                card.Set    = x.Set;

                return(card);
            })
                                     .ToDictionary(x => x.Name, x => x);

            _libraryItems = _library
                            .GroupBy(x => x.Name)
                            .Select(x =>
            {
                var cardsLeft   = Bindable.Create <LibraryItem>();
                cardsLeft.Info  = x.First();
                cardsLeft.Card  = _cardsWithSetAndRarity[x.Key];
                cardsLeft.Count = x.Count() - Deck.Deck.GetCount(x.Key);
                return(cardsLeft);
            })
                            .ToDictionary(x => x.Info.Name, x => x);


            LibraryFilter = ViewModels.LibraryFilter.Create(
                cards: uniqueCards,
                transformResult: card => _libraryItems[card.Name],
                orderBy: card => card.Rarity.HasValue ? -(int)card.Rarity : 0);


            SelectedCard = _cardsWithSetAndRarity[_library[0].Name];
        }
        public void UpdateViaMethod()
        {
            var changed = false;
            var dog     = Bindable.Create <Dog>();
            var notify  = dog as INotifyPropertyChanged;

            notify.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "Description")
                {
                    changed = true;
                }
            };

            dog.ChangeDestription();

            Assert.True(changed);
        }
Exemple #6
0
        public override void Initialize()
        {
            Task.Factory.StartNew(() =>
            {
                var cards = _cardsSearch.Query().Where(x => _cards.ContainsKey(x.Name));

                foreach (var card in cards.OrderBy(x => _orderBy(_cards[x.Name])).ThenBy(x => x.Name))
                {
                    if (_cards.ContainsKey(card.Name))
                    {
                        var info         = _cards[card.Name];
                        var result       = Bindable.Create <Result>();
                        result.View      = _transformResult(info);
                        result.CardName  = card.Name;
                        result.IsVisible = true;
                        _results.Add(result);
                    }
                }
            });
        }
Exemple #7
0
 public static Animation Create()
 {
     return(Bindable.Create <Animation>());
 }
Exemple #8
0
 public ViewModel(IEnumerable <object> objects, string title)
 {
     Title    = title;
     _objects = objects.Select(x => Bindable.Create <OrderedObject>(x)).ToList();
 }