Example #1
0
        private void UpdateHeroPicture(HeroClass heroClass, HeroGender gender)
        {
            Image picture;
            switch (heroClass)
            {
                case HeroClass.Barbarian:
                    picture = (gender == HeroGender.Female ? Resources.barbarian_female : Resources.barbarian_male);
                    break;
                case HeroClass.Crusader:
                    picture = (gender == HeroGender.Female ? Resources.crusader_female : Resources.crusader_male);
                    break;
                case HeroClass.DemonHunter:
                    picture = (gender == HeroGender.Female ? Resources.demonhunter_female : Resources.demonhunter_male);
                    break;
                case HeroClass.Monk:
                    picture = (gender == HeroGender.Female ? Resources.monk_female : Resources.monk_male);
                    break;
                case HeroClass.WitchDoctor:
                    picture = (gender == HeroGender.Female ? Resources.witchdoctor_female : Resources.witchdoctor_male);
                    break;
                case HeroClass.Wizard:
                    picture = (gender == HeroGender.Female ? Resources.wizard_female : Resources.wizard_male);
                    break;
                default:
                    return;
            }

            if (picture == null)
            {
                return;
            }

            guiHeroPicture.Image = picture;
        }
Example #2
0
        private void UpdateHeroPicture(HeroClass heroClass, HeroGender gender)
        {
            Image picture;

            switch (heroClass)
            {
            case HeroClass.Barbarian:
                picture = (gender == HeroGender.Female ? Resources.barbarian_female : Resources.barbarian_male);
                break;

            case HeroClass.Crusader:
                picture = (gender == HeroGender.Female ? Resources.crusader_female : Resources.crusader_male);
                break;

            case HeroClass.DemonHunter:
                picture = (gender == HeroGender.Female ? Resources.demonhunter_female : Resources.demonhunter_male);
                break;

            case HeroClass.Monk:
                picture = (gender == HeroGender.Female ? Resources.monk_female : Resources.monk_male);
                break;

            case HeroClass.Necromancer:
                picture = (gender == HeroGender.Female ? Resources.necromancer_female : Resources.necromancer_male);
                break;

            case HeroClass.WitchDoctor:
                picture = (gender == HeroGender.Female ? Resources.witchdoctor_female : Resources.witchdoctor_male);
                break;

            case HeroClass.Wizard:
                picture = (gender == HeroGender.Female ? Resources.wizard_female : Resources.wizard_male);
                break;

            default:
                return;
            }

            if (picture == null)
            {
                return;
            }

            guiHeroPicture.Image = picture;
        }
 public static int GetPortraitResource(this HeroClass heroClass, HeroGender gender)
 {
     switch (heroClass)
     {
         case HeroClass.Barbarian:
             return (gender == HeroGender.Male ? Resource.Drawable.barbarian_male : Resource.Drawable.barbarian_female);
         case HeroClass.Crusader:
             return (gender == HeroGender.Male ? Resource.Drawable.crusader_male : Resource.Drawable.crusader_female);
         case HeroClass.DemonHunter:
             return (gender == HeroGender.Male ? Resource.Drawable.demonhunter_male : Resource.Drawable.demonhunter_female);
         case HeroClass.Monk:
             return (gender == HeroGender.Male ? Resource.Drawable.monk_male : Resource.Drawable.monk_female);
         case HeroClass.WitchDoctor:
             return (gender == HeroGender.Male ? Resource.Drawable.witchdoctor_male : Resource.Drawable.witchdoctor_female);
         case HeroClass.Wizard:
             return (gender == HeroGender.Male ? Resource.Drawable.wizard_male : Resource.Drawable.wizard_female);
         default:
             return Resource.Drawable.ic_launcher;
     }
 }
Example #4
0
        /// <summary>
        /// Returns a random name
        /// </summary>
        /// <param name="race">Race</param>
        /// <param name="gender">Gender</param>
        /// <returns>Random name</returns>
        string GetRandomName(HeroRace race, HeroGender gender)
        {
            if (Names == null)
            {
                return(string.Empty);
            }

            var res = (from name in Names.Descendants("race")
                       where name.Attribute("name").Value == race.ToString()
                       select new
            {
                Entries = name.Element(gender.ToString()).Elements("name")
            }).FirstOrDefault();

            if (res == null || res.Entries.Count() == 0)
            {
                return(string.Empty);
            }

            return(res.Entries.ElementAt(GameBase.Random.Next(res.Entries.Count() - 1)).Value);
        }
Example #5
0
		/// <summary>
		/// Returns a random name
		/// </summary>
		/// <param name="race">Race</param>
		/// <param name="gender">Gender</param>
		/// <returns>Random name</returns>
		string GetRandomName(HeroRace race, HeroGender gender)
		{
			if (Names == null)
				return string.Empty;

			var res = (from name in Names.Descendants("race")
					   where name.Attribute("name").Value == race.ToString()
					   select new
					   {
						   Entries = name.Element(gender.ToString()).Elements("name")
					   }).FirstOrDefault();

			if (res == null || res.Entries.Count() == 0)
				return string.Empty;

			return res.Entries.ElementAt(GameBase.Random.Next(res.Entries.Count() - 1)).Value;
		}