Fixed vocalization translation issues for some dialogue being scraped from StringsFromCS
This commit is contained in:
parent
3029ed2c2f
commit
917e169cea
|
@ -0,0 +1,70 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Vocalization.Framework
|
||||||
|
{
|
||||||
|
public class AudioCues
|
||||||
|
{
|
||||||
|
//Translation_speaker_file_key
|
||||||
|
public static char Seperator = '_';
|
||||||
|
|
||||||
|
public static Dictionary<string, SortedDictionary<string, VoiceAudioOptions>> DictionaryReferences = new Dictionary<string, SortedDictionary<string, VoiceAudioOptions>>();
|
||||||
|
|
||||||
|
public static string generateKey(string translationPath, string SpeakerName, string fileName, string dialogueKey)
|
||||||
|
{
|
||||||
|
return Vocalization.config.translationInfo.getTranslationNameFromPath(translationPath) + Seperator + SpeakerName + Seperator + fileName + Seperator + dialogueKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SortedDictionary<string,VoiceAudioOptions> getWavFileReferences(string translation)
|
||||||
|
{
|
||||||
|
return DictionaryReferences[Vocalization.config.translationInfo.getTranslationNameFromPath(translation)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initialize()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues"))){
|
||||||
|
Directory.CreateDirectory(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues"));
|
||||||
|
}
|
||||||
|
loadAudioCues();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addWavReference(string key, VoiceAudioOptions cue)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string translation = key.Split(Seperator).ElementAt(0);
|
||||||
|
DictionaryReferences.TryGetValue(translation,out SortedDictionary<string,VoiceAudioOptions> value);
|
||||||
|
|
||||||
|
value.Add(key, cue);
|
||||||
|
}
|
||||||
|
catch(Exception err)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loadAudioCues()
|
||||||
|
{
|
||||||
|
foreach (var v in Vocalization.config.translationInfo.translations)
|
||||||
|
{
|
||||||
|
var loaded = Vocalization.ModHelper.ReadJsonFile<SortedDictionary<string, VoiceAudioOptions>>(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues","AudioCues" + Seperator + v + ".json"));
|
||||||
|
if (loaded == null) loaded = new SortedDictionary<string, VoiceAudioOptions>();
|
||||||
|
DictionaryReferences.Add(v,loaded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveAudioCues()
|
||||||
|
{
|
||||||
|
foreach (var v in DictionaryReferences)
|
||||||
|
{
|
||||||
|
Vocalization.ModHelper.WriteJsonFile<SortedDictionary<string, VoiceAudioOptions>>(Path.Combine(Vocalization.ModHelper.DirectoryPath, "AudioCues", "AudioCues" + Seperator + v.Key + ".json"),v.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -146,7 +146,7 @@ namespace Vocalization.Framework
|
||||||
{
|
{
|
||||||
List<string> stock = new List<string>();
|
List<string> stock = new List<string>();
|
||||||
Dictionary<int, string> objDict = Game1.content.Load<Dictionary<int, string>>(Path.Combine("Data", Vocalization.config.translationInfo.getXNBForTranslation("ObjectInformation", translation)));
|
Dictionary<int, string> objDict = Game1.content.Load<Dictionary<int, string>>(Path.Combine("Data", Vocalization.config.translationInfo.getXNBForTranslation("ObjectInformation", translation)));
|
||||||
Vocalization.ModMonitor.Log("LOAD THE OBJECT INFO: ", LogLevel.Alert);
|
//Vocalization.ModMonitor.Log("LOAD THE OBJECT INFO: ", LogLevel.Alert);
|
||||||
foreach (KeyValuePair<int, string> pair in objDict)
|
foreach (KeyValuePair<int, string> pair in objDict)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= 3; i++)
|
for (int i = 0; i <= 3; i++)
|
||||||
|
|
|
@ -39,6 +39,14 @@ namespace Vocalization.Framework
|
||||||
simpleAndHeartEvents = "";
|
simpleAndHeartEvents = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VoiceAudioOptions(string simple, string full, string heartEvent, string simpleAndHeartEvent)
|
||||||
|
{
|
||||||
|
this.simple = simple;
|
||||||
|
this.full = full;
|
||||||
|
this.heartEvents = heartEvent;
|
||||||
|
this.simpleAndHeartEvents = simpleAndHeartEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public string getAudioClip()
|
public string getAudioClip()
|
||||||
{
|
{
|
||||||
if (Vocalization.config.currentMode == "Simple") return simple;
|
if (Vocalization.config.currentMode == "Simple") return simple;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -48,6 +48,7 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Framework\AudioCues.cs" />
|
||||||
<Compile Include="Framework\CharacterVoiceCue.cs" />
|
<Compile Include="Framework\CharacterVoiceCue.cs" />
|
||||||
<Compile Include="Framework\Menus\VocalizationMenu.cs" />
|
<Compile Include="Framework\Menus\VocalizationMenu.cs" />
|
||||||
<Compile Include="Framework\ReplacementStrings.cs" />
|
<Compile Include="Framework\ReplacementStrings.cs" />
|
||||||
|
|
Loading…
Reference in New Issue