SlotController class
类型化控制器;调用方拥有时须 dispose,可 attachHeadless 注入手动时钟。
- Inheritance
-
- Object
- LuckyController<
SlotConfig, SlotLayout, SlotFrame, SlotResult> - SlotController
Constructors
- SlotController({PrizePicker picker = const WeightedPrizePicker(), Random? random})
-
创建独立状态;例如
SlotController(random: Random(1))。
Properties
- frame → SlotFrame
-
复用的当前帧,不可由用户修改。
no setterinherited
- frameListenable → Listenable
-
绘制监听器,稳态帧不触发 Widget 构建。
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAttached → bool
-
是否有宿主。
no setterinherited
- isPaused → bool
-
用户暂停或生命周期暂停是否生效。
no setterinherited
- lastResult → SlotResult?
-
最近一次正常或作废结果。
no setterinherited
-
motion
→ LuckyMotion<
SlotConfig, SlotLayout, SlotFrame, SlotResult> -
玩法状态机。
finalinherited
-
phase
→ ValueListenable<
LuckyPhase> -
当前阶段,只读监听;例如
controller.phase.value。no setterinherited -
phaseChanges
→ Stream<
LuckyPhase> -
同步广播阶段变化;首次访问才创建流。
no setterinherited
- picker → PrizePicker
-
无下标停止时使用的策略。
finalinherited
- random → Random
-
选奖与停止偏移共用的随机源。
finalinherited
- reportsIdleCancellation → bool
-
待机慢转被取消或重置时是否上报作废结果;九宫格覆写为 false。
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldReportCancelled → bool
-
上游老虎机取消不调用 onEnd。
no setteroverride
- typedMotion → SlotMotion
-
具体类型的玩法状态机,与基类
motion是同一对象。finalinherited
Methods
-
attach(
LuckyControllerHost< SlotResult> host) → void -
挂接宿主;已有宿主时抛出 StateError。
inherited
-
attachHeadless(
{required LuckyClock clock, required SlotConfig config, SlotLayout? layout}) → void -
无头驱动;时钟归调用者所有,控制器只启停它。
inherited
-
cancel(
) → bool -
作废本局;减速阶段是否接受由玩法决定。
inherited
-
commitCommand(
bool accepted, {bool fromIdle = false}) → bool -
子类执行类型化命令后调用,统一同步阶段、结果和时间源。
inherited
-
configure(
SlotConfig config, SlotLayout? layout, {bool structural = false}) → void -
应用配置,自动识别列顺序等结构变化。
override
-
createCancelledResult(
) → SlotResult -
为未决异步调用提供作废结果。
override
-
detach(
) → void -
解除挂接并停止原宿主时钟;未决本局以作废结果完成。
inherited
-
dispose(
) → void -
停止时钟、关闭通知并以作废结果结束未决 Future;不触发宿主回调。
inherited
-
idleSpin(
) → bool -
开始待机慢转,返回是否接受。
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → bool -
用户暂停;只有运动且尚未用户暂停时接受。
inherited
-
pauseForLifecycle(
) → void -
生命周期暂停,与用户暂停独立。
inherited
-
play(
) → bool -
开始本局,运动中返回 false。
inherited
-
playUntil(
FutureOr< List< resolveIndices(), {Duration minSpinDuration = Duration.zero}) → Future<int> ?>SlotResult> - 开始并等待异步各列目标;null 作废,最短转动时间按有效时间计算。
-
reset(
) → void -
重置到原点;运动中(含待机慢转)按取消报告策略作废本局。
inherited
-
resume(
) → bool -
恢复用户暂停;生命周期暂停解除后才恢复时间源。
inherited
-
resumeForLifecycle(
) → void -
解除生命周期暂停,用户仍暂停时保持停止。
inherited
-
runPlayUntil<
T> (FutureOr< T> resolve(), Duration minSpin, bool applyStop(T target)) → Future<SlotResult> -
play 后获取目标并等待最短有效时间,再应用停止命令。
inherited
-
stop(
[int? index]) → bool -
全部列停到奖品
index;null 选奖一次复用到各列,任意负数作废。 -
stopEach(
List< int> indices) → bool - 每列停到各自奖品下标;长度不等于列数抛 ArgumentError,状态不变。
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited