载入中...
搜索中...
未找到
eve::tactics::InteractionSession类 参考final

A disposable, non-authoritative interaction session. 更多...

#include <Interaction.h>

Public 成员函数

InteractionState state () const noexcept
 Current player-facing state.
 
const InteractionContext & context () const noexcept
 The context this session was created from.
 
const LogicalId & armedAction () const noexcept
 The ability currently armed, or an invalid id when none is.
 
Result< InteractionIntent > onCellClicked (Cell cell)
 Resolve a click on one cell into an intention.
 
Result< void > armAbility (const LogicalId &action, std::vector< Cell > targetableCells)
 Arm an ability so the next click selects its target.
 
Result< InteractionIntent > onCancel ()
 Drop any selection or armed ability, reporting it as a Cancel intent.
 
Result< InteractionIntent > onEndTurn ()
 Ask to end the controlled unit's activation.
 
Result< void > markResolving ()
 Record that the caller is committing the intent it just received.
 
Result< void > resolve ()
 Return to AwaitSelection after a commit succeeded, failed or was dropped.
 

静态 Public 成员函数

static InteractionSession create (InteractionContext context)
 Start a session from an immutable context.
 

详细描述

A disposable, non-authoritative interaction session.

The session holds only the player-facing state (what is selected, what is armed). The authoritative battle owns nothing here, so a session may be dropped and rebuilt from a fresh context at any time — which is what makes it safe for a UI to keep one per client.

@thread Affine to the caller; it has no internal synchronization and touches no shared state, so two clients may each drive their own copy of the same context. @reentrancy Handlers do not invoke callbacks.

在文件 Interaction.h 第 128 行定义.

成员函数说明

◆ armAbility()

Result< void > eve::tactics::InteractionSession::armAbility ( const LogicalId &  action,
std::vector< Cell >  targetableCells 
)

Arm an ability so the next click selects its target.

参数
actionAbility identity the caller's rule set reported as usable.
targetableCellsCells that ability may land on, already filtered by the caller's own rules (range, line of sight, resources).
返回
Applied, or a refusal when the session cannot accept input or the ability id is invalid. targetableCells may be empty: arming is allowed, and every click then resolves to None, which is how a UI shows "this ability has no legal target right now" without inventing a failure.

在文件 Interaction.cpp 第 127 行定义.

引用了 action, eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::PreconditionViolation, eve::Status::success() , 以及 eve::Result< T >::success().

◆ armedAction()

const LogicalId & eve::tactics::InteractionSession::armedAction ( ) const
inlinenoexcept

The ability currently armed, or an invalid id when none is.

在文件 Interaction.h 第 147 行定义.

◆ context()

const InteractionContext & eve::tactics::InteractionSession::context ( ) const
inlinenoexcept

The context this session was created from.

在文件 Interaction.h 第 145 行定义.

◆ create()

InteractionSession eve::tactics::InteractionSession::create ( InteractionContext  context)
static

Start a session from an immutable context.

返回
The session, whose initial state is derived from the context and never stored twice. A battle that is not running or not in acting starts Blocked; a finished battle starts Ended; a session that drives a unit other than the active one also starts Blocked. A session that cannot act reports it through state rather than through a failing factory, so a UI can hold one session across turns instead of rebuilding it defensively.

在文件 Interaction.cpp 第 61 行定义.

引用了 context.

◆ markResolving()

Result< void > eve::tactics::InteractionSession::markResolving ( )

Record that the caller is committing the intent it just received.

返回
Applied (state Resolving) or a refusal when there is no pending intent.
备注
The session stays non-authoritative: this only tells the machine that the intent is in flight, so a second click is refused instead of queueing a contradictory intention behind a commit that may yet fail.

在文件 Interaction.cpp 第 188 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation, eve::Status::success() , 以及 eve::Result< T >::success().

◆ onCancel()

Result< InteractionIntent > eve::tactics::InteractionSession::onCancel ( )

Drop any selection or armed ability, reporting it as a Cancel intent.

在文件 Interaction.cpp 第 142 行定义.

引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation , 以及 eve::Result< T >::success().

◆ onCellClicked()

Result< InteractionIntent > eve::tactics::InteractionSession::onCellClicked ( Cell  cell)

Resolve a click on one cell into an intention.

返回
The intent, or a structured refusal when the machine cannot accept input at all: blocked, or ended. A click with no meaning in the current state yields InteractionIntentKind::None rather than a failure: "the player clicked an empty hex" is normal, not an error.

在文件 Interaction.cpp 第 88 行定义.

引用了 cell, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation , 以及 eve::Result< T >::success().

◆ onEndTurn()

Result< InteractionIntent > eve::tactics::InteractionSession::onEndTurn ( )

◆ resolve()

Result< void > eve::tactics::InteractionSession::resolve ( )

Return to AwaitSelection after a commit succeeded, failed or was dropped.

在文件 Interaction.cpp 第 200 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation, eve::Status::success() , 以及 eve::Result< T >::success().

◆ state()

InteractionState eve::tactics::InteractionSession::state ( ) const
noexcept

Current player-facing state.

在文件 Interaction.cpp 第 65 行定义.


该类的文档由以下文件生成: