public Profile(Gender gender, EyeColor eyeColor, HairColor hairColor, HeightCategory heightCategory) { _gender = gender; _eyeColor = eyeColor; _hairColor = hairColor; _heightCategory = heightCategory; }
static public HairColor Convert_to_haircolor(string a) { HairColor haircolor = HairColor.Black; if (a == "Каштановые") { haircolor = HairColor.Brown; } if (a == "Блондин") { haircolor = HairColor.Blond; } if (a == "Рыжий") { haircolor = HairColor.Red; } if (a == "Брюнет") { haircolor = HairColor.Black; } if (a == "Фиолетовый") { haircolor = HairColor.Purple; } if (a == "Зеленый") { haircolor = HairColor.Green; } if (a == "Розовый") { haircolor = HairColor.Pink; } return(haircolor); }
public ActionResult Create([Bind(Include = "Id,InterNationalColorCode,InterNationalColorName,PersianColorCode,PersianColorName,HairPic")] HairColor hairColor, HttpPostedFileBase image) { if (ModelState.IsValid) { if (image != null) { hairColor.HairPic = ConvertToBytes(image); } db.HairColors.Add(hairColor); db.SaveChanges(); Image img; using (MemoryStream ms = new MemoryStream(hairColor.HairPic)) { string pic = System.IO.Path.GetFileName(hairColor.Id + ".jpg"); string path = System.IO.Path.Combine( Server.MapPath("~/Images/HairColorImages/"), pic); img = Image.FromStream(ms); img.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg); } //return RedirectToAction("Create"); return(RedirectToAction("Index")); } return(View(hairColor)); }
public void ChangeHairColor(HairColor color) { if (currentColor == color) { return; } currentColor = color; DisableOldParticles(currentHair); if (color == HairColor.Blue) { currentHair = blueHair; } else if (color == HairColor.Green) { currentHair = greenHair; } else if (color == HairColor.Red) { currentHair = redHair; } EnableNewParticles(currentHair); }
public Person(string firstName, string lastName, DateTime?birthDay, HairColor hairColor) { this.FirstName = firstName; this.LastName = lastName; this.BirthDay = birthDay; this.HairColor = hairColor; }
public bool MemberwiseEquals(ICharacterAppearance maybeOther) { if (maybeOther is not HumanoidCharacterAppearance other) { return(false); } if (HairStyleId != other.HairStyleId) { return(false); } if (!HairColor.Equals(other.HairColor)) { return(false); } if (FacialHairStyleId != other.FacialHairStyleId) { return(false); } if (!FacialHairColor.Equals(other.FacialHairColor)) { return(false); } if (!EyeColor.Equals(other.EyeColor)) { return(false); } if (!SkinColor.Equals(other.SkinColor)) { return(false); } return(true); }
public async Task <IActionResult> Edit(short id, [Bind("HairColorId,HairColorName")] HairColor hairColor) { try { if (id != hairColor.HairColorId) { return(NotFound()); } // Préparation de l'appel à l'API string accessToken = await HttpContext.GetTokenAsync("access_token"); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); if (ModelState.IsValid) { // Préparation de la requête update à l'API StringContent httpContent = new StringContent(hairColor.ToJson(), Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PutAsync(_configuration["URLAPI"] + $"api/HairColors/{id}", httpContent); if (response.StatusCode != HttpStatusCode.NoContent) { return(BadRequest()); } return(RedirectToAction(nameof(Index))); } return(View(hairColor)); } catch (HttpRequestException) { return(Unauthorized()); } }
// GET: HairColors/Details/5 public async Task <IActionResult> Details(short?id) { try { if (id == null) { return(NotFound()); } // Préparation de l'appel à l'API string accessToken = await HttpContext.GetTokenAsync("access_token"); HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); // Récurération des données et convertion des données dans le bon type string content = await client.GetStringAsync(_configuration["URLAPI"] + $"api/HairColors/{id}"); HairColor hairColor = JsonConvert.DeserializeObject <HairColor>(content); if (hairColor == null) { return(NotFound()); } return(View(hairColor)); } catch (HttpRequestException) { return(Unauthorized()); } }
public void seed() { HairColor hairColor = new HairColor(); EyeColor eyeColor = new EyeColor(); Job job = new Job(); Adult[] persons = { new Adult { firstName = "Alex", lastName = "Clinton", ID = 1, hairColor = hairColor.blackColor, eyeColor = eyeColor.blueColor, age = 17, weight = 80, height = 170, job = job.astronautJob }, new Adult { firstName = "John", lastName = "Smith", ID = 2, hairColor = hairColor.blueColor, eyeColor = eyeColor.brownColor, age = 20, weight = 73, height = 180, job = job.captainJob }, new Adult { firstName = "Sara", lastName = "Jordan", ID = 3, hairColor = hairColor.brownColor, eyeColor = eyeColor.greyColor, age = 30, weight = 60, height = 173, job = job.chefJob } }; personsList = persons.ToList(); }
public IHttpActionResult PutHairColor(int id, HairColor hairColor) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hairColor.Id) { return(BadRequest()); } db.Entry(hairColor).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HairColorExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Randomize() { Gender = (Gender)UnityEngine.Random.Range(0, Enum.GetNames(typeof(Gender)).Length); SkinTone = (SkinTone)UnityEngine.Random.Range(0, Enum.GetNames(typeof(SkinTone)).Length - 1); HairType = UnityEngine.Random.Range(1, 16 + 1); HairColor = (HairColor)UnityEngine.Random.Range(0, Enum.GetNames(typeof(HairColor)).Length); }
public Hair( HairColor newHairColor, HairStyle newHairStyle) { this.hairColor = newHairColor; this.hairStyle = newHairStyle; }
void ChangeColor() { if (Player == null) { return; } int colorNr = UnityEngine.Random.Range(0, 3); AudioSource.PlayClipAtPoint(piii, Player.transform.position); desireColor = (HairColor)colorNr; currentPickups = 0; pusia.SetActive(true); timeToChangeColor = UnityEngine.Random.Range(1, 4); DeactivateAllTips(); if (colorNr == 0) { blueTip.SetActive(true); } else if (colorNr == 1) { greenTip.SetActive(true); } else if (colorNr == 2) { redTip.SetActive(true); } }
public Human(int age)//случайный человек заданого возраста { Random randomNum = new Random(); this.SurName = ListOfSurNames[randomNum.Next(0, ListOfSurNames.Count)]; this.Age = age; this.identification_code = counter; this.gender = (Gender)randomNum.Next(0, num_of_gender); if (this.gender == Gender.Male) { this.Name = ListOfMaleNames[randomNum.Next(0, ListOfMaleNames.Count)]; } else { this.Name = ListOfFemaleNames[randomNum.Next(0, ListOfFemaleNames.Count)]; } this.hair_color = (HairColor)randomNum.Next(0, num_of_hairs); this.charisma = randomNum.Next(0, 100); this.attractiveness = randomNum.Next(0, 100); this.intelligence = randomNum.Next(0, 100); this.HealthIndex = randomNum.Next(0, 101); counter++; }
public Profile(Gender Gender, EyeColor EyeColor, HairColor HairColor, HeightCategory HeightCategory) { _gender = Gender; _eyeColor = EyeColor; _hairColor = HairColor; _heightCategory = HeightCategory; }
public async Task <ActionResult <HairColor> > PostHairColor(HairColor hairColor) { _context.HairColors.Add(hairColor); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHairColor", new { id = hairColor.HairColorId }, hairColor)); }
public async Task <IActionResult> PutHairColor(short id, HairColor hairColor) { if (id != hairColor.HairColorId) { return(BadRequest()); } _context.Entry(hairColor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HairColorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public PlayerOptions(HairColor hairColor, HairLength hairLength, BodyColor bodyColor, TailColor tailColor) { this.hairColor = hairColor; this.hairLength = hairLength; this.bodyColor = bodyColor; this.tailColor = tailColor; }
public CharacterAppearance() { HairColor = new HairColor("none"); HairStyle = new HairStyle("none"); FacialHair = new FacialHair("none"); EyeColor = new EyeColor("none"); }
public Princess(int number, string name, byte age, HairColor hairColor, EyeColor eyeColor) { this.Number = number; this.Name = name; this.Age = age; this.HairColor = hairColor; this.EyeColor = eyeColor; }
private void SetDefaults() { firstName = "John"; lastName = "Doe"; birthDate = new DateTime(1900, 1, 1); eyeCol = EyeColor.blue; hairCol = HairColor.brown; height = 180; }
public Person(string firstName, string lastName, DateTime birthDate, EyeColor eyeCol, HairColor hairCol, int height) { FirstName = firstName; LastName = lastName; BirthDate = birthDate; EyeCol = eyeCol; HairCol = hairCol; Height = height; }
internal PhysicalAttributes(Guid personId, EyeColor eyeColor = EyeColor.NotSpecified, HairColor naturalHairColor = HairColor.NotSpecified, SkinColor skinColor = SkinColor.NotSpecified, int?heightCm = null, int?weightKg = null) { PersonId = personId; EyeColor = eyeColor; NaturalHairColor = naturalHairColor; SkinColor = skinColor; HeightCm = heightCm; WeightKg = weightKg; }
public JsonResult AddHairColor(HairColor model) { using (AppContext context = AppContext.Create()) { context.HairColors.Add(model); context.SaveChanges(); return(Json(true)); } }
public DNA(Gender gender, HairColor hairColor, EyeColor eyeColor, SkinColor skinColor, Height height, BloodType bloodType) { Gender = gender; HairColor = hairColor; EyeColor = eyeColor; SkinColor = skinColor; Height = height; BloodType = bloodType; }
private void GenPartner(RootPerson root) { gender = Generators.PartnerGender(root); ageGroup = Generators.PartnerAgeGroup(root); age = Generators.Age(ageGroup); skinColor = Generators.PartnerSkinColor(root); hairColor = Generators.RootHairColor(skinColor); eyeColor = Generators.RootEyeColor(skinColor); }
public IHttpActionResult GetHairColor(int id) { HairColor hairColor = db.HairColors.Find(id); if (hairColor == null) { return(NotFound()); } return(Ok(hairColor)); }
public async Task <IHttpActionResult> GetHairColor(int id) { HairColor hairColor = await db.HairColors.FindAsync(id); if (hairColor == null) { return(NotFound()); } return(Ok(hairColor)); }
private void Awake() { rb2d = GetComponent <Rigidbody2D>(); originalSpeed = rb2d.velocity; currentColor = HairColor.Green; currentHair = greenHair; //DisableOldParticles(greenHair); DisableOldParticles(blueHair); DisableOldParticles(redHair); orginalLifeTime = 100; }
public Person() { m_FirstName = "J."; m_LastName = "Doe"; m_ID = 0; m_Birthdate = DateTime.UtcNow; m_Height = 0; m_Weight = 0; m_HairColour = HairColor.None; m_Gender = Gender.NoneOfYourDamnBusiness; }
public Person() { myName = new Name(6); myEyes = NewEyes(); myHair = NewHair(); itsGender = NewGender(); mySize = NewSize(); myPrefs = new Preferences(); myThoughtBubble = NewThoughts(); myAge = 18.0; MomsName = new Name(3); DadsName = new Name(3); myChildrensNames = new List<Name>(); }
public BusyPerson(Boolean isCreator) { Random random = new Random(DateTime.Now.Millisecond * DateTime.Now.Second); this.Hair = (HairColor)(isCreator ? 0 : random.Next(1, HairColorLimit)); this.ID = Guid.NewGuid(); if (random.Next(1, 100) > 50 && !isCreator) { this.IsFemale = true; this.FirstName = (ProName)random.Next(MaleProNameLimit + 1, FemaleProNameLimit); } else { this.IsFemale = false; this.FirstName = (ProName)(isCreator ? 0 : random.Next(1, MaleProNameLimit)); } this.Children = new List<Guid>(); this.IsPregnant = false; this.GestationTime = 0; }
public Person(Person mom, Person dad) { myName = new Name(mom.Name, dad.Name); myEyes = NewEyes(mom.Eyes, dad.Eyes); myHair = NewHair(mom.Hair, dad.Hair); itsGender = NewGender(); mySize = NewSize(mom.Size, dad.Size); if (itsGender == Gender.Male) { myPrefs = new Preferences(mom); } else { myPrefs = new Preferences(dad); } myAge = 0.0; MomsName = mom.Name; DadsName = dad.Name; myChildrensNames = new List<PopSim2.Name>(); mom.NewChild(this); dad.NewChild(this); myThoughtBubble = NewThoughts(mom, dad); }
private HairColor NewHair(HairColor MomsHair, HairColor DadsHair) { int t; HairColor h = HairColor.Brown; if (MomsHair == HairColor.Blonde && DadsHair == HairColor.Blonde) { h = HairColor.Blonde; } else if (MomsHair == HairColor.Red || DadsHair == HairColor.Red) { t = r.Next(0, 2); if (t == 0) { h = MomsHair; } else { h = DadsHair; } } else if (MomsHair == HairColor.Black || DadsHair == HairColor.Black) { t = r.Next(0, 2); if (t == 0) { h = MomsHair; } else { h = DadsHair; } } else { h = HairColor.Brown; } return h; }
public int Hair(HairColor h) { return myHairPrefs[(int)h]; }