public async Task <IActionResult> Edit(short id, [Bind("SexualityId,SexualityName")] Sexuality sexuality)
        {
            try
            {
                if (id != sexuality.SexualityId)
                {
                    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(sexuality.ToJson(), Encoding.UTF8, "application/json");
                    HttpResponseMessage response    = await client.PutAsync(_configuration["URLAPI"] + $"api/Sexualities/{id}", httpContent);

                    if (response.StatusCode != HttpStatusCode.NoContent)
                    {
                        return(BadRequest());
                    }
                    return(RedirectToAction(nameof(Index)));
                }
                return(View(sexuality));
            }
            catch (HttpRequestException)
            {
                return(Unauthorized());
            }
        }
        // GET: Sexualities/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/Sexualities/{id}");

                Sexuality sexuality = JsonConvert.DeserializeObject <Sexuality>(content);

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

                return(View(sexuality));
            }
            catch (HttpRequestException)
            {
                return(Unauthorized());
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <Sexuality> > PostSexuality(Sexuality sexuality)
        {
            _context.Sexualities.Add(sexuality);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSexuality", new { id = sexuality.SexualityId }, sexuality));
        }
Ejemplo n.º 4
0
 private void Awake()
 {
     perceptor      = GetComponentInChildren <Perceptor>();
     animalMovement = GetComponent <AnimalMovement>();
     communicator   = GetComponentInChildren <BehaviourCommunicator>();
     sexuality      = GetComponent <Sexuality>();
 }
Ejemplo n.º 5
0
        public async Task <IActionResult> PutSexuality(short id, Sexuality sexuality)
        {
            if (id != sexuality.SexualityId)
            {
                return(BadRequest());
            }

            _context.Entry(sexuality).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SexualityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create a new entity, naked and squirming
        /// Created with no equipment, knowledge, family, etc
        /// </summary>
        /// <param name="template"></param>
        /// <param name="needs"></param>
        /// <param name="level"></param>
        /// <param name="job"></param>
        /// <param name="sex"></param>
        /// <param name="sexuality"></param>
        /// <param name="position"></param>
        /// <param name="icons"></param>
        /// <param name="world"></param>
        public Entity(EntityTemplate template, Dictionary <NeedIndex, EntityNeed> needs, int level, JobType job, Sex sex, Sexuality sexuality,
                      Vector2Int position, List <Sprite> sprites, WorldInstance world) :
            base(NameProvider.GetRandomName(template.CreatureType, sex), template.Statistics[StatisticIndex.Endurance].Value * 2, position, sprites, template.JoyType, true)
        {
            this.CreatureType = template.CreatureType;

            this.m_Size = template.Size;
            this.Slots  = template.Slots;

            this.m_JobLevels       = new Dictionary <string, int>();
            this.m_Sexuality       = sexuality;
            this.m_IdentifiedItems = new List <string>();
            this.m_Statistics      = template.Statistics;

            if (template.Skills.Count == 0)
            {
                this.m_Skills = EntitySkillHandler.GetSkillBlock(needs);
            }
            else
            {
                this.m_Skills = template.Skills;
            }
            this.m_Needs     = needs;
            this.m_Abilities = template.Abilities;
            this.m_Level     = level;
            for (int i = 1; i < level; i++)
            {
                this.LevelUp();
            }
            this.m_Experience     = 0;
            this.m_CurrentJob     = job;
            this.m_Sentient       = template.Sentient;
            this.m_NaturalWeapons = NaturalWeaponHelper.MakeNaturalWeapon(template.Size);
            this.m_Equipment      = new Dictionary <string, ItemInstance>();
            this.m_Backpack       = new List <ItemInstance>();
            this.m_Relationships  = new Dictionary <long, int>();
            this.Sex          = sex;
            this.m_Family     = new Dictionary <long, RelationshipStatus>();
            this.m_VisionType = template.VisionType;

            this.m_Tileset = template.Tileset;

            this.CalculateDerivatives();

            this.m_Vision = new bool[1, 1];

            this.m_Pathfinder      = new Pathfinder();
            this.m_PathfindingData = new Queue <Vector2Int>();

            this.m_FulfillingNeed    = (NeedIndex)(-1);
            this.m_FulfilmentCounter = 0;

            this.RegenTicker = RNG.Roll(0, REGEN_TICK_TIME - 1);

            this.MyWorld = world;

            SetFOVHandler();
            SetCurrentTarget();
        }
Ejemplo n.º 7
0
        public float Probability(Sexuality val)
        {
            switch (val)
            {
            case Sexuality.Straight: return(SyrIndividualitySettings.commonalityStraight);

            case Sexuality.Bisexual: return(SyrIndividualitySettings.commonalityBi);

            case Sexuality.Gay: return(SyrIndividualitySettings.commonalityGay);

            case Sexuality.Asexual: return(SyrIndividualitySettings.commonalityAsexual);
            }
            return(0);
        }
Ejemplo n.º 8
0
        private Sexuality NewRandomSexuality(RelationShipAll relationShip)
        {
            var       randomGenerator = new Random();
            Sexuality toReturn        = ((Sexuality)randomGenerator.Next(Enum.GetNames(typeof(Sexuality)).Length));

            if (toReturn == Sexuality.virgin && ImpossibleVirgin(relationShip))
            {
                while (toReturn == Sexuality.virgin && ImpossibleVirgin(relationShip))
                {
                    toReturn = ((Sexuality)randomGenerator.Next(Enum.GetNames(typeof(Sexuality)).Length));
                }
            }

            return(toReturn);
        }
Ejemplo n.º 9
0
        public void IndividualityValueSetup()
        {
            Pawn pawn = parent as Pawn;

            if (parent.def.defName == "ChjDroid")
            {
                if (sexuality == Sexuality.Undefined)
                {
                    sexuality = Sexuality.Asexual;
                }
                if (RomanceFactor == -1f)
                {
                    RomanceFactor = 0f;
                }
                if (PsychicFactor == -2f)
                {
                    PsychicFactor = RandomPsychicFactor();
                }
            }
            else if (parent.def.defName == "Harpy")
            {
                if (sexuality == Sexuality.Undefined)
                {
                    sexuality = Sexuality.Bisexual;
                }
            }
            if (sexuality == Sexuality.Undefined)
            {
                sexuality = RandomSexualityByWeight();
            }
            if (RomanceFactor == -1f)
            {
                RomanceFactor = GenMath.RoundTo(Rand.Range(0.1f, 1f), 0.1f);
            }
            if (PsychicFactor == -2f)
            {
                PsychicFactor = RandomPsychicFactor();
            }
            if (pawn != null && BodyWeight == -29)
            {
                BodyWeight = RandomBodyWeightByBodyType(pawn);
            }
        }
Ejemplo n.º 10
0
    public RootPerson()
    {
        gender    = Generators.RootGender();
        ageGroup  = Generators.RootAgeGroup();
        age       = Generators.Age(ageGroup);
        sexuality = Generators.RootSexuality(gender);
        wealth    = Generators.RootWealth(ageGroup);

        if (sexuality == Sexuality.aroAce)
        {
            relationship = Relationship.single;
        }
        else
        {
            relationship = Generators.RootRelationship(wealth, ageGroup);
        }

        skinColor = Generators.RootSkinColor();
        hairColor = Generators.RootHairColor(skinColor);
        eyeColor  = Generators.RootEyeColor(skinColor);
    }
Ejemplo n.º 11
0
        private PussyType NewRandomPussyType(RelationShipAll relationShip, int age, Sexuality sexuality)
        {
            if (sexuality == Sexuality.virgin)
            {
                return(PussyType.virgin);
            }
            if (age < 10)
            {
                return(PussyType.virgin);
            }

            var       randomGenerator = new Random();
            PussyType toReturn        = ((PussyType)randomGenerator.Next(Enum.GetNames(typeof(PussyType)).Length));

            if ((toReturn == PussyType.virgin && ImpossibleVirgin(relationShip)) || sexuality == Sexuality.s**t || sexuality == Sexuality.easy)
            {
                while (toReturn == PussyType.virgin)
                {
                    toReturn = ((PussyType)randomGenerator.Next(Enum.GetNames(typeof(PussyType)).Length));
                }
            }

            return(toReturn);
        }
Ejemplo n.º 12
0
 public Human(Sexuality sexuality, double height, double weight)
 {
     Sexuality = sexuality;
     Height    = height;
     Weight    = weight;
 }
Ejemplo n.º 13
0
        public Entity CreateLong(EntityTemplate template, Dictionary <NeedIndex, EntityNeed> needs, int level, float experience, JobType job, Sex sex, Sexuality sexuality,
                                 Vector2Int position, List <Sprite> sprites, ItemInstance naturalWeapons, Dictionary <string, ItemInstance> equipment,
                                 List <ItemInstance> backpack, Dictionary <long, int> relationships, List <string> identifiedItems, Dictionary <long, RelationshipStatus> family,
                                 Dictionary <string, int> jobLevels, WorldInstance world, string tileset)
        {
            Entity entity = new Entity(template, needs, level, experience, job, sex, sexuality, position, sprites, naturalWeapons, equipment, backpack, relationships, identifiedItems,
                                       family, jobLevels, world, tileset);

            m_Entities.Add(entity.GUID, entity);

            if (entity.PlayerControlled)
            {
                m_Player = entity;
            }

            return(entity);
        }
Ejemplo n.º 14
0
        public Entity Create(EntityTemplate template, Dictionary <NeedIndex, EntityNeed> needs, int level, JobType job, Sex sex, Sexuality sexuality,
                             Vector2Int position, List <Sprite> sprites, WorldInstance world)
        {
            Entity entity = new Entity(template, needs, level, job, sex, sexuality, position, sprites, world);

            m_Entities.Add(entity.GUID, entity);

            if (entity.PlayerControlled)
            {
                m_Player = entity;
            }

            return(entity);
        }