@@ -101,23 +101,7 @@ object Replay : Module(
101101 return @listener
102102 }
103103 }
104- it.input.removeFirstOrNull()?.update(event.input) ? : run {
105- if (loop && repeats < loops) {
106- if (repeats >= 0 ) repeats++
107- replay = recording?.duplicate()
108- this @Replay.info(" Replay looped. $repeats / $loops " )
109- } else {
110- if (state != State .PLAYING_CHECKPOINTS ) {
111- state = State .INACTIVE
112- this @Replay.info(" Replay finished after ${recording?.duration} ." )
113- return @listener
114- }
115-
116- state = State .RECORDING
117- recording = checkpoint?.duplicate()
118- this @Replay.info(" Checkpoint replayed. Continued recording..." )
119- }
120- }
104+ it.input.removeFirstOrNull()?.update(event.input)
121105 }
122106 }
123107 else -> {}
@@ -156,6 +140,33 @@ object Replay : Module(
156140 else -> {}
157141 }
158142 }
143+
144+ listener<MovementEvent .Post > {
145+ when (state) {
146+ State .PLAYING , State .PLAYING_CHECKPOINTS -> {
147+ replay?.let {
148+ if (it.size != 0 ) return @listener
149+
150+ if (loop && repeats < loops) {
151+ if (repeats >= 0 ) repeats++
152+ replay = recording?.duplicate()
153+ this @Replay.info(" Replay looped. $repeats / $loops " )
154+ } else {
155+ if (state != State .PLAYING_CHECKPOINTS ) {
156+ state = State .INACTIVE
157+ this @Replay.info(" Replay finished after ${recording?.duration} ." )
158+ return @listener
159+ }
160+
161+ state = State .RECORDING
162+ recording = checkpoint?.duplicate()
163+ this @Replay.info(" Checkpoint replayed. Continued recording..." )
164+ }
165+ }
166+ }
167+ else -> {}
168+ }
169+ }
159170 }
160171
161172 private fun handlePlay () {
0 commit comments