Exemplo n.º 1
0
        public void UpdateCardDisplay()
        {
            wpCardCollections.Children.Clear();
            wpCardCollections2.Children.Clear();
            wpToolTipCards.Children.Clear();
            nPileName.Content = PileName;

            if (this.CardSize == NET_WPF.CardSize.Full && this.Pile != null && this.PileCount > 0)
            {
                foreach (DominionBase.Cards.Card card in this.Pile)
                {
                    ToolTipCard ttc = new ToolTipCard();
                    ttc.ICard  = card;
                    ttc.Margin = new Thickness(3);
                    wpToolTipCards.Children.Add(ttc);
                }
            }
            else
            {
                if (String.IsNullOrEmpty(this.PileName))
                {
                    nPileName.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    nPileName.Visibility = System.Windows.Visibility.Visible;
                }

                if (ExactCount && this.Pile != null && this.PileCount > 0)
                {
                    lCount.Visibility = System.Windows.Visibility.Visible;
                    lCount.Content    = String.Format("({0})", StringUtility.Plural("Card", this.PileCount, true));
                }
                else
                {
                    lCount.Visibility = System.Windows.Visibility.Collapsed;
                }

                WrapPanel currentWrapPanel = wpCardCollections;
                foreach (DominionBase.Cards.CardCollection cardStack in GenerateCardStacks())
                {
                    Controls.CardStackControl csc = new Controls.CardStackControl()
                    {
                        MinWidth = this.MinStackWidth
                    };
                    csc.CardSize       = this.CardSize;
                    csc.ExactCount     = this.ExactCount;
                    csc.IsCardsVisible = this.IsCardsVisible;
                    csc.Phase          = this._PlayerPhase;
                    csc.PlayerMode     = this._PlayerMode;
                    csc.PileVisibility = this.PileVisibility;
                    if (this.TokenDict != null && this.TokenDict.ContainsKey(cardStack[0]))
                    {
                        csc.Tokens = this.TokenDict[cardStack[0]];
                    }
                    csc.CardCollection = cardStack;
                    if (this.IsVPsVisible && (
                            (cardStack[0].Category & DominionBase.Cards.Category.Victory) == DominionBase.Cards.Category.Victory ||
                            (cardStack[0].Category & DominionBase.Cards.Category.Curse) == DominionBase.Cards.Category.Curse))
                    {
                        csc.CountVPs(this.Pile);
                    }
                    else
                    {
                        csc.HideVPs();
                    }

                    if (this.SplitAt != null && csc.CardCollection.Count() > 0 && csc.CardCollection.First().CardType == this.SplitAt.CardType)
                    {
                        currentWrapPanel = wpCardCollections2;
                    }

                    currentWrapPanel.Children.Add(csc);
                }
            }

            InvalidateVisual();
        }
		public void UpdateCardDisplay()
		{
			wpCardCollections.Children.Clear();
			wpCardCollections2.Children.Clear();
			wpToolTipCards.Children.Clear();
			nPileName.Content = PileName;

			if (this.CardSize == NET_WPF.CardSize.Full && this.Pile != null && this.PileCount > 0)
			{
				foreach (DominionBase.Cards.Card card in this.Pile)
				{
					ToolTipCard ttc = new ToolTipCard();
					ttc.ICard = card;
					ttc.Margin = new Thickness(3);
					wpToolTipCards.Children.Add(ttc);
				}
			}
			else
			{
				if (String.IsNullOrEmpty(this.PileName))
					nPileName.Visibility = System.Windows.Visibility.Collapsed;
				else
					nPileName.Visibility = System.Windows.Visibility.Visible;

				if (ExactCount && this.Pile != null && this.PileCount > 0)
				{
					lCount.Visibility = System.Windows.Visibility.Visible;
					lCount.Content = String.Format("({0})", StringUtility.Plural("Card", this.PileCount, true));
				}
				else
				{
					lCount.Visibility = System.Windows.Visibility.Collapsed;
				}

				WrapPanel currentWrapPanel = wpCardCollections;
				foreach (DominionBase.Cards.CardCollection cardStack in GenerateCardStacks())
				{
					Controls.CardStackControl csc = new Controls.CardStackControl() { MinWidth = this.MinStackWidth };
					csc.CardSize = this.CardSize;
					csc.ExactCount = this.ExactCount;
					csc.IsCardsVisible = this.IsCardsVisible;
					csc.Phase = this._PlayerPhase;
					csc.PlayerMode = this._PlayerMode;
					csc.PileVisibility = this.PileVisibility;
					if (this.TokenDict != null && this.TokenDict.ContainsKey(cardStack[0]))
						csc.Tokens = this.TokenDict[cardStack[0]];
					csc.CardCollection = cardStack;
					if (this.IsVPsVisible && (
						(cardStack[0].Category & DominionBase.Cards.Category.Victory) == DominionBase.Cards.Category.Victory ||
						(cardStack[0].Category & DominionBase.Cards.Category.Curse) == DominionBase.Cards.Category.Curse))
						csc.CountVPs(this.Pile);
					else
						csc.HideVPs();

					if (this.SplitAt != null && csc.CardCollection.Count() > 0 && csc.CardCollection.First().CardType == this.SplitAt.CardType)
						currentWrapPanel = wpCardCollections2;

					currentWrapPanel.Children.Add(csc);
				}
			}

			InvalidateVisual();
		}