载入中...
搜索中...
未找到
eve::dialogue 命名空间参考

类

struct  CommandRequest
 Immutable request emitted by a command node. 更多...
 
struct  CommandResponse
 Structured response to a request emitted by a command node. 更多...
 
struct  ConversationDiagnostic
 Stable diagnostic emitted by dnut compilation, lint, or migration. 更多...
 
class  ConversationDocument
 Mutable, UI-neutral conversation document for custom editor composition. 更多...
 
class  ConversationLocalizationCatalog
 CSV-backed translation and voice recording catalog with default-locale resolution. 更多...
 
struct  ConversationLocalizationEntry
 Runtime translation and voice-production row keyed by stable key and locale. 更多...
 
class  ConversationSaveMigrations
 Explicit save migrations from an old asset version to its current version. 更多...
 
class  ConversationTextRenderer
 Parameter substitution and state-driven character voice modifiers. 更多...
 
class  Dialogue
 Visual-novel style dialogue stage. Script: dlg <- eve.Dialogue(); 更多...
 
struct  DialogueAccountBindings
 Borrowed account bindings used by one DialogueFlow integration. 更多...
 
class  DialogueControl
 Exposes the module's conversation runner through the shared gameplay protocol. 更多...
 
class  DialogueFlow
 Script-facing registry and runner for compiled .dnut conversations. 更多...
 
class  DialoguePaymentAdapter
 Composes Dialogue accounts with StatePatch or Action participants. 更多...
 
class  DialogueStateContext
 Dialogue-owned facade for world reads, unified conditions, and mutations. 更多...
 
class  DialogueStateMutationParticipant
 Transaction participant that delegates an atomic state mutation. 更多...
 
class  DialogueUX
 Presentation state shared by default and custom dialogue UIs. 更多...
 
class  DialogueVoice
 Localized voice assets, duration-based advance, and amplitude lip sync. 更多...
 
struct  DnutDocument
 UI-neutral syntax tree produced by the single dnut parser. 更多...
 
struct  DnutSourceSpan
 Exact source location in a dnut document. 更多...
 
struct  PaymentSpec
 Canonical money/reputation cost attached to a dialogue choice or command. 更多...
 
class  StateEvaluationContext
 Decision EvaluationContext backed by one dialogue subject. 更多...
 

类型定义

using DataValue = eve::Value
 Canonical data value used by dialogue pools, conditions and scripts.
 
using VarValue = eve::Value
 
using CommandRequestHandler = std::function< CommandResponse(const CommandRequest &)>
 Handler implemented by the owning operation or gameplay domain.
 

枚举

enum class  CommandRequestKind : std::uint8_t { Operation , GameplayAction }
 Destination protocol requested by a dialogue command node. 更多...
 

函数

eve::Result< DnutDocument > compileDnutDocument (const std::string &source, const std::string &path, std::vector< ConversationDiagnostic > &diagnostics)
 Compile and lint the complete pools-plus-conversations dnut document.
 
eve::Result< void > lintConversations (const std::vector< eve::dnut::SequenceAsset > &assets, const std::string &path, std::vector< ConversationDiagnostic > &diagnostics)
 Validate references and report unreachable nodes.
 
std::string exportConversationLocalizationCsv (const std::vector< eve::dnut::SequenceAsset > &assets)
 Export stable line IDs and localization keys as RFC4180 CSV.
 
eve::Result< std::vector< eve::dnut::SequenceAsset > > importYarnConversation (const std::string &source, const std::string &path, std::vector< ConversationDiagnostic > &diagnostics)
 Import Yarn Spinner source through the canonical validated conversation schema.
 
eve::Result< std::vector< eve::dnut::SequenceAsset > > importTweeConversation (const std::string &source, const std::string &path, std::vector< ConversationDiagnostic > &diagnostics)
 Import Twee 3 passage source through the canonical validated conversation schema.
 
eve::Result< std::string > conversationStateToJson (const StateValue &state)
 Serialize a dialogue state tree as JSON.
 
eve::Result< StateValue > conversationStateFromJson (const std::string &json)
 Parse a JSON dialogue state tree.
 
eve::Result< void > lintConversationWorkspace (const std::vector< eve::dnut::SequenceAsset > &assets, const std::string &label, std::vector< ConversationDiagnostic > &diagnostics)
 Lint a complete multi-file registry, including cross-asset call targets.
 
