LuckyController<C extends Object, L extends LuckyLayout, F extends LuckyFrame, R extends LuckyResult<Object?>> class abstract

通用命令与时间轴;玩法子类补充类型化 stop 和 playUntil。

可以 attachHeadless 注入时钟;同一时刻最多挂接一个宿主。

Implementers

Constructors

LuckyController({required LuckyMotion<C, L, F, R> motion, PrizePicker picker = const WeightedPrizePicker(), Random? random})
创建控制器;不传 random 时使用独立的随机源。

Properties

frame → F
复用的当前帧,不可由用户修改。
no setter
frameListenable → Listenable
绘制监听器,稳态帧不触发 Widget 构建。
no setter
hashCode → int
The hash code for this object.
no setterinherited
isAttached → bool
是否有宿主。
no setter
isPaused → bool
用户暂停或生命周期暂停是否生效。
no setter
lastResult → R?
最近一次正常或作废结果。
no setter
motion → LuckyMotion<C, L, F, R>
玩法状态机。
final
phase → ValueListenable<LuckyPhase>
当前阶段,只读监听;例如 controller.phase.value。
no setter
phaseChanges → Stream<LuckyPhase>
同步广播阶段变化;首次访问才创建流。
no setter
picker → PrizePicker
无下标停止时使用的策略。
final
random → Random
选奖与停止偏移共用的随机源。
final
reportsIdleCancellation → bool
待机慢转被取消或重置时是否上报作废结果;九宫格覆写为 false。
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shouldReportCancelled → bool
是否把作废结果交给宿主;上游老虎机覆写为 false。
no setter

Methods

attach(LuckyControllerHost<R> host) → void
挂接宿主;已有宿主时抛出 StateError。
attachHeadless({required LuckyClock clock, required C config, L? layout}) → void
无头驱动;时钟归调用者所有,控制器只启停它。
cancel() → bool
作废本局;减速阶段是否接受由玩法决定。
commitCommand(bool accepted, {bool fromIdle = false}) → bool
子类执行类型化命令后调用,统一同步阶段、结果和时间源。
configure(C config, L? layout, {bool structural = false}) → void
应用配置;减速中的结构变化排队,结算后应用最新一份。
createCancelledResult() → R
子类提供类型化的作废结果。
detach() → void
解除挂接并停止原宿主时钟;未决本局以作废结果完成。
dispose() → void
停止时钟、关闭通知并以作废结果结束未决 Future;不触发宿主回调。
idleSpin() → bool
开始待机慢转,返回是否接受。
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → bool
用户暂停;只有运动且尚未用户暂停时接受。
pauseForLifecycle() → void
生命周期暂停,与用户暂停独立。
play() → bool
开始本局,运动中返回 false。
reset() → void
重置到原点;运动中(含待机慢转)按取消报告策略作废本局。
resume() → bool
恢复用户暂停;生命周期暂停解除后才恢复时间源。
resumeForLifecycle() → void
解除生命周期暂停,用户仍暂停时保持停止。
runPlayUntil<T>(FutureOr<T> resolve(), Duration minSpin, bool applyStop(T target)) → Future<R>
play 后获取目标并等待最短有效时间,再应用停止命令。
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited