|
|
|
|
@ -67,6 +67,11 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun drawTable(config: ReplayerConfiguration, canvas: Canvas, context: Context) { |
|
|
|
|
drawTableItems(config, canvas, context) |
|
|
|
|
config.frameDrawn() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun drawTableItems(config: ReplayerConfiguration, canvas: Canvas, context: Context) { |
|
|
|
|
|
|
|
|
|
// base |
|
|
|
|
initializeTable(config, canvas, context) |
|
|
|
|
@ -93,6 +98,7 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) { |
|
|
|
|
val hh = config.handHistory |
|
|
|
|
for (i in 0 until hh.numberOfPlayers) { |
|
|
|
|
drawPlayerShapes(i, computedAction, config, canvas, context) |
|
|
|
|
drawPlayerChips(i, config, canvas, context) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// show player cards |
|
|
|
|
@ -115,8 +121,6 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) { |
|
|
|
|
drawPositionAndStack(i, remainingStack, config, canvas) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
drawPlayerChips(i, config, canvas, context) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
@ -125,7 +129,23 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) { |
|
|
|
|
*/ |
|
|
|
|
private fun drawPlayerChips(i: Int, config: ReplayerConfiguration, canvas: Canvas, context: Context) { |
|
|
|
|
|
|
|
|
|
config.lastSignificantActionOfPlayer(i)?.let { action -> |
|
|
|
|
when (config.currentStep) { |
|
|
|
|
is Street -> { // animate chips |
|
|
|
|
if (config.lastChipCommittingActionOfPlayer(i) != null) { |
|
|
|
|
val circle = config.animatedChipCircle(i) |
|
|
|
|
drawChipCircle(circle, canvas, context) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
is ComputedAction -> { |
|
|
|
|
drawChipForAction(i, config, canvas, context) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun drawChipForAction(i: Int, config: ReplayerConfiguration, canvas: Canvas, context: Context) { |
|
|
|
|
|
|
|
|
|
config.lastChipCommittingActionOfPlayer(i)?.let { action -> |
|
|
|
|
when { |
|
|
|
|
action.action.type?.isSignificant == true -> { |
|
|
|
|
action.action.amount?.let { amount -> |
|
|
|
|
@ -182,6 +202,16 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) { |
|
|
|
|
|
|
|
|
|
private fun drawChip(amount: Double, chipText: ReplayerConfiguration.TextPoint, chipCircle: ReplayerConfiguration.Circle, canvas: Canvas, context: Context) { |
|
|
|
|
|
|
|
|
|
drawChipCircle(chipCircle, canvas, context) |
|
|
|
|
|
|
|
|
|
this.textPaint.textSize = chipText.fontSize |
|
|
|
|
this.textPaint.color = context.getColor(R.color.white) |
|
|
|
|
canvas.drawText(amount.formatted, chipText.x, chipText.y, this.textPaint) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun drawChipCircle(chipCircle: ReplayerConfiguration.Circle, canvas: Canvas, context: Context) { |
|
|
|
|
|
|
|
|
|
this.fillPaint.color = context.getColor(R.color.green) |
|
|
|
|
canvas.drawCircle(chipCircle.x, chipCircle.y, chipCircle.radius, this.fillPaint) |
|
|
|
|
this.chipBorderPaint.color = context.getColor(R.color.white) |
|
|
|
|
@ -191,10 +221,6 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) { |
|
|
|
|
chipBorderPaint.pathEffect = DashPathEffect(floatArrayOf(chipCircle.radius * 0.6f, chipCircle.radius * 0.44f), 0f) |
|
|
|
|
canvas.drawCircle(chipCircle.x, chipCircle.y, chipCircle.radius - chipBorderStrokeWidth / 2, this.chipBorderPaint) |
|
|
|
|
|
|
|
|
|
this.textPaint.textSize = chipText.fontSize |
|
|
|
|
this.textPaint.color = context.getColor(R.color.white) |
|
|
|
|
canvas.drawText(amount.formatted, chipText.x, chipText.y, this.textPaint) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun drawCards(playerIndex: Int, config: ReplayerConfiguration, canvas: Canvas, context: Context) { |
|
|
|
|
|