eve::Result< void > renameConversationAsset (std::vector< eve::dnut::SequenceAsset > &assets, const std::string &oldId, const std::string &newId)
 Rename an asset and rewrite every cross-asset call target.
 
eve::Result< void > renameConversationNode (std::vector< eve::dnut::SequenceAsset > &assets, const std::string &assetId, const std::string &oldId, const std::string &newId)
 Rename one stable node and rewrite all references inside its asset.
 
 Module_IMPL (Dialogue, new Dialogue())
 
 Module_IMPL (DialogueFlow, new DialogueFlow())
 
std::string sequencePayloadString (const eve::dnut::SequenceNode &node, std::string_view key)
 Read an optional string from a node payload; missing or ill-typed values yield empty.
 
std::string sequenceRoutePayloadString (const eve::dnut::SequenceRoute &route, std::string_view key)
 Read an optional string from a route payload; missing or ill-typed values yield empty.
 
eve::Result< PaymentSpec > decodeSequencePayment (const eve::Value &payload)
 Decode an optional dialogue payment from one canonical payload object.
 
eve::Result< std::vector< eve::StateMutation > > decodeSequenceStateMutations (const eve::Value &payload)
 Decode dialogue state mutations from one canonical payload object.
 
eve::Value encodeSequenceStateMutations (std::span< const eve::StateMutation > mutations)
 Encode dialogue state mutations as the canonical payload array.
 
eve::Result< void > registerDialogueSequenceSteps (eve::dnut::StepKindRegistry &registry)
 Register dialogue's line, choice, and command contracts and validators.
 
eve::Result< void > validateDialogueSequenceAsset (const eve::dnut::SequenceAsset &asset, const eve::dnut::StepKindRegistry &registry)
 Validate every dialogue-owned payload without taking control-flow ownership.
 
eve::Result< CommandRequest > decodeDialogueCommandRequest (const eve::dnut::SequenceCommandRequest &request)
 Adapt an L1 command request to dialogue's transaction-bearing request.
 
eve::Value toCanonicalValue (const eve::StateValue &value)
 Convert the legacy reload value into the canonical common value.
 
eve::StateValue toDialogueStateValue (const eve::Value &value)
 Convert a canonical value to the legacy reload representation.
 
 Module_IMPL (DialogueUX, new DialogueUX())
 
 Module_IMPL (DialogueVoice, new DialogueVoice())
 
eve::Result< DnutDocument > parseDnutDocument (const std::string &source, const std::string &path, std::vector< ConversationDiagnostic > &diagnostics)
 Parse pools and conversations from one versioned dnut token stream.
 
EVENGINE_API_ORCHESTRATION std::uint64_t scriptStateQueryFailures ()
 脚本 state query **失败**(抛错或答案形状不对)的累计次数。
 
EVENGINE_API_ORCHESTRATION void resetScriptStateQueryFailures ()
 把上面的计数归零(测试隔离用)。
 
EVENGINE_API_ORCHESTRATION void declareScriptStateQuerySeam ()
 声明"`IStateQuery` 可以由脚本提供"这条接缝。
 
EVENGINE_API_ORCHESTRATION void withdrawScriptStateQuerySeam ()
 撤回 IStateQuery 接缝与仍然在位的脚本适配器。
 
EVENGINE_API_ORCHESTRATION void declareScriptStateMutationSeam ()
 声明"`IStateMutation` 可以由脚本提供"这条接缝。
 
EVENGINE_API_ORCHESTRATION void withdrawScriptStateMutationSeam ()
 撤回 IStateMutation 接缝与仍然在位的脚本适配器。
 

类型定义说明

◆ CommandRequestHandler

Handler implemented by the owning operation or gameplay domain.

在文件 DialogueState.h 第 63 行定义.

◆ DataValue

Canonical data value used by dialogue pools, conditions and scripts.

These aliases intentionally do not add another storage tree. The factory names and scalar helpers are retained by eve::Value for source-compatible dialogue scripts and tests, while all new cross-module data uses the common deterministic value protocol.

在文件 Dialogue.h 第 37 行定义.

◆ VarValue

在文件 Dialogue.h 第 38 行定义.

