Exemple #1
0
        public static List <KnownInfo> GetKnownInfoAboutSelf(HudModel ths, IMiniSimDescription simDescription)
        {
            List <KnownInfo> infos       = new List <KnownInfo>();
            SimDescription   description = simDescription as SimDescription;

            if (description != null)
            {
                string firstName;
                bool   isHuman = description.IsHuman;
                bool   teen    = (description.Age & CASAgeGenderFlags.Teen) != CASAgeGenderFlags.None;
                bool   child   = (description.Age & CASAgeGenderFlags.Child) != CASAgeGenderFlags.None;
                foreach (Trait trait in description.TraitManager.List)
                {
                    if (trait.IsVisible && Localization.HasLocalizationString(trait.TraitNameInfo))
                    {
                        infos.Add(new KnownInfo(trait.TraitName(description.IsFemale), trait.IconKey, KnownInfoType.Trait));
                    }
                }

                if (isHuman && !child)
                {
                    if (GameUtils.GetCurrentWorld() != description.HomeWorld)
                    {
                        MiniSimDescription description2 = MiniSimDescription.Find(description.SimDescriptionId);
                        if (description2 != null)
                        {
                            description2.GetKnownJobInfo(infos);
                        }
                    }
                    else if ((description.CareerManager != null) && (description.CareerManager.Occupation != null))
                    {
                        infos.Add(new KnownInfo(description.CareerManager.Occupation.CurLevelJobTitle, ResourceKey.CreatePNGKey(description.CareerManager.Occupation.CareerIcon, 0), KnownInfoType.Career));
                    }
                    else if (description.CreatedByService != null)
                    {
                        string str2 = Localization.LocalizeString(description.IsFemale, "Gameplay/Services/Title:" + description.CreatedByService.ServiceType.ToString(), new object[0]);
                        infos.Add(new KnownInfo(str2, ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                    else
                    {
                        infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:Unemployed", new object[0]), ResourceKey.kInvalidResourceKey, KnownInfoType.Career));
                    }
                }

                ResourceKey kInvalidResourceKey = ResourceKey.kInvalidResourceKey;
                if (description.Partner != null)
                {
                    firstName = description.Partner.FirstName;
                    Relationship relationship = description.GetRelationship(description.Partner, false);

                    // Custom
                    if (relationship != null)
                    {
                        kInvalidResourceKey = RelationshipFunctions.GetLTRRelationshipImageKey(relationship.LTR.CurrentLTR, relationship.IsPetToPetRelationship);
                    }
                }
                else
                {
                    firstName = Localization.LocalizeString("Ui/Caption/HUD/KnownInfoDialog:None", new object[0]);
                }

                infos.Add(new KnownInfo(firstName, kInvalidResourceKey, KnownInfoType.Partner));
                if ((isHuman && (teen || child)) && ((description.CareerManager != null) && (description.CareerManager.School != null)))
                {
                    infos.Add(new KnownInfo(description.CareerManager.School.Name, ResourceKey.CreatePNGKey(description.CareerManager.School.CareerIcon, 0), KnownInfoType.School));
                }

                if (GameUtils.IsInstalled(ProductVersion.EP9))
                {
                    List <IDegreeEntry> completedDegreeEntries = description.CareerManager.DegreeManager.GetCompletedDegreeEntries();
                    if (completedDegreeEntries.Count > 0)
                    {
                        KnownInfo item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                        foreach (IDegreeEntry entry in completedDegreeEntries)
                        {
                            if (item.mDegreeIcons.Count == 5)
                            {
                                infos.Add(item);
                                item = new KnownInfo("", ResourceKey.kInvalidResourceKey, KnownInfoType.Degree);
                            }
                            item.mDegreeIcons.Add(ResourceKey.CreatePNGKey(entry.DegreeIcon, 0));
                        }
                        infos.Add(item);
                    }
                }

                if (description.IsRich)
                {
                    infos.Add(new KnownInfo(Localization.LocalizeString(description.IsFemale, "Ui/Caption/HUD/KnownInfoDialog:IsRich", new object[0]), ResourceKey.CreatePNGKey("w_simoleon_32", 0), KnownInfoType.Rich));
                }
                return(infos);
            }

            MiniSimDescription description3 = simDescription as MiniSimDescription;

            if (description3 != null)
            {
                infos = description3.GetKnownInfoOfSelf();
            }
            return(infos);
        }