载入中...
搜索中...
未找到
DamageNumbers.cpp
浏览该文件的文档.
14 Diagnostic::error(DiagnosticCode::InvalidArgument, std::move(message), "graphics.damageNumbers"));
16bool validKind(DamageNumberKind kind) { return kind >= DamageNumberKind::Damage && kind <= DamageNumberKind::Miss; }
17bool bounded(double value, double maximum) { return std::isfinite(value) && std::abs(value) <= maximum; }
31 stream << (request.kind == DamageNumberKind::Heal ? "+" : "-") << std::fixed << std::setprecision(style.decimals)
64 !bounded(style.velocityY, 10000.0) || !bounded(style.gravity, 10000.0) || !bounded(style.scale, 20.0) ||
65 style.scale <= 0.f || !bounded(style.pop, 5.0) || style.pop < 0.f || !bounded(style.shake, 100.0) ||
66 style.shake < 0.f || !bounded(style.r, 1.0) || style.r < 0.f || !bounded(style.g, 1.0) || style.g < 0.f ||
67 !bounded(style.b, 1.0) || style.b < 0.f || !bounded(style.outline, 8.0) || style.outline < 0.f ||
68 !bounded(style.fadeIn, style.lifetime) || style.fadeIn < 0.0 || !bounded(style.fadeOut, style.lifetime) ||
76 if (!validKind(kind)) return Result<DamageNumberStyle>::failure(invalid("Invalid popup kind").status());
81 !bounded(request.x, 1.0e7) || !bounded(request.y, 1.0e7) || !bounded(request.velocityX, 10000.0) ||
114 if (!std::isfinite(seconds) || seconds < 0.0) return invalid("dt must be finite and nonnegative");
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Result< DamageNumberStyle > style(DamageNumberKind kind) const
Return an owning preset copy; invalid enum values fail.
Definition DamageNumbers.cpp:75
DamageNumbers()
Construct a pool with four built-in styles and 256 reusable slots.
Definition DamageNumbers.cpp:38
static constexpr std::size_t capacity()
Fixed maximum live popup budget; overflow replaces the oldest.
Definition DamageNumbers.h:87
Result< DamageNumberAdmission > spawn(const DamageNumberRequest &request)
Validate and admit one popup. Failure leaves pool and sequence unchanged.
Definition DamageNumbers.cpp:79
Result< void > update(double seconds)
Advance injected seconds; nonfinite/negative dt fails without mutation.
Definition DamageNumbers.cpp:113
Result< void > setStyle(DamageNumberKind kind, const DamageNumberStyle &style)
Validate and replace one future-spawn style; existing entries keep their own copy.
Definition DamageNumbers.cpp:62
~DamageNumbers()
std::vector< DamageNumberSample > snapshot() const
Build an independent owning frame snapshot for observation. @cost Linear allocations/copies in live e...
Definition DamageNumbers.cpp:141
void clear()
Remove every transient entry; deterministic spawn sequence restarts.
Definition DamageNumbers.cpp:119
Status invalid(const char *message)
Definition OceanBindingInternal.h:21
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
DamageNumberKind
Presentation categories, independent of any combat or settlement module.
Definition DamageNumbers.h:16
@ ReplacedOldest
@ InvalidArgument
Definition Container.h:602
Owning display request. The caller supplies actual committed amounts, never pending damage.
Definition DamageNumbers.h:38
Independent owning frame sample, useful for observation and alternative renderers.
Definition DamageNumbers.h:49
Owning style copied into each popup at spawn. Coordinates are drawable pixels.
Definition DamageNumbers.h:21
static DamageNumberSample sample(const Popup &popup)
Definition DamageNumbers.cpp:124