コード例 #1
0
        private TextModel GetGenderAndAge()
        {
            var gender     = GetGender();
            var genderKind = Lang.AdjectiveNoun(gender, Base.kindDef?.race?.label);

            if (Base.ageTracker == null)
            {
                return(TextModel.Create(genderKind.CapitalizeFirst(), GetBioTooltip(), FactionRelationColor, InspectPanePlus.ToggleBioTab));
            }

            Base.ageTracker.AgeBiologicalTicks.TicksToPeriod(out var years, out var quadrums, out var days, out _);
            var ageDays = (quadrums * GenDate.DaysPerQuadrum) + days;

            var age = years.ToString().Bold();

            if ((ageDays == 0) || (ageDays == GenDate.DaysPerYear))
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Birthday"));
            }
            else if (ageDays == 1)
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Day"));
            }
            else
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Days", ageDays));
            }

            return(TextModel.Create(Lang.Get("Model.GenderAndAge", genderKind, age).CapitalizeFirst(), GetBioTooltip(), FactionRelationColor, InspectPanePlus.ToggleBioTab));
        }
コード例 #2
0
        private string GetGenderRaceAndAgeText(bool hideRaceIfHuman)
        {
            var gender     = GetGender();
            var genderKind = Lang.AdjectiveNoun(gender, hideRaceIfHuman ? GetRaceIfNotHuman() : GetRace());

            if (Base.ageTracker == null)
            {
                return(genderKind.Trim());
            }

            Base.ageTracker.AgeBiologicalTicks.TicksToPeriod(out var years, out var quadrums, out var days, out _);
            var ageDays = (quadrums * GenDate.DaysPerQuadrum) + days;

            var age = years.ToString().Bold();

            if (ageDays == 0 || ageDays == GenDate.DaysPerYear)
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Birthday"));
            }
            else if (ageDays == 1)
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Day"));
            }
            else
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Days", ageDays));
            }

            return(Lang.Get("Model.GenderRaceAndAge", genderKind, age).Trim());
        }