private void OnHeroDefeated (HeroViewModel sender, HeroDefeatedArgs args)
		{
			var defeatedHeroRow = HeroRows.SingleOrDefault (x => x.Hero.Id == args.DefeatedHero.Id);
			if (defeatedHeroRow != null)
				HeroRows.Remove (defeatedHeroRow);

			args.NewHero.Grace = args.NewHero.GraceDefault;
			args.NewHero.Secrecy = args.NewHero.SecrecyDefault;

			HeroRows.Add (new HeroSummaryViewModel (args.NewHero));

			Task.Run (() => {
				Application.CurrentGame.Heroes = HeroRows.Select(x=> x.Hero).ToList ();
				Application.SaveCurrentGame ();
			});
		}
예제 #2
0
		private void OnHeroDefeated (HeroViewModel sender, HeroDefeatedArgs args)
		{
			var model = Heroes.FirstOrDefault (x => x.Hero.Id == args.DefeatedHero.Id);
			if (model != null)
				Heroes.Remove (model);

			args.NewHero.Grace = args.NewHero.GraceDefault;
			args.NewHero.Secrecy = args.NewHero.SecrecyDefault;

			Heroes.Add(new HeroSummaryViewModel (args.NewHero));

			Task.Run (() => {
				Application.CurrentGame.Heroes.Active.Remove (args.DefeatedHero);
				Application.CurrentGame.Heroes.Active.Add (args.NewHero);
				Application.SaveCurrentGame ();
			});
		}
		private void OnHeroUpdated(HeroViewModel sender, Hero hero){
			HeroRows.SingleOrDefault (x => x.Hero.Id == hero.Id).Updated ();
		}