public LargeHeroViewModel(HeroBrief hero) { this.Id = hero.Id; this.Name = hero.Name; this.Level = hero.Level; this.NameColor = new SolidColorBrush(hero.Hardcore ? Colors.Red : Helper.ParseColor(0xD96500)); this.LastUpdated = hero.LastUpdated.ToString(CultureInfo.CurrentUICulture); this.FrameViewModel = GetFrameViewModel(hero.Hardcore); this.ProtraitViewModel = GetProtraitViewModel(hero); }
private static SpriteImageViewModel GetProtraitViewModel(HeroBrief hero) { double width = 168d; double height = 130d; double x = hero.Gender == 0 ? 0d : 168d; double y = 0d; switch (hero.Class.Id) { case "demon-hunter": y = 130d; break; case "monk": y = 260d; break; case "witch-doctor": y = 390d; break; case "wizard": y = 520d; break; case "barbarian": default: y = 0d; break; } return new SpriteImageViewModel(x, y, width, height); }
private static string GetProtraitUri(HeroBrief hero) { string className = hero.Class.Id.Replace("-", string.Empty); string genderName = hero.Gender == 0 ? "male" : "female"; return string.Format("/Resources/Images/{0}_{1}.png", className, genderName); }