枚举类型说明

◆ CommandRequestKind

enum class eve::dialogue::CommandRequestKind : std::uint8_t
strong

Destination protocol requested by a dialogue command node.

枚举值
Operation 
GameplayAction 

在文件 DialogueState.h 第 25 行定义.

函数说明

◆ compileDnutDocument()

EVENGINE_API_ORCHESTRATION eve::Result< DnutDocument > eve::dialogue::compileDnutDocument ( const std::string &  source,
const std::string &  path,
std::vector< ConversationDiagnostic > &  diagnostics 
)

Compile and lint the complete pools-plus-conversations dnut document.

在文件 ConversationCompiler.cpp 第 26 行定义.

引用了 eve::dialogue::DnutDocument::conversations, eve::Result< T >::failure(), lintConversations(), parseDnutDocument(), path, source , 以及 eve::Result< T >::success().

◆ conversationStateFromJson()

EVENGINE_API_ORCHESTRATION eve::Result< StateValue > eve::dialogue::conversationStateFromJson ( const std::string &  json)

◆ conversationStateToJson()

EVENGINE_API_ORCHESTRATION eve::Result< std::string > eve::dialogue::conversationStateToJson ( const StateValue &  state)

◆ declareScriptStateMutationSeam()

EVENGINE_API_ORCHESTRATION void eve::dialogue::declareScriptStateMutationSeam ( )

声明"`IStateMutation` 可以由脚本提供"这条接缝。

脚本对象实现 applyStateMutations(payload):payload 是一张表

{
transactionId = "…", correlationId = "…", causationId = "…",
mutations = [ { subject = "…", key = "gold", kind = "set" | "remove" | "addTag" |
"removeTag" | "addNumber", persistent = false, value = … }, … ],
}

**返回值是"实际改了几条"这个整数**(与原生适配器同一个收据语义:0 条 → NoOp,否则 Applied,transactionId 由适配器从上下文回填)。同一个接口契约要求"先验完再发布": 脚本要么整批生效,要么在改动任何东西之前抛错——抛错会让本次调用失败,且**承诺没有半套状态**。

备注
单实现槽位(消费方用 cap::query),顶掉时写一行 warn。 @cost 一次 map 插入;只在模块构造时调用。

在文件 StateAccessScriptSeam.cpp 第 237 行定义.

引用了 adapter, eve::state::IStateMutation::capabilityName, eve::ScriptProviderRegistry::declareCapability(), handle, eve::ScriptProviderRegistry::instance(), owned, eve::recordLogEvent() , 以及 eve::Result< T >::success().

被这些函数引用 eve::dialogue::Dialogue::Dialogue().

◆ declareScriptStateQuerySeam()

EVENGINE_API_ORCHESTRATION void eve::dialogue::declareScriptStateQuerySeam ( )

声明"`IStateQuery` 可以由脚本提供"这条接缝。

脚本提供方发布一个对象,实现与接口**同名**的六个问询方法(不需要全实现,见下):

class WorldState {
function value(subject, key) { ... } // 通用世界值
function hasTag(subject, tag) { ... } // 精确标签成员
function attribute(subject, key) { ... } // 属性/声望
function resource(subject, key) { ... } // 资源
function state(subject, key) { ... } // 持久世界状态
function authority(subject, scope) { ... } // 只读权限
}
eve.provider.publishFor("eve.state.IStateQuery", "game.world-state", WorldState())
  • 返回 null = **"这一问不归我"**(接口的 nullopt 语义):调用方会继续问下一个 provider。 因此**没实现某个方法也等于"不拥有那一类问题"**,不算错误。
  • hasTag / authority 必须回布尔;value / attribute / resource / state 可以回任意值 (数、串、表、数组都行)。
  • 备注
    **接的是 listener 面**:DialogueState::queryProviders 先问 cap::query 的单实现、 再按优先级问 listener,**第一个给出非空答案的赢**。所以脚本 provider 不会顶掉原生 provider, 而是补在同一张优先级表里(原生可以传更低优先级跑在脚本前面)。注册表按类型路由,per capability 只有一条接缝。由 Dialogue 模块构造时调用。 @cost 一次 map 插入;只在模块构造时调用。

在文件 StateAccessScriptSeam.cpp 第 198 行定义.

