public override void Initialize()
        {
            Debug.Assert(MultiplayerClassDivisions.AvailableCultures != null, "Available Cultures should not be null");
            if (MultiplayerClassDivisions.AvailableCultures == null)
            {
                return;
            }
            Cultures.Clear();
            foreach (var eachCulture in MultiplayerClassDivisions.AvailableCultures)
            {
                Cultures.Add(eachCulture.StringId);
                var groupsInCurrentCulture = new List <Group>();
                GroupsInCultures.Add(eachCulture.StringId, groupsInCurrentCulture);
                foreach (var mpHeroClass in MultiplayerClassDivisions.GetMPHeroClasses(eachCulture))
                {
                    var group =
                        groupsInCurrentCulture.Find(g => g.Info.StringId == mpHeroClass.ClassGroup.StringId) as MPGroup;
                    if (group == null)
                    {
                        var newGroup = new MPGroup(mpHeroClass.ClassGroup,
                                                   mpHeroClass.HeroCharacter.DefaultFormationClass);
                        groupsInCurrentCulture.Add(newGroup);
                        groupsInCurrentCulture.Sort((lhs, rhs) => lhs.Info.FormationClass - rhs.Info.FormationClass);
                        group = newGroup;
                    }

                    group.CharactersInGroup.Add(mpHeroClass.StringId, new MPCharacter(mpHeroClass, group.Info));
                }
            }
        }
        private void Campaign_SelectedIndexChanged(object sender, EventArgs e)
        {
            Cultures.Clear();
            var list = Culture.GetCulturesForCampaign(GenerationConfiguration.Campaign);

            foreach (var item in list)
            {
                Cultures.Add(item);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Sets the cultures list
        /// </summary>
        public static async void SetCultures()
        {
            Cultures.Clear();
            Cultures.Add(new CCulture {
                DisplayName = "German", ISO = "de"
            });
            Cultures.Add(new CCulture {
                DisplayName = "English", ISO = "en"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Spanish", ISO = "es"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Franch", ISO = "fr"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Hindi", ISO = "hi"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Italian", ISO = "it"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Japanese", ISO = "ja"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Korean", ISO = "ko"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Polish", ISO = "pl"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Portuguese", ISO = "pt"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Russian", ISO = "ru"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Swedish", ISO = "sv"
            });
            Cultures.Add(new CCulture {
                DisplayName = "Chinese", ISO = "zh"
            });
            Cultures.ToList().ForEach(culture => AddRegions(culture.ISO));
            await AddAdditionalCultures();

            await CTranslator.GetAvailableLanguages();

            Cultures = Cultures.OrderBy(culture => culture.ISO).ToObservableList();
            var config = new CConfig();
            await config.LoadFromFileTask(@"D:\Dev\Desktop\ULocalizer\ULocalizer\bin\Debug\data\Localization.ini");
        }
Exemplo n.º 4
0
        public static void ClearDictionaries()
        {
            States.Clear();
            Continents.Clear();
            PopTypes.Clear();
            Goods.Clear();
            CountryTags.Clear();
            Religions.Clear();
            Cultures.Clear();
            CultureGroups.Clear();
            Ideologies.Clear();
            Buildings.Clear();
            PolicyGroups.Clear();
            SubPolicies.Clear();
            Schools.Clear();
            Techs.Clear();
            Inventions.Clear();
            Units.Clear();
            Governments.Clear();
            Crimes.Clear();
            EventModifiers.Clear();
            NationalValues.Clear();
            Terrain.Clear();

            States         = null;
            Continents     = null;
            PopTypes       = null;
            Goods          = null;
            CountryTags    = null;
            Religions      = null;
            Cultures       = null;
            CultureGroups  = null;
            Ideologies     = null;
            Buildings      = null;
            PolicyGroups   = null;
            SubPolicies    = null;
            Schools        = null;
            Techs          = null;
            Inventions     = null;
            Units          = null;
            Governments    = null;
            Crimes         = null;
            EventModifiers = null;
            NationalValues = null;
            Terrain        = null;
        }
        public override void Initialize()
        {
            Cultures.Clear();

            foreach (var basicCharacterObject in TaleWorlds.Core.Game.Current.ObjectManager.GetObjectTypeList <BasicCharacterObject>())
            {
                if (basicCharacterObject is CharacterObject characterObject)
                {
                    if (characterObject.IsTemplate || characterObject.IsChildTemplate)
                    {
                        continue;
                    }
                    var culture   = characterObject.Culture;
                    var cultureId = culture?.StringId ?? "null";
                    if (!Cultures.Contains(cultureId))
                    {
                        Cultures.Add(cultureId);
                    }
                    if (!GroupsInCultures.TryGetValue(cultureId, out var groupsInCurrentCulture))
                    {
                        GroupsInCultures[cultureId] = groupsInCurrentCulture = new List <Group>();
                    }

                    var formationClass = characterObject.DefaultFormationClass;
                    var group          = groupsInCurrentCulture.Find(g => g.Info.FormationClass == formationClass) as SPGroup;
                    if (group == null)
                    {
                        var newGroup = new SPGroup(formationClass);
                        groupsInCurrentCulture.Add(newGroup);
                        groupsInCurrentCulture.Sort((lhs, rhs) => lhs.Info.FormationClass - rhs.Info.FormationClass);
                        group = newGroup;
                    }

                    var occupation = characterObject.Occupation;
                    if (!group.OccupationsInGroup.TryGetValue(occupation, out var charactersInOccupation))
                    {
                        group.OccupationsInGroup[occupation] = charactersInOccupation = new CharactersInOccupation();
                    }

                    charactersInOccupation.Characters.Add(characterObject.StringId,
                                                          new SPCharacter(characterObject, group.Info));
                }
            }
        }