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); } } } } }
public static void ImportNPCTexts(Mod mod, string path) { using (var fs = new FileStream(Path.Combine(path, "NPCs.json"), FileMode.Open)) { using (var sr = new StreamReader(fs)) { var npcs = JsonConvert.DeserializeObject <TextFile.NPCFile>(sr.ReadToEnd()); foreach (var npc in npcs.NPCs) { var modnpc = mod.GetNPC(npc.Key); if (modnpc == null) { continue; } if (!string.IsNullOrWhiteSpace(npc.Value.NameTranslation)) { TranslateTool.AddNpcNameTranslation(modnpc, npc.Value.NameTranslation, GameCulture.Chinese); } } } } }
public static void TestAddTileTranslation() { try { var type = ModLoader.GetMod("Bluemagic").TileType("ElementalBar"); if (type > 0) { TranslateTool.AddTileNameTranslation(TileLoader.GetTile(type), "测试tile名字", GameCulture.Chinese); } } catch (Exception ex) { ErrorLogger.Log(ex.ToString()); } }
public static void TestAddNPCTranslation() { try { var type = ModLoader.GetMod("Bluemagic").NPCType("Phantom"); if (type > 0) { TranslateTool.AddNpcNameTranslation(NPCLoader.GetNPC(type), "测试npc名字", GameCulture.Chinese); } } catch (Exception ex) { ErrorLogger.Log(ex.ToString()); } }
public static void TestAddChatButtonTranslation() { try { var type = ModLoader.GetMod("Bluemagic").NPCType("Hardmode Guide"); if (type > 0) { TranslateTool.AddChatButtonTranslation(type, "测试npc对话按扭1", "测试npc对话按扭2", GameCulture.Chinese); } } catch (Exception ex) { ErrorLogger.Log(ex.ToString()); } }
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()); } }
public static void TestAddChatTranslation() { try { var type = ModLoader.GetMod("Bluemagic").NPCType("Hardmode Guide"); if (type > 0) { TranslateTool.AddChatTranslation("Sometimes I feel like I'm different from everyone else here.", "测试npc对话1"); TranslateTool.AddChatTranslation("What's your favorite color? My favorite colors are white and black.", "测试npc对话2"); TranslateTool.AddChatTranslation("What? I don't have any arms or legs? Oh, don't be ridiculous!", "测试npc对话3"); } } catch (Exception ex) { ErrorLogger.Log(ex.ToString()); } }
public static void TestAddItemTranslation() { try { var type = ModLoader.GetMod("Bluemagic").ItemType("PuriumBreastplate"); if (type > 0) { TranslateTool.AddItemNameTranslation(ItemLoader.GetItem(type), "测试item名字", GameCulture.Chinese); TranslateTool.AddItemTooltipTranslation(ItemLoader.GetItem(type), "测试tooltip", GameCulture.Chinese); TranslateTool.AddSetBonusTranslation(ItemLoader.GetItem(type), "测试setbonus", GameCulture.Chinese); } } catch (Exception ex) { ErrorLogger.Log(ex.ToString()); } }
public static void ImportItemTexts(Mod mod, string path) { using (var fs = new FileStream(Path.Combine(path, "Items.json"), FileMode.Open)) { using (var sr = new StreamReader(fs)) { var items = JsonConvert.DeserializeObject <TextFile.ItemFile>(sr.ReadToEnd()); foreach (var item in items.Items) { var moditem = mod.GetItem(item.Key); if (moditem == null) { continue; } if (!string.IsNullOrWhiteSpace(item.Value.NameTranslation)) { TranslateTool.AddItemNameTranslation(moditem, item.Value.NameTranslation, GameCulture.Chinese); } if (!string.IsNullOrWhiteSpace(item.Value.TooltipTranslation)) { TranslateTool.AddItemTooltipTranslation(moditem, item.Value.TooltipTranslation, GameCulture.Chinese); } } foreach (var setbonus in items.SetBonus) { if (!string.IsNullOrWhiteSpace(setbonus.Value.Translation)) { TranslateTool.AddSetBonusTranslation(mod.GetItem(setbonus.Key), setbonus.Value.Translation, GameCulture.Chinese); } } } } }