mirror of
https://github.com/kalarina-bit/Matewave.git
synced 2026-11-22 08:06:09 +00:00
Radio off by default over HTTPS only, menu music, labels for promotion pieces
This commit is contained in:
@@ -17,6 +17,9 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.unit.dp
|
||||
import cc.skysparkle.matewave.R
|
||||
import cc.skysparkle.matewave.engine.Piece
|
||||
@@ -39,6 +42,14 @@ fun PromotionDialog(color: PieceColor, onChoose: (PieceType) -> Unit, onDismiss:
|
||||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
listOf(PieceType.QUEEN, PieceType.ROOK, PieceType.BISHOP, PieceType.KNIGHT).forEach { type ->
|
||||
val optionShape = RoundedCornerShape(UiCornerRadius)
|
||||
val label = stringResource(
|
||||
when (type) {
|
||||
PieceType.QUEEN -> R.string.piece_queen
|
||||
PieceType.ROOK -> R.string.piece_rook
|
||||
PieceType.BISHOP -> R.string.piece_bishop
|
||||
else -> R.string.piece_knight
|
||||
}
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
@@ -46,7 +57,8 @@ fun PromotionDialog(color: PieceColor, onChoose: (PieceType) -> Unit, onDismiss:
|
||||
.clip(optionShape)
|
||||
.background(ink.copy(alpha = 0.10f))
|
||||
.border(1.dp, PanelBorder, optionShape)
|
||||
.clickable { onChoose(type) }
|
||||
.clickable(onClickLabel = label, role = Role.Button) { onChoose(type) }
|
||||
.semantics { contentDescription = label }
|
||||
.padding(8.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
|
||||
@@ -84,6 +84,10 @@ fun MainMenuScreen(
|
||||
onFriendsClick: () -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
androidx.compose.runtime.DisposableEffect(Unit) {
|
||||
cc.skysparkle.matewave.audio.SoundManager.setMenuVisible(true)
|
||||
onDispose { cc.skysparkle.matewave.audio.SoundManager.setMenuVisible(false) }
|
||||
}
|
||||
val resumable by viewModel.resumable.collectAsState()
|
||||
val ongoing = resumable
|
||||
val hasOngoingGame = ongoing != null
|
||||
|
||||
@@ -60,6 +60,7 @@ fun SettingsScreen(
|
||||
onOpenShare: () -> Unit
|
||||
) {
|
||||
var musicOn by remember { mutableStateOf(SoundManager.musicEnabled) }
|
||||
var menuMusicOn by remember { mutableStateOf(SoundManager.menuMusicEnabled) }
|
||||
var sfxOn by remember { mutableStateOf(SoundManager.sfxEnabled) }
|
||||
val context = LocalContext.current
|
||||
|
||||
@@ -106,6 +107,13 @@ fun SettingsScreen(
|
||||
) {
|
||||
SectionCaption(stringResource(R.string.settings_section_sound))
|
||||
ListGroup {
|
||||
ListRow(
|
||||
title = stringResource(R.string.settings_menu_music),
|
||||
subtitle = stringResource(R.string.settings_menu_music_subtitle),
|
||||
icon = R.drawable.ic_music,
|
||||
trailing = { SettingSwitch(menuMusicOn) { menuMusicOn = it; SoundManager.setMenuMusicEnabled(it) } }
|
||||
)
|
||||
ListDivider()
|
||||
ListRow(
|
||||
title = stringResource(R.string.settings_radio),
|
||||
subtitle = stringResource(R.string.settings_radio_subtitle),
|
||||
|
||||
Reference in New Issue
Block a user