Dialog is const class only sound is lazy loaded.
Definition at line 14 of file Dialog.h.
Public Member Functions | |
Dialog (const std::string &lang, const std::string &soundfile, const std::string &subtitle) | |
Create new dialog. | |
virtual | ~Dialog () |
bool | isSpeechless () const |
int | talk (int volume, int loops=0) const |
Run dialog. | |
virtual void | runSubtitle (const StringTool::t_args &args) const |
Override this method to run subtitles. | |
std::string | getLang () const |
std::string | getSubtitle () const |
std::string | getFormatedSubtitle (const StringTool::t_args &args) const |
Replace 1, 2, . | |
int | getMinTime () const |
Minimal time according subtitle length. | |
bool | equalSound (const Mix_Chunk *other) const |
Static Public Attributes | |
static const std::string | DEFAULT_LANG = "en" |
|
Create new dialog. Both sound file and subtitles are optional. Definition at line 23 of file Dialog.cpp. 00025 : m_soundfile(soundfile), m_lang(lang), m_subtitle(subtitle) 00026 { 00027 m_sound = NULL; 00028 }
|
|
Definition at line 30 of file Dialog.cpp. 00031 {
00032 if (m_sound) {
00033 Mix_FreeChunk(m_sound);
00034 }
00035 }
|
|
Definition at line 35 of file Dialog.h. 00036 { return m_sound == other; }
|
|
Replace 1, 2, . .. with the arguments. NOTE: 0 is not expanded Definition at line 72 of file Dialog.cpp. 00073 { 00074 std::string buffer = m_subtitle; 00075 for (unsigned int i = 1; i < args.size(); ++i) { 00076 StringTool::replace(buffer, 00077 "%" + StringTool::toString(i), args[i]); 00078 } 00079 return buffer; 00080 }
|
|
Definition at line 30 of file Dialog.h. 00030 { return m_lang; }
|
|
Minimal time according subtitle length.
Definition at line 87 of file Dialog.cpp. 00088 { 00089 return min(180, m_subtitle.size()); 00090 }
|
|
Definition at line 31 of file Dialog.h. 00031 { return m_subtitle; }
|
|
Definition at line 27 of file Dialog.h. 00027 { return m_soundfile.empty(); }
|
|
Override this method to run subtitles.
Reimplemented in FishDialog. Definition at line 61 of file Dialog.cpp. 00062 { 00063 LOG_INFO(ExInfo("subtitle") 00064 .addInfo("content", getFormatedSubtitle(args))); 00065 }
|
|
Run dialog. Do lazy loading of sound.
Definition at line 46 of file Dialog.cpp. 00047 { 00048 if (NULL == m_sound && !m_soundfile.empty()) { 00049 Path soundPath = Path::dataReadPath(m_soundfile); 00050 m_sound = ResSoundPack::loadSound(soundPath); 00051 } 00052 00053 int channel = SoundAgent::agent()->playSound(m_sound, volume, loops); 00054 return channel; 00055 }
|
|
Definition at line 17 of file Dialog.cpp. |