コード例 #1
0
 private void SetUpTeamPiles()
 {
     _mainGame !.SingleInfo = _gameContainer.PlayerList !.GetSelf();
     if (_gameContainer.SingleInfo !.MainHandList.Any(items => items.CompleteCategory == EnumCompleteCategories.None))
     {
         throw new BasicBlankException("Cannot have category of none.  Rethink");
     }
     _pileStack !.Children.Clear();
     _gameContainer.TeamList.ForEach(thisTeam =>
     {
         Grid tempGrid   = new Grid();
         tempGrid.Margin = new Thickness(0, 0, 0, 20);
         AddAutoRows(tempGrid, 2);
         AddAutoColumns(tempGrid, 2);
         TextBlock ThisLabel  = new TextBlock();
         ThisLabel.Text       = thisTeam.Text;
         ThisLabel.Foreground = Brushes.Aqua;
         ThisLabel.FontWeight = FontWeights.Bold;
         AddControlToGrid(tempGrid, ThisLabel, 0, 0);
         Grid.SetColumnSpan(ThisLabel, 2);
         ThisLabel.HorizontalAlignment = HorizontalAlignment.Center; // try this
         BasicMultiplePilesWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF> thisDis = new BasicMultiplePilesWPF <MillebournesCardInformation, MillebournesGraphicsCP, CardGraphicsWPF>();
         thisDis.Init(thisTeam.CardPiles, "");
         thisDis.StartAnimationListener("team" + thisTeam.TeamNumber);
         AddControlToGrid(tempGrid, thisDis, 1, 0);
         SafetiesWPF thisS = new SafetiesWPF();
         thisS.Init(thisTeam, _mainGame, _gameContainer.Command);
         _disList.Add(thisDis);
         AddControlToGrid(tempGrid, thisS, 1, 1);
         _pileStack.Children.Add(tempGrid);
     });
 }
コード例 #2
0
 //anything else needed is here.
 protected override bool CanEnableDeck()
 {
     if (NeedsSpecial == true)
     {
         return(false); //otherwise, can't compile.
     }
     if (_mainGame !.SingleInfo !.MainHandList.Any(items => _mainGame.CanPlay(items.Deck)) && _mainGame.Test !.AllowAnyMove == false)
     {
         return(false);
     }
     return(!_gameContainer.AlreadyDrew);
 }
コード例 #3
0
        public override bool CanEndTurn()
        {
            var thisCard = _model.Pile1 !.GetCardInfo();

            if (thisCard.Instructions == EnumInstructionList.Flip || thisCard.Instructions == EnumInstructionList.Cut)
            {
                return(false);
            }
            if (_mainGame !.SingleInfo !.MainHandList.Any(items => _mainGame.CanPlay(items.Deck)))
            {
                return(false);
            }
            return(_gameContainer.AlreadyDrew);
        }
コード例 #4
0
        public bool CanProcessDiscard(out bool pickUp, ref int deck, out string message)
        {
            message = "";
            if (_gameContainer.AlreadyDrew == false && _gameContainer.PreviousCard == 0)
            {
                pickUp = true;
            }
            else
            {
                pickUp = false;
            }
            var thisCol = _model !.PlayerHand1 !.ListSelectedObjects();

            if (pickUp == true)
            {
                if (thisCol.Count > 0)
                {
                    message = "There is at least one card selected.  Unselect all the cards before picking up from discard";
                    return(false);
                }
                return(true);
            }
            if (thisCol.Count == 0)
            {
                message = "Sorry, you must select a card to discard";
                return(false);
            }
            if (thisCol.Count > 1)
            {
                message = "Sorry, you can only select one card to discard";
                return(false);
            }
            if (SaveRoot !.MoreThanOne == true)
            {
                if (SingleInfo !.MainHandList.Any(items => items.Deck == _gameContainer.PreviousCard))
                {
                    message = "Sorry, since you picked up more than one card from the discard pile, the one clicked must be used in a set";
                    return(false);
                }
            }
            if (thisCol.First().Deck == _gameContainer.PreviousCard)
            {
                message = "Sorry, you cannot discard the one that was picked up since there is more than one card to choose from";
                return(false);
            }
            deck = thisCol.First().Deck;
            return(true);
        }
コード例 #5
0
        private bool HeartsValidMove(int deck)
        {
            var          heartSave = (ITrickStatusSavedClass)SaveRoot !;
            var          thisList  = SaveRoot !.TrickList;
            var          thisCard  = _gameContainer.DeckList !.GetSpecificItem(deck);
            EnumSuitList cardSuit  = thisCard.GetSuit.GetRegularSuit();

            if (thisList.Count == 0)
            {
                if (heartSave.TrickStatus == EnumTrickStatus.FirstTrick)
                {
                    var tempCard = SingleInfo !.MainHandList.OrderBy(Items => Items.GetSuit).ThenBy(Items => Items.ReadMainValue).Take(1).Single();
                    if (tempCard.Deck == deck)
                    {
                        return(true);
                    }
                    return(false);
                }
                if (heartSave.TrickStatus == EnumTrickStatus.SuitBroken)
                {
                    return(true);
                }
                if (cardSuit == EnumSuitList.Hearts)
                {
                    return(!SingleInfo !.MainHandList.Any(Items => Items.GetSuit.GetRegularSuit() != EnumSuitList.Hearts));
                }
                return(true);
            }
            var leadCard = thisList.First();

            if (leadCard.GetSuit.Equals(thisCard.GetSuit))
            {
                return(true);
            }
            DeckObservableDict <T> tempList;

            if (_trickData !.HasDummy == true)
            {
                var temps = MainContainer.Resolve <ITrickDummyHand <SU, T> >(); //if you don't have it, then will raise an error.
                tempList = temps.GetCurrentHandList();
            }
コード例 #6
0
 private bool CanDraw()
 {
     return(!_mainGame !.SingleInfo !.MainHandList.Any(x => _mainGame.CanPlay(x.Deck)));
 }