示例#1
0
        /// <summary>
        /// 获得英雄的天赋树
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async static Task <HeroTalent> GetHeroTalent(string id, string html)
        {
            if (html == null)
            {
                await InitializeHtml(id);
            }
            HeroTalent heroTalent = new HeroTalent();

            try
            {
                MatchCollection matchCollection = Regex.Matches(html, "<div class=\\\"talent-explain\\\">(.*?)</div>");
                heroTalent.Talent_25_left  = matchCollection[0].Groups[1].Value.Replace("\\n", "\n");
                heroTalent.Talent_25_right = matchCollection[1].Groups[1].Value.Replace("\\n", "\n");
                heroTalent.Talent_20_left  = matchCollection[2].Groups[1].Value.Replace("\\n", "\n");
                heroTalent.Talent_20_right = matchCollection[3].Groups[1].Value.Replace("\\n", "\n");
                heroTalent.Talent_15_left  = matchCollection[4].Groups[1].Value.Replace("\\n", "\n");
                heroTalent.Talent_15_right = matchCollection[5].Groups[1].Value.Replace("\\n", "\n");
                heroTalent.Talent_10_left  = matchCollection[6].Groups[1].Value.Replace("\\n", "\n");
                heroTalent.Talent_10_right = matchCollection[7].Groups[1].Value.Replace("\\n", "\n");
            }
            catch
            {
                return(null);
            }
            return(heroTalent);
        }
示例#2
0
        /// <summary>
        /// 显示英雄天赋树
        /// </summary>
        private async void ShowTheHeroTalent(string html)
        {
            HeroTalent heroTalent = await CrawlerHelper.GetHeroTalent(SelectedHero.ID, html);

            if (heroTalent == null)
            {
                return;
            }
            try
            {
                Talent_25_leftTextBlock.Text  = heroTalent.Talent_25_left;
                Talent_25_rightTextBlock.Text = heroTalent.Talent_25_right;
                Talent_20_leftTextBlock.Text  = heroTalent.Talent_20_left;
                Talent_20_rightTextBlock.Text = heroTalent.Talent_20_right;
                Talent_15_leftTextBlock.Text  = heroTalent.Talent_15_left;
                Talent_15_rightTextBlock.Text = heroTalent.Talent_15_right;
                Talent_10_leftTextBlock.Text  = heroTalent.Talent_10_left;
                Talent_10_rightTextBlock.Text = heroTalent.Talent_10_right;
            }
            catch { }
        }