Beispiel #1
0
        public static void ImportBuffTexts(Mod mod, string path)
        {
            using (var fs = new FileStream(Path.Combine(path, "Buffs.json"), FileMode.Open))
            {
                using (var sr = new StreamReader(fs))
                {
                    var buffs = JsonConvert.DeserializeObject <TextFile.BuffFile>(sr.ReadToEnd());

                    foreach (var buff in buffs.Buffs)
                    {
                        var modbuff = mod.GetBuff(buff.Key);

                        if (modbuff == null)
                        {
                            continue;
                        }

                        if (!string.IsNullOrWhiteSpace(buff.Value.NameTranslation))
                        {
                            TranslateTool.AddBuffNameTranslation(modbuff, buff.Value.NameTranslation, GameCulture.Chinese);
                        }
                        if (!string.IsNullOrWhiteSpace(buff.Value.TipTranslation))
                        {
                            TranslateTool.AddBuffTipTranslation(modbuff, buff.Value.TipTranslation, GameCulture.Chinese);
                        }
                    }
                }
            }
        }
Beispiel #2
0
 public static void TestAddBuffTranslation()
 {
     try
     {
         var type = ModLoader.GetMod("Bluemagic").BuffType("Sunlight");
         if (type > 0)
         {
             TranslateTool.AddBuffNameTranslation(BuffLoader.GetBuff(type), "测试buff名字", GameCulture.Chinese);
             TranslateTool.AddBuffTipTranslation(BuffLoader.GetBuff(type), "测试buff说明", GameCulture.Chinese);
         }
     }
     catch (Exception ex)
     {
         ErrorLogger.Log(ex.ToString());
     }
 }