コード例 #1
0
        private void CreateFearDeck(int deckSize = 9)
        {
            FearDeck.Clear();
            FearBox.Clear();

            // construct and initialize all 30 Fear cards
            for (int i = 1; i <= 30; i++)
            {
                String      backPath = "assets/cards/fear/cards-fear-00.png";
                ImageSource back     = new BitmapImage(new Uri(backPath, UriKind.Relative));

                String s = "";
                if (i < 10)
                {
                    s = "0" + i.ToString();
                }
                else
                {
                    s = i.ToString();
                }
                String      frontPath = "assets/cards/fear/cards-fear-" + s + ".png";
                ImageSource front     = new BitmapImage(new Uri(frontPath, UriKind.Relative));

                FearCard fc = new FearCard(i, front, back);
                FearDeck.Add(fc);
            }
            FearDeck.Shuffle();

            while (FearDeck.Count > deckSize)
            {
                FearBox.Add(FearDeck[0]);
                FearDeck.RemoveAt(0);
            }
            FearDeck.Shuffle();
        }
コード例 #2
0
        private void SetUpGameBoardDecks()
        {
            for (int i = 0; i < invasion.FearDeck.Count; i++)
            {
                FearCard c = invasion.FearDeck[i];
                DealCardToNewDeck(c);
                Canvas.SetZIndex(c, invasion.FearDeck.Count - i);
                mainCanvas.Children.Add(c);
            }

            for (int i = 0; i < invasion.EventDeck.Count; i++)
            {
                EventCard c = invasion.EventDeck[i];
                DealCardToNewDeck(c);
                Canvas.SetZIndex(c, invasion.EventDeck.Count - i);
                mainCanvas.Children.Add(c);
            }

            for (int i = 0; i < invasion.InvaderDeck.Count; i++)
            {
                InvaderCard c = invasion.InvaderDeck[i];
                DealCardToNewDeck(c);
                Canvas.SetZIndex(c, invasion.InvaderDeck.Count - i);
                mainCanvas.Children.Add(c);
            }

            foreach (BlightCard c in invasion.BlightDeck)
            {
                DealCardToNewDeck(c);
                mainCanvas.Children.Add(c);
            }

            foreach (AdversaryCard c in invasion.AdversaryDeck)
            {
                if (invasion.MyAdversary.Id == c.Id)
                {
                    DealCardToNewDeck(c);
                    Canvas.SetZIndex(c, 1);
                    mainCanvas.Children.Add(c);
                }
            }

            // Check for Adversary == England Level 3+
            if (invasion.HighImmigration == true)
            {
                SetBoardForEngland();
            }
            else
            {
                RemoveHighImmigrationTile();
            }
        }