Beispiel #1
0
        public void GetAllCards()
        {
            ArtifactClient client   = new ArtifactClient();
            List <Card>    allCards = client.GetAllCards();

            Assert.IsNotNull(allCards);
        }
Beispiel #2
0
 private void InitClient()
 {
     if (m_client == null)
     {
         m_client = new ArtifactClient();
         m_client.GetAllCards();
     }
 }
Beispiel #3
0
        public MainWindow()
        {
            Logger.OutputInfo($"Program Start - Artifact API {VERSION}");
            InitializeComponent();

            this.Title += $" {VERSION}";
            Closed     += OnProgramClosed;

            Loaded += OnViewLoaded;
            outputBox.TextChanged      += OnOutputPasted;
            tb_javascriptCopy.GotFocus += OnHaveGotFocus;

            t_invalidCode.Visibility = Visibility.Collapsed;

            m_client = new ArtifactClient();
            //Load since bug with not loading cards
            m_client.GetAllCards();
        }
Beispiel #4
0
        /// <summary>
        /// Gets 5 random hero names
        /// </summary>
        /// <returns></returns>
        private string[] GetRandomHeroNames()
        {
            InitClient();

            if (m_allHeroNames == null)
            {
                List <Models.Card> cards  = m_client.GetAllCards();
                List <Models.Card> heroes = cards.Where(x => x.Type == ArtifactAPI.Enums.CardType.Hero).ToList();
                m_allHeroNames = heroes.Select(x => x.Names.English).ToList();
            }

            List <string> randomHeroes = new List <string>();

            for (int i = 0; i < 5; i++)
            {
                int rndIndex = m_rnd.Next(0, m_allHeroNames.Count);
                randomHeroes.Add(m_allHeroNames[rndIndex]);
            }

            return(randomHeroes.ToArray());
        }