public XactikaVMData(IEventAggregator aggregator,
                             CommandContainer command,
                             BasicTrickAreaObservable <EnumShapes, XactikaCardInformation> trickArea1,
                             XactikaGameContainer gameContainer
                             )
        {
            Deck1          = new DeckObservablePile <XactikaCardInformation>(aggregator, command);
            Pile1          = new PileObservable <XactikaCardInformation>(aggregator, command);
            PlayerHand1    = new HandObservable <XactikaCardInformation>(command);
            TrickArea1     = trickArea1;
            _gameContainer = gameContainer;
            ModeChoose1    = new ListViewPicker(command, gameContainer.Resolver);
            ShapeChoose1   = new ChooseShapeObservable(_gameContainer);
            Bid1           = new NumberPicker(command, gameContainer.Resolver);
            ModeChoose1.ItemSelectedAsync += ModeChooser1_ItemSelectedAsync;
            Bid1.ChangedNumberValueAsync  += Bid1_ChangedNumberValueAsync;
            PlayerHand1 !.Maximum          = 8;
            ModeChoose1.IndexMethod        = EnumIndexMethod.OneBased;
            CustomBasicList <string> tempList = new CustomBasicList <string> {
                "To Win", "To Lose", "Bid"
            };

            ModeChoose1.LoadTextList(tempList);
            ShapeChoose1.SendEnableProcesses(this, (() => _gameContainer.SaveRoot.GameStatus == EnumStatusList.CallShape));
        }
예제 #2
0
        public void Init(BasicTrickAreaObservable <SU, TC> thisMod, IMultiplayerTrick <SU, TC, PA> others, string tagUsed)
        {
            if (thisMod.CardList.Count == 0)
            {
                throw new BasicBlankException("Must have at least one card before i can initialize");
            }
            if (others.ViewList !.Count != thisMod.CardList.Count)
            {
                throw new BasicBlankException("The view list must equal the cardlist as well");
            }
            _thisMod  = thisMod;
            _cardList = thisMod.CardList;
            _cardList.CollectionChanged += CardList_CollectionChanged;
            var privateList = others.ViewList.ToCustomBasicList();
            int tempHeight  = 0;

            foreach (var thisPrivate in privateList)
            {
                var index = privateList.IndexOf(thisPrivate);
                if (thisPrivate.IsSelf == false && index == 0)
                {
                    throw new BasicBlankException("Must be self to start with");
                }
                var thisPlayer = others.GetSpecificPlayer(thisPrivate.Player); // can send in 1 based
                if (thisPrivate.IsSelf == true && thisPlayer.PlayerCategory != EnumPlayerCategory.Self)
                {
                    throw new BasicBlankException("Self Must Always Produce Self Trick Areas");
                }
                var thisLabel = GetLabel(thisPlayer.NickName, thisPrivate);
                _thisCanvas.Children.Add(thisLabel);
                var thisCoordinate = GetCoortinates(EnumCategory.Label, thisPrivate);
                Canvas.SetLeft(thisLabel, thisCoordinate.Left);
                Canvas.SetTop(thisLabel, thisCoordinate.Top);
                GW      thisCard = new GW();
                Binding thisBind = new Binding(nameof(BasicTrickAreaObservable <SU, TC> .CardSingleClickCommand));
                thisBind.Source = thisMod;                                                    // has to be that one
                thisCard.SetBinding(BaseDeckGraphicsWPF <TC, GC> .CommandProperty, thisBind); //i think
                var tempCard = thisMod.CardList[index];
                thisCard.SendSize(tagUsed, tempCard);
                thisCard.CommandParameter = tempCard;
                _thisCanvas.Children.Add(thisCard);
                thisCoordinate = GetCoortinates(EnumCategory.Card, thisPrivate);
                Canvas.SetLeft(thisCard, thisCoordinate.Left);
                Canvas.SetTop(thisCard, thisCoordinate.Top);
                var OtherHeight = thisCoordinate.Top + thisCard.ObjectSize.Height + 30;
                if (OtherHeight > tempHeight)
                {
                    tempHeight = (int)OtherHeight;
                }
            }
            Height      = tempHeight;
            DataContext = thisMod;
            Binding finalBind = GetVisibleBinding(nameof(BasicTrickAreaObservable <SU, TC> .Visible));

            SetBinding(VisibilityProperty, finalBind);
            Content = _thisCanvas; // this is the content for this page.
        }
