载入中...
搜索中...
未找到
Presentation.h
浏览该文件的文档.
1#pragma once
2
20#include "common/Result.h"
22
23#include <cstdint>
24#include <map>
25#include <string_view>
26#include <vector>
27
28namespace eve::tactics {
29
36enum class UnitVisualState : std::uint8_t {
38 Idle,
52 Moving,
55};
56
62enum class PresentationRevertTrigger : std::uint8_t {
64 Never,
71};
72
74[[nodiscard]] EVENGINE_API_DOMAINS std::string_view unitVisualStateName(UnitVisualState state) noexcept;
76[[nodiscard]] EVENGINE_API_DOMAINS std::string_view presentationRevertTriggerName(
77 PresentationRevertTrigger trigger) noexcept;
78
114
134
140
152 std::map<std::string, UnitVisualState> restingState;
154 std::uint64_t transientTicks = 20;
155};
156
164public:
166 explicit PresentationProjector(std::uint64_t transientTicks = 20) : transientTicks_(transientTicks) {}
167
179 [[nodiscard]] Result<std::vector<PresentationCommand>> project(const BattleEvent& event,
180 const BattleCommand* command,
181 const PresentationFrame& frame) const;
182
190 [[nodiscard]] Result<PresentationIntent> revert(const PresentationIntent& intent,
191 const PresentationRevert& spec) const;
192
193private:
194 std::uint64_t transientTicks_ = 20;
195};
196
197} // namespace eve::tactics
#define EVENGINE_API_DOMAINS
Definition Export.h:110
Move-only, checked operation results for the common layer.
Deterministic board values and short-root ECS entities for tactics.
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
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
Projects authoritative events into bounded, revertible presentation intents.
PresentationProjector(std::uint64_t transientTicks=20)
Configure the projector; the default lifetime is used unless overridden.
PresentationRevertTrigger
What makes a presentation intent stop being true.
@ OnExpiry
Clear when expiresAtTick has passed.
@ Never
Durable state (defeat, end of round): never taken back.
@ OnNextTurn
Clear when any unit's next turn starts.
@ OnRoundStart
Clear at the next round boundary.
std::string_view presentationRevertTriggerName(PresentationRevertTrigger trigger) noexcept
Human-readable stable spelling of a revert trigger (protocol text).
std::string_view unitVisualStateName(UnitVisualState state) noexcept
Human-readable stable spelling of a visual state (protocol text).
UnitVisualState
How a consumer should draw one unit.
@ Friendly
Controlled by the viewing session.
@ Targetable
A legal target for the armed ability.
@ Attacking
Currently declaring an ability.
@ Finished
Already finished this round.
@ Selected
Currently selected or acting.
@ Destroyed
Defeated; terminal.
@ Moving
In transit between cells.
@ Idle
Resting, nothing special.
@ Defending
Reacting to an incoming effect.
One accepted replay command using only persistent identities and values.
One deterministic battle lifecycle event owned by Battle.
Logical board coordinate independent of rendering projection.
One intent together with the way to take it back.
What the projector knows about the battle beyond the event itself.
std::uint64_t transientTicks
How long a transient state stays valid, in ticks.
std::map< std::string, UnitVisualState > restingState
Resting state of each subject, used as the revert target.
Revision revision
Battle revision the frame was observed at.
One presentation instruction: what to show, where, and until when.
SimulationTick tick
Battle tick this intent was projected from.
SimulationTick expiresAtTick
Tick after which the intent is stale.
Cell from
Origin cell, when the intent has geometry.
Cell to
Destination or target cell, when the intent has geometry.
std::vector< Cell > path
Traversal the consumer may animate; empty when not applicable.
Revision revision
Battle revision this intent was projected from.
SubjectRef subject
The unit the intent is about.
SubjectRef other
The other unit involved (ability target, attacker), when there is one.
std::uint64_t sequence
Battle event sequence this intent was projected from.
The explicit undo contract for one intent.
std::uint64_t sequence
Event sequence the revert belongs to, for correlation.
UnitVisualState restingState
The state to restore when the trigger fires.
constexpr bool isRevertable() const noexcept
Whether a consumer may undo the intent at all.
PresentationRevertTrigger trigger