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