예제 #3
0
 public RoundsCardGameVMData(IEventAggregator aggregator,
                             CommandContainer command,
                             BasicTrickAreaObservable <EnumSuitList, RoundsCardGameCardInformation> trickArea1
                             )
 {
     Deck1       = new DeckObservablePile <RoundsCardGameCardInformation>(aggregator, command);
     Pile1       = new PileObservable <RoundsCardGameCardInformation>(aggregator, command);
     PlayerHand1 = new HandObservable <RoundsCardGameCardInformation>(command);
     TrickArea1  = trickArea1;
 }
 public CaliforniaJackVMData(IEventAggregator aggregator,
                             CommandContainer command,
                             BasicTrickAreaObservable <EnumSuitList, CaliforniaJackCardInformation> trickArea1
                             )
 {
     Deck1       = new DeckObservablePile <CaliforniaJackCardInformation>(aggregator, command);
     Pile1       = new PileObservable <CaliforniaJackCardInformation>(aggregator, command);
     PlayerHand1 = new HandObservable <CaliforniaJackCardInformation>(command);
     TrickArea1  = trickArea1;
 }
        public void Init(BasicTrickAreaObservable <SU, TC> thisMod, string tagUsed)
        {
            if (thisMod.CardList.Count != 2)
            {
                throw new BasicBlankException("Only 2 are supported for 2 player trick taking games.  Otherwise, try using another trick taking control");
            }
            BindingContext = thisMod;
            _thisMod       = thisMod;
            _cardList      = thisMod.CardList;
            _cardList.CollectionChanged += CardList_CollectionChanged;
            float startTop;
            float firstLeft;

            startTop  = 3;
            firstLeft = 3;
            float cardTop;

            cardTop = 33; // if changing, will be here
            var thisLabel = GetLabel("Your Card Played");

            _thisCanvas.Children.Add(thisLabel);
            var thisRect = new Rectangle(firstLeft, firstLeft, thisLabel.WidthRequest, thisLabel.HeightRequest);

            AbsoluteLayout.SetLayoutBounds(thisLabel, thisRect);
            GW      thisCard = new GW();
            Binding thisBind = new Binding(nameof(BasicTrickAreaObservable <SU, TC> .CardSingleClickCommand));

            thisBind.Source = thisMod;                                      // has to be that one
            thisCard.SetBinding(GraphicsCommand.CommandProperty, thisBind); //i think
            thisCard.SendSize(tagUsed, _cardList.First());                  //hopefully this simple.
            thisCard.CommandParameter = _cardList.First();                  // this needs to be the parameter.
            _thisCanvas.Children.Add(thisCard);
            thisRect = new Rectangle(10, cardTop, thisCard.ObjectSize.Width, thisCard.ObjectSize.Height);
            AbsoluteLayout.SetLayoutBounds(thisCard, thisRect);
            thisLabel = GetLabel("Opponent Card Played");
            _thisCanvas.Children.Add(thisLabel);
            thisRect = new Rectangle(150, startTop, thisLabel.WidthRequest, thisLabel.HeightRequest);
            AbsoluteLayout.SetLayoutBounds(thisLabel, thisRect);
            thisCard = new GW();
            thisCard.SendSize(tagUsed, _cardList.Last()); //hopefully this simple.
            _thisCanvas.Children.Add(thisCard);
            thisRect = new Rectangle(170, cardTop, thisCard.ObjectSize.Width, thisCard.ObjectSize.Height);
            AbsoluteLayout.SetLayoutBounds(thisCard, thisRect);
            Binding FinalBind = new Binding(nameof(BasicTrickAreaObservable <SU, TC> .Visible));

            SetBinding(IsVisibleProperty, FinalBind);
            Content = _thisCanvas; // this is the content for this page.
        }
 public Spades2PlayerVMData(IEventAggregator aggregator,
                            CommandContainer command,
                            BasicTrickAreaObservable <EnumSuitList, Spades2PlayerCardInformation> trickArea1,
                            IGamePackageResolver resolver
                            )
 {
     Deck1       = new DeckObservablePile <Spades2PlayerCardInformation>(aggregator, command);
     Pile1       = new PileObservable <Spades2PlayerCardInformation>(aggregator, command);
     PlayerHand1 = new HandObservable <Spades2PlayerCardInformation>(command);
     TrickArea1  = trickArea1;
     OtherPile   = new PileObservable <Spades2PlayerCardInformation>(aggregator, command);
     Bid1        = new NumberPicker(command, resolver);
     Bid1.LoadNormalNumberRangeValues(0, 13);
     OtherPile.Text    = "Current";
     OtherPile.Visible = false;
 }
 public PickelCardGameVMData(IEventAggregator aggregator,
                             CommandContainer command,
                             BasicTrickAreaObservable <EnumSuitList, PickelCardGameCardInformation> trickArea1,
                             IGamePackageResolver resolver
                             )
 {
     Deck1                    = new DeckObservablePile <PickelCardGameCardInformation>(aggregator, command);
     Pile1                    = new PileObservable <PickelCardGameCardInformation>(aggregator, command);
     PlayerHand1              = new HandObservable <PickelCardGameCardInformation>(command);
     PlayerHand1.Text         = "Your Cards";
     TrickArea1               = trickArea1;
     Bid1                     = new NumberPicker(command, resolver);
     Suit1                    = new SimpleEnumPickerVM <EnumSuitList, DeckPieceCP>(command, new SuitListChooser());
     Suit1.AutoSelectCategory = EnumAutoSelectCategory.AutoSelect;
     //rethink on the next part.
 }
        public void Init(BasicTrickAreaObservable <SU, TC> thisMod, string tagUsed)
        {
            if (thisMod.CardList.Count != 2)
            {
                throw new BasicBlankException("Only 2 are supported for 2 player trick taking games.  Otherwise, try using another trick taking control");
            }
            DataContext = thisMod;
            _thisMod    = thisMod;
            _cardList   = thisMod.CardList;
            _cardList.CollectionChanged += CardList_CollectionChanged;
            float startTop;
            float firstLeft;

            startTop  = 3;
            firstLeft = 3;
            float cardTop;

            cardTop = 33; // if changing, will be here
            var thisLabel = GetLabel("Your Card Played");

            _thisCanvas.Children.Add(thisLabel);
            Canvas.SetLeft(thisLabel, firstLeft);
            Canvas.SetTop(thisLabel, startTop);
            GW      thisCard = new GW();
            Binding thisBind = new Binding(nameof(BasicTrickAreaObservable <SU, TC> .CardSingleClickCommand));

            thisBind.Source = thisMod;                                                    // has to be that one
            thisCard.SetBinding(BaseDeckGraphicsWPF <TC, GC> .CommandProperty, thisBind); //i think
            thisCard.SendSize(tagUsed, _cardList.First());                                //hopefully this simple.
            thisCard.CommandParameter = _cardList.First();                                // this needs to be the parameter.
            _thisCanvas.Children.Add(thisCard);
            Canvas.SetTop(thisCard, cardTop);
            Canvas.SetLeft(thisCard, 10); // its manually done.
            thisLabel = GetLabel("Opponent Card Played");
            _thisCanvas.Children.Add(thisLabel);
            Canvas.SetLeft(thisLabel, 250); // try 150.  can always adjust as needed
            Canvas.SetTop(thisLabel, startTop);
            thisCard = new GW();
            thisCard.SendSize(tagUsed, _cardList.Last()); //hopefully this simple.
            _thisCanvas.Children.Add(thisCard);
            Canvas.SetTop(thisCard, cardTop);
            Canvas.SetLeft(thisCard, 270);
            Binding FinalBind = GetVisibleBinding(nameof(BasicTrickAreaObservable <SU, TC> .Visible)); //hopefully no problem (?)

            SetBinding(VisibilityProperty, FinalBind);
            Content = _thisCanvas; // this is the content for this page.
        }
        public async Task MovePiecesAsync(BasicTrickAreaObservable <S, T> thisArea)
        {
            _tempArea     = thisArea;
            _destinationX = (int)thisArea.WinCard !.Location.X;
            _destinationY = (int)thisArea.WinCard.Location.Y;
            var index = thisArea.CardList.IndexOf(thisArea.WinCard);

            if (index == -1)
            {
                throw new BasicBlankException("Win card not found");
            }
            var ThisLoc = GameBoard !.GetStartingPoint(index);

            _destinationX = (int)ThisLoc.X;
            _destinationY = (int)ThisLoc.Y;
            _trickList    = new CustomBasicList <TrickInfo>();
            var temps = LongestTravelTime / _internval;

            _totalSteps = (int)temps;
            if (LongestTravelTime == 0)
            {
                throw new BasicBlankException("Longest travel time not set");
            }
            foreach (var thisCard in _tempArea.CardList)
            {
                if (thisCard.Equals(thisArea.WinCard) == false)
                {
                    TrickInfo thisTrick = new TrickInfo();
                    thisTrick.Index = _tempArea.CardList.IndexOf(thisCard);
                    var thisLocation = GameBoard.GetStartingPoint(thisTrick.Index);
                    thisTrick.CurrentX = thisLocation.X;
                    thisTrick.CurrenyY = thisLocation.Y;
                    thisTrick.StartX   = thisLocation.X;
                    thisTrick.StartY   = thisLocation.Y;
                    double totalxDistance;
                    double totalYDistance;
                    totalxDistance  = (double)_destinationX - thisTrick.StartX;
                    totalYDistance  = (double)_destinationY - thisTrick.StartY;
                    thisTrick.DiffX = (float)totalxDistance / _totalSteps;
                    thisTrick.DiffY = (float)totalYDistance / _totalSteps;
                    _trickList.Add(thisTrick);
                }
            }
            await RunAnimationsAsync();
        }
 public SkuckCardGameVMData(IEventAggregator aggregator,
                            CommandContainer command,
                            BasicTrickAreaObservable <EnumSuitList, SkuckCardGameCardInformation> trickArea1,
                            IGamePackageResolver resolver,
                            SkuckCardGameGameContainer gameContainer
                            )
 {
     Deck1          = new DeckObservablePile <SkuckCardGameCardInformation>(aggregator, command);
     Pile1          = new PileObservable <SkuckCardGameCardInformation>(aggregator, command);
     PlayerHand1    = new HandObservable <SkuckCardGameCardInformation>(command);
     TrickArea1     = trickArea1;
     _gameContainer = gameContainer;
     Bid1           = new NumberPicker(command, resolver);
     Suit1          = new SimpleEnumPickerVM <EnumSuitList, DeckPieceCP>(command, new SuitListChooser());
     //iffy part is the trickarea visible.
     Suit1.AutoSelectCategory      = EnumAutoSelectCategory.AutoSelect;
     Bid1.ChangedNumberValueAsync += Bid1_ChangedNumberValueAsync;
     Suit1.ItemSelectionChanged   += Suit1_ItemSelectionChanged;
     Bid1.LoadNormalNumberRangeValues(1, 26);
 }
