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

            foreach (var target in targets)
            {
                _targets.Add(Bindable.Create <TargetWithValue>(target));
            }
        }
コード例 #3
0
ファイル: ViewModel.cs プロジェクト: callumhutchy/grove
        public ViewModel(Attacker attacker, DamageAssignmentOrder assignmentOrder)
        {
            _attacker = attacker;

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

            _assignmentOrder = assignmentOrder;
        }
コード例 #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];
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: ViewModel.cs プロジェクト: longde123/grove
        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);
                    }
                }
            });
        }
コード例 #7
0
ファイル: Animation.cs プロジェクト: longde123/grove
 public static Animation Create()
 {
     return(Bindable.Create <Animation>());
 }
コード例 #8
0
ファイル: ViewModel.cs プロジェクト: longde123/grove
 public ViewModel(IEnumerable <object> objects, string title)
 {
     Title    = title;
     _objects = objects.Select(x => Bindable.Create <OrderedObject>(x)).ToList();
 }