当前位置: 首页>>代码示例>>C#>>正文


C# Business.HasAchieved方法代码示例

本文整理汇总了C#中Business.HasAchieved方法的典型用法代码示例。如果您正苦于以下问题:C# Business.HasAchieved方法的具体用法?C# Business.HasAchieved怎么用?C# Business.HasAchieved使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Business的用法示例。


在下文中一共展示了Business.HasAchieved方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

        public Business.Character Parse(Business.Character character, bool forceParse)
        {
            WowExplorer explorer = new WowExplorer(Region.US);
            try
            {
                WowDotNetAPI.Models.Character downloadedCharacter = explorer.GetCharacter(Region.US, character.Server, character.Name, CharacterOptions.GetAchievements | CharacterOptions.GetGuild);

                if (downloadedCharacter == null)
                {
                    return null;
                }

                character.Class = downloadedCharacter.Class.ToString();
                character.CurrentPoints = downloadedCharacter.AchievementPoints;
                character.LastParseDate = DateTime.UtcNow;
                character.Level = downloadedCharacter.Level;
                character.Race = downloadedCharacter.Race.ToString();
                character.Thumbnail = downloadedCharacter.Thumbnail;
                character.Guild = downloadedCharacter.Guild.Name;

                if (downloadedCharacter.Race == WowDotNetAPI.Models.CharacterRace.BLOOD_ELF ||
                    downloadedCharacter.Race == WowDotNetAPI.Models.CharacterRace.GOBLIN ||
                    downloadedCharacter.Race == WowDotNetAPI.Models.CharacterRace.ORC ||
                    downloadedCharacter.Race == WowDotNetAPI.Models.CharacterRace.PANDAREN_HORDE ||
                    downloadedCharacter.Race == WowDotNetAPI.Models.CharacterRace.TAUREN ||
                    downloadedCharacter.Race == WowDotNetAPI.Models.CharacterRace.TROLL ||
                    downloadedCharacter.Race == WowDotNetAPI.Models.CharacterRace.UNDEAD)
                {
                    character.Side = Achievement.HordeOnly;
                }
                else
                {
                    character.Side = Achievement.AllianceOnly;
                }

                for (int i = 0; i < downloadedCharacter.Achievements.AchievementsCompleted.Count(); i++)
                {
                    int blizzardId = downloadedCharacter.Achievements.AchievementsCompleted.ElementAt(i);
                    DateTime completedOn = ConvertUnixEpochTime(downloadedCharacter.Achievements.AchievementsCompletedTimestamp.ElementAt(i));

                    Achievement achievement = _achievementRepository.FindAchivementByBlizzardId(blizzardId);
                    if (achievement != null && !character.HasAchieved(achievement))
                    {
                        character.AddNewAchivement(completedOn, achievement);
                    }
                }

                for (int i = 0; i < downloadedCharacter.Achievements.Criteria

                return character;
            }
            catch (WebException we)
            {
                HttpWebResponse webResponse = we.Response as HttpWebResponse;
                if (webResponse != null && webResponse.StatusCode == HttpStatusCode.NotFound)
                {
                    return null;
                }

                throw we;
            }
        }
开发者ID:blat001,项目名称:Achievement-Sherpa,代码行数:62,代码来源:WowApiCharacterParser.cs


注:本文中的Business.HasAchieved方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。