예제 #11
0
 public Pinochle2PlayerVMData(IEventAggregator aggregator,
                              CommandContainer command,
                              BasicTrickAreaObservable <EnumSuitList, Pinochle2PlayerCardInformation> trickArea1,
                              IGamePackageResolver resolver
                              )
 {
     Deck1                        = new DeckObservablePile <Pinochle2PlayerCardInformation>(aggregator, command);
     Pile1                        = new PileObservable <Pinochle2PlayerCardInformation>(aggregator, command);
     PlayerHand1                  = new HandObservable <Pinochle2PlayerCardInformation>(command);
     TrickArea1                   = trickArea1;
     Guide1                       = new ScoreGuideViewModel();
     YourMelds                    = new HandObservable <Pinochle2PlayerCardInformation>(command);
     OpponentMelds                = new HandObservable <Pinochle2PlayerCardInformation>(command);
     TempSets                     = new TempSetsObservable <EnumSuitList, EnumColorList, Pinochle2PlayerCardInformation>(command, resolver);
     TempSets.HowManySets         = 2;
     Deck1.DrawInCenter           = true;
     YourMelds.Text               = "Yours";
     OpponentMelds.Text           = "Opponents";
     YourMelds.IgnoreMaxRules     = true;
     OpponentMelds.IgnoreMaxRules = true;
     YourMelds.Maximum            = 8;
     OpponentMelds.Maximum        = 8;
     YourMelds.AutoSelect         = HandObservable <Pinochle2PlayerCardInformation> .EnumAutoType.SelectOneOnly;
 }