Add subtitle UI for voice playback
This commit is contained in:
@@ -11,24 +11,45 @@ namespace BriarQueen.Data.Identifiers
|
||||
// TutorialTip = 2
|
||||
}
|
||||
|
||||
public static class SubtitleIdentifiers
|
||||
public readonly struct SubtitleEntry
|
||||
{
|
||||
public static readonly IReadOnlyDictionary<SubtitleKey, string> Subtitles =
|
||||
new ReadOnlyDictionary<SubtitleKey, string>(
|
||||
new Dictionary<SubtitleKey, string>
|
||||
{
|
||||
// { SubtitleKey.IntroLine, "Subtitle:IntroLine" },
|
||||
// { SubtitleKey.TutorialTip, "Subtitle:TutorialTip" }
|
||||
});
|
||||
|
||||
public static string Get(SubtitleKey key)
|
||||
public SubtitleEntry(string text, float preferredDurationSeconds = 0f)
|
||||
{
|
||||
return Subtitles.TryGetValue(key, out var value) ? value : string.Empty;
|
||||
Text = text;
|
||||
PreferredDurationSeconds = preferredDurationSeconds;
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetAll()
|
||||
public string Text { get; }
|
||||
public float PreferredDurationSeconds { get; }
|
||||
}
|
||||
|
||||
public static class SubtitleIdentifiers
|
||||
{
|
||||
public static readonly IReadOnlyDictionary<SubtitleKey, SubtitleEntry> Subtitles =
|
||||
new ReadOnlyDictionary<SubtitleKey, SubtitleEntry>(
|
||||
new Dictionary<SubtitleKey, SubtitleEntry>
|
||||
{
|
||||
// { SubtitleKey.IntroLine, new SubtitleEntry("Example subtitle.", 2.5f) },
|
||||
});
|
||||
|
||||
public static bool TryGet(SubtitleKey key, out SubtitleEntry entry)
|
||||
{
|
||||
return Subtitles.Values;
|
||||
return Subtitles.TryGetValue(key, out entry);
|
||||
}
|
||||
|
||||
public static string GetText(SubtitleKey key)
|
||||
{
|
||||
return Subtitles.TryGetValue(key, out var entry) ? entry.Text : string.Empty;
|
||||
}
|
||||
|
||||
public static float GetPreferredDuration(SubtitleKey key)
|
||||
{
|
||||
return Subtitles.TryGetValue(key, out var entry) ? entry.PreferredDurationSeconds : 0f;
|
||||
}
|
||||
|
||||
public static IEnumerable<SubtitleKey> GetAllKeys()
|
||||
{
|
||||
return Subtitles.Keys;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user