|
|
|
@ -73,12 +73,12 @@ class ReplayerConfiguration(var handHistory: HandHistory) { |
|
|
|
|
|
|
|
|
|
|
|
private var lastBlindIndex: Int = 0 |
|
|
|
private var lastBlindIndex: Int = 0 |
|
|
|
|
|
|
|
|
|
|
|
private var stepIndex: Int = 0 |
|
|
|
private var currentStepIndex: Int = 0 |
|
|
|
set(value) { |
|
|
|
set(value) { |
|
|
|
val backwards = value < field |
|
|
|
val backwards = value < field |
|
|
|
field = value |
|
|
|
field = value |
|
|
|
|
|
|
|
|
|
|
|
// if we go backwards we don't want to perform an animate, otherwise we want |
|
|
|
// if we go backwards we don't want to perform an animation, otherwise we want |
|
|
|
this.currentFrame = if (backwards) this.numberOfFramesForCurrentStep - 1 else 0 |
|
|
|
this.currentFrame = if (backwards) this.numberOfFramesForCurrentStep - 1 else 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -86,7 +86,7 @@ class ReplayerConfiguration(var handHistory: HandHistory) { |
|
|
|
|
|
|
|
|
|
|
|
this.actionList.load(this.handHistory) |
|
|
|
this.actionList.load(this.handHistory) |
|
|
|
this.lastBlindIndex = max(this.actionList.indexOfLast { it.action.type?.isBlind == true }, 0) |
|
|
|
this.lastBlindIndex = max(this.actionList.indexOfLast { it.action.type?.isBlind == true }, 0) |
|
|
|
this.stepIndex = this.lastBlindIndex + 1 // initialize at big blind |
|
|
|
this.currentStepIndex = this.lastBlindIndex + 1 // initialize at big blind |
|
|
|
|
|
|
|
|
|
|
|
this.steps = HandStep.createSteps(this.handHistory) |
|
|
|
this.steps = HandStep.createSteps(this.handHistory) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -366,20 +366,20 @@ class ReplayerConfiguration(var handHistory: HandHistory) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun next() { |
|
|
|
fun next() { |
|
|
|
if (this.steps.size > this.stepIndex + 1) { |
|
|
|
if (this.steps.size > this.currentStepIndex + 1) { |
|
|
|
this.stepIndex += 1 |
|
|
|
this.currentStepIndex += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun previous() { |
|
|
|
fun previous() { |
|
|
|
if (this.stepIndex > this.lastBlindIndex + 1) { |
|
|
|
if (this.currentStepIndex > this.lastBlindIndex + 1) { |
|
|
|
this.stepIndex -= 1 |
|
|
|
this.currentStepIndex -= 1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val currentStep: HandStep |
|
|
|
val currentStep: HandStep |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
return this.steps[this.stepIndex] |
|
|
|
return this.steps[this.currentStepIndex] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private val lastActionAtStep: ComputedAction? |
|
|
|
private val lastActionAtStep: ComputedAction? |
|
|
|
@ -389,7 +389,7 @@ class ReplayerConfiguration(var handHistory: HandHistory) { |
|
|
|
return step |
|
|
|
return step |
|
|
|
} |
|
|
|
} |
|
|
|
else -> { |
|
|
|
else -> { |
|
|
|
(0 until stepIndex).reversed().forEach { i -> |
|
|
|
(0 until currentStepIndex).reversed().forEach { i -> |
|
|
|
val hs = this.steps[i] |
|
|
|
val hs = this.steps[i] |
|
|
|
if (hs is ComputedAction) { |
|
|
|
if (hs is ComputedAction) { |
|
|
|
return hs |
|
|
|
return hs |
|
|
|
@ -442,6 +442,16 @@ class ReplayerConfiguration(var handHistory: HandHistory) { |
|
|
|
return Circle(x, y, radius) |
|
|
|
return Circle(x, y, radius) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun restart() { |
|
|
|
|
|
|
|
this.currentStepIndex = 0 |
|
|
|
|
|
|
|
this.currentFrame = 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val isReplayFinished: Boolean |
|
|
|
|
|
|
|
get() { |
|
|
|
|
|
|
|
return this.currentStepIndex >= this.steps.size - 1 && this.currentFrame >= this.numberOfFramesForCurrentStep - 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|