Working on translations for dialogs and cutscenes
This commit is contained in:
1 parent
a98f71676d
commit
794a820be9
25 files changed
+3015
-123
No files matched your search
@@ -10,6 +10,14 @@ void CutsceneRuntime::setDatabase(const CutsceneDatabase* value) {
|
||||
database = value;
|
||||
}
|
||||
|
||||
void CutsceneRuntime::setTranslationDatabase(const ZL::Dialogue::TranslationDatabase* value) {
|
||||
translations = value;
|
||||
}
|
||||
|
||||
std::string CutsceneRuntime::tr(const std::string& s) const {
|
||||
return translations ? translations->translate(s, ZL::g_currentLanguage) : s;
|
||||
}
|
||||
|
||||
void CutsceneRuntime::setOnFinished(std::function<void(const std::string&)> cb) {
|
||||
onFinished = std::move(cb);
|
||||
}
|
||||
@@ -329,9 +337,9 @@ void CutsceneRuntime::refreshPresentation() {
|
||||
}
|
||||
|
||||
const CutsceneLine& line = activeCutscene->lines[currentCutsceneLine];
|
||||
presentation.speaker = line.speaker;
|
||||
presentation.fullText = line.text;
|
||||
presentation.visibleText = line.text;
|
||||
presentation.speaker = tr(line.speaker);
|
||||
presentation.fullText = tr(line.text);
|
||||
presentation.visibleText = presentation.fullText;
|
||||
presentation.selectedChoice = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "cutscene/CutsceneDatabase.h"
|
||||
#include "dialogue/DialogueTypes.h"
|
||||
#include "dialogue/TranslationDatabase.h"
|
||||
#include "Localization.h"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
@@ -10,6 +12,7 @@ namespace ZL::Cutscene {
|
||||
class CutsceneRuntime {
|
||||
public:
|
||||
void setDatabase(const CutsceneDatabase* value);
|
||||
void setTranslationDatabase(const ZL::Dialogue::TranslationDatabase* value);
|
||||
|
||||
void setOnFinished(std::function<void(const std::string&)> cb);
|
||||
void setOnLineStarted(std::function<void(const std::string&)> cb);
|
||||
@@ -27,6 +30,7 @@ public:
|
||||
|
||||
private:
|
||||
const CutsceneDatabase* database = nullptr;
|
||||
const ZL::Dialogue::TranslationDatabase* translations = nullptr;
|
||||
|
||||
const StaticCutsceneDefinition* activeCutscene = nullptr;
|
||||
std::string activeCutsceneId;
|
||||
@@ -50,6 +54,7 @@ private:
|
||||
void syncLineToElapsedTime();
|
||||
void advanceLine();
|
||||
void refreshPresentation();
|
||||
std::string tr(const std::string& s) const;
|
||||
|
||||
std::vector<PresentedCutsceneImage> evaluateImages() const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user