コード例 #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();
        }