mirror of
https://github.com/nacabaro/vbhelper.git
synced 2026-06-05 22:02:54 +00:00
Adjusted BattlesScreen UI.
This commit is contained in:
parent
a3bebcf290
commit
481c0b6d9a
@ -400,6 +400,7 @@ fun MiddleBattleView(
|
|||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
// Debug display
|
// Debug display
|
||||||
|
/*
|
||||||
if (lastApiResult != null) {
|
if (lastApiResult != null) {
|
||||||
Text(
|
Text(
|
||||||
text = "Debug: state=${lastApiResult!!.state}, playerAttackHit=${lastApiResult!!.playerAttackHit}, opponentDamage=${lastApiResult!!.opponentAttackDamage}",
|
text = "Debug: state=${lastApiResult!!.state}, playerAttackHit=${lastApiResult!!.playerAttackHit}, opponentDamage=${lastApiResult!!.opponentAttackDamage}",
|
||||||
@ -408,6 +409,7 @@ fun MiddleBattleView(
|
|||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Enemy HP bar (top)
|
// Enemy HP bar (top)
|
||||||
LinearProgressIndicator(
|
LinearProgressIndicator(
|
||||||
@ -428,22 +430,14 @@ fun MiddleBattleView(
|
|||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
// Player HP bar (bottom)
|
|
||||||
LinearProgressIndicator(
|
|
||||||
progress = battleSystem.playerHP / (activeCharacter?.baseHp?.toFloat() ?: 100f),
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(10.dp),
|
|
||||||
color = Color.Green,
|
|
||||||
trackColor = Color.Gray
|
|
||||||
)
|
|
||||||
|
|
||||||
// Player HP display numbers
|
// Player HP display numbers
|
||||||
|
/*
|
||||||
Text(
|
Text(
|
||||||
text = "HP: ${battleSystem.playerHP.toInt()}/${activeCharacter?.baseHp ?: 100}",
|
text = "HP: ${battleSystem.playerHP.toInt()}/${activeCharacter?.baseHp ?: 100}",
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
color = Color.Black
|
color = Color.Black
|
||||||
)
|
)
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Middle section: Both Digimon with horizontal line separator
|
// Middle section: Both Digimon with horizontal line separator
|
||||||
@ -611,7 +605,7 @@ fun MiddleBattleView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bottom section: Critical bar and Attack button
|
// Bottom section: Player HP bar, Critical bar and Attack button
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@ -629,7 +623,26 @@ fun MiddleBattleView(
|
|||||||
trackColor = Color.Gray
|
trackColor = Color.Gray
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(6.dp))
|
||||||
|
|
||||||
|
// Player HP bar
|
||||||
|
LinearProgressIndicator(
|
||||||
|
progress = battleSystem.playerHP / (activeCharacter?.baseHp?.toFloat() ?: 100f),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(10.dp),
|
||||||
|
color = Color.Green,
|
||||||
|
trackColor = Color.Gray
|
||||||
|
)
|
||||||
|
|
||||||
|
// Player HP display numbers
|
||||||
|
Text(
|
||||||
|
text = "HP: ${battleSystem.playerHP.toInt()}/${activeCharacter?.baseHp ?: 100}",
|
||||||
|
fontSize = 14.sp,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(6.dp))
|
||||||
|
|
||||||
// Attack button
|
// Attack button
|
||||||
Button(
|
Button(
|
||||||
@ -780,13 +793,14 @@ fun PlayerBattleView(
|
|||||||
modifier = Modifier.align(Alignment.TopEnd),
|
modifier = Modifier.align(Alignment.TopEnd),
|
||||||
colors = ButtonDefaults.buttonColors(containerColor = Color.Red)
|
colors = ButtonDefaults.buttonColors(containerColor = Color.Red)
|
||||||
) {
|
) {
|
||||||
Text("Exit", color = Color.White, fontSize = 14.sp)
|
Text("Exit", color = Color.White, fontSize = 12.sp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
// Debug display
|
// Debug display
|
||||||
|
/*
|
||||||
if (lastApiResult != null) {
|
if (lastApiResult != null) {
|
||||||
Text(
|
Text(
|
||||||
text = "Debug: state=${lastApiResult!!.state}, playerAttackHit=${lastApiResult!!.playerAttackHit}, opponentDamage=${lastApiResult!!.opponentAttackDamage}",
|
text = "Debug: state=${lastApiResult!!.state}, playerAttackHit=${lastApiResult!!.playerAttackHit}, opponentDamage=${lastApiResult!!.opponentAttackDamage}",
|
||||||
@ -795,6 +809,7 @@ fun PlayerBattleView(
|
|||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Health bar
|
// Health bar
|
||||||
LinearProgressIndicator(
|
LinearProgressIndicator(
|
||||||
@ -1298,6 +1313,7 @@ fun BattlesScreen() {
|
|||||||
opponentsList.clear()
|
opponentsList.clear()
|
||||||
opponentsList.addAll(opponents.opponentsList)
|
opponentsList.addAll(opponents.opponentsList)
|
||||||
currentView = "rookie"
|
currentView = "rookie"
|
||||||
|
currentStage = "rookie"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@ -1322,6 +1338,7 @@ fun BattlesScreen() {
|
|||||||
opponentsList.clear()
|
opponentsList.clear()
|
||||||
opponentsList.addAll(opponents.opponentsList)
|
opponentsList.addAll(opponents.opponentsList)
|
||||||
currentView = "champion"
|
currentView = "champion"
|
||||||
|
currentStage = "champion"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@ -1346,6 +1363,7 @@ fun BattlesScreen() {
|
|||||||
opponentsList.clear()
|
opponentsList.clear()
|
||||||
opponentsList.addAll(opponents.opponentsList)
|
opponentsList.addAll(opponents.opponentsList)
|
||||||
currentView = "ultimate"
|
currentView = "ultimate"
|
||||||
|
currentStage = "ultimate"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@ -1370,6 +1388,7 @@ fun BattlesScreen() {
|
|||||||
opponentsList.clear()
|
opponentsList.clear()
|
||||||
opponentsList.addAll(opponents.opponentsList)
|
opponentsList.addAll(opponents.opponentsList)
|
||||||
currentView = "mega"
|
currentView = "mega"
|
||||||
|
currentStage = "mega"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
Log.d(TAG, "Error processing opponents data: ${e.message}")
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@ -1394,6 +1413,15 @@ fun BattlesScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val characterDropdown = @Composable { currentStage: String ->
|
val characterDropdown = @Composable { currentStage: String ->
|
||||||
|
// Get the appropriate character list based on the passed currentStage parameter
|
||||||
|
val characterListForStage = when (currentStage.lowercase()) {
|
||||||
|
"rookie" -> rookieCharacters
|
||||||
|
"champion" -> championCharacters
|
||||||
|
"ultimate" -> ultimateCharacters
|
||||||
|
"mega" -> megaCharacters
|
||||||
|
else -> rookieCharacters
|
||||||
|
}
|
||||||
|
|
||||||
ExposedDropdownMenuBox(
|
ExposedDropdownMenuBox(
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
onExpandedChange = { expanded = !expanded }
|
onExpandedChange = { expanded = !expanded }
|
||||||
@ -1410,7 +1438,7 @@ fun BattlesScreen() {
|
|||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
onDismissRequest = { expanded = false }
|
onDismissRequest = { expanded = false }
|
||||||
) {
|
) {
|
||||||
characterList.forEach { character ->
|
characterListForStage.forEach { character ->
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(character.name) },
|
text = { Text(character.name) },
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user