/// <summary>
        /// Loads a deck file given its relative or full path
        /// </summary>
        /// <param name="path">Relative or full path of deck file</param>
        private void LoadDeckAtPath(string path)
        {
            string   loadedText = System.IO.File.ReadAllText(path);
            DeckData deck       = JsonConvert.DeserializeObject <DeckData>(loadedText);

            if (deck == null)
            {
                Console.WriteLine("Null Deck");
            }
            ActiveDeckData = deck;
            OnDeckLoaded?.Invoke();
        }
        public Simulation(DeckData deckData, int numberOfCardsPerPlayer, int numberOfCommonCards, int numberOfSimulations, int numberOfPlayers)
        {
            this.NumberOfCardsPerPlayer = numberOfCardsPerPlayer;
            this.NumberOfCommonCards    = numberOfCommonCards;
            this.NumberOfSimulations    = numberOfSimulations;
            this.NumberOfPlayers        = numberOfPlayers;

            this.m_ShuffleDeck = deckData.GetFullCompleteCardDataList();
            m_CommonCards      = new List <CompleteCardData>(NumberOfCommonCards);
            m_PlayerCards      = new List <PlayerGameData>(NumberOfPlayers);
            CurrentGameRules   = new PokerGameRules(new CompleteDeckData(m_ShuffleDeck));
        }
Esempio n. 3
0
        /// <summary>
        /// Checks and validates all data. Creates defaults if anything is missing.
        /// </summary>
        void CheckAndValidateData()
        {
            if (!System.IO.File.Exists(Seed_Tools.Properties.Settings.Default.ActiveDeckPath))
            {
                // Create Default Deck.
                DeckData.CreateDefaultDeckDataAtPath(Seed_Tools.Properties.Settings.Default.ActiveDeckPath);
            }

            LoadSeedData();

            foreach (var kv in CardLibrary)
            {
                kv.Value.id = kv.Key;
            }
        }
Esempio n. 4
0
        public CompleteDeckData(DeckData inputDeck)
        {
            Dictionary <string, int> cards = new Dictionary <string, int>(inputDeck.CardIdToCount);

            foreach (var kv in cards)
            {
                int      cardCount  = kv.Value;
                CardData simpleCard = null;
                if (!App.CastedInstance.CardLibrary.TryGetValue(kv.Key, out simpleCard))
                {
                    continue;
                }

                CompleteCardData completeCard = new CompleteCardData(simpleCard);

                for (int i = 0; i < cardCount; i++)
                {
                    Cards.Enqueue(completeCard);
                }
            }
        }