引用了 adapter, eve::state::IStateQuery::capabilityName, eve::ScriptProviderRegistry::declareCapability(), handle, eve::ScriptProviderRegistry::instance(), owned , 以及 eve::Result< T >::success().

被这些函数引用 eve::dialogue::Dialogue::Dialogue().

◆ decodeDialogueCommandRequest()

◆ decodeSequencePayment()

EVENGINE_API_ORCHESTRATION eve::Result< PaymentSpec > eve::dialogue::decodeSequencePayment ( const eve::Value &  payload)

◆ decodeSequenceStateMutations()

EVENGINE_API_ORCHESTRATION eve::Result< std::vector< eve::StateMutation > > eve::dialogue::decodeSequenceStateMutations ( const eve::Value &  payload)

Decode dialogue state mutations from one canonical payload object.

在文件 DialogueSequence.cpp 第 126 行定义.

引用了 eve::Diagnostic::error(), eve::Value::find(), index, eve::InvalidArgument, payload , 以及 values.

被这些函数引用 decodeDialogueCommandRequest() , 以及 eve::dialogue::DialogueFlow::select().

◆ encodeSequenceStateMutations()

EVENGINE_API_ORCHESTRATION eve::Value eve::dialogue::encodeSequenceStateMutations ( std::span< const eve::StateMutation >  mutations)

◆ exportConversationLocalizationCsv()

EVENGINE_API_ORCHESTRATION std::string eve::dialogue::exportConversationLocalizationCsv ( const std::vector< eve::dnut::SequenceAsset > &  assets)

Export stable line IDs and localization keys as RFC4180 CSV.

在文件 ConversationCompiler.cpp 第 124 行定义.

引用了 exportConversationLocalizationCsv(), node, output , 以及 sequencePayloadString().

被这些函数引用 exportConversationLocalizationCsv() , 以及 eve::dialogue::DialogueFlow::exportLocalizationCsv().

◆ importTweeConversation()

EVENGINE_API_ORCHESTRATION eve::Result< std::vector< eve::dnut::SequenceAsset > > eve::dialogue::importTweeConversation ( const std::string &  source,
const std::string &  path,
std::vector< ConversationDiagnostic > &  diagnostics 
)

Import Twee 3 passage source through the canonical validated conversation schema.

在文件 ConversationImporter.cpp 第 273 行定义.

引用了 current, eve::Diagnostic::error(), message, number, eve::ParseError, path, raw, source, tags , 以及 text.

被这些函数引用 eve::dialogue::DialogueFlow::importTweeChecked().

◆ importYarnConversation()

EVENGINE_API_ORCHESTRATION eve::Result< std::vector< eve::dnut::SequenceAsset > > eve::dialogue::importYarnConversation ( const std::string &  source,
const std::string &  path,
std::vector< ConversationDiagnostic > &  diagnostics 
)

Import Yarn Spinner source through the canonical validated conversation schema.

在文件 ConversationImporter.cpp 第 262 行定义.

引用了 eve::Diagnostic::error(), message, eve::ParseError, path , 以及 source.

被这些函数引用 eve::dialogue::DialogueFlow::importYarnChecked().

◆ lintConversations()

EVENGINE_API_ORCHESTRATION eve::Result< void > eve::dialogue::lintConversations ( const std::vector< eve::dnut::SequenceAsset > &  assets,
const std::string &  path,
std::vector< ConversationDiagnostic > &  diagnostics 
)

◆ lintConversationWorkspace()

◆ Module_IMPL() [1/4]

eve::dialogue::Module_IMPL ( Dialogue  ,
new   Dialogue() 
)

◆ Module_IMPL() [2/4]

eve::dialogue::Module_IMPL ( DialogueFlow  ,
new   DialogueFlow() 
)

◆ Module_IMPL() [3/4]

eve::dialogue::Module_IMPL ( DialogueUX  ,
new   DialogueUX() 
)

◆ Module_IMPL() [4/4]

eve::dialogue::Module_IMPL ( DialogueVoice  ,
new   DialogueVoice() 
)

◆ parseDnutDocument()

◆ registerDialogueSequenceSteps()

EVENGINE_API_ORCHESTRATION eve::Result< void > eve::dialogue::registerDialogueSequenceSteps ( eve::dnut::StepKindRegistry &  registry)

