Caller-owned cursor over one published .dnut story.
更多...
#include <RpgDialect.h>
类 | |
| class | Impl |
Public 成员函数 | |
| RpgStorySession () | |
| Rpg story session. | |
| ~RpgStorySession () | |
| Rpg story session. | |
| RpgStorySession (RpgStorySession &&) noexcept | |
| Rpg story session. | |
| RpgStorySession & | operator= (RpgStorySession &&) noexcept |
| Operator =. | |
| RpgStorySession (const RpgStorySession &)=delete | |
| RpgStorySession & | operator= (const RpgStorySession &)=delete |
| eve::Result< void > | begin (const std::string &storyId, RpgStoryBinding *binding) |
| Start a published story and run it to its first suspension point. | |
| eve::Result< void > | begin (const std::string &storyId, GameState *gameState, Party *party, eve::inventory::Bag *bag, eve::inventory::EquipmentSet *equipment) |
| Start a story against the standard RPG objects. | |
| eve::Result< void > | advance () |
Acknowledge the presented move / animation / select / dialogue / message / camera / wait step and continue. | |
| eve::Result< void > | select (const std::string &routeLabel) |
Answer a blocked choice step by its authored label. | |
| eve::Result< void > | resume (eve::Value result) |
| Resume a step whose handler suspended the story. | |
| void | stop () |
| Stop and clear the session. | |
| bool | isActive () const |
| Whether a story is loaded. | |
| bool | isBlocked () const |
| Whether the story is suspended and awaiting acknowledgement. | |
| bool | isWaitingStep () const |
Whether the suspension expects resume rather than advance. | |
| std::string | getStoryId () const |
| Owning copy of the running story id, or an empty string. | |
| std::string | getStepKind () const |
Current step type (move, choice, wait, …), or an empty string. | |
| const eve::Value & | getStepPayload () const |
| Current step payload. | |
| std::vector< std::string > | getChoiceLabels () const |
Authored labels of the current choice step, empty for other step types. | |
| eve::Result< void > | captureState (eve::Value &out) const |
| Capture the complete cursor for persistence. | |
| eve::Result< void > | restoreState (const std::string &storyId, const eve::Value &in, RpgStoryBinding *binding) |
| Restore a captured cursor into a fresh session. | |
详细描述
Caller-owned cursor over one published .dnut story.
The session snapshots the whole catalogue when it begins, so a later hot replacement cannot invalidate an active run. Persistent facts live in RpgStoryBinding::gameState under the self-variable scope story.<id>:
completed(numeric 0/1) records a finished non-repeatable story;cursor(scoped string) holds the opaquecaptureStateJSON while a run is suspended, so F5 mid-story resumes at the same blocked step after load. ExplicitcaptureState/restoreStateremain available for hosts that want to own the blob themselves.
@thread Owner thread only. @reentrancy No callbacks into the session.
在文件 RpgDialect.h 第 275 行定义.
构造及析构函数说明
◆ RpgStorySession() [1/3]
| eve::rpg::RpgStorySession::RpgStorySession | ( | ) |
Rpg story session.
在文件 RpgDialect.cpp 第 643 行定义.
◆ ~RpgStorySession()
|
default |
Rpg story session.
◆ RpgStorySession() [2/3]
|
defaultnoexcept |
Rpg story session.
◆ RpgStorySession() [3/3]
|
delete |
成员函数说明
◆ advance()
| eve::Result< void > eve::rpg::RpgStorySession::advance | ( | ) |
Acknowledge the presented move / animation / select / dialogue / message / camera / wait step and continue.
- 备注
- A
movestep is acknowledged the same way whether it was host-presented or suspended byRpgStoryBinding::moveActorreportingStoryMoveStatus::Travelling: calladvanceonce the actor has actually arrived. A handler that reportsArrivednever suspends the story at all.
在文件 RpgDialect.cpp 第 718 行定义.
引用了 eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::PreconditionViolation , 以及 eve::Result< T >::success().
◆ begin() [1/2]
| eve::Result< void > eve::rpg::RpgStorySession::begin | ( | const std::string & | storyId, |
| GameState * | gameState, | ||
| Party * | party, | ||
| eve::inventory::Bag * | bag, | ||
| eve::inventory::EquipmentSet * | equipment | ||
| ) |
Start a story against the standard RPG objects.
Convenience overload for hosts that do not need a custom actor resolver. The session keeps its own RpgStoryBinding filled from these arguments, so the caller only has to keep the domain objects themselves alive.
- 参数
-
storyId Exact published story id. gameState Switches, variables and completion facts; may be null. party Actor lookup for actor=<memberId>; may be null.bag Bag used by item/equipment; may be null.equipment Equipment set used by equipment; may be null.
在文件 RpgDialect.cpp 第 648 行定义.
引用了 begin , 以及 eve::rpg::RpgStoryBinding::gameState.
◆ begin() [2/2]
| eve::Result< void > eve::rpg::RpgStorySession::begin | ( | const std::string & | storyId, |
| RpgStoryBinding * | binding | ||
| ) |
Start a published story and run it to its first suspension point.
- 参数
-
storyId Exact published story id. binding Borrowed domain objects; may be null for presentation-only stories.
- 返回
- Success, or a structured failure that leaves this session stopped.
在文件 RpgDialect.cpp 第 658 行定义.
引用了 binding, eve::Conflict, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Value::fromJson(), eve::InvariantViolation, message, eve::NotFound, eve::ParseError, scope, started, stop() , 以及 eve::Result< T >::success().
◆ captureState()
| eve::Result< void > eve::rpg::RpgStorySession::captureState | ( | eve::Value & | out | ) | const |
Capture the complete cursor for persistence.
在文件 RpgDialect.cpp 第 788 行定义.
◆ getChoiceLabels()
| std::vector< std::string > eve::rpg::RpgStorySession::getChoiceLabels | ( | ) | const |
Authored labels of the current choice step, empty for other step types.
在文件 RpgDialect.cpp 第 779 行定义.
引用了 node.
◆ getStepKind()
| std::string eve::rpg::RpgStorySession::getStepKind | ( | ) | const |
Current step type (move, choice, wait, …), or an empty string.
在文件 RpgDialect.cpp 第 769 行定义.
引用了 node.
◆ getStepPayload()
| const eve::Value & eve::rpg::RpgStorySession::getStepPayload | ( | ) | const |
Current step payload.
- 返回
- Borrowed reference; an empty object while no step is current. @lifetime Invalidated by the next session transition.
在文件 RpgDialect.cpp 第 774 行定义.
引用了 node.
◆ getStoryId()
| std::string eve::rpg::RpgStorySession::getStoryId | ( | ) | const |
Owning copy of the running story id, or an empty string.
在文件 RpgDialect.cpp 第 767 行定义.
◆ isActive()
| bool eve::rpg::RpgStorySession::isActive | ( | ) | const |
Whether a story is loaded.
在文件 RpgDialect.cpp 第 764 行定义.
◆ isBlocked()
| bool eve::rpg::RpgStorySession::isBlocked | ( | ) | const |
Whether the story is suspended and awaiting acknowledgement.
在文件 RpgDialect.cpp 第 765 行定义.
◆ isWaitingStep()
| bool eve::rpg::RpgStorySession::isWaitingStep | ( | ) | const |
Whether the suspension expects resume rather than advance.
在文件 RpgDialect.cpp 第 766 行定义.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
defaultnoexcept |
Operator =.
◆ restoreState()
| eve::Result< void > eve::rpg::RpgStorySession::restoreState | ( | const std::string & | storyId, |
| const eve::Value & | in, | ||
| RpgStoryBinding * | binding | ||
| ) |
Restore a captured cursor into a fresh session.
- 参数
-
storyId Root story id the cursor was captured from. in Value previously produced by captureState.binding Borrowed domain objects; the runtime does not retain them across turns.
- 返回
- Success, or a structured failure that leaves this session stopped.
在文件 RpgDialect.cpp 第 790 行定义.
引用了 binding, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), message, eve::NotFound, stop() , 以及 eve::Result< T >::success().
◆ resume()
| eve::Result< void > eve::rpg::RpgStorySession::resume | ( | eve::Value | result | ) |
Resume a step whose handler suspended the story.
在文件 RpgDialect.cpp 第 744 行定义.
引用了 eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::PreconditionViolation , 以及 eve::Result< T >::success().
◆ select()
| eve::Result< void > eve::rpg::RpgStorySession::select | ( | const std::string & | routeLabel | ) |
Answer a blocked choice step by its authored label.
在文件 RpgDialect.cpp 第 731 行定义.
引用了 eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::PreconditionViolation , 以及 eve::Result< T >::success().
◆ stop()
| void eve::rpg::RpgStorySession::stop | ( | ) |
该类的文档由以下文件生成:
- src/modules/rpg/RpgDialect.h
- src/modules/rpg/RpgDialect.cpp