コード例 #1
0
        private void CreateEventDeck(int deckSize = 26)
        {
            EventBox.Clear();
            EventDeck.Clear();

            // construct and initialize all 26 Event cards
            for (int i = 1; i <= 26; i++)
            {
                String      backPath = "assets/cards/event/cards-event-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/event/cards-event-" + s + ".png";
                ImageSource front     = new BitmapImage(new Uri(frontPath, UriKind.Relative));

                EventCard ec = new EventCard(i, front, back);
                EventDeck.Add(ec);
            }

            EventBox.Add(EventDeck[0]);
            EventDeck.RemoveAt(0);
            EventDeck.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();
            }
        }