Re-added missing UI pieces (HP bar, HP numbers, & exit button).

This commit is contained in:
lightheel 2025-08-04 11:22:22 -04:00
parent 31fab9dba4
commit 9d0e68fb8a

View File

@ -206,32 +206,59 @@ fun PlayerBattleView(
) {
Box(
modifier = Modifier.fillMaxSize()
) {
// Top section: Exit button, HP bar, and HP numbers
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
) {
// Exit button at the top-right
Box(
modifier = Modifier.fillMaxWidth()
) {
Button(
onClick = { /* TODO: Add exit functionality */ },
modifier = Modifier
.align(Alignment.TopEnd)
.padding(16.dp),
modifier = Modifier.align(Alignment.TopEnd),
colors = ButtonDefaults.buttonColors(containerColor = Color.Red)
) {
Text("Exit", color = Color.White, fontSize = 14.sp)
}
}
// Main content
Column(
Spacer(modifier = Modifier.height(16.dp))
// Health bar
LinearProgressIndicator(
progress = battleSystem.playerHP / (activeCharacter?.baseHp?.toFloat() ?: 100f),
modifier = Modifier
.fillMaxWidth()
.height(10.dp),
color = Color.Green,
trackColor = Color.Gray
)
// Health display numbers
Text(
text = "HP: ${battleSystem.playerHP.toInt()}/${activeCharacter?.baseHp ?: 100}",
fontSize = 14.sp,
color = Color.Black
)
}
// Middle section: Player Digimon only
Box(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceBetween
contentAlignment = Alignment.Center
) {
// Player Digimon
// Player Digimon (center)
Box(
modifier = Modifier
.fillMaxWidth()
.size(80.dp),
contentAlignment = Alignment.CenterStart
contentAlignment = Alignment.Center
) {
SpriteImage(
spriteName = activeCharacter?.charaId ?: "dim011_mon01",
@ -274,7 +301,16 @@ fun PlayerBattleView(
)
}
}
}
// Bottom section: Critical bar and Attack button
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.align(Alignment.BottomCenter),
horizontalAlignment = Alignment.CenterHorizontally
) {
// Critical bar
LinearProgressIndicator(
progress = battleSystem.critBarProgress / 100f,
@ -287,25 +323,6 @@ fun PlayerBattleView(
Spacer(modifier = Modifier.height(16.dp))
// Health bar
LinearProgressIndicator(
progress = battleSystem.playerHP / (activeCharacter?.baseHp?.toFloat() ?: 100f),
modifier = Modifier
.fillMaxWidth()
.height(10.dp),
color = Color.Green,
trackColor = Color.Gray
)
// Health display numbers
Text(
text = "HP: ${battleSystem.playerHP.toInt()}/${activeCharacter?.baseHp ?: 100}",
fontSize = 14.sp,
color = Color.Black
)
Spacer(modifier = Modifier.height(16.dp))
// Attack button
Button(
onClick = {
@ -396,8 +413,6 @@ fun PlayerBattleView(
) {
Text("Attack", color = Color.White, fontSize = 18.sp)
}
Spacer(modifier = Modifier.height(16.dp))
}
}
}