17 lines
528 B
Rust
17 lines
528 B
Rust
//! runtime story 写入命令。
|
|
//!
|
|
//! 用于表达剧情动作解析、战斗动作、锻造动作和 NPC 互动等输入。
|
|
|
|
use shared_contracts::runtime_story::RuntimeStoryActionRequest;
|
|
|
|
use crate::read_optional_string_field;
|
|
|
|
pub fn resolve_action_text(default_text: &str, request: &RuntimeStoryActionRequest) -> String {
|
|
request
|
|
.action
|
|
.payload
|
|
.as_ref()
|
|
.and_then(|payload| read_optional_string_field(payload, "optionText"))
|
|
.unwrap_or_else(|| default_text.to_string())
|
|
}
|