Register dialogue's line, choice, and command contracts and validators.

在文件 DialogueSequence.cpp 第 161 行定义.

引用了 line, eve::dnut::StepKindRegistry::registerStep(), registry, eve::Result< T >::success() , 以及 validateCommand.

被这些函数引用 eve::dialogue::DialogueFlow::DialogueFlow(), lintConversations() , 以及 parseDnutDocument().

◆ renameConversationAsset()

EVENGINE_API_ORCHESTRATION eve::Result< void > eve::dialogue::renameConversationAsset ( std::vector< eve::dnut::SequenceAsset > &  assets,
const std::string &  oldId,
const std::string &  newId 
)

◆ renameConversationNode()

EVENGINE_API_ORCHESTRATION eve::Result< void > eve::dialogue::renameConversationNode ( std::vector< eve::dnut::SequenceAsset > &  assets,
const std::string &  assetId,
const std::string &  oldId,
const std::string &  newId 
)

◆ resetScriptStateQueryFailures()

EVENGINE_API_ORCHESTRATION void eve::dialogue::resetScriptStateQueryFailures ( )

把上面的计数归零(测试隔离用)。

在文件 StateAccessScriptSeam.cpp 第 196 行定义.

◆ scriptStateQueryFailures()

EVENGINE_API_ORCHESTRATION std::uint64_t eve::dialogue::scriptStateQueryFailures ( )

脚本 state query **失败**(抛错或答案形状不对)的累计次数。

IStateQuery 的每个方法只回 optional——**没有失败通道**,而 nullopt 的语义是"不拥有"。 所以一次真失败只能按"不拥有"返回(否则整条条件链会因为一个 provider 而崩),同时**计数 + 上报**: 与地块碰撞 sink 同一条理由,让"脚本没接上"和"脚本每次都失败"分得开。

返回
进程内累计值;resetScriptStateQueryFailures() 归零,供测试隔离。

在文件 StateAccessScriptSeam.cpp 第 194 行定义.

◆ sequencePayloadString()

◆ sequenceRoutePayloadString()

EVENGINE_API_ORCHESTRATION std::string eve::dialogue::sequenceRoutePayloadString ( const eve::dnut::SequenceRoute &  route,
std::string_view  key 
)

Read an optional string from a route payload; missing or ill-typed values yield empty.

在文件 DialogueSequence.cpp 第 113 行定义.

引用了 eve::Value::find(), eve::Value::isString(), key, eve::dnut::SequenceRoute::payload , 以及 value.

被这些函数引用 eve::dialogue::DialogueFlow::getRouteText() , 以及 eve::dialogue::DialogueFlow::lintAllChecked().

◆ toCanonicalValue()

◆ toDialogueStateValue()

EVENGINE_API_ORCHESTRATION eve::StateValue eve::dialogue::toDialogueStateValue ( const eve::Value &  value)

Convert a canonical value to the legacy reload representation.

参数
valueOwned common value; it is not retained.
返回
An owning StateValue used by the existing persistence facade.

在文件 DialogueState.cpp 第 225 行定义.

引用了 eve::toLegacyStateValue() , 以及 value.

被这些函数引用 eve::dialogue::DialogueFlow::captureStateChecked().

◆ validateDialogueSequenceAsset()

EVENGINE_API_ORCHESTRATION eve::Result< void > eve::dialogue::validateDialogueSequenceAsset ( const eve::dnut::SequenceAsset &  asset,
const eve::dnut::StepKindRegistry &  registry 
)

Validate every dialogue-owned payload without taking control-flow ownership.

在文件 DialogueSequence.cpp 第 195 行定义.

引用了 eve::Diagnostic::error(), graph, eve::InvalidArgument, node, eve::dnut::SequenceAsset::nodes, registry, eve::Result< T >::success() , 以及 eve::dnut::SequenceAsset::validate().

被这些函数引用 lintConversations().

◆ withdrawScriptStateMutationSeam()

EVENGINE_API_ORCHESTRATION void eve::dialogue::withdrawScriptStateMutationSeam ( )

◆ withdrawScriptStateQuerySeam()

EVENGINE_API_ORCHESTRATION void eve::dialogue::withdrawScriptStateQuerySeam ( )