コード例 #1
0
ファイル: Profile.cs プロジェクト: perl-easj/OOProg
 public Profile(Gender gender, EyeColor eyeColor, HairColor hairColor, HeightCategory heightCategory)
 {
     _gender         = gender;
     _eyeColor       = eyeColor;
     _hairColor      = hairColor;
     _heightCategory = heightCategory;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
    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);
    }
コード例 #5
0
 public Person(string firstName, string lastName, DateTime?birthDay, HairColor hairColor)
 {
     this.FirstName = firstName;
     this.LastName  = lastName;
     this.BirthDay  = birthDay;
     this.HairColor = hairColor;
 }
コード例 #6
0
 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);
 }
コード例 #7
0
        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());
            }
        }
コード例 #8
0
        // 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());
            }
        }
コード例 #9
0
        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();
        }
コード例 #10
0
        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));
        }
コード例 #11
0
 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);
 }
コード例 #12
0
 public Hair(
     HairColor newHairColor,
     HairStyle newHairStyle)
 {
     this.hairColor = newHairColor;
     this.hairStyle = newHairStyle;
 }
コード例 #13
0
    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);
        }
    }
コード例 #14
0
ファイル: Human.cs プロジェクト: llBigBigll/TavernMaster
        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++;
        }
コード例 #15
0
 public Profile(Gender Gender, EyeColor EyeColor, HairColor HairColor, HeightCategory HeightCategory)
 {
     _gender         = Gender;
     _eyeColor       = EyeColor;
     _hairColor      = HairColor;
     _heightCategory = HeightCategory;
 }
コード例 #16
0
        public async Task <ActionResult <HairColor> > PostHairColor(HairColor hairColor)
        {
            _context.HairColors.Add(hairColor);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHairColor", new { id = hairColor.HairColorId }, hairColor));
        }
コード例 #17
0
        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());
        }
コード例 #18
0
 public PlayerOptions(HairColor hairColor, HairLength hairLength, BodyColor bodyColor, TailColor tailColor)
 {
     this.hairColor  = hairColor;
     this.hairLength = hairLength;
     this.bodyColor  = bodyColor;
     this.tailColor  = tailColor;
 }
コード例 #19
0
 public CharacterAppearance()
 {
     HairColor  = new HairColor("none");
     HairStyle  = new HairStyle("none");
     FacialHair = new FacialHair("none");
     EyeColor   = new EyeColor("none");
 }
コード例 #20
0
ファイル: Princess.cs プロジェクト: balkar20/Interview2020
 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;
 }
コード例 #21
0
 private void SetDefaults()
 {
     firstName = "John";
     lastName  = "Doe";
     birthDate = new DateTime(1900, 1, 1);
     eyeCol    = EyeColor.blue;
     hairCol   = HairColor.brown;
     height    = 180;
 }
コード例 #22
0
 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;
 }
コード例 #23
0
 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;
 }
コード例 #24
0
 public JsonResult AddHairColor(HairColor model)
 {
     using (AppContext context = AppContext.Create())
     {
         context.HairColors.Add(model);
         context.SaveChanges();
         return(Json(true));
     }
 }
コード例 #25
0
 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;
 }
コード例 #26
0
ファイル: Person.cs プロジェクト: ButterfishGames/TheGuild
    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);
    }
コード例 #27
0
        public IHttpActionResult GetHairColor(int id)
        {
            HairColor hairColor = db.HairColors.Find(id);

            if (hairColor == null)
            {
                return(NotFound());
            }

            return(Ok(hairColor));
        }
コード例 #28
0
        public async Task <IHttpActionResult> GetHairColor(int id)
        {
            HairColor hairColor = await db.HairColors.FindAsync(id);

            if (hairColor == null)
            {
                return(NotFound());
            }

            return(Ok(hairColor));
        }
コード例 #29
0
 private void Awake()
 {
     rb2d          = GetComponent <Rigidbody2D>();
     originalSpeed = rb2d.velocity;
     currentColor  = HairColor.Green;
     currentHair   = greenHair;
     //DisableOldParticles(greenHair);
     DisableOldParticles(blueHair);
     DisableOldParticles(redHair);
     orginalLifeTime = 100;
 }
コード例 #30
0
ファイル: Person.cs プロジェクト: ISTNAIT/CMPE2300.Public
 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;
 }
コード例 #31
0
ファイル: Person.cs プロジェクト: RtHiaHB/PopSim2
 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>();
 }
コード例 #32
0
ファイル: BusyPerson.cs プロジェクト: blurrydude/Busyness
 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;
 }
コード例 #33
0
ファイル: Person.cs プロジェクト: RtHiaHB/PopSim2
 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);
 }
コード例 #34
0
ファイル: Person.cs プロジェクト: RtHiaHB/PopSim2
        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;
        }
コード例 #35
0
ファイル: Preferences.cs プロジェクト: RtHiaHB/PopSim2
 public int Hair(HairColor h)
 {
     return myHairPrefs[(int)h];
 }