diff --git a/GeneralMods/SimpleSoundManager/Framework/SoundManager.cs b/GeneralMods/SimpleSoundManager/Framework/SoundManager.cs index 3eb34171..dfe2c8a9 100644 --- a/GeneralMods/SimpleSoundManager/Framework/SoundManager.cs +++ b/GeneralMods/SimpleSoundManager/Framework/SoundManager.cs @@ -35,6 +35,7 @@ namespace SimpleSoundManager.Framework public void loadWavFile(string soundName,string pathToWav) { WavSound wav = new WavSound(soundName,pathToWav); + SimpleSoundManagerMod.ModMonitor.Log("Getting sound file:" + soundName); this.sounds.Add(soundName,wav); } @@ -47,6 +48,7 @@ namespace SimpleSoundManager.Framework public void loadWavFile(IModHelper helper,string soundName,string pathToWav) { WavSound wav = new WavSound(helper ,soundName,pathToWav); + SimpleSoundManagerMod.ModMonitor.Log("Getting sound file:" + soundName); this.sounds.Add(soundName,wav); } @@ -59,6 +61,7 @@ namespace SimpleSoundManager.Framework public void loadWavFile(IModHelper helper,string songName,List pathToWav) { WavSound wav = new WavSound(helper,songName,pathToWav); + SimpleSoundManagerMod.ModMonitor.Log("Getting sound file:" + songName); this.sounds.Add(songName,wav); } @@ -136,10 +139,12 @@ namespace SimpleSoundManager.Framework /// public void playSound(string soundName) { + SimpleSoundManagerMod.ModMonitor.Log("Trying to play sound: " + soundName); foreach(var sound in this.sounds) { if (sound.Key == soundName) { + SimpleSoundManagerMod.ModMonitor.Log("Time to play sound: " + soundName); var s=getSoundClone(soundName); s.play(); this.currentlyPlayingSounds.Add(s); @@ -190,6 +195,11 @@ namespace SimpleSoundManager.Framework } } + public void swapSounds(string newSong) + { + this.playSound(newSong); + } + public void update() { List removalList = new List(); diff --git a/GeneralMods/SimpleSoundManager/Framework/WavSound.cs b/GeneralMods/SimpleSoundManager/Framework/WavSound.cs index 7478b5da..9d24bf86 100644 --- a/GeneralMods/SimpleSoundManager/Framework/WavSound.cs +++ b/GeneralMods/SimpleSoundManager/Framework/WavSound.cs @@ -113,7 +113,9 @@ namespace SimpleSoundManager dynamicSound = new DynamicSoundEffectInstance(sampleRate, (AudioChannels)channels); - count = dynamicSound.GetSampleSizeInBytes(TimeSpan.FromMilliseconds(10000)); + count = dynamicSound.GetSampleSizeInBytes(TimeSpan.FromMilliseconds(1000)); + + dynamicSound.BufferNeeded += new EventHandler(DynamicSound_BufferNeeded); } @@ -125,7 +127,7 @@ namespace SimpleSoundManager } catch (Exception err) { - + SimpleSoundManagerMod.ModMonitor.Log(err.ToString()); } position += count; @@ -150,7 +152,8 @@ namespace SimpleSoundManager public void play() { if (this.isPlaying() == true) return; - dynamicSound.BufferNeeded += new EventHandler(DynamicSound_BufferNeeded); + LoadWavFromFileToStream(); + SimpleSoundManagerMod.ModMonitor.Log("OK NOW WE ACTUALLY PLAY THE SONG"); dynamicSound.Play(); } diff --git a/GeneralMods/SimpleSoundManager/SimpleSoundManagerMod.cs b/GeneralMods/SimpleSoundManager/SimpleSoundManagerMod.cs index 3e4eb435..b93be9b0 100644 --- a/GeneralMods/SimpleSoundManager/SimpleSoundManagerMod.cs +++ b/GeneralMods/SimpleSoundManager/SimpleSoundManagerMod.cs @@ -5,10 +5,12 @@ namespace SimpleSoundManager public class SimpleSoundManagerMod : Mod { internal static IModHelper ModHelper; + internal static IMonitor ModMonitor; public override void Entry(IModHelper helper) { ModHelper = helper; + ModMonitor = Monitor; } } } diff --git a/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs b/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs index a9bfa309..2ef49bb6 100644 --- a/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs +++ b/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs @@ -1,5 +1,7 @@ -using System; +using StardewValley; +using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -139,6 +141,119 @@ namespace Vocalization.Framework stringsFileNames.Add("SpeechBubbles.xnb"); } + else if (name == "Temp") + { + Vocalization.ModMonitor.Log("Scraping dialogue file: Temp.xnb", StardewModdingAPI.LogLevel.Debug); + //dataFileNames.Add(Path.Combine("Events", "Temp.xnb")); + + Dictionary meh = Game1.content.Load>(Path.Combine("Data", "Events", "Temp.xnb")); + + foreach(KeyValuePair pair in meh) + { + if(pair.Key== "decorate") + { + string dia = pair.Value; + Vocalization.ModMonitor.Log(dia); + string[]values = dia.Split('\"'); + + foreach(var v in values) + { + Vocalization.ModMonitor.Log(v); + Vocalization.ModMonitor.Log("HELLO?"); + } + + List goodValues = new List(); + goodValues.Add(values.ElementAt(1)); + goodValues.Add(values.ElementAt(3)); + goodValues.Add(values.ElementAt(5)); + + foreach(var sentence in goodValues) + { + List clean = Vocalization.sanitizeDialogueFromDictionaries(sentence); + foreach(var cleanSentence in clean) + { + this.dialogueCues.Add(cleanSentence, ""); + } + } + + } + + if (pair.Key == "leave") + { + string dia = pair.Value; + string[] values = dia.Split('\"'); + List goodValues = new List(); + goodValues.Add(values.ElementAt(1)); + goodValues.Add(values.ElementAt(3)); + goodValues.Add(values.ElementAt(5)); + + foreach (var sentence in goodValues) + { + List clean = Vocalization.sanitizeDialogueFromDictionaries(sentence); + foreach (var cleanSentence in clean) + { + this.dialogueCues.Add(cleanSentence, ""); + } + } + + } + + if (pair.Key == "tooBold") + { + string dia = pair.Value; + string[] values = dia.Split('\"'); + List goodValues = new List(); + goodValues.Add(values.ElementAt(1)); + + foreach (var sentence in goodValues) + { + List clean = Vocalization.sanitizeDialogueFromDictionaries(sentence); + foreach (var cleanSentence in clean) + { + this.dialogueCues.Add(cleanSentence, ""); + } + } + } + + if (pair.Key == "poppy" || pair.Key=="heavy" || pair.Key=="techno"|| pair.Key=="honkytonk") + { + string dia = pair.Value; + string[] values = dia.Split('\"'); + List goodValues = new List(); + goodValues.Add(values.ElementAt(1)); + goodValues.Add(values.ElementAt(3)); + goodValues.Add(values.ElementAt(5)); + goodValues.Add(values.ElementAt(7)); + goodValues.Add(values.ElementAt(9)); + goodValues.Add(values.ElementAt(11)); + goodValues.Add(values.ElementAt(13)); + goodValues.Add(values.ElementAt(15)); + goodValues.Add(values.ElementAt(17)); + goodValues.Add(values.ElementAt(19)); + + foreach (var sentence in goodValues) + { + List clean = Vocalization.sanitizeDialogueFromDictionaries(sentence); + foreach (var cleanSentence in clean) + { + try + { + this.dialogueCues.Add(cleanSentence, ""); + } + catch (Exception err) + { + + } + } + } + + } + } + + + + } + else { dialogueFileNames.Add(name + ".xnb"); diff --git a/Vocalization/Vocalization/Vocalization.cs b/Vocalization/Vocalization/Vocalization.cs index 1f0af7f9..7e7e0f55 100644 --- a/Vocalization/Vocalization/Vocalization.cs +++ b/Vocalization/Vocalization/Vocalization.cs @@ -142,7 +142,7 @@ namespace Vocalization /// -NPC Gift tastes (done) /// speech bubbles (done) /// -temp - /// -ui + /// -ui (not needed???) /// /// /// /// @@ -204,9 +204,10 @@ namespace Vocalization private void MenuEvents_MenuClosed(object sender, StardewModdingAPI.Events.EventArgsClickableMenuClosed e) { //Clean out my previous dialogue when I close any sort of menu. + + if (String.IsNullOrEmpty(previousDialogue) || soundManager.sounds[previousDialogue]==null) return; + soundManager.stopSound(previousDialogue); previousDialogue = ""; - if (String.IsNullOrEmpty(soundManager.previousSound.Key) || soundManager.previousSound.Value == null) return; - soundManager.stopPreviousSound(); } /// @@ -244,6 +245,7 @@ namespace Vocalization /// private void GameEvents_UpdateTick(object sender, EventArgs e) { + soundManager.update(); if (Game1.player != null) { if (Game1.player.currentLocation != null) { foreach (NPC v in Game1.currentLocation.characters) @@ -296,21 +298,30 @@ namespace Vocalization List tries = new List(); tries.Add(speakerName); + tries.Add("ExtraDialogue"); tries.Add("Events"); tries.Add("CharactersStrings"); tries.Add("LocationDialogue"); tries.Add("Utility"); tries.Add("Quests"); tries.Add("NPCGiftTastes"); + tries.Add("Temp"); foreach (var v in tries) { CharacterVoiceCue voice; DialogueCues.TryGetValue(v, out voice); currentDialogue = sanitizeDialogueInGame(currentDialogue); //If contains the stuff in the else statement, change things up. + + if (voice == null) + { + ModMonitor.Log("WHY IS MY VOICE NULL??"); + } if (voice.dialogueCues.ContainsKey(currentDialogue)) { //Not variable messages. Aka messages that don't contain words the user can change such as farm name, farmer name etc. voice.speak(currentDialogue); + ModMonitor.Log("SPEAK????"); + return; } else { @@ -470,6 +481,12 @@ namespace Vocalization } } + //Create all of the necessary folders for different translations. + foreach (var dir in config.translations) + { + if (!Directory.Exists(Path.Combine(voicePath,dir))) Directory.CreateDirectory(Path.Combine(voicePath, dir)); + } + //Add in folder for TV Shows foreach (var translation in config.translations) { @@ -570,22 +587,23 @@ namespace Vocalization characterDialoguePaths.Add(extra); } + + foreach (var translation in config.translations) + { + string extra = Path.Combine(translation, "Temp"); + 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 all of the necessary folders for different translations. - foreach(var dir in config.translations) - { - if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); - } - //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 (var dir in characterDialoguePaths) { - if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); + if (!Directory.Exists(Path.Combine(voicePath, dir))) Directory.CreateDirectory(Path.Combine(voicePath, dir)); } } @@ -603,10 +621,12 @@ namespace Vocalization //get a list of all characters supported in this translation and load their voice cue file. foreach (var dir in characterVoiceLines) { + ModMonitor.Log(dir); + + string[] clips = Directory.GetFiles(dir,"*.wav"); - List audioClips = Directory.GetFiles(dir, ".wav").ToList(); //For every .wav file in every character voice clip directory load in the voice clip. - foreach (var file in audioClips) + foreach (var file in clips) { string fileName = Path.GetFileNameWithoutExtension(file); soundManager.loadWavFile(ModHelper, fileName, file); @@ -623,11 +643,29 @@ namespace Vocalization CharacterVoiceCue cue = new CharacterVoiceCue(characterName); cue.initializeEnglishScrape(); scrapeDictionaries(voiceCueFile,cue); + ///??? DO I NEVER ACTUALLY ADD IT IN??? + try + { + DialogueCues.Add(characterName, cue); + } + catch(Exception err) + { + + } } else { CharacterVoiceCue cue = ModHelper.ReadJsonFile(voiceCueFile); - scrapeDictionaries(voiceCueFile,cue); + //scrapeDictionaries(voiceCueFile,cue); + try + { + DialogueCues.Add(characterName, cue); + } + catch (Exception err) + { + + } + ///??? DO I ACTUALLY NEVER ADD IT IN??? } } } @@ -1086,7 +1124,7 @@ namespace Vocalization else if (cue.name == "Quests") { - foreach (var fileName in cue.stringsFileNames) + foreach (var fileName in cue.dataFileNames) { ModMonitor.Log(" Scraping dialogue file: " + fileName, LogLevel.Info); string dialoguePath2 = Path.Combine(stringsPath, fileName); @@ -1518,7 +1556,7 @@ namespace Vocalization /// /// /// - public List sanitizeDialogueFromDictionaries(string dialogue) + public static List sanitizeDialogueFromDictionaries(string dialogue) { List possibleDialogues = new List(); @@ -1599,6 +1637,8 @@ namespace Vocalization //Split across choices List orSplit = new List(); + List quoteSplit = new List(); + //Split across genders List finalSplit = new List(); @@ -1619,8 +1659,24 @@ namespace Vocalization } } + foreach(var dia in orSplit) + { + if (dia.Contains("\"")) //If I can split my string do so and add all the split strings into my orSplit list. + { + List tempSplits = dia.Split('\"').ToList(); + foreach (var v in tempSplits) + { + quoteSplit.Add(v); + } + } + else + { + quoteSplit.Add(dia); //If I can't split the list just add the dialogue and keep processing. + } + } + //split across ^ symbol - foreach (var dia in orSplit) + foreach (var dia in quoteSplit) { if (dia.Contains("^")) //If I can split my string do so and add all the split strings into my orSplit list. { diff --git a/Vocalization/Vocalization/Vocalization.csproj b/Vocalization/Vocalization/Vocalization.csproj index b406aa9b..47f50aa5 100644 --- a/Vocalization/Vocalization/Vocalization.csproj +++ b/Vocalization/Vocalization/Vocalization.csproj @@ -1,70 +1,71 @@ - - - - - Debug - AnyCPU - {1651701C-DB36-43C7-B66D-2700171DD9A9} - Library - Properties - Vocalization - Vocalization - v4.6.1 - 512 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Netcode.dll - - - ..\..\Stardew_Valley_Mods-Development\GeneralMods\SimpleSoundManager\bin\Debug\SimpleSoundManager.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + + + Debug + AnyCPU + {1651701C-DB36-43C7-B66D-2700171DD9A9} + Library + Properties + Vocalization + Vocalization + v4.6.1 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Netcode.dll + + + False + ..\..\GeneralMods\SimpleSoundManager\bin\Release\SimpleSoundManager.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + \ No newline at end of file diff --git a/Vocalization/Vocalization/bin/Debug/Netcode.pdb b/Vocalization/Vocalization/bin/Debug/Netcode.pdb deleted file mode 100644 index 8e128c4e..00000000 Binary files a/Vocalization/Vocalization/bin/Debug/Netcode.pdb and /dev/null differ diff --git a/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.dll b/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.dll index ab698f96..95884874 100644 Binary files a/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.dll and b/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.dll differ diff --git a/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.pdb b/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.pdb index 0db6a5d1..d1885aee 100644 Binary files a/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.pdb and b/Vocalization/Vocalization/bin/Debug/SimpleSoundManager.pdb differ diff --git a/Vocalization/Vocalization/bin/Debug/Vocalization 0.0.1.zip b/Vocalization/Vocalization/bin/Debug/Vocalization 0.0.1.zip index a81d5ec4..842a3e96 100644 Binary files a/Vocalization/Vocalization/bin/Debug/Vocalization 0.0.1.zip and b/Vocalization/Vocalization/bin/Debug/Vocalization 0.0.1.zip differ diff --git a/Vocalization/Vocalization/bin/Debug/Vocalization.dll b/Vocalization/Vocalization/bin/Debug/Vocalization.dll index 45cc7edd..6b6913d9 100644 Binary files a/Vocalization/Vocalization/bin/Debug/Vocalization.dll and b/Vocalization/Vocalization/bin/Debug/Vocalization.dll differ diff --git a/Vocalization/Vocalization/bin/Debug/Vocalization.pdb b/Vocalization/Vocalization/bin/Debug/Vocalization.pdb index f3cb97c0..f07ed380 100644 Binary files a/Vocalization/Vocalization/bin/Debug/Vocalization.pdb and b/Vocalization/Vocalization/bin/Debug/Vocalization.pdb differ diff --git a/Vocalization/Vocalization/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Vocalization/Vocalization/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 1faae210..512a1f1b 100644 Binary files a/Vocalization/Vocalization/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Vocalization/Vocalization/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.CoreCompileInputs.cache b/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.CoreCompileInputs.cache index 1e1813e7..05f7f549 100644 --- a/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.CoreCompileInputs.cache +++ b/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -d2f6ea8ff6eabfbcaf9442f44d54892bdeabe452 +3b7bd19887cca12ff75f6ac1abe1ec154bb35718 diff --git a/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.FileListAbsolute.txt b/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.FileListAbsolute.txt index d7e4a876..55038ef2 100644 --- a/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.FileListAbsolute.txt +++ b/Vocalization/Vocalization/obj/Debug/Vocalization.csproj.FileListAbsolute.txt @@ -11,9 +11,9 @@ C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\bin\Debug\SimpleSo C:\Users\iD Student\Desktop\Stardew\Vocalization\Vocalization\obj\Debug\Vocalization.csprojResolveAssemblyReference.cache C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\bin\Debug\Vocalization.dll C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\bin\Debug\Vocalization.pdb -C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\bin\Debug\Netcode.pdb -C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\bin\Debug\SimpleSoundManager.pdb -C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\obj\Debug\Vocalization.csprojResolveAssemblyReference.cache C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\obj\Debug\Vocalization.csproj.CoreCompileInputs.cache C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\obj\Debug\Vocalization.dll C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\obj\Debug\Vocalization.pdb +C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\bin\Debug\SimpleSoundManager.dll +C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\bin\Debug\SimpleSoundManager.pdb +C:\Users\owner\Documents\Visual Studio 2015\Projects\github\StardewValleyMods\Vocalization\Vocalization\obj\Debug\Vocalization.csprojResolveAssemblyReference.cache diff --git a/Vocalization/Vocalization/obj/Debug/Vocalization.csprojResolveAssemblyReference.cache b/Vocalization/Vocalization/obj/Debug/Vocalization.csprojResolveAssemblyReference.cache index c197cb7c..f81aa8ab 100644 Binary files a/Vocalization/Vocalization/obj/Debug/Vocalization.csprojResolveAssemblyReference.cache and b/Vocalization/Vocalization/obj/Debug/Vocalization.csprojResolveAssemblyReference.cache differ diff --git a/Vocalization/Vocalization/obj/Debug/Vocalization.dll b/Vocalization/Vocalization/obj/Debug/Vocalization.dll index 45cc7edd..6b6913d9 100644 Binary files a/Vocalization/Vocalization/obj/Debug/Vocalization.dll and b/Vocalization/Vocalization/obj/Debug/Vocalization.dll differ diff --git a/Vocalization/Vocalization/obj/Debug/Vocalization.pdb b/Vocalization/Vocalization/obj/Debug/Vocalization.pdb index f3cb97c0..f07ed380 100644 Binary files a/Vocalization/Vocalization/obj/Debug/Vocalization.pdb and b/Vocalization/Vocalization/obj/Debug/Vocalization.pdb differ