Added scrollable button list for opponents of all stages.

This commit is contained in:
lightheel 2025-10-19 12:02:14 -04:00
parent ac02205f76
commit 952fd5a871

View File

@ -1973,160 +1973,208 @@ fun BattlesScreen() {
"rookie" -> { "rookie" -> {
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) { ) {
Text("Rookie Battle View") Text("Rookie Battle View", fontSize = 20.sp, fontWeight = FontWeight.Bold)
// Add character selection dropdown // Add character selection dropdown
characterDropdown("rookie") characterDropdown("rookie")
// Display buttons for each opponent
opponentsList.forEach { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 0, 0, opponent.name, 0) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.padding(vertical = 4.dp)
) {
Text("Battle ${opponent.name}")
}
}
// Show selected character info // Show selected character info
activeCharacter?.let { character -> activeCharacter?.let { character ->
Text("Active Character: ${character.name}") Text("Active Character: ${character.name}", fontSize = 16.sp, fontWeight = FontWeight.Bold)
Text("HP: ${character.currentHp}/${character.baseHp}") Text("HP: ${character.currentHp}/${character.baseHp}")
Text("BP: ${character.baseBp}") Text("BP: ${character.baseBp}")
Text("AP: ${character.baseAp}") Text("AP: ${character.baseAp}")
} }
Spacer(modifier = Modifier.height(16.dp))
// Scrollable list of opponents
Text("Select Opponent:", fontSize = 16.sp, fontWeight = FontWeight.Bold)
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
items(opponentsList) { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 0, 0, opponent.name, 0) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.fillMaxWidth()
) {
Text("Battle ${opponent.name}")
}
}
}
backButton() backButton()
} }
} }
"champion" -> { "champion" -> {
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) { ) {
Text("Champion Battle View") Text("Champion Battle View", fontSize = 20.sp, fontWeight = FontWeight.Bold)
// Add character selection dropdown // Add character selection dropdown
characterDropdown("champion") characterDropdown("champion")
// Display buttons for each opponent
opponentsList.forEach { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 1, 0, opponent.name, 1) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.padding(vertical = 4.dp)
) {
Text("Battle ${opponent.name}")
}
}
// Show selected character info // Show selected character info
activeCharacter?.let { character -> activeCharacter?.let { character ->
Text("Active Character: ${character.name}") Text("Active Character: ${character.name}", fontSize = 16.sp, fontWeight = FontWeight.Bold)
Text("HP: ${character.currentHp}/${character.baseHp}") Text("HP: ${character.currentHp}/${character.baseHp}")
Text("BP: ${character.baseBp}") Text("BP: ${character.baseBp}")
Text("AP: ${character.baseAp}") Text("AP: ${character.baseAp}")
} }
Spacer(modifier = Modifier.height(16.dp))
// Scrollable list of opponents
Text("Select Opponent:", fontSize = 16.sp, fontWeight = FontWeight.Bold)
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
items(opponentsList) { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 1, 0, opponent.name, 1) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.fillMaxWidth()
) {
Text("Battle ${opponent.name}")
}
}
}
backButton() backButton()
} }
} }
"ultimate" -> { "ultimate" -> {
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) { ) {
Text("Ultimate Battle View") Text("Ultimate Battle View", fontSize = 20.sp, fontWeight = FontWeight.Bold)
// Add character selection dropdown // Add character selection dropdown
characterDropdown("ultimate") characterDropdown("ultimate")
// Display buttons for each opponent
opponentsList.forEach { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 2, 0, opponent.name, 2) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.padding(vertical = 4.dp)
) {
Text("Battle ${opponent.name}")
}
}
// Show selected character info // Show selected character info
activeCharacter?.let { character -> activeCharacter?.let { character ->
Text("Active Character: ${character.name}") Text("Active Character: ${character.name}", fontSize = 16.sp, fontWeight = FontWeight.Bold)
Text("HP: ${character.currentHp}/${character.baseHp}") Text("HP: ${character.currentHp}/${character.baseHp}")
Text("BP: ${character.baseBp}") Text("BP: ${character.baseBp}")
Text("AP: ${character.baseAp}") Text("AP: ${character.baseAp}")
} }
Spacer(modifier = Modifier.height(16.dp))
// Scrollable list of opponents
Text("Select Opponent:", fontSize = 16.sp, fontWeight = FontWeight.Bold)
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
items(opponentsList) { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 2, 0, opponent.name, 2) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.fillMaxWidth()
) {
Text("Battle ${opponent.name}")
}
}
}
backButton() backButton()
} }
} }
"mega" -> { "mega" -> {
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) { ) {
Text("Mega Battle View") Text("Mega Battle View", fontSize = 20.sp, fontWeight = FontWeight.Bold)
// Add character selection dropdown // Add character selection dropdown
characterDropdown("mega") characterDropdown("mega")
// Display buttons for each opponent
opponentsList.forEach { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 3, 0, opponent.name, 3) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.padding(vertical = 4.dp)
) {
Text("Battle ${opponent.name}")
}
}
// Show selected character info // Show selected character info
activeCharacter?.let { character -> activeCharacter?.let { character ->
Text("Active Character: ${character.name}") Text("Active Character: ${character.name}", fontSize = 16.sp, fontWeight = FontWeight.Bold)
Text("HP: ${character.currentHp}/${character.baseHp}") Text("HP: ${character.currentHp}/${character.baseHp}")
Text("BP: ${character.baseBp}") Text("BP: ${character.baseBp}")
Text("AP: ${character.baseAp}") Text("AP: ${character.baseAp}")
} }
Spacer(modifier = Modifier.height(16.dp))
// Scrollable list of opponents
Text("Select Opponent:", fontSize = 16.sp, fontWeight = FontWeight.Bold)
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
items(opponentsList) { opponent ->
Button(
onClick = {
activeCharacter?.let {
selectedOpponent = opponent
// Randomly select background set (0, 1, or 2)
selectedBackgroundSet = kotlin.random.Random.nextInt(3)
RetrofitHelper().getPVPWinner(context, 0, 2, it.name, 3, 0, opponent.name, 3) { apiResult ->
currentView = "battle-main"
}
}
},
modifier = Modifier.fillMaxWidth()
) {
Text("Battle ${opponent.name}")
}
}
}
backButton() backButton()
} }
} }