载入中...
搜索中...
未找到
DialogueControl.h
浏览该文件的文档.
1#pragma once
2
5
6#include <cstdint>
7#include <optional>
8#include <string>
9#include <string_view>
10#include <vector>
11
12namespace eve::dialogue {
13
14class DialogueFlow;
15
45public:
50 explicit DialogueControl(DialogueFlow& flow);
52 ~DialogueControl() override;
53
56
63 [[nodiscard]] Result<void> publish(SubjectRef instance, SubjectRef owner);
65 [[nodiscard]] Result<void> unpublish(SubjectRef instance);
67 void clear();
69 [[nodiscard]] int count() const;
71 [[nodiscard]] std::vector<SubjectRef> instances() const;
72
75 [[nodiscard]] std::string_view gameplayDomain() const noexcept override;
78 [[nodiscard]] std::vector<SubjectRef> gameplayInstances() const override;
82 SubjectRef instance) const override;
86 const GameplaySession& session, SubjectRef instance, SubjectRef subject) const override;
90 const GameplayCommand& command) override;
94 const SimulationStep& step) override;
97 [[nodiscard]] Result<std::vector<GameplayEvent>> gameplayEvents(const GameplaySession& session, SubjectRef instance,
98 std::uint64_t afterSequence) const override;
99
100private:
102 struct Entry {
103 SubjectRef instance;
104 SubjectRef owner;
106 std::uint64_t revision = 0;
107 std::uint64_t nextEventSequence = 1;
108 std::vector<GameplayEvent> events;
109 };
110
112 [[nodiscard]] bool published() const { return entry_.has_value(); }
114 [[nodiscard]] bool controls(const GameplaySession& session) const;
116 [[nodiscard]] Value conversationState() const;
118 void record(Entry& entry, const GameplayCommand& command, std::string type, std::string detail,
119 std::int64_t quantity);
120
121 DialogueFlow* flow_ = nullptr;
122 std::optional<Entry> entry_;
123};
124
125} // namespace eve::dialogue
int subject
Definition AnimSmr.cpp:163
Host-neutral player-equivalent command and observation protocol.
Optional companion surface for gameplay providers that can enumerate instances.
std::uint64_t revision
Battle::Events events
SimulationTick tick
std::optional< InteractionSession > session
Definition Tactics.cpp:39
float step
Definition TreeMesh.cpp:314
Multi-provider gameplay boundary consumed by input, scripts and automation.
Optional read-only discovery surface implemented beside a gameplay provider.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Strong, domain-neutral reference to a runtime subject.
Definition SubjectRef.h:26
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
Exposes the module's conversation runner through the shared gameplay protocol.
Result< std::vector< GameplayEvent > > gameplayEvents(const GameplaySession &session, SubjectRef instance, std::uint64_t afterSequence) const override
Return events strictly newer than an instance-local sequence cursor.
Result< GameplayCommandReceipt > submitGameplay(const GameplaySession &session, SubjectRef instance, const GameplayCommand &command) override
Validate authority and atomically submit one domain command.
std::string_view gameplayDomain() const noexcept override
Stable provider domain used for discovery and routing.
~DialogueControl() override
Unpublish without touching the borrowed runner.
DialogueControl(const DialogueControl &)=delete
Result< GameplayObservation > observeGameplay(const GameplaySession &session, SubjectRef instance) const override
Observe one provider-owned gameplay instance without mutation.
Result< void > publish(SubjectRef instance, SubjectRef owner)
Publish the conversation runner under a stable instance identity.
std::vector< SubjectRef > instances() const
Published instance identities, in publication order.
void clear()
Drop every publication.
DialogueControl & operator=(const DialogueControl &)=delete
Result< void > unpublish(SubjectRef instance)
Drop the publication; NotFound when that instance is not published.
std::vector< SubjectRef > gameplayInstances() const override
Instances currently served, in publication order.
Result< GameplayObservation > advanceGameplay(const GameplaySession &session, SubjectRef instance, const SimulationStep &step) override
Advance one provider-owned instance using injected deterministic time.
int count() const
Number of published instances (0 or 1).
Result< std::vector< GameplayActionDescriptor > > availableGameplayActions(const GameplaySession &session, SubjectRef instance, SubjectRef subject) const override
Discover currently legal player-semantic actions for one subject.
Script-facing registry and runner for compiled .dnut conversations.
One discoverable domain action and its owning schema projection.
Owning evidence that a gameplay authority accepted one command.
One player-semantic command submitted to a domain authority.
Owning event projection safe across frames and process boundaries.
Immutable owning observation of one authoritative gameplay instance.
Owning authorization context shared by player, script and automation adapters.
One deterministic fixed-step emitted by SimulationClock.
Definition Time.h:158