From 03ca0277daec30fe91808811c91630d451e7a229 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 5 Jan 2019 23:33:17 -0500 Subject: [PATCH 1/7] simplify Vocalization folder initialisation --- .../Vocalization/Framework/AudioCues.cs | 2 +- .../Framework/Menus/VocalizationMenu.cs | 6 +- .../Vocalization/Framework/TranslationInfo.cs | 71 +++--- .../Vocalization/Vocalization/Vocalization.cs | 205 +++++------------- 4 files changed, 91 insertions(+), 193 deletions(-) diff --git a/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs b/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs index 29ffe130..76f01e18 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs @@ -45,7 +45,7 @@ namespace Vocalization.Framework public static void loadAudioCues() { - foreach (string v in Vocalization.config.translationInfo.translations) + foreach (string v in Vocalization.config.translationInfo.LanguageNames) { var loaded = Vocalization.ModHelper.ReadJsonFile>(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues", "AudioCues" + Seperator + v + ".json")); if (loaded == null) loaded = new SortedDictionary(); diff --git a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs index 38fb7ee2..7c24f117 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs @@ -61,7 +61,7 @@ namespace Vocalization.Framework.Menus for (int i = 0; i < this.languages.buttons.Count; i++) { - if (Vocalization.config.translationInfo.currentTranslation == this.languages.buttons.ElementAt(i).label) + if (Vocalization.config.translationInfo.CurrentTranslation == this.languages.buttons.ElementAt(i).label) this.languages.buttonIndex = i; } } @@ -99,9 +99,9 @@ namespace Vocalization.Framework.Menus Vocalization.ModHelper.WriteConfig(Vocalization.config); Vocalization.soundManager.volume = (float)Vocalization.config.voiceVolume; - if (Vocalization.config.translationInfo.currentTranslation != this.getTranslationInfo()) + if (Vocalization.config.translationInfo.CurrentTranslation != this.getTranslationInfo()) { - Vocalization.config.translationInfo.currentTranslation = this.getTranslationInfo(); + Vocalization.config.translationInfo.CurrentTranslation = this.getTranslationInfo(); Vocalization.soundManager.sounds.Clear(); Vocalization.DialogueCues.Clear(); Vocalization.loadAllVoiceFiles(); diff --git a/GeneralMods/Vocalization/Vocalization/Framework/TranslationInfo.cs b/GeneralMods/Vocalization/Vocalization/Framework/TranslationInfo.cs index b748592d..71a11269 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/TranslationInfo.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/TranslationInfo.cs @@ -8,49 +8,50 @@ namespace Vocalization.Framework /// A class which deals with handling different translations for Vocalization should other voice teams ever wish to voice act for that language. public class TranslationInfo { - /// The list of all supported translations by this mod. - public List translations; + /********* + ** Accessors + *********/ + /// The language names supported by this mod. + public List LanguageNames { get; } = new List(); /// The current translation mode for the mod, so that it knows what files to load at the beginning of the game. - public string currentTranslation; + public string CurrentTranslation { get; set; } = "English"; /// Holds the info for what translation has what file extension. - public Dictionary translationFileInfo; + public Dictionary TranslationFileInfo { get; } = new Dictionary(); + + public Dictionary TranslationCodes { get; } = new Dictionary(); - public Dictionary translationCodes; - /// Default constructor. + /********* + ** Public methods + *********/ + /// Construct an instance. public TranslationInfo() { - this.translations = new List(); + this.LanguageNames.Add("English"); + this.LanguageNames.Add("Spanish"); + this.LanguageNames.Add("Chinese"); + this.LanguageNames.Add("Japanese"); + this.LanguageNames.Add("Russian"); + this.LanguageNames.Add("German"); + this.LanguageNames.Add("Brazillian Portuguese"); - this.translationFileInfo = new Dictionary(); - this.translationCodes = new Dictionary(); - this.translations.Add("English"); - this.translations.Add("Spanish"); - this.translations.Add("Chinese"); - this.translations.Add("Japanese"); - this.translations.Add("Russian"); - this.translations.Add("German"); - this.translations.Add("Brazillian Portuguese"); - - this.currentTranslation = "English"; - - this.translationFileInfo.Add("English", ".xnb"); - this.translationFileInfo.Add("Spanish", ".es-ES.xnb"); - this.translationFileInfo.Add("Chinese", ".zh-CN.xnb"); - this.translationFileInfo.Add("Japanese", ".ja-JP.xnb"); - this.translationFileInfo.Add("Russian", ".ru-RU.xnb"); - this.translationFileInfo.Add("German", ".de-DE.xnb"); - this.translationFileInfo.Add("Brazillian Portuguese", ".pt-BR.xnb"); + this.TranslationFileInfo.Add("English", ".xnb"); + this.TranslationFileInfo.Add("Spanish", ".es-ES.xnb"); + this.TranslationFileInfo.Add("Chinese", ".zh-CN.xnb"); + this.TranslationFileInfo.Add("Japanese", ".ja-JP.xnb"); + this.TranslationFileInfo.Add("Russian", ".ru-RU.xnb"); + this.TranslationFileInfo.Add("German", ".de-DE.xnb"); + this.TranslationFileInfo.Add("Brazillian Portuguese", ".pt-BR.xnb"); - this.translationCodes.Add("English", LocalizedContentManager.LanguageCode.en); - this.translationCodes.Add("Spanish", LocalizedContentManager.LanguageCode.es); - this.translationCodes.Add("Chinese", LocalizedContentManager.LanguageCode.zh); - this.translationCodes.Add("Japanese", LocalizedContentManager.LanguageCode.ja); - this.translationCodes.Add("Russian", LocalizedContentManager.LanguageCode.ru); - this.translationCodes.Add("German", LocalizedContentManager.LanguageCode.de); - this.translationCodes.Add("Brazillian Portuguese", LocalizedContentManager.LanguageCode.pt); + this.TranslationCodes.Add("English", LocalizedContentManager.LanguageCode.en); + this.TranslationCodes.Add("Spanish", LocalizedContentManager.LanguageCode.es); + this.TranslationCodes.Add("Chinese", LocalizedContentManager.LanguageCode.zh); + this.TranslationCodes.Add("Japanese", LocalizedContentManager.LanguageCode.ja); + this.TranslationCodes.Add("Russian", LocalizedContentManager.LanguageCode.ru); + this.TranslationCodes.Add("German", LocalizedContentManager.LanguageCode.de); + this.TranslationCodes.Add("Brazillian Portuguese", LocalizedContentManager.LanguageCode.pt); } public string getTranslationNameFromPath(string fullPath) @@ -61,7 +62,7 @@ namespace Vocalization.Framework public void changeLocalizedContentManagerFromTranslation(string translation) { string tra = this.getTranslationNameFromPath(translation); - LocalizedContentManager.CurrentLanguageCode = !this.translationCodes.TryGetValue(tra, out LocalizedContentManager.LanguageCode code) + LocalizedContentManager.CurrentLanguageCode = !this.TranslationCodes.TryGetValue(tra, out LocalizedContentManager.LanguageCode code) ? LocalizedContentManager.LanguageCode.en : code; return; @@ -83,7 +84,7 @@ namespace Vocalization.Framework string translation = Path.GetFileName(path); try { - return this.translationFileInfo[translation]; + return this.TranslationFileInfo[translation]; } catch (Exception err) { diff --git a/GeneralMods/Vocalization/Vocalization/Vocalization.cs b/GeneralMods/Vocalization/Vocalization/Vocalization.cs index 496ded25..4525e99f 100644 --- a/GeneralMods/Vocalization/Vocalization/Vocalization.cs +++ b/GeneralMods/Vocalization/Vocalization/Vocalization.cs @@ -153,6 +153,36 @@ namespace Vocalization /// public class Vocalization : Mod { + /********* + ** Fields + *********/ + /// The subfolders to create for each language, in addition to a subfolder for each detected NPC. + private readonly string[] DefaultSubfolders = new[] + { + "Characters", + "Events", + "ExtraDialogue", // folder for ExtraDialogue.yaml + "Gil", + "Governor", + "Grandpa", + "Kent", + "LocationDialogue", + "Mail", + "Morris", + "Notes", + "NPCGiftTastes", + "Quests", + "Shops", // NPC shops + "SpeechBubbles", + "Temp", + "TV", // TV Shows + "Utility" + }; + + + /********* + ** Accessors + *********/ public static IModHelper ModHelper; public static IMonitor ModMonitor; public static IManifest Manifest; @@ -160,13 +190,11 @@ namespace Vocalization /// A string that keeps track of the previous dialogue said to ensure that dialogue isn't constantly repeated while the text box is open. public static string previousDialogue; - List characterDialoguePaths = new List(); - /// Simple Sound Manager class that handles playing and stoping dialogue. public static SimpleSoundManager.Framework.SoundManager soundManager; - /// The path to the folder where all of the NPC folders for dialogue .wav files are kept. - public static string VoicePath = ""; + /// The path to the folder where all of the NPC folders for dialogue .wav files are kept, relative to the mod folder. + private static readonly string RelativeVoicePath = Path.Combine("Content", "Audio", "VoiceFiles"); public static ReplacementStrings replacementStrings; @@ -177,6 +205,10 @@ namespace Vocalization /// A dictionary that keeps track of all of the npcs whom have voice acting for their dialogue. public static Dictionary DialogueCues; + + /********* + ** Public methods + *********/ /// The mod entry point, called after the mod is first loaded. /// Provides simplified APIs for writing mods. public override void Entry(IModHelper helper) @@ -554,156 +586,21 @@ namespace Vocalization /// Runs after loading and creates necessary mod directories. private void initialzeDirectories() { - string basePath = ModHelper.DirectoryPath; - string contentPath = Path.Combine(basePath, "Content"); - string graphicsPath = Path.Combine(contentPath, "Graphics"); - string audioPath = Path.Combine(contentPath, "Audio"); - string voicePath = Path.Combine(audioPath, "VoiceFiles"); + Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Content", "Graphics")); + Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, RelativeVoicePath)); - if (!Directory.Exists(graphicsPath)) - Directory.CreateDirectory(graphicsPath); + // get list of subfolders to create + List subfolderNames = new List(this.DefaultSubfolders); + foreach (NPC npc in Game1.locations.SelectMany(loc => loc.characters)) + subfolderNames.Add(npc.Name); - VoicePath = voicePath; //Set a static reference to my voice files directory. - - //Get a list of all characters in the game and make voice directories for them in each supported translation of the mod. - foreach (var loc in Game1.locations) + // create subfolders for each translation + // Note: a modder could also manually add their own character directory for voice lines instead of having to add it via code. + foreach (string language in config.translationInfo.LanguageNames) { - foreach (var npc in loc.characters) - { - foreach (string translation in config.translationInfo.translations) - { - string characterPath = Path.Combine(translation, npc.Name); - this.characterDialoguePaths.Add(characterPath); - } - } - } - - //Create all of the necessary folders for different translations. - foreach (string dir in config.translationInfo.translations) - { - if (!Directory.Exists(Path.Combine(voicePath, dir))) Directory.CreateDirectory(Path.Combine(voicePath, dir)); - } - - //Add in folder for TV Shows - foreach (string translation in config.translationInfo.translations) - { - string TVPath = Path.Combine(translation, "TV"); - this.characterDialoguePaths.Add(TVPath); - } - - //Add in folder for shop support - foreach (string translation in config.translationInfo.translations) - { - string shop = Path.Combine(translation, "Shops"); //Used to hold NPC Shops - this.characterDialoguePaths.Add(shop); - } - - //Add in folder for Mail support. - foreach (string translation in config.translationInfo.translations) - { - string mail = Path.Combine(translation, "Mail"); - this.characterDialoguePaths.Add(mail); - } - - //Add in folder for ExtraDiaogue.yaml - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "ExtraDialogue"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "Events"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "Characters"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "LocationDialogue"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "Notes"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "Utility"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "NPCGiftTastes"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "SpeechBubbles"); - this.characterDialoguePaths.Add(extra); - } - - foreach (string translation in config.translationInfo.translations) - { - string kent = Path.Combine(translation, "Kent"); - this.characterDialoguePaths.Add(kent); - - - string gil = Path.Combine(translation, "Gil"); - this.characterDialoguePaths.Add(gil); - - - string governor = Path.Combine(translation, "Governor"); - this.characterDialoguePaths.Add(governor); - - - string grandpa = Path.Combine(translation, "Grandpa"); - this.characterDialoguePaths.Add(grandpa); - - - string morris = Path.Combine(translation, "Morris"); - this.characterDialoguePaths.Add(morris); - } - - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "Quests"); - this.characterDialoguePaths.Add(extra); - } - - - foreach (string translation in config.translationInfo.translations) - { - string extra = Path.Combine(translation, "Temp"); - this.characterDialoguePaths.Add(extra); - } - - if (!Directory.Exists(contentPath)) - Directory.CreateDirectory(contentPath); - if (!Directory.Exists(audioPath)) - Directory.CreateDirectory(audioPath); - if (!Directory.Exists(voicePath)) - Directory.CreateDirectory(voicePath); - - - //Create a list of new directories if the corresponding character directory doesn't exist. - //Note: A modder could also manually add in their own character directory for voice lines instead of having to add it via code. - foreach (string dir in this.characterDialoguePaths) - { - if (!Directory.Exists(Path.Combine(voicePath, dir))) - Directory.CreateDirectory(Path.Combine(voicePath, dir)); + DirectoryInfo translationPath = new DirectoryInfo(Path.Combine(this.Helper.DirectoryPath, RelativeVoicePath, language)); + foreach (string subfolderName in subfolderNames) + Directory.CreateDirectory(Path.Combine(translationPath.FullName, subfolderName)); } } @@ -711,7 +608,7 @@ namespace Vocalization public static void loadAllVoiceFiles() { //get a list of all translations supported by this mod. - List translations = Directory.GetDirectories(VoicePath).ToList(); + List translations = Directory.GetDirectories(Path.Combine(ModHelper.DirectoryPath, RelativeVoicePath)).ToList(); foreach (string translation in translations) { string[] characterVoiceLines = Directory.GetDirectories(translation); @@ -744,7 +641,7 @@ namespace Vocalization scrapeDictionaries(voiceCueFile, cue, translation); try { - if (Path.GetFileName(translation) == config.translationInfo.currentTranslation) + if (Path.GetFileName(translation) == config.translationInfo.CurrentTranslation) DialogueCues.Add(characterName, cue); } catch { } @@ -754,7 +651,7 @@ namespace Vocalization try { //Only load in the cues for the current translation. - if (Path.GetFileName(translation) == config.translationInfo.currentTranslation) + if (Path.GetFileName(translation) == config.translationInfo.CurrentTranslation) { CharacterVoiceCue cue = ModHelper.ReadJsonFile(voiceCueFile); //scrapeDictionaries(voiceCueFile,cue); From cfe5cdc49e44b9858ff6340051991d07120fbe55 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 5 Jan 2019 23:33:45 -0500 Subject: [PATCH 2/7] use enum for language names --- .../Vocalization/Framework/AudioCues.cs | 24 +- .../Framework/CharacterVoiceCue.cs | 15 +- .../Vocalization/Framework/LanguageName.cs | 14 + .../Framework/Menus/VocalizationMenu.cs | 22 +- .../Vocalization/Framework/TranslationInfo.cs | 105 ++- .../Vocalization/Framework/Vocabulary.cs | 62 +- .../Vocalization/Vocalization/Vocalization.cs | 697 +++++++++--------- .../Vocalization/Vocalization.csproj | 1 + 8 files changed, 467 insertions(+), 473 deletions(-) create mode 100644 GeneralMods/Vocalization/Vocalization/Framework/LanguageName.cs diff --git a/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs b/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs index 76f01e18..95a42c60 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/AudioCues.cs @@ -11,22 +11,19 @@ namespace Vocalization.Framework public static Dictionary> DictionaryReferences = new Dictionary>(); - public static string generateKey(string translationPath, string SpeakerName, string fileName, string dialogueKey) + public static string generateKey(LanguageName language, string SpeakerName, string fileName, string dialogueKey) { - return Vocalization.config.translationInfo.getTranslationNameFromPath(translationPath) + Seperator + SpeakerName + Seperator + fileName + Seperator + dialogueKey; + return Vocalization.config.translationInfo.getTranslationName(language) + Seperator + SpeakerName + Seperator + fileName + Seperator + dialogueKey; } - public static SortedDictionary getWavFileReferences(string translation) + public static SortedDictionary getWavFileReferences(LanguageName language) { - return DictionaryReferences[Vocalization.config.translationInfo.getTranslationNameFromPath(translation)]; + return DictionaryReferences[Vocalization.config.translationInfo.getTranslationName(language)]; } public static void initialize() { - if (!Directory.Exists(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues"))) - { - Directory.CreateDirectory(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues")); - } + Directory.CreateDirectory(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues")); loadAudioCues(); } @@ -45,20 +42,19 @@ namespace Vocalization.Framework public static void loadAudioCues() { - foreach (string v in Vocalization.config.translationInfo.LanguageNames) + foreach (LanguageName language in Vocalization.config.translationInfo.LanguageNames) { - var loaded = Vocalization.ModHelper.ReadJsonFile>(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues", "AudioCues" + Seperator + v + ".json")); - if (loaded == null) loaded = new SortedDictionary(); - DictionaryReferences.Add(v, loaded); + var loaded = + Vocalization.ModHelper.ReadJsonFile>(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues", "AudioCues" + Seperator + language + ".json")) + ?? new SortedDictionary(); + DictionaryReferences.Add(Vocalization.config.translationInfo.getTranslationName(language), loaded); } } public static void saveAudioCues() { foreach (var v in DictionaryReferences) - { Vocalization.ModHelper.WriteJsonFile>(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues", "AudioCues" + Seperator + v.Key + ".json"), v.Value); - } } } } diff --git a/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs b/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs index a1b91933..26c7150d 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs @@ -172,13 +172,16 @@ namespace Vocalization.Framework } /// Change all of the files to the ones that are appropriate for that translation version. - public void initializeForTranslation(string translation) + /// The translation language name. + public void initializeForTranslation(LanguageName language) { + string extension = Vocalization.config.translationInfo.getFileExtentionForTranslation(language); + for (int i = 0; i < this.dataFileNames.Count; i++) { Vocalization.ModMonitor.Log(this.dataFileNames.ElementAt(i)); string s = this.dataFileNames.ElementAt(i); - s = this.dataFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); + s = this.dataFileNames.ElementAt(i).Replace(".xnb", extension); this.dataFileNames[i] = s; Vocalization.ModMonitor.Log(this.dataFileNames.ElementAt(i)); } @@ -187,7 +190,7 @@ namespace Vocalization.Framework { Vocalization.ModMonitor.Log(this.dialogueFileNames.ElementAt(i)); string s = this.dialogueFileNames.ElementAt(i); - s = this.dialogueFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); + s = this.dialogueFileNames.ElementAt(i).Replace(".xnb", extension); this.dialogueFileNames[i] = s; Vocalization.ModMonitor.Log(this.dialogueFileNames.ElementAt(i)); } @@ -196,7 +199,7 @@ namespace Vocalization.Framework { Vocalization.ModMonitor.Log(this.stringsFileNames.ElementAt(i)); string s = this.stringsFileNames.ElementAt(i); - s = this.stringsFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); + s = this.stringsFileNames.ElementAt(i).Replace(".xnb", extension); this.stringsFileNames[i] = s; Vocalization.ModMonitor.Log(this.stringsFileNames.ElementAt(i)); } @@ -205,7 +208,7 @@ namespace Vocalization.Framework { Vocalization.ModMonitor.Log(this.festivalFileNames.ElementAt(i)); string s = this.festivalFileNames.ElementAt(i); - s = this.festivalFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); + s = this.festivalFileNames.ElementAt(i).Replace(".xnb", extension); this.festivalFileNames[i] = s; Vocalization.ModMonitor.Log(this.festivalFileNames.ElementAt(i)); } @@ -214,7 +217,7 @@ namespace Vocalization.Framework { Vocalization.ModMonitor.Log(this.eventFileNames.ElementAt(i)); string s = this.eventFileNames.ElementAt(i); - s = this.eventFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); + s = this.eventFileNames.ElementAt(i).Replace(".xnb", extension); this.eventFileNames[i] = s; Vocalization.ModMonitor.Log(this.eventFileNames.ElementAt(i)); } diff --git a/GeneralMods/Vocalization/Vocalization/Framework/LanguageName.cs b/GeneralMods/Vocalization/Vocalization/Framework/LanguageName.cs new file mode 100644 index 00000000..c78d42a5 --- /dev/null +++ b/GeneralMods/Vocalization/Vocalization/Framework/LanguageName.cs @@ -0,0 +1,14 @@ +namespace Vocalization.Framework +{ + /// The supported language names. + public enum LanguageName + { + English, + Spanish, + Chinese, + Japanese, + Russian, + German, + Portuguese + } +} diff --git a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs index 7c24f117..ae25f24c 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -39,13 +40,13 @@ namespace Vocalization.Framework.Menus Rectangle sourceRect = new Rectangle(0, 0, 4, 16); this.sliderButton = new SliderButton("Slider", "Volume", new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 4, 16), buttonTexture, bar, sourceRect, 2f, new SliderInformation(SliderStyle.Horizontal, (int)(Vocalization.config.voiceVolume * 100), 1), new StardustCore.Animations.Animation(sourceRect), Color.White, Color.Black, new StardustCore.UIUtilities.MenuComponents.Delegates.Functionality.ButtonFunctionality(null, null, null), false, null, true); - Button english = new Button("EnglishButton", "English", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 0, 174, 39), 1f); - Button spanish = new Button("SpanishButton", "Spanish", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 2, 174, 39), 1f); - Button portuguese = new Button("PortugueseButton", "Brazillian Portuguese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 4, 174, 39), 1f); - Button russian = new Button("RussianButton", "Russian", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 6, 174, 39), 1f); - Button chinese = new Button("ChineseButton", "Chinese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 8, 174, 39), 1f); - Button japanese = new Button("JapaneseButton", "Japanese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 10, 174, 39), 1f); - Button german = new Button("GermanButton", "German", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 12, 174, 39), 1f); + Button english = new Button(LanguageName.English.ToString(), "English", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 0, 174, 39), 1f); + Button spanish = new Button(LanguageName.Spanish.ToString(), "Spanish", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 2, 174, 39), 1f); + Button portuguese = new Button(LanguageName.Portuguese.ToString(), "Brazillian Portuguese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 4, 174, 39), 1f); + Button russian = new Button(LanguageName.Russian.ToString(), "Russian", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 6, 174, 39), 1f); + Button chinese = new Button(LanguageName.Chinese.ToString(), "Chinese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 8, 174, 39), 1f); + Button japanese = new Button(LanguageName.Japanese.ToString(), "Japanese", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 10, 174, 39), 1f); + Button german = new Button(LanguageName.German.ToString(), "German", new Rectangle(0, 0, 174, 39), new Texture2DExtended(Vocalization.ModHelper, Path.Combine("LooseSprites", "LanguageButtons.xnb"), StardewModdingAPI.ContentSource.GameContent), new Rectangle(0, 39 * 12, 174, 39), 1f); List