Skip to content

Commit

Permalink
Remove key from speaker export
Browse files Browse the repository at this point in the history
  • Loading branch information
BDeshiDev committed Aug 1, 2024
1 parent 1883ec0 commit 8f3d689
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,19 @@ private static void ExportStringTable(DialogueGraph graph, string path, List<Dia
ExportStringTable(stream, collection, columnMappings, dialogueLinesInOrder, dialogueGraphLineIds);
}
}


/// <summary>
/// #TODO temporary measure till I figure out columnmapping
/// </summary>
/// <param name="dialogueLinesInOrder"></param>
/// <param name="path"></param>
public void ExportSpeakerData(List<DialogueLineNodeBase> dialogueLinesInOrder, string path)
{
// StringBuilder to construct the CSV content
StringBuilder csvContent = new StringBuilder();

// Append the header
csvContent.AppendLine("Key,Id,Speaker, Expression");
csvContent.AppendLine("Id,Speaker, Expression");

// Append each dialogue line
foreach (var line in dialogueLinesInOrder)
Expand All @@ -195,11 +200,11 @@ public void ExportSpeakerData(List<DialogueLineNodeBase> dialogueLinesInOrder, s
{
if (line.SpeakerData.Character != null)
{
csvContent.AppendLine($"{entry.Key},{entry.Id},{line.SpeakerData.Character.CharacterName}, {line.SpeakerData.Expression}");
csvContent.AppendLine($"{entry.Id},{line.SpeakerData.Character.CharacterName}, {line.SpeakerData.Expression.name}");
}
else
{
csvContent.AppendLine($"{entry.Key},{entry.Id},,");
csvContent.AppendLine($"{entry.Id},,");
}
}
}
Expand Down Expand Up @@ -301,32 +306,6 @@ public static void ExportStringTable(TextWriter writer, StringTableCollection co
}
}

private static void WriteCSV(List<DialogueLineNodeBase> dialogueLines, string path)
{
StringBuilder csvContent = new StringBuilder();

// Append the header
csvContent.AppendLine("Key,Id,English(en),Japanese(ja),Russian(ru),Spanish(es),Bangla(bn)");

// Append each dialogue line
foreach (var line in dialogueLines)
{
var entry = GetTableEntry(line);
if (entry == null)
{
Debug.LogError($"entry null for {line}", line);
}
else
{
csvContent.AppendLine($"{entry.Key},{entry.Id},{line.DialogueLocalizedString.GetLocalizedStringInEditor()},,,,");
}
// csvContent.AppendLine($"{line.DialogueLocalizedString.Keys},{line.Key},{line.English},{line.Japanese},{line.Russian},{line.Spanish},{line.Bangla}");
}

// Write the content to the file
File.WriteAllText(path, csvContent.ToString());
}

public void HandleDialogueLineNodeTraversed(DialogueLineNodeBase node)
{
traversedLinesCache.Add(node);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.studio23.ss2.dialoguesystem",
"version": "0.4.21",
"version": "0.4.22",
"displayName": "Dialogue System",
"description": "Dialogue system is an authoring tool for developers to integrate dialogue from scriptwriters inside unity.",
"unity": "2022.3",
Expand Down

0 comments on commit 8f3d689

Please sign in to comment.