154 lines
5.3 KiB
Kotlin
154 lines
5.3 KiB
Kotlin
package com.unogame.ui.screens
|
|
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.layout.*
|
|
import androidx.compose.foundation.rememberScrollState
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
import androidx.compose.foundation.verticalScroll
|
|
import androidx.compose.material.icons.Icons
|
|
import androidx.compose.material.icons.filled.*
|
|
import androidx.compose.material3.*
|
|
import androidx.compose.runtime.*
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.graphics.Color
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
import androidx.compose.ui.text.style.TextAlign
|
|
import androidx.compose.ui.unit.dp
|
|
import androidx.compose.ui.unit.sp
|
|
import com.unogame.ui.theme.*
|
|
|
|
@Composable
|
|
fun MainMenuScreen(
|
|
onLocalGame: () -> Unit,
|
|
onOnlineGame: () -> Unit,
|
|
onScoreboard: () -> Unit,
|
|
onRules: () -> Unit,
|
|
onSettings: () -> Unit
|
|
) {
|
|
Box(
|
|
modifier = Modifier
|
|
.fillMaxSize()
|
|
.background(LocalTableBg.current.color),
|
|
contentAlignment = Alignment.Center
|
|
) {
|
|
Column(
|
|
modifier = Modifier
|
|
.fillMaxSize()
|
|
.verticalScroll(rememberScrollState())
|
|
.padding(32.dp),
|
|
horizontalAlignment = Alignment.CenterHorizontally
|
|
) {
|
|
// Title
|
|
Text(
|
|
text = "UNO",
|
|
fontSize = 72.sp,
|
|
fontWeight = FontWeight.Black,
|
|
color = GoldAccent,
|
|
textAlign = TextAlign.Center
|
|
)
|
|
Text(
|
|
text = "卡牌游戏",
|
|
fontSize = 18.sp,
|
|
color = Color.White.copy(alpha = 0.6f),
|
|
textAlign = TextAlign.Center
|
|
)
|
|
|
|
Spacer(modifier = Modifier.height(48.dp))
|
|
|
|
// 1. 本地模式
|
|
Button(
|
|
onClick = onLocalGame,
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.height(56.dp),
|
|
shape = RoundedCornerShape(16.dp),
|
|
colors = ButtonDefaults.buttonColors(
|
|
containerColor = DarkSurface,
|
|
contentColor = UnoGreen
|
|
)
|
|
) {
|
|
Icon(Icons.Default.PhoneAndroid, contentDescription = null)
|
|
Spacer(modifier = Modifier.width(12.dp))
|
|
Text("本地模式", fontSize = 18.sp, fontWeight = FontWeight.Bold)
|
|
}
|
|
|
|
Spacer(modifier = Modifier.height(16.dp))
|
|
|
|
// 2. 联机模式
|
|
Button(
|
|
onClick = onOnlineGame,
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.height(56.dp),
|
|
shape = RoundedCornerShape(16.dp),
|
|
colors = ButtonDefaults.buttonColors(
|
|
containerColor = DarkSurface,
|
|
contentColor = GoldAccent
|
|
)
|
|
) {
|
|
Icon(Icons.Default.Wifi, contentDescription = null)
|
|
Spacer(modifier = Modifier.width(12.dp))
|
|
Text("联机模式", fontSize = 18.sp, fontWeight = FontWeight.Bold)
|
|
}
|
|
|
|
Spacer(modifier = Modifier.height(16.dp))
|
|
|
|
// 3. 排行榜
|
|
Button(
|
|
onClick = onScoreboard,
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.height(56.dp),
|
|
shape = RoundedCornerShape(16.dp),
|
|
colors = ButtonDefaults.buttonColors(
|
|
containerColor = DarkSurface,
|
|
contentColor = UnoPurple.copy(alpha = 0.8f)
|
|
)
|
|
) {
|
|
Icon(Icons.Default.EmojiEvents, contentDescription = null)
|
|
Spacer(modifier = Modifier.width(12.dp))
|
|
Text("排行榜", fontSize = 18.sp, fontWeight = FontWeight.Bold)
|
|
}
|
|
|
|
Spacer(modifier = Modifier.height(16.dp))
|
|
|
|
// 4. 规则说明
|
|
Button(
|
|
onClick = onRules,
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.height(56.dp),
|
|
shape = RoundedCornerShape(16.dp),
|
|
colors = ButtonDefaults.buttonColors(
|
|
containerColor = DarkSurface,
|
|
contentColor = Color.White.copy(alpha = 0.7f)
|
|
)
|
|
) {
|
|
Icon(Icons.Default.MenuBook, contentDescription = null)
|
|
Spacer(modifier = Modifier.width(12.dp))
|
|
Text("规则说明", fontSize = 18.sp, fontWeight = FontWeight.Bold)
|
|
}
|
|
|
|
Spacer(modifier = Modifier.height(16.dp))
|
|
|
|
// 5. 游戏设置
|
|
Button(
|
|
onClick = onSettings,
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.height(56.dp),
|
|
shape = RoundedCornerShape(16.dp),
|
|
colors = ButtonDefaults.buttonColors(
|
|
containerColor = DarkSurface,
|
|
contentColor = Color.White.copy(alpha = 0.5f)
|
|
)
|
|
) {
|
|
Icon(Icons.Default.Settings, contentDescription = null)
|
|
Spacer(modifier = Modifier.width(12.dp))
|
|
Text("游戏设置", fontSize = 18.sp, fontWeight = FontWeight.Bold)
|
|
}
|
|
}
|
|
}
|
|
}
|