mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-18 15:35:20 +01:00
feat: add B button support for exiting customization menu
This commit is contained in:
parent
419cd8cbdb
commit
0b78bf7833
1 changed files with 22 additions and 8 deletions
|
@ -528,16 +528,23 @@ class MainActivity : AppCompatActivity(),
|
||||||
binding.customizationContainer.visibility = View.VISIBLE
|
binding.customizationContainer.visibility = View.VISIBLE
|
||||||
binding.pauseContainer.visibility = View.GONE
|
binding.pauseContainer.visibility = View.GONE
|
||||||
|
|
||||||
// Update theme colors
|
// Get theme colors
|
||||||
val themeColors = ThemeManager.getThemeColors()
|
val themeColor = getThemeColor(currentTheme)
|
||||||
binding.customizationContainer.setBackgroundColor(themeColors.background)
|
val backgroundColor = getThemeBackgroundColor(currentTheme)
|
||||||
|
|
||||||
|
// Apply background color to customization container
|
||||||
|
binding.customizationContainer.setBackgroundColor(backgroundColor)
|
||||||
|
|
||||||
// Update level badge
|
// Update level badge
|
||||||
binding.customizationLevelBadge.setLevel(progressionManager.getPlayerLevel())
|
binding.customizationLevelBadge.setLevel(progressionManager.getPlayerLevel())
|
||||||
binding.customizationLevelBadge.setThemeColor(themeColors.accent)
|
binding.customizationLevelBadge.setThemeColor(themeColor)
|
||||||
|
|
||||||
// Apply theme colors to text
|
// Apply theme colors to text and buttons
|
||||||
binding.customizationTitle.setTextColor(themeColors.text.toInt())
|
binding.customizationTitle.setTextColor(themeColor)
|
||||||
|
binding.customizationBackButton.setTextColor(themeColor)
|
||||||
|
|
||||||
|
// Apply theme colors to all text views in the container
|
||||||
|
applyThemeColorToTextViews(binding.customizationContainer, themeColor)
|
||||||
|
|
||||||
// Update theme and block skin selectors
|
// Update theme and block skin selectors
|
||||||
binding.customizationThemeSelector.updateThemes(
|
binding.customizationThemeSelector.updateThemes(
|
||||||
|
@ -1204,7 +1211,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
|
|
||||||
// If not handled as gamepad, handle as regular key event
|
// If not handled as gamepad, handle as regular key event
|
||||||
// Handle back button
|
// Handle back button
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_BUTTON_B) {
|
||||||
// Handle back button press as a pause action during gameplay
|
// Handle back button press as a pause action during gameplay
|
||||||
if (gameView.visibility == View.VISIBLE && !gameView.isPaused && !gameView.isGameOver()) {
|
if (gameView.visibility == View.VISIBLE && !gameView.isPaused && !gameView.isGameOver()) {
|
||||||
gameView.pause()
|
gameView.pause()
|
||||||
|
@ -1217,6 +1224,10 @@ class MainActivity : AppCompatActivity(),
|
||||||
// If pause menu is showing, handle as a resume
|
// If pause menu is showing, handle as a resume
|
||||||
resumeGame()
|
resumeGame()
|
||||||
return true // Consume the event
|
return true // Consume the event
|
||||||
|
} else if (binding.customizationContainer.visibility == View.VISIBLE) {
|
||||||
|
// If customization menu is showing, hide it
|
||||||
|
hideCustomizationMenu()
|
||||||
|
return true // Consume the event
|
||||||
} else if (binding.gameOverContainer.visibility == View.VISIBLE) {
|
} else if (binding.gameOverContainer.visibility == View.VISIBLE) {
|
||||||
// If game over is showing, go back to title
|
// If game over is showing, go back to title
|
||||||
hideGameOver()
|
hideGameOver()
|
||||||
|
@ -1259,7 +1270,10 @@ class MainActivity : AppCompatActivity(),
|
||||||
*/
|
*/
|
||||||
override fun onPauseRequested() {
|
override fun onPauseRequested() {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (gameView.visibility == View.VISIBLE && !gameView.isPaused && !gameView.isGameOver()) {
|
if (binding.customizationContainer.visibility == View.VISIBLE) {
|
||||||
|
// If customization menu is showing, hide it
|
||||||
|
hideCustomizationMenu()
|
||||||
|
} else if (gameView.visibility == View.VISIBLE && !gameView.isPaused && !gameView.isGameOver()) {
|
||||||
gameView.pause()
|
gameView.pause()
|
||||||
gameMusic.pause()
|
gameMusic.pause()
|
||||||
showPauseMenu()
|
showPauseMenu()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue