feat: R8 난독화 적용, Fragment 1.8.6 업그레이드, 스테이지 해금 및 도장 연출 개선

This commit is contained in:
2026-10-23 02:39:22 +09:00
parent 1dfb0276e6
commit 173ba7c92c
13 changed files with 378 additions and 2450 deletions
-2373
View File
File diff suppressed because it is too large Load Diff
+20
View File
@@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
<defs>
<filter id="rough" x="-15%" y="-15%" width="130%" height="130%">
<feTurbulence type="fractalNoise" baseFrequency="0.025" numOctaves="2" seed="18" result="noise"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="4" xChannelSelector="R" yChannelSelector="G"/>
</filter>
</defs>
<!-- Upright vermilion seal frame with a true transparent center. -->
<g filter="url(#rough)">
<path fill="#a91419" fill-rule="evenodd" opacity=".95" d="M218 172 Q229 162 250 166 L770 166 Q792 170 796 191 L796 743 Q791 764 769 767 L252 767 Q229 763 226 742 Z M304 252 Q304 244 316 244 L706 244 Q718 245 718 257 L718 669 Q718 681 706 682 L316 682 Q304 681 304 669 Z"/>
<path d="M257 207 Q262 201 278 201 L741 201 Q757 204 757 220 L757 708 Q755 725 739 727 L283 727 Q266 724 265 708 Z" fill="none" stroke="#f3ddc3" stroke-width="13" opacity=".95"/>
<path d="M286 236 Q292 228 306 229 L713 229 Q730 231 730 247 L730 680 Q728 697 712 698 L309 698 Q292 696 292 679 Z" fill="none" stroke="#f3ddc3" stroke-width="4" opacity=".72"/>
<!-- Corner key marks sit on the frame; the center remains completely empty. -->
<path d="M323 272h91v14h-75v90h-16zm378 0h-91v14h75v90h16zM323 655h91v-14h-75v-90h-16zm378 0h-91v-14h75v-90h16z" fill="#f3ddc3" opacity=".9"/>
</g>
<g fill="#a91419" opacity=".8">
<circle cx="194" cy="326" r="7"/><circle cx="824" cy="402" r="6"/><circle cx="208" cy="694" r="5"/>
<path d="M800 238l14-7 3 12-15 5zM782 770l10-5 4 8-12 6z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+118
View File
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="1024"
height="1024"
viewBox="0 0 1024 1024"
version="1.1"
id="svg6"
sodipodi:docname="congrats-seal_bg.svg"
inkscape:version="1.4.3 (0d15f75042, 2025-12-25)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="0.84570312"
inkscape:cx="512"
inkscape:cy="512"
inkscape:window-width="1920"
inkscape:window-height="1128"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg6" />
<defs
id="defs1">
<filter
id="rough"
x="0"
y="0"
width="1"
height="1">
<feTurbulence
type="fractalNoise"
baseFrequency="0.025"
numOctaves="2"
seed="18"
result="noise"
id="feTurbulence1" />
<feDisplacementMap
in="SourceGraphic"
in2="noise"
scale="4"
xChannelSelector="R"
yChannelSelector="G"
id="feDisplacementMap1" />
</filter>
</defs>
<!-- Upright vermilion seal frame with a true transparent center. -->
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:1.13167;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10.9"
id="rect6"
width="688.18475"
height="703.55658"
x="160.81293"
y="111.15011"
ry="37.50769" />
<g
filter="url(#rough)"
id="g4">
<path
fill="#a91419"
fill-rule="evenodd"
opacity=".95"
d="M218 172 Q229 162 250 166 L770 166 Q792 170 796 191 L796 743 Q791 764 769 767 L252 767 Q229 763 226 742 Z M304 252 Q304 244 316 244 L706 244 Q718 245 718 257 L718 669 Q718 681 706 682 L316 682 Q304 681 304 669 Z"
id="path1" />
<path
d="M257 207 Q262 201 278 201 L741 201 Q757 204 757 220 L757 708 Q755 725 739 727 L283 727 Q266 724 265 708 Z"
fill="none"
stroke="#f3ddc3"
stroke-width="13"
opacity=".95"
id="path2" />
<path
d="M286 236 Q292 228 306 229 L713 229 Q730 231 730 247 L730 680 Q728 697 712 698 L309 698 Q292 696 292 679 Z"
fill="none"
stroke="#f3ddc3"
stroke-width="4"
opacity=".72"
id="path3" />
<!-- Corner key marks sit on the frame; the center remains completely empty. -->
<path
d="M323 272h91v14h-75v90h-16zm378 0h-91v14h75v90h16zM323 655h91v-14h-75v-90h-16zm378 0h-91v-14h75v-90h16z"
fill="#f3ddc3"
opacity=".9"
id="path4" />
</g>
<g
fill="#a91419"
opacity=".8"
id="g6">
<circle
cx="194"
cy="326"
r="7"
id="circle4" />
<circle
cx="824"
cy="402"
r="6"
id="circle5" />
<circle
cx="208"
cy="694"
r="5"
id="circle6" />
<path
d="M800 238l14-7 3 12-15 5zM782 770l10-5 4 8-12 6z"
id="path6" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

+5 -3
View File
@@ -13,8 +13,8 @@ android {
applicationId = "com.wordpuzzle.hangul" applicationId = "com.wordpuzzle.hangul"
minSdk = 26 minSdk = 26
targetSdk = 36 targetSdk = 36
versionCode = 6 versionCode = 7
versionName = "1.1.4" versionName = "1.1.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -31,7 +31,8 @@ android {
buildTypes { buildTypes {
release { release {
signingConfig = signingConfigs.getByName("release") signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false isMinifyEnabled = true
isShrinkResources = true
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"
@@ -52,6 +53,7 @@ android {
dependencies { dependencies {
implementation(libs.androidx.core.ktx) implementation(libs.androidx.core.ktx)
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.compose) implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.activity.compose) implementation(libs.androidx.activity.compose)
+16 -1
View File
@@ -1,3 +1,18 @@
# Proguard rules # Proguard / R8 rules for WordPuzzle
# Keep Data Models for Gson JSON serialization & Room Database
-keep class com.wordpuzzle.hangul.data.model.** { *; } -keep class com.wordpuzzle.hangul.data.model.** { *; }
-keep class com.wordpuzzle.hangul.data.local.** { *; } -keep class com.wordpuzzle.hangul.data.local.** { *; }
# Keep Gson serialization annotations
-keepattributes *Annotation*
-keepattributes Signature
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Keep Google Mobile Ads (AdMob)
-keep class com.google.android.gms.ads.** { *; }
# Keep Firebase Remote Config
-keep class com.google.firebase.** { *; }
@@ -68,6 +68,7 @@ fun WordPuzzleAppNavHost(
) { ) {
val navController = rememberNavController() val navController = rememberNavController()
val currentUnlockedStage by prefs.currentStageFlow.collectAsState(initial = 1) val currentUnlockedStage by prefs.currentStageFlow.collectAsState(initial = 1)
val maxUnlockedStage by prefs.maxUnlockedStageFlow.collectAsState(initial = 1)
val hintCount by prefs.hintCountFlow.collectAsState(initial = 3) val hintCount by prefs.hintCountFlow.collectAsState(initial = 3)
val coroutineScope = rememberCoroutineScope() val coroutineScope = rememberCoroutineScope()
@@ -80,12 +81,12 @@ fun WordPuzzleAppNavHost(
currentUnlockedStage = currentUnlockedStage, currentUnlockedStage = currentUnlockedStage,
hintCount = hintCount, hintCount = hintCount,
onContinueGame = { stageNum -> onContinueGame = { stageNum ->
navController.navigate("game/$stageNum") navController.navigate("game/$stageNum?isSelectionMode=false")
}, },
onRestartGame = { onRestartGame = {
coroutineScope.launch { coroutineScope.launch {
prefs.setStageCleared(0) // 진행 단계 1단계로 리셋 prefs.resetContinueStage() // 이어하기 단계 1단계로 리셋
navController.navigate("game/1") navController.navigate("game/1?isSelectionMode=false")
} }
}, },
onNavigateToStageSelection = { onNavigateToStageSelection = {
@@ -104,9 +105,9 @@ fun WordPuzzleAppNavHost(
composable("stage_selection") { composable("stage_selection") {
StageSelectionScreen( StageSelectionScreen(
currentUnlockedStage = currentUnlockedStage, currentUnlockedStage = maxUnlockedStage,
onSelectStage = { stageNum -> onSelectStage = { stageNum ->
navController.navigate("game/$stageNum") navController.navigate("game/$stageNum?isSelectionMode=true")
}, },
onNavigateBack = { onNavigateBack = {
navController.popBackStack() navController.popBackStack()
@@ -115,17 +116,25 @@ fun WordPuzzleAppNavHost(
} }
composable( composable(
route = "game/{stageNumber}", route = "game/{stageNumber}?isSelectionMode={isSelectionMode}",
arguments = listOf(navArgument("stageNumber") { type = NavType.IntType }) arguments = listOf(
navArgument("stageNumber") { type = NavType.IntType },
navArgument("isSelectionMode") {
type = NavType.BoolType
defaultValue = false
}
)
) { backStackEntry -> ) { backStackEntry ->
val stageNumber = backStackEntry.arguments?.getInt("stageNumber") ?: 1 val stageNumber = backStackEntry.arguments?.getInt("stageNumber") ?: 1
val isSelectionMode = backStackEntry.arguments?.getBoolean("isSelectionMode") ?: false
GameScreen( GameScreen(
stageNumber = stageNumber, stageNumber = stageNumber,
isSelectionMode = isSelectionMode,
onNavigateBack = { onNavigateBack = {
navController.popBackStack() navController.popBackStack()
}, },
onNavigateToNextStage = { nextStage -> onNavigateToNextStage = { nextStage ->
navController.navigate("game/$nextStage") { navController.navigate("game/$nextStage?isSelectionMode=$isSelectionMode") {
popUpTo("lobby") popUpTo("lobby")
} }
} }
@@ -21,6 +21,7 @@ class UserPreferencesManager(private val context: Context) {
const val MAX_DAILY_AD_HINTS = 3 // 일일 무료 광고 시청 횟수 3회로 변경 const val MAX_DAILY_AD_HINTS = 3 // 일일 무료 광고 시청 횟수 3회로 변경
const val MAX_HINT_LIMIT = 5 // 힌트 최대 보유 제한 5개 const val MAX_HINT_LIMIT = 5 // 힌트 최대 보유 제한 5개
private val KEY_CURRENT_STAGE = intPreferencesKey("current_stage") private val KEY_CURRENT_STAGE = intPreferencesKey("current_stage")
private val KEY_MAX_UNLOCKED_STAGE = intPreferencesKey("max_unlocked_stage")
private val KEY_HINT_COUNT = intPreferencesKey("hint_count") private val KEY_HINT_COUNT = intPreferencesKey("hint_count")
private val KEY_LAST_AD_DATE = stringPreferencesKey("last_ad_date") private val KEY_LAST_AD_DATE = stringPreferencesKey("last_ad_date")
private val KEY_DAILY_AD_WATCH_COUNT = intPreferencesKey("daily_ad_watch_count") private val KEY_DAILY_AD_WATCH_COUNT = intPreferencesKey("daily_ad_watch_count")
@@ -78,6 +79,18 @@ class UserPreferencesManager(private val context: Context) {
.catch { emit(emptyPreferences()) } .catch { emit(emptyPreferences()) }
.map { preferences -> preferences[KEY_CURRENT_STAGE] ?: 1 } .map { preferences -> preferences[KEY_CURRENT_STAGE] ?: 1 }
/**
* 스테이지 선택 화면에서 사용되는 최고 해금 스테이지 Flow
* (한번이라도 도달하거나 클리어한 스테이지는 새로하기에 영향 받지 않고 영구 해금 보존)
*/
val maxUnlockedStageFlow: Flow<Int> = context.dataStore.data
.catch { emit(emptyPreferences()) }
.map { preferences ->
val current = preferences[KEY_CURRENT_STAGE] ?: 1
val maxUnlocked = preferences[KEY_MAX_UNLOCKED_STAGE] ?: 1
maxOf(current, maxUnlocked)
}
val hintCountFlow: Flow<Int> = context.dataStore.data val hintCountFlow: Flow<Int> = context.dataStore.data
.catch { emit(emptyPreferences()) } .catch { emit(emptyPreferences()) }
.map { preferences -> preferences[KEY_HINT_COUNT] ?: 3 } .map { preferences -> preferences[KEY_HINT_COUNT] ?: 3 }
@@ -122,11 +135,30 @@ class UserPreferencesManager(private val context: Context) {
.catch { emit(emptyPreferences()) } .catch { emit(emptyPreferences()) }
.map { preferences -> preferences[KEY_PRE_LEARNED_WORDS] ?: emptySet() } .map { preferences -> preferences[KEY_PRE_LEARNED_WORDS] ?: emptySet() }
suspend fun setStageCleared(clearedStage: Int) { suspend fun resetContinueStage() {
context.dataStore.edit { preferences -> context.dataStore.edit { preferences ->
val current = preferences[KEY_CURRENT_STAGE] ?: 1 preferences[KEY_CURRENT_STAGE] = 1
if (clearedStage >= current) { }
preferences[KEY_CURRENT_STAGE] = clearedStage + 1 }
suspend fun updateStageProgress(playedStage: Int, isCleared: Boolean = false) {
context.dataStore.edit { preferences ->
val currentMax = preferences[KEY_MAX_UNLOCKED_STAGE] ?: 1
val currentContinue = preferences[KEY_CURRENT_STAGE] ?: 1
val nextUnlock = if (isCleared) playedStage + 1 else playedStage
val newMax = maxOf(currentMax, currentContinue, nextUnlock)
if (newMax > currentMax) {
preferences[KEY_MAX_UNLOCKED_STAGE] = newMax
}
}
}
suspend fun updateContinueStage(nextStage: Int) {
context.dataStore.edit { preferences ->
preferences[KEY_CURRENT_STAGE] = nextStage
val currentMax = preferences[KEY_MAX_UNLOCKED_STAGE] ?: 1
if (nextStage > currentMax) {
preferences[KEY_MAX_UNLOCKED_STAGE] = nextStage
} }
} }
} }
@@ -38,9 +38,9 @@ private class FastConfettiSystem(val count: Int) {
val rand = Random(42) val rand = Random(42)
for (i in 0 until count) { for (i in 0 until count) {
x[i] = rand.nextFloat() * 1000f x[i] = rand.nextFloat() * 1000f
y[i] = -30f - rand.nextFloat() * 350f y[i] = -30f - rand.nextFloat() * 300f
vx[i] = (rand.nextFloat() - 0.5f) * 5f vx[i] = (rand.nextFloat() - 0.5f) * 6f
vy[i] = 3.5f + rand.nextFloat() * 7f vy[i] = 7.0f + rand.nextFloat() * 12f
size[i] = 12f + rand.nextFloat() * 16f size[i] = 12f + rand.nextFloat() * 16f
colorIndex[i] = rand.nextInt(CONFETTI_COLORS.size) colorIndex[i] = rand.nextInt(CONFETTI_COLORS.size)
flutterPhase[i] = rand.nextFloat() * 6.28f flutterPhase[i] = rand.nextFloat() * 6.28f
@@ -62,7 +62,7 @@ fun ConfettiParticleCanvas(
animProgress.animateTo( animProgress.animateTo(
targetValue = 1f, targetValue = 1f,
animationSpec = tween( animationSpec = tween(
durationMillis = 3800, durationMillis = 2000, // 딱 2.0초로 설정
easing = LinearEasing easing = LinearEasing
) )
) )
@@ -74,7 +74,7 @@ fun ConfettiParticleCanvas(
Canvas(modifier = modifier.fillMaxSize()) { Canvas(modifier = modifier.fillMaxSize()) {
val canvasWidth = size.width val canvasWidth = size.width
val canvasHeight = size.height val canvasHeight = size.height
val elapsedSec = progress * 3.8f val elapsedSec = progress * 2.0f
val globalAlpha = if (progress > 0.82f) { val globalAlpha = if (progress > 0.82f) {
((1f - progress) / 0.18f).coerceIn(0f, 1f) ((1f - progress) / 0.18f).coerceIn(0f, 1f)
@@ -85,10 +85,10 @@ fun ConfettiParticleCanvas(
if (globalAlpha <= 0f) return@Canvas if (globalAlpha <= 0f) return@Canvas
for (i in 0 until system.count) { for (i in 0 until system.count) {
// 수학 공식으로 위치 계산 (매 프레임 객체 생성 0개) // 2.0초 내에 화면 아래까지 가볍고 부드럽게 완전 낙하
val flutterX = sin(elapsedSec * 3.5f + system.flutterPhase[i]) * 18f val flutterX = sin(elapsedSec * 4.8f + system.flutterPhase[i]) * 18f
val px = ((system.x[i] + system.vx[i] * elapsedSec * 30f + flutterX) / 1000f) * canvasWidth val px = ((system.x[i] + system.vx[i] * elapsedSec * 30f + flutterX) / 1000f) * canvasWidth
val py = ((system.y[i] + system.vy[i] * elapsedSec * 35f + 0.5f * 9.8f * elapsedSec * elapsedSec * 15f) / 1000f) * canvasHeight val py = ((system.y[i] + system.vy[i] * elapsedSec * 50f + 0.5f * 18f * elapsedSec * elapsedSec * 15f) / 1000f) * canvasHeight
if (py < -20f || py > canvasHeight + 50f) continue if (py < -20f || py > canvasHeight + 50f) continue
@@ -33,6 +33,7 @@ import kotlinx.coroutines.delay
@Composable @Composable
fun GameScreen( fun GameScreen(
stageNumber: Int, stageNumber: Int,
isSelectionMode: Boolean = false,
onNavigateBack: () -> Unit, onNavigateBack: () -> Unit,
onNavigateToNextStage: (Int) -> Unit, onNavigateToNextStage: (Int) -> Unit,
viewModel: GameViewModel = viewModel() viewModel: GameViewModel = viewModel()
@@ -42,8 +43,8 @@ fun GameScreen(
val activity = context as? Activity val activity = context as? Activity
val lifecycleOwner = LocalLifecycleOwner.current val lifecycleOwner = LocalLifecycleOwner.current
LaunchedEffect(stageNumber) { LaunchedEffect(stageNumber, isSelectionMode) {
viewModel.loadStage(stageNumber) viewModel.loadStage(stageNumber, isSelectionMode)
SoundManager.playPuzzleBgm(context, stageNumber) SoundManager.playPuzzleBgm(context, stageNumber)
} }
@@ -69,11 +70,11 @@ fun GameScreen(
} }
} }
// 클리어 이벤트 수신: 참 잘했어요 도장과 폭죽 연출이 바닥까지 완전히 떨어지도록 3.8초 딜레이 후 전환 // 클리어 이벤트 수신: 참 잘했어요 도장과 폭죽 연출을 2.0초간 보여준 후 다음 스테이지로 전환
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
viewModel.stageClearEvent.collect { event -> viewModel.stageClearEvent.collect { event ->
// 종이가 완전히 떨어지는 애니메이션을 위한 3.8초 딜레이 // 종이가 바닥으로 완전히 떨어지는 2.0초 딜레이
delay(3800L) delay(2000L)
if (event.isLastStage) { if (event.isLastStage) {
ToastUtils.showTopToast(context, "🎉 모든 스테이지를 클리어하셨습니다!") ToastUtils.showTopToast(context, "🎉 모든 스테이지를 클리어하셨습니다!")
@@ -265,10 +266,18 @@ fun GameScreen(
) )
} }
// 스테이지 클리어 세레모니 연출 (Confetti 폭죽 + 참 잘했어요! 도장) // 스테이지 클리어 세레모니 연출 (Confetti 폭죽 + 퍼즐 위치로 위로 끌어올린 도장 오버레이)
if (uiState.isStageClear) { if (uiState.isStageClear) {
ConfettiParticleCanvas(particleCount = 80) ConfettiParticleCanvas(particleCount = 45)
StageClearStampOverlay(stageNumber = stageNumber)
Box(
modifier = Modifier
.fillMaxSize()
.offset(y = (-75).dp), // 기존 UI 배치 유지 및 도장 오버레이 위치만 퍼즐 보드 한가운데로 상향 조절
contentAlignment = Alignment.Center
) {
StageClearStampOverlay(stageNumber = stageNumber)
}
} }
} }
} }
@@ -59,6 +59,7 @@ class GameViewModel(application: Application) : AndroidViewModel(application) {
private var isTimerPaused: Boolean = false private var isTimerPaused: Boolean = false
private var cleanTemplateGrid: List<List<CrosswordCell>>? = null private var cleanTemplateGrid: List<List<CrosswordCell>>? = null
private var isSelectionMode: Boolean = false
init { init {
viewModelScope.launch { viewModelScope.launch {
@@ -90,8 +91,12 @@ class GameViewModel(application: Application) : AndroidViewModel(application) {
!state.showHintDialog !state.showHintDialog
} }
fun loadStage(stageNumber: Int) { fun loadStage(stageNumber: Int, isSelectionMode: Boolean = false) {
this.isSelectionMode = isSelectionMode
viewModelScope.launch { viewModelScope.launch {
// 플레이 한 스테이지는 최고 해금 스테이지 기록에 반영
prefs.updateStageProgress(stageNumber)
_uiState.update { it.copy(isLoading = true, isStageClear = false, isStageFailed = false) } _uiState.update { it.copy(isLoading = true, isStageClear = false, isStageFailed = false) }
val template = stageRepo.getCleanStageTemplate(stageNumber) val template = stageRepo.getCleanStageTemplate(stageNumber)
@@ -351,7 +356,14 @@ class GameViewModel(application: Application) : AndroidViewModel(application) {
viewModelScope.launch { viewModelScope.launch {
val elapsedSeconds = getEffectiveElapsedSeconds() val elapsedSeconds = getEffectiveElapsedSeconds()
prefs.setStageCleared(stage.stageNumber) // 클리어한 스테이지는 최고 해금 스테이지 기록에 반영
prefs.updateStageProgress(stage.stageNumber, isCleared = true)
// 선택하기 모드가 아닐 때만(새로하기/이어하기 순차 진행 시) 이어하기 저장 스테이지 갱신
if (!isSelectionMode) {
prefs.updateContinueStage(stage.stageNumber + 1)
}
for (clue in stage.clues) { for (clue in stage.clues) {
wordRepo.markWordLearned(clue.word) wordRepo.markWordLearned(clue.word)
} }
@@ -3,9 +3,9 @@ package com.wordpuzzle.hangul.ui.game
import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.Spring import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.spring import androidx.compose.animation.core.spring
import androidx.compose.foundation.border import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -16,82 +16,125 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate import androidx.compose.ui.draw.rotate
import androidx.compose.ui.draw.scale import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.wordpuzzle.hangul.R
@Composable @Composable
fun StageClearStampOverlay( fun StageClearStampOverlay(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
stageNumber: Int = 1 stageNumber: Int = 1
) { ) {
// 쾅! 하고 힘차게 찍히는 중후한 스탬프 바운스 애니메이션 // 순간 팡! 타격 스탬프 애니메이션
val scaleAnim = remember { Animatable(2.8f) } val scaleAnim = remember { Animatable(0f) }
val rotateAnim = remember { Animatable(-18f) } val rotateAnim = remember { Animatable(-6f) }
val alphaAnim = remember { Animatable(0f) }
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
alphaAnim.animateTo(1f)
scaleAnim.animateTo( scaleAnim.animateTo(
targetValue = 1.0f, targetValue = 1.0f,
animationSpec = spring( animationSpec = spring(
dampingRatio = Spring.DampingRatioMediumBouncy, dampingRatio = Spring.DampingRatioHighBouncy,
stiffness = Spring.StiffnessMediumLow stiffness = Spring.StiffnessHigh
) )
) )
rotateAnim.animateTo( rotateAnim.animateTo(
targetValue = -9f, targetValue = -3f,
animationSpec = spring( animationSpec = spring(
dampingRatio = Spring.DampingRatioHighBouncy, dampingRatio = Spring.DampingRatioMediumBouncy,
stiffness = Spring.StiffnessMedium stiffness = Spring.StiffnessHigh
) )
) )
} }
Box( BoxWithConstraints(
modifier = modifier.fillMaxSize(), modifier = modifier.fillMaxSize(),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
Surface( // 화면 가로 폭의 약 85% 크기로 확대 설정
val stampWidth = this.maxWidth * 0.85f
Box(
modifier = Modifier modifier = Modifier
.size(240.dp) .width(stampWidth)
.aspectRatio(1f)
.scale(scaleAnim.value) .scale(scaleAnim.value)
.rotate(rotateAnim.value) .rotate(rotateAnim.value),
.border(6.dp, Color(0xFFC62828), CircleShape), contentAlignment = Alignment.Center
shape = CircleShape,
color = Color(0xFFFFF5F5), // 선명한 한지 인주 배경
shadowElevation = 16.dp
) { ) {
Box( // 전통 낙관 도장 SVG 백그라운드 프레임 (congrats-seal_bg.svg)
Image(
painter = painterResource(id = R.drawable.ic_congrats_seal),
contentDescription = "축하 도장 프레임",
modifier = Modifier.fillMaxSize()
)
// 도장 내부 프레임 중앙 흰색 영역에만 깔끔하게 정렬
Column(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxWidth(0.58f)
.padding(8.dp) .fillMaxHeight(0.62f)
.border(3.dp, Color(0xFFB71C1C), CircleShape), .padding(vertical = 2.dp, horizontal = 2.dp),
contentAlignment = Alignment.Center horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) { ) {
Column( // 상단 한자 어구
horizontalAlignment = Alignment.CenterHorizontally, Row(
verticalArrangement = Arrangement.Center verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp)
) { ) {
Text( Text(
text = "祝 클리어", text = "祝",
fontSize = 20.sp, fontSize = 18.sp,
fontWeight = FontWeight.ExtraBold,
color = Color(0xFFB71C1C)
)
Spacer(modifier = Modifier.height(6.dp))
Text(
text = "참 잘했어요!",
fontSize = 32.sp,
fontWeight = FontWeight.Black, fontWeight = FontWeight.Black,
color = Color(0xFFC62828) color = Color(0xFFA91419)
) )
Spacer(modifier = Modifier.height(4.dp))
Text( Text(
text = "STAGE $stageNumber", text = "·",
fontSize = 15.sp, fontSize = 18.sp,
fontWeight = FontWeight.ExtraBold, fontWeight = FontWeight.Black,
color = Color(0xFFD32F2F) color = Color(0xFFA91419)
)
Text(
text = "通",
fontSize = 18.sp,
fontWeight = FontWeight.Black,
color = Color(0xFFA91419)
)
}
Spacer(modifier = Modifier.height(3.dp))
// 중앙 1행: 참
Text(
text = "참",
fontSize = 34.sp,
fontWeight = FontWeight.Black,
color = Color(0xFFA91419)
)
// 중앙 2행: 잘했어요!
Text(
text = "잘했어요!",
fontSize = 27.sp,
fontWeight = FontWeight.Black,
color = Color(0xFFA91419)
)
Spacer(modifier = Modifier.height(4.dp))
// 하단 전통 스테이지 표시
Surface(
shape = RoundedCornerShape(5.dp),
color = Color(0xFFA91419)
) {
Text(
text = "第 $stageNumber 章",
modifier = Modifier.padding(horizontal = 9.dp, vertical = 2.5.dp),
fontSize = 12.5.sp,
fontWeight = FontWeight.Bold,
color = Color(0xFFF3DDC3)
) )
} }
} }
@@ -0,0 +1,39 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="256dp"
android:height="256dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<!-- White Background Card (congrats-seal_bg.svg) -->
<path
android:fillColor="#FFFFFF"
android:pathData="M198.32,111.15 L811.49,111.15 A37.5,37.5 0 0,1 848.99,148.65 L848.99,777.2 A37.5,37.5 0 0,1 811.49,814.7 L198.32,814.7 A37.5,37.5 0 0,1 160.82,777.2 L160.82,148.65 A37.5,37.5 0 0,1 198.32,111.15 Z" />
<!-- Outer Seal Stamp Frame (Red with hollow center) -->
<path
android:fillColor="#A91419"
android:fillType="evenOdd"
android:pathData="M218,172 Q229,162 250,166 L770,166 Q792,170 796,191 L796,743 Q791,764 769,767 L252,767 Q229,763 226,742 Z M304,252 Q304,244 316,244 L706,244 Q718,245 718,257 L718,669 Q718,681 706,682 L316,682 Q304,681 304,669 Z" />
<!-- Inner Gold Outline 1 -->
<path
android:strokeColor="#F3DDC3"
android:strokeWidth="13"
android:pathData="M257,207 Q262,201 278,201 L741,201 Q757,204 757,220 L757,708 Q755,725 739,727 L283,727 Q266,724 265,708 Z" />
<!-- Inner Gold Outline 2 -->
<path
android:strokeColor="#F3DDC3"
android:strokeWidth="4"
android:pathData="M286,236 Q292,228 306,229 L713,229 Q730,231 730,247 L730,680 Q728,697 712,698 L309,698 Q292,696 292,679 Z" />
<!-- Corner Key Marks -->
<path
android:fillColor="#F3DDC3"
android:pathData="M323,272h91v14h-75v90h-16zm378,0h-91v14h75v90h16zM323,655h91v-14h-75v-90h-16zm378,0h-91v-14h75v-90h16z" />
<!-- Small Ink Specks -->
<path
android:fillColor="#A91419"
android:pathData="M194,319a7,7 0 1,0 0.1,0z M824,396a6,6 0 1,0 0.1,0z M208,689a5,5 0 1,0 0.1,0z M800,238l14,-7 3,12 -15,5z M782,770l10,-5 4,8 -12,6z" />
</vector>
+2
View File
@@ -13,12 +13,14 @@ datastore = "1.1.2"
room = "2.7.0" room = "2.7.0"
ksp = "2.3.6" ksp = "2.3.6"
glance = "1.1.1" glance = "1.1.1"
fragment = "1.8.6"
playServicesAds = "23.6.0" playServicesAds = "23.6.0"
coroutines = "1.10.1" coroutines = "1.10.1"
gson = "2.11.0" gson = "2.11.0"
firebaseBom = "33.9.0" firebaseBom = "33.9.0"
[libraries] [libraries]
androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragment" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" } junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }