Visual-novel style dialogue stage. Script: dlg <- eve.Dialogue();
更多...
#include <Dialogue.h>
类 | |
| struct | VarValue |
Public 成员函数 | |
| Module_REG (Dialogue) | |
| Dialogue () | |
| ~Dialogue () override | |
| bool | registerCharacter (const std::string &id, const std::string &displayName) |
| 角色:注册 / 查询 / 绑定 Avatar。 | |
| bool | hasCharacter (const std::string &id) const |
| std::string | getDisplayName (const std::string &id) const |
| bool | bindAvatar (const std::string &id, avatar::AvatarInstance *av) |
| avatar::AvatarInstance * | getAvatar (const std::string &id) const |
| int | getCharacterCount () const |
| std::string | getCharacterId (int index) const |
| bool | show (const std::string &id, const std::string &slot) |
| 舞台:显示/隐藏角色、槽位与表情/动作。 | |
| bool | hide (const std::string &id) |
| bool | isShown (const std::string &id) const |
| std::string | getSlot (const std::string &id) const |
| void | setSlotX (const std::string &slot, float xNorm) |
| float | getSlotX (const std::string &slot) const |
| bool | setExpression (const std::string &id, const std::string &expression) |
| bool | setMotion (const std::string &id, const std::string &motion) |
| void | syncStage (float stageWidth, float stageHeight) |
| void | say (const std::string &speakerId, const std::string &text) |
| 台词:说话/旁白、打字机效果与推进。 | |
| void | narrate (const std::string &text) |
| void | setTypeSpeed (float charsPerSecond) |
| float | getTypeSpeed () const |
| void | skipTyping () |
| bool | isTyping () const |
| bool | isWaitingAdvance () const |
| bool | isIdle () const |
| void | advance () |
| std::string | getSpeakerId () const |
| std::string | getSpeakerName () const |
| std::string | getFullText () const |
| std::string | getVisibleText () const |
| std::string | getPhase () const |
| void | setLipSyncEnabled (bool enabled) |
| 口型同步:打字时驱动说话者 Avatar 参数。 | |
| bool | isLipSyncEnabled () const |
| void | setLipSyncParameter (const std::string &name) |
| std::string | getLipSyncParameter () const |
| void | setLipSyncAmplitude (float amplitude) |
| float | getLipSyncAmplitude () const |
| float | getLipSyncValue () const |
| void | clearChoices () |
| 选项:清空/添加/展示与选择。 | |
| bool | addChoice (const std::string &id, const std::string &label) |
| void | presentChoices () |
| bool | isWaitingChoice () const |
| int | getChoiceCount () const |
| std::string | getChoiceId (int index) const |
| std::string | getChoiceLabel (int index) const |
| bool | selectChoice (int index) |
| std::string | getSelectedChoiceId () const |
| bool | setVar (const std::string &name, ssq::Object value, const std::string &scope) |
| bool | setVarValue (const std::string &name, const VarValue &value, const std::string &scope) |
| VarValue | getVarValue (const std::string &name, const std::string &scope) const |
| std::string | getVarType (const std::string &name, const std::string &scope) const |
| int | getVarInt (const std::string &name, int defaultValue, const std::string &scope) const |
| float | getVarFloat (const std::string &name, float defaultValue, const std::string &scope) const |
| bool | getVarBool (const std::string &name, bool defaultValue, const std::string &scope) const |
| std::string | getVarString (const std::string &name, const std::string &defaultValue, const std::string &scope) const |
| bool | hasVar (const std::string &name, const std::string &scope) const |
| bool | clearVar (const std::string &name, const std::string &scope) |
| void | clearVars (const std::string &scope) |
| bool | registerCondition (const std::string &name, ssq::Object fn) |
| bool | unregisterCondition (const std::string &name) |
| bool | evalCondition (ssq::Object table) |
| bool | evalConditionData (const DataValue &cond) |
| int | loadPoolsFromTable (ssq::Object table) |
| int | loadPoolsFromData (const DataValue &root) |
| int | loadPoolsFromDnut (const std::string &source, const std::string &path) |
| int | loadPoolsFromDnutFile (const std::string &path) |
| void | clearPools () |
| int | getPoolCount () const |
| std::string | getPoolId (int index) const |
| bool | hasPool (const std::string &id) const |
| std::string | getLastPoolsError () const |
| void | setRandomSeed (int seed) |
| int | getRandomSeed () const |
| std::string | pickLine (const std::string &poolId, ssq::Object params) |
| std::string | pickLineWithParams (const std::string &poolId, const std::unordered_map< std::string, VarValue > ¶ms) |
| bool | playLine (const std::string &lineId, ssq::Object params) |
| bool | playLineWithParams (const std::string &lineId, const std::unordered_map< std::string, VarValue > ¶ms) |
| bool | playPool (const std::string &poolId, ssq::Object params) |
| bool | playPoolWithParams (const std::string &poolId, const std::unordered_map< std::string, VarValue > ¶ms) |
| std::string | getCurrentLineId () const |
| std::string | getCurrentLineMeta (const std::string &field) const |
| std::vector< std::string > | getCurrentLineTags () const |
| void | update (float dt) |
| 推进打字机 / 口型同步 / 阶段机;每帧调用。 | |
| void | reset () |
| 重置舞台与台词状态。 | |
| bool | captureState (StateValue &out) const |
| Serialize conversation state (vars, rng, phase, choices, stage). | |
| bool | restoreState (const StateValue &in, std::string *err=nullptr) |
| Restore conversation state captured by captureState(). | |
| bool | resetToDefaults () |
| Reset stage and line state (restore fallback). | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| virtual std::string | getName () const =0 |
详细描述
Visual-novel style dialogue stage. Script: dlg <- eve.Dialogue();
Dialogue scripts remain Squirrel (functions / generators). This module only owns speaker lines, typewriter, choices, and avatar stage slots.
在文件 Dialogue.h 第 92 行定义.
构造及析构函数说明
◆ Dialogue()
| eve::dialogue::Dialogue::Dialogue | ( | ) |
在文件 Dialogue.cpp 第 316 行定义.
◆ ~Dialogue()
|
override |
在文件 Dialogue.cpp 第 318 行定义.
成员函数说明
◆ addChoice()
| bool eve::dialogue::Dialogue::addChoice | ( | const std::string & | id, |
| const std::string & | label | ||
| ) |
在文件 Dialogue.cpp 第 1242 行定义.
引用了 id.
◆ advance()
| void eve::dialogue::Dialogue::advance | ( | ) |
在文件 Dialogue.cpp 第 1201 行定义.
引用了 skipTyping().
◆ bindAvatar()
| bool eve::dialogue::Dialogue::bindAvatar | ( | const std::string & | id, |
| avatar::AvatarInstance * | av | ||
| ) |
在文件 Dialogue.cpp 第 1074 行定义.
引用了 c.
◆ captureState()
| bool eve::dialogue::Dialogue::captureState | ( | StateValue & | out | ) | const |
Serialize conversation state (vars, rng, phase, choices, stage).
在文件 Dialogue.cpp 第 1351 行定义.
引用了 eve::StateValue::array(), eve::StateValue::boolean(), c, getPhase(), eve::StateValue::integer(), eve::StateValue::number(), eve::StateValue::object(), eve::StateValue::pushBack(), eve::StateValue::set() , 以及 eve::StateValue::string().
◆ clearChoices()
| void eve::dialogue::Dialogue::clearChoices | ( | ) |
选项:清空/添加/展示与选择。
在文件 Dialogue.cpp 第 1237 行定义.
◆ clearPools()
| void eve::dialogue::Dialogue::clearPools | ( | ) |
在文件 Dialogue.cpp 第 823 行定义.
◆ clearVar()
| bool eve::dialogue::Dialogue::clearVar | ( | const std::string & | name, |
| const std::string & | scope | ||
| ) |
在文件 Dialogue.cpp 第 411 行定义.
◆ clearVars()
| void eve::dialogue::Dialogue::clearVars | ( | const std::string & | scope | ) |
在文件 Dialogue.cpp 第 416 行定义.
引用了 scope.
◆ evalCondition()
| bool eve::dialogue::Dialogue::evalCondition | ( | ssq::Object | table | ) |
在文件 Dialogue.cpp 第 454 行定义.
引用了 evalConditionData() , 以及 v.
◆ evalConditionData()
| bool eve::dialogue::Dialogue::evalConditionData | ( | const DataValue & | cond | ) |
◆ getAvatar()
| avatar::AvatarInstance * eve::dialogue::Dialogue::getAvatar | ( | const std::string & | id | ) | const |
在文件 Dialogue.cpp 第 1081 行定义.
引用了 c.
◆ getCharacterCount()
| int eve::dialogue::Dialogue::getCharacterCount | ( | ) | const |
在文件 Dialogue.cpp 第 1086 行定义.
◆ getCharacterId()
| std::string eve::dialogue::Dialogue::getCharacterId | ( | int | index | ) | const |
在文件 Dialogue.cpp 第 1088 行定义.
◆ getChoiceCount()
| int eve::dialogue::Dialogue::getChoiceCount | ( | ) | const |
在文件 Dialogue.cpp 第 1265 行定义.
◆ getChoiceId()
| std::string eve::dialogue::Dialogue::getChoiceId | ( | int | index | ) | const |
在文件 Dialogue.cpp 第 1267 行定义.
◆ getChoiceLabel()
| std::string eve::dialogue::Dialogue::getChoiceLabel | ( | int | index | ) | const |
在文件 Dialogue.cpp 第 1272 行定义.
◆ getCurrentLineId()
|
inline |
在文件 Dialogue.h 第 226 行定义.
◆ getCurrentLineMeta()
| std::string eve::dialogue::Dialogue::getCurrentLineMeta | ( | const std::string & | field | ) | const |
在文件 Dialogue.cpp 第 1011 行定义.
◆ getCurrentLineTags()
| std::vector< std::string > eve::dialogue::Dialogue::getCurrentLineTags | ( | ) | const |
在文件 Dialogue.cpp 第 1016 行定义.
◆ getDisplayName()
| std::string eve::dialogue::Dialogue::getDisplayName | ( | const std::string & | id | ) | const |
◆ getFullText()
|
inline |
在文件 Dialogue.h 第 132 行定义.
◆ getLastPoolsError()
|
inline |
在文件 Dialogue.h 第 209 行定义.
◆ getLipSyncAmplitude()
|
inline |
在文件 Dialogue.h 第 142 行定义.
◆ getLipSyncParameter()
|
inline |
在文件 Dialogue.h 第 140 行定义.
◆ getLipSyncValue()
|
inline |
在文件 Dialogue.h 第 143 行定义.
◆ getPhase()
| std::string eve::dialogue::Dialogue::getPhase | ( | ) | const |
在文件 Dialogue.cpp 第 1223 行定义.
被这些函数引用 captureState().
◆ getPoolCount()
| int eve::dialogue::Dialogue::getPoolCount | ( | ) | const |
在文件 Dialogue.cpp 第 825 行定义.
◆ getPoolId()
| std::string eve::dialogue::Dialogue::getPoolId | ( | int | index | ) | const |
在文件 Dialogue.cpp 第 827 行定义.
◆ getRandomSeed()
|
inline |
在文件 Dialogue.h 第 214 行定义.
◆ getSelectedChoiceId()
|
inline |
在文件 Dialogue.h 第 154 行定义.
◆ getSlot()
| std::string eve::dialogue::Dialogue::getSlot | ( | const std::string & | id | ) | const |
在文件 Dialogue.cpp 第 1115 行定义.
引用了 c.
◆ getSlotX()
| float eve::dialogue::Dialogue::getSlotX | ( | const std::string & | slot | ) | const |
在文件 Dialogue.cpp 第 1125 行定义.
被这些函数引用 syncStage().
◆ getSpeakerId()
|
inline |
在文件 Dialogue.h 第 130 行定义.
◆ getSpeakerName()
| std::string eve::dialogue::Dialogue::getSpeakerName | ( | ) | const |
在文件 Dialogue.cpp 第 1209 行定义.
引用了 getDisplayName().
◆ getTypeSpeed()
|
inline |
在文件 Dialogue.h 第 123 行定义.
◆ getVarBool()
| bool eve::dialogue::Dialogue::getVarBool | ( | const std::string & | name, |
| bool | defaultValue, | ||
| const std::string & | scope | ||
| ) | const |
◆ getVarFloat()
| float eve::dialogue::Dialogue::getVarFloat | ( | const std::string & | name, |
| float | defaultValue, | ||
| const std::string & | scope | ||
| ) | const |
◆ getVarInt()
| int eve::dialogue::Dialogue::getVarInt | ( | const std::string & | name, |
| int | defaultValue, | ||
| const std::string & | scope | ||
| ) | const |
◆ getVarString()
| std::string eve::dialogue::Dialogue::getVarString | ( | const std::string & | name, |
| const std::string & | defaultValue, | ||
| const std::string & | scope | ||
| ) | const |
在文件 Dialogue.cpp 第 400 行定义.
引用了 getVarValue(), name, scope, eve::dialogue::Dialogue::VarValue::String , 以及 v.
◆ getVarType()
| std::string eve::dialogue::Dialogue::getVarType | ( | const std::string & | name, |
| const std::string & | scope | ||
| ) | const |
在文件 Dialogue.cpp 第 370 行定义.
引用了 getVarValue(), hasVar(), name, scope , 以及 eve::dialogue::Dialogue::VarValue::typeName().
◆ getVarValue()
| Dialogue::VarValue eve::dialogue::Dialogue::getVarValue | ( | const std::string & | name, |
| const std::string & | scope | ||
| ) | const |
在文件 Dialogue.cpp 第 363 行定义.
引用了 m, name, scope , 以及 eve::dialogue::Dialogue::VarValue::string().
被这些函数引用 getVarBool(), getVarFloat(), getVarInt(), getVarString() , 以及 getVarType().
◆ getVisibleText()
| std::string eve::dialogue::Dialogue::getVisibleText | ( | ) | const |
在文件 Dialogue.cpp 第 1214 行定义.
引用了 n, eve::utf8_byte_offset_for_codepoints() , 以及 eve::utf8_codepoint_count().
◆ hasCharacter()
| bool eve::dialogue::Dialogue::hasCharacter | ( | const std::string & | id | ) | const |
在文件 Dialogue.cpp 第 1067 行定义.
◆ hasPool()
| bool eve::dialogue::Dialogue::hasPool | ( | const std::string & | id | ) | const |
在文件 Dialogue.cpp 第 832 行定义.
◆ hasVar()
| bool eve::dialogue::Dialogue::hasVar | ( | const std::string & | name, |
| const std::string & | scope | ||
| ) | const |
◆ hide()
| bool eve::dialogue::Dialogue::hide | ( | const std::string & | id | ) |
在文件 Dialogue.cpp 第 1102 行定义.
引用了 c.
◆ isIdle()
| bool eve::dialogue::Dialogue::isIdle | ( | ) | const |
在文件 Dialogue.cpp 第 1199 行定义.
◆ isLipSyncEnabled()
|
inline |
在文件 Dialogue.h 第 138 行定义.
◆ isShown()
| bool eve::dialogue::Dialogue::isShown | ( | const std::string & | id | ) | const |
在文件 Dialogue.cpp 第 1110 行定义.
引用了 c.
◆ isTyping()
| bool eve::dialogue::Dialogue::isTyping | ( | ) | const |
在文件 Dialogue.cpp 第 1195 行定义.
◆ isWaitingAdvance()
| bool eve::dialogue::Dialogue::isWaitingAdvance | ( | ) | const |
在文件 Dialogue.cpp 第 1197 行定义.
◆ isWaitingChoice()
| bool eve::dialogue::Dialogue::isWaitingChoice | ( | ) | const |
在文件 Dialogue.cpp 第 1263 行定义.
◆ loadPoolsFromData()
| int eve::dialogue::Dialogue::loadPoolsFromData | ( | const DataValue & | root | ) |
在文件 Dialogue.cpp 第 744 行定义.
引用了 eve::dialogue::DataValue::arr, eve::dialogue::DataValue::Array, error, eve::dialogue::DataValue::find(), eve::dialogue::DataValue::Float, eve::dialogue::DataValue::Int, eve::dialogue::DataValue::kind, line, eve::dialogue::DataValue::obj , 以及 eve::dialogue::DataValue::Object.
被这些函数引用 loadPoolsFromDnut() , 以及 loadPoolsFromTable().
◆ loadPoolsFromDnut()
| int eve::dialogue::Dialogue::loadPoolsFromDnut | ( | const std::string & | source, |
| const std::string & | path | ||
| ) |
解析 .dnut 源码并注册台词池;path 用于错误信息(可传 "")。
在文件 Dialogue.cpp 第 792 行定义.
引用了 error, loadPoolsFromData() , 以及 eve::dialogue::parseDnut().
被这些函数引用 loadPoolsFromDnutFile().
◆ loadPoolsFromDnutFile()
| int eve::dialogue::Dialogue::loadPoolsFromDnutFile | ( | const std::string & | path | ) |
读取 .dnut 文件并解析注册(经 eve.Filesystem)。
在文件 Dialogue.cpp 第 802 行定义.
引用了 eve::filesystem::FileData::getData(), eve::filesystem::FileData::getSize() , 以及 loadPoolsFromDnut().
◆ loadPoolsFromTable()
| int eve::dialogue::Dialogue::loadPoolsFromTable | ( | ssq::Object | table | ) |
在文件 Dialogue.cpp 第 660 行定义.
引用了 loadPoolsFromData().
◆ Module_REG()
| eve::dialogue::Dialogue::Module_REG | ( | Dialogue | ) |
◆ narrate()
| void eve::dialogue::Dialogue::narrate | ( | const std::string & | text | ) |
在文件 Dialogue.cpp 第 1184 行定义.
被这些函数引用 playLineWithParams().
◆ pickLine()
| std::string eve::dialogue::Dialogue::pickLine | ( | const std::string & | poolId, |
| ssq::Object | params | ||
| ) |
在文件 Dialogue.cpp 第 921 行定义.
引用了 p , 以及 pickLineWithParams().
◆ pickLineWithParams()
| std::string eve::dialogue::Dialogue::pickLineWithParams | ( | const std::string & | poolId, |
| const std::unordered_map< std::string, VarValue > & | params | ||
| ) |
◆ playLine()
| bool eve::dialogue::Dialogue::playLine | ( | const std::string & | lineId, |
| ssq::Object | params | ||
| ) |
在文件 Dialogue.cpp 第 969 行定义.
引用了 p , 以及 playLineWithParams().
◆ playLineWithParams()
| bool eve::dialogue::Dialogue::playLineWithParams | ( | const std::string & | lineId, |
| const std::unordered_map< std::string, VarValue > & | params | ||
| ) |
在文件 Dialogue.cpp 第 975 行定义.
引用了 line, narrate() , 以及 say().
被这些函数引用 playLine() , 以及 playPoolWithParams().
◆ playPool()
| bool eve::dialogue::Dialogue::playPool | ( | const std::string & | poolId, |
| ssq::Object | params | ||
| ) |
在文件 Dialogue.cpp 第 999 行定义.
引用了 p , 以及 playPoolWithParams().
◆ playPoolWithParams()
| bool eve::dialogue::Dialogue::playPoolWithParams | ( | const std::string & | poolId, |
| const std::unordered_map< std::string, VarValue > & | params | ||
| ) |
在文件 Dialogue.cpp 第 1005 行定义.
引用了 pickLineWithParams() , 以及 playLineWithParams().
被这些函数引用 playPool().
◆ presentChoices()
| void eve::dialogue::Dialogue::presentChoices | ( | ) |
在文件 Dialogue.cpp 第 1254 行定义.
引用了 skipTyping().
◆ registerCharacter()
| bool eve::dialogue::Dialogue::registerCharacter | ( | const std::string & | id, |
| const std::string & | displayName | ||
| ) |
◆ registerCondition()
| bool eve::dialogue::Dialogue::registerCondition | ( | const std::string & | name, |
| ssq::Object | fn | ||
| ) |
Register a Squirrel predicate: fn(ctx) -> bool, ctx = {vars, params, lineId}.
在文件 Dialogue.cpp 第 431 行定义.
引用了 fn, name , 以及 unregisterCondition().
◆ reset()
| void eve::dialogue::Dialogue::reset | ( | ) |
◆ resetToDefaults()
| bool eve::dialogue::Dialogue::resetToDefaults | ( | ) |
◆ restoreState()
| bool eve::dialogue::Dialogue::restoreState | ( | const StateValue & | in, |
| std::string * | err = nullptr |
||
| ) |
Restore conversation state captured by captureState().
- 返回
- false when the captured state is malformed; the reload session then falls back to resetToDefaults().
在文件 Dialogue.cpp 第 1399 行定义.
引用了 eve::StateValue::asString(), eve::StateValue::at(), c, eve::StateValue::find(), id, eve::StateValue::isArray(), eve::StateValue::isBool(), eve::StateValue::isInt(), eve::StateValue::isObject(), eve::StateValue::isString(), name, v , 以及 vars.
◆ say()
| void eve::dialogue::Dialogue::say | ( | const std::string & | speakerId, |
| const std::string & | text | ||
| ) |
◆ selectChoice()
| bool eve::dialogue::Dialogue::selectChoice | ( | int | index | ) |
在文件 Dialogue.cpp 第 1277 行定义.
◆ setExpression()
| bool eve::dialogue::Dialogue::setExpression | ( | const std::string & | id, |
| const std::string & | expression | ||
| ) |
在文件 Dialogue.cpp 第 1134 行定义.
引用了 c.
◆ setLipSyncAmplitude()
| void eve::dialogue::Dialogue::setLipSyncAmplitude | ( | float | amplitude | ) |
在文件 Dialogue.cpp 第 1291 行定义.
◆ setLipSyncEnabled()
| void eve::dialogue::Dialogue::setLipSyncEnabled | ( | bool | enabled | ) |
◆ setLipSyncParameter()
| void eve::dialogue::Dialogue::setLipSyncParameter | ( | const std::string & | name | ) |
在文件 Dialogue.cpp 第 1287 行定义.
引用了 name.
◆ setMotion()
| bool eve::dialogue::Dialogue::setMotion | ( | const std::string & | id, |
| const std::string & | motion | ||
| ) |
在文件 Dialogue.cpp 第 1141 行定义.
引用了 c.
◆ setRandomSeed()
| void eve::dialogue::Dialogue::setRandomSeed | ( | int | seed | ) |
Reseed the weighted picker; also resets per-pool no-repeat history.
在文件 Dialogue.cpp 第 916 行定义.
◆ setSlotX()
| void eve::dialogue::Dialogue::setSlotX | ( | const std::string & | slot, |
| float | xNorm | ||
| ) |
在文件 Dialogue.cpp 第 1120 行定义.
◆ setTypeSpeed()
| void eve::dialogue::Dialogue::setTypeSpeed | ( | float | charsPerSecond | ) |
在文件 Dialogue.cpp 第 1186 行定义.
◆ setVar()
| bool eve::dialogue::Dialogue::setVar | ( | const std::string & | name, |
| ssq::Object | value, | ||
| const std::string & | scope | ||
| ) |
Squirrel-facing setter: value may be int/float/bool/string.
在文件 Dialogue.cpp 第 352 行定义.
◆ setVarValue()
| bool eve::dialogue::Dialogue::setVarValue | ( | const std::string & | name, |
| const VarValue & | value, | ||
| const std::string & | scope | ||
| ) |
◆ show()
| bool eve::dialogue::Dialogue::show | ( | const std::string & | id, |
| const std::string & | slot | ||
| ) |
◆ skipTyping()
| void eve::dialogue::Dialogue::skipTyping | ( | ) |
在文件 Dialogue.cpp 第 1188 行定义.
引用了 eve::utf8_codepoint_count().
被这些函数引用 advance() , 以及 presentChoices().
◆ syncStage()
| void eve::dialogue::Dialogue::syncStage | ( | float | stageWidth, |
| float | stageHeight | ||
| ) |
Place visible avatars using normalized slot X * stageWidth.
在文件 Dialogue.cpp 第 1148 行定义.
引用了 c, getSlotX() , 以及 x.
◆ unregisterCondition()
| bool eve::dialogue::Dialogue::unregisterCondition | ( | const std::string & | name | ) |
◆ update()
| void eve::dialogue::Dialogue::update | ( | float | dt | ) |
该类的文档由以下文件生成:
- src/modules/dialogue/Dialogue.h
- src/modules/dialogue/Dialogue.cpp
Public 成员函数 继承自