コード例 #1
0
        public void LoadFile(string path, bool locked)
        {
            string fileText = System.IO.File.ReadAllText(path);

            LocalizationFileClass fileClass = new LocalizationFileClass { FilePathName = path, Locked = locked };

            List<KeyValue> keys = KVParser.Parse(fileText);

            parseTokens(ref fileClass, keys[0]);

            Files.Add(fileClass);
        }
コード例 #2
0
 public void LocalizateHeroes(ref LocalizationFileClass locFile)
 {
     foreach (var hero in Heroes)
     {
         if (!locFile.LocalizationKeys.HasKeyInChildren(hero.Name))
         {
             locFile.LocalizationKeys.Children.Add(new KeyValue()
             {
                 Key = hero.Name,
                 Value = "",
                 Parent = locFile.LocalizationKeys,
                 Type = KvType.KeyValue,
             });
         }
     }
 }
コード例 #3
0
        private void localizateAbilitiesAuras(ref LocalizationFileClass locFile, AbilityClass abil)
        {
            var modeferValues = abil.AbilityValues.FindChildren("Modifiers");
            if (modeferValues == null)
                return;
            if (modeferValues.Children == null)
                return;

            foreach (var modKv in modeferValues.Children.Where(modKv => isAura(modKv)))
            {
                locFile.LocalizationKeys.Children.Add(new KeyValue()
                { // аура
                    Key = "DOTA_Tooltip_ability_" + modKv.Key,
                    Parent = locFile.LocalizationKeys,
                    Type = KvType.KeyValue,
                    Value = "",
                });
            }
        }
コード例 #4
0
        private void localizateAbilitiesSpecials(ref LocalizationFileClass locFile, AbilityClass abil)
        {
            var specialValues = abil.AbilityValues.FindChildren("AbilitySpecial");
            if (specialValues == null)
                return;
            if (specialValues.Children == null)
                return;

            foreach (var kv in specialValues.Children)
            {
                foreach (var kvVar in kv.Children.Where(kvVar => kvVar.Key != "var_type"))
                {
                    locFile.LocalizationKeys.Children.Add(new KeyValue()
                    { // доп переменные
                        Key = "DOTA_Tooltip_ability_" + abil.Name + "_" + kvVar.Key,
                        Parent = locFile.LocalizationKeys,
                        Type = KvType.KeyValue,
                        Value = "",
                    });
                }
            }
        }
コード例 #5
0
        public void LocalizateAbilities(ref LocalizationFileClass locFile)
        {
            foreach (var abil in Abilities)
            {
                locFile.LocalizationKeys.Children.Add(new KeyValue()
                { // Имя способности
                    Key = "DOTA_Tooltip_ability_" + abil.Name,
                    Parent = locFile.LocalizationKeys,
                    Type = KvType.KeyValue,
                    Value = "",
                });

                locFile.LocalizationKeys.Children.Add(new KeyValue()
                { // описание способности
                    Key = "DOTA_Tooltip_ability_" + abil.Name + "_Description",
                    Parent = locFile.LocalizationKeys,
                    Type = KvType.KeyValue,
                    Value = "",
                });

                localizateAbilitiesSpecials(ref locFile, abil);
                localizateAbilitiesAuras(ref locFile, abil);
            }
        }
コード例 #6
0
 private void parseTokens(ref LocalizationFileClass fileClass, KeyValue key)
 {
     fileClass.Language = key.Children[0].Value;
     fileClass.Keys = key;
     fileClass.LocalizationKeys = key.Children[1];
 }