Skip to content

Commit 4117875

Browse files
committed
fix: Remove mini-games and logs button from simple mode
1 parent e8b2851 commit 4117875

5 files changed

Lines changed: 36 additions & 152 deletions

File tree

app/src/main/java/app/morphe/manager/ui/screen/PatcherScreen.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@ fun PatcherScreen(
460460
patchesProgress = patchesProgress,
461461
patcherViewModel = patcherViewModel,
462462
showLongStepWarning = showLongStepWarning,
463-
miniGameState = miniGameState,
464463
onCancelClick = { state.showCancelDialog = true },
465464
onHomeClick = onBackClick
466465
)

app/src/main/java/app/morphe/manager/ui/screen/patcher/ExpertPatchingProgress.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,10 +769,7 @@ private fun ExpertLogPanel(
769769
)
770770

771771
when (activeTab) {
772-
1 -> MiniGameContent(
773-
state = miniGameState,
774-
modifier = Modifier.fillMaxSize()
775-
)
772+
1 -> MiniGameContent(state = miniGameState)
776773
else -> {
777774
LazyColumn(
778775
state = listState,

app/src/main/java/app/morphe/manager/ui/screen/patcher/PatcherStates.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fun PatchingSuccess(
196196
// Bottom action bar
197197
PatcherBottomActionBar(
198198
showCancelButton = false,
199-
showLogsButton = true,
199+
showLogsButton = isExpertMode,
200200
showHomeButton = true,
201201
showSaveButton = true,
202202
showErrorButton = false,

app/src/main/java/app/morphe/manager/ui/screen/patcher/SimplePatcherProgress.kt

Lines changed: 26 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@ package app.morphe.manager.ui.screen.patcher
88
import androidx.compose.animation.AnimatedContent
99
import androidx.compose.animation.AnimatedVisibility
1010
import androidx.compose.foundation.layout.*
11-
import androidx.compose.foundation.shape.RoundedCornerShape
1211
import androidx.compose.material.icons.Icons
1312
import androidx.compose.material.icons.outlined.Info
14-
import androidx.compose.material.icons.outlined.SportsEsports
1513
import androidx.compose.material3.CircularProgressIndicator
16-
import androidx.compose.material3.Icon
1714
import androidx.compose.material3.MaterialTheme
18-
import androidx.compose.material3.Surface
1915
import androidx.compose.material3.Text
2016
import androidx.compose.runtime.*
21-
import androidx.compose.runtime.saveable.rememberSaveable
2217
import androidx.compose.ui.Alignment
2318
import androidx.compose.ui.Modifier
2419
import androidx.compose.ui.graphics.StrokeCap
@@ -32,8 +27,6 @@ import androidx.compose.ui.unit.dp
3227
import androidx.compose.ui.unit.sp
3328
import app.morphe.manager.R
3429
import app.morphe.manager.ui.model.State
35-
import app.morphe.manager.ui.screen.patcher.game.MiniGameContent
36-
import app.morphe.manager.ui.screen.patcher.game.MiniGameState
3730
import app.morphe.manager.ui.screen.shared.*
3831
import app.morphe.manager.ui.viewmodel.HomeAndPatcherMessages
3932
import app.morphe.manager.ui.viewmodel.PatcherViewModel
@@ -51,14 +44,12 @@ fun SimplePatchingInProgress(
5144
patchesProgress: Pair<Int, Int>,
5245
patcherViewModel: PatcherViewModel,
5346
showLongStepWarning: Boolean = false,
54-
miniGameState: MiniGameState,
5547
onCancelClick: () -> Unit,
5648
onHomeClick: () -> Unit
5749
) {
5850
val windowSize = rememberWindowSize()
5951
val (completed, total) = patchesProgress
6052
val context = LocalContext.current
61-
var showGame by rememberSaveable { mutableStateOf(false) }
6253

6354
val currentMessage = remember {
6455
mutableIntStateOf(
@@ -95,9 +86,6 @@ fun SimplePatchingInProgress(
9586
total = total,
9687
showLongStepWarning = showLongStepWarning,
9788
patcherViewModel = patcherViewModel,
98-
showGame = showGame,
99-
onToggleGame = { showGame = !showGame },
100-
miniGameState = miniGameState,
10189
onCancelClick = onCancelClick,
10290
onHomeClick = onHomeClick
10391
)
@@ -131,9 +119,6 @@ private fun AdaptiveProgressContent(
131119
total: Int,
132120
showLongStepWarning: Boolean,
133121
patcherViewModel: PatcherViewModel,
134-
showGame: Boolean,
135-
onToggleGame: () -> Unit,
136-
miniGameState: MiniGameState,
137122
onCancelClick: () -> Unit = {},
138123
onHomeClick: () -> Unit = {}
139124
) {
@@ -184,121 +169,44 @@ private fun AdaptiveProgressContent(
184169
)
185170
}
186171

187-
// Right column: Progress circle or game
188-
ProgressSlot(
189-
progress = progress,
190-
completed = completed,
191-
total = total,
192-
showGame = showGame,
193-
onToggleGame = onToggleGame,
194-
miniGameState = miniGameState,
172+
// Right column: Circular progress
173+
Box(
195174
modifier = Modifier
196175
.weight(0.5f)
197-
.fillMaxHeight()
198-
)
199-
}
200-
} else {
201-
// Single-column layout for compact windows (portrait)
202-
BoxWithConstraints(
203-
modifier = Modifier
204-
.fillMaxSize()
205-
.padding(horizontal = contentPadding),
206-
contentAlignment = Alignment.Center
207-
) {
208-
// Slot height = square board (maxWidth) + 56dp header (ScoreRow 44dp + spacing 12dp),
209-
// capped so message + details still fit.
210-
val slotHeight = (maxWidth + 56.dp)
211-
.coerceAtMost(maxHeight - 160.dp)
212-
.coerceAtLeast(220.dp)
213-
214-
Column(
215-
modifier = Modifier.fillMaxWidth(),
216-
horizontalAlignment = Alignment.CenterHorizontally,
217-
verticalArrangement = Arrangement.spacedBy(itemSpacing)
176+
.fillMaxHeight(),
177+
contentAlignment = Alignment.Center
218178
) {
219-
ProgressMessageSection(currentMessage)
220-
221-
ProgressSlot(
179+
CircularProgressWithStats(
222180
progress = progress,
223181
completed = completed,
224182
total = total,
225-
showGame = showGame,
226-
onToggleGame = onToggleGame,
227-
miniGameState = miniGameState,
228-
modifier = Modifier
229-
.fillMaxWidth()
230-
.height(slotHeight)
231-
)
232-
233-
ProgressDetailsSection(
234-
showLongStepWarning = showLongStepWarning,
235-
patcherViewModel = patcherViewModel,
236-
windowSize = windowSize
183+
modifier = Modifier.size(280.dp)
237184
)
238185
}
239186
}
240-
}
241-
}
187+
} else {
188+
// Single-column layout for compact windows (portrait)
189+
Column(
190+
modifier = Modifier
191+
.fillMaxWidth()
192+
.padding(horizontal = contentPadding),
193+
horizontalAlignment = Alignment.CenterHorizontally,
194+
verticalArrangement = Arrangement.spacedBy(itemSpacing * 3)
195+
) {
196+
ProgressMessageSection(currentMessage)
242197

243-
/**
244-
* Swappable slot that shows either the circular progress or the mini-game.
245-
*/
246-
@Composable
247-
private fun ProgressSlot(
248-
progress: Float,
249-
completed: Int,
250-
total: Int,
251-
showGame: Boolean,
252-
onToggleGame: () -> Unit,
253-
miniGameState: MiniGameState,
254-
modifier: Modifier = Modifier
255-
) {
256-
LaunchedEffect(showGame) {
257-
if (!showGame) miniGameState.pauseActiveGame()
258-
}
259-
Box(modifier = modifier) {
260-
if (showGame) {
261-
MiniGameContent(
262-
state = miniGameState,
263-
modifier = Modifier.fillMaxSize(),
198+
CircularProgressWithStats(
264199
progress = progress,
265-
gameContentPadding = 8.dp,
266-
onBackToHost = onToggleGame
200+
completed = completed,
201+
total = total,
202+
modifier = Modifier.size(280.dp)
203+
)
204+
205+
ProgressDetailsSection(
206+
showLongStepWarning = showLongStepWarning,
207+
patcherViewModel = patcherViewModel,
208+
windowSize = windowSize
267209
)
268-
} else {
269-
Column(
270-
modifier = Modifier.fillMaxSize().padding(8.dp),
271-
verticalArrangement = Arrangement.spacedBy(12.dp)
272-
) {
273-
Row(
274-
modifier = Modifier.fillMaxWidth(),
275-
horizontalArrangement = Arrangement.End
276-
) {
277-
Surface(
278-
onClick = onToggleGame,
279-
shape = RoundedCornerShape(10.dp),
280-
color = MaterialTheme.colorScheme.surfaceVariant
281-
) {
282-
Icon(
283-
imageVector = Icons.Outlined.SportsEsports,
284-
contentDescription = null,
285-
tint = MaterialTheme.colorScheme.onSurfaceVariant,
286-
modifier = Modifier.padding(12.dp).size(20.dp)
287-
)
288-
}
289-
}
290-
Box(
291-
modifier = Modifier.weight(1f).fillMaxWidth(),
292-
contentAlignment = Alignment.Center
293-
) {
294-
CircularProgressWithStats(
295-
progress = progress,
296-
completed = completed,
297-
total = total,
298-
modifier = Modifier.size(280.dp)
299-
)
300-
}
301-
}
302210
}
303211
}
304212
}

app/src/main/java/app/morphe/manager/ui/screen/patcher/game/MiniGameConfig.kt

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,11 @@ internal fun GameChip(
9595

9696
/**
9797
* Game selection screen shown when no game is active yet.
98-
* [onClose] is optional; pass null when the caller's navigation already provides
99-
* a way to dismiss (e.g. Expert mode, clicking the Logs tab suffices).
10098
*/
10199
@Composable
102100
internal fun GamePickerContent(
103101
onSelect: (MiniGame) -> Unit,
104-
modifier: Modifier = Modifier,
105-
onClose: (() -> Unit)? = null
102+
modifier: Modifier = Modifier
106103
) {
107104
Column(
108105
modifier = modifier,
@@ -127,12 +124,6 @@ internal fun GamePickerContent(
127124
)
128125
}
129126
}
130-
Spacer(Modifier.weight(1f))
131-
if (onClose != null) {
132-
GameChip(onClick = onClose) {
133-
Icon(Icons.Outlined.BarChart, contentDescription = null, modifier = Modifier.size(20.dp))
134-
}
135-
}
136127
}
137128

138129
Column(
@@ -224,57 +215,46 @@ private fun GamePickerGridCard(
224215
/**
225216
* Unified slot that shows either the game picker or the active game.
226217
* Handles all picker/game switching internally so callers only need to pass state.
227-
*
228-
* [onBackToHost] adds a BarChart chip that exits the game slot entirely (Simple mode only).
229-
* Pass null in Expert mode where the Logs tab serves that purpose.
230218
*/
231219
@Composable
232220
internal fun MiniGameContent(
233221
state: MiniGameState,
234-
modifier: Modifier = Modifier,
235-
progress: Float? = null,
236-
gameContentPadding: Dp = 16.dp,
237-
onBackToHost: (() -> Unit)? = null
222+
progress: Float? = null
238223
) {
224+
val contentModifier = Modifier.fillMaxSize().padding(16.dp)
239225
when (val selected = state.selectedGame) {
240226
null -> GamePickerContent(
241227
onSelect = { state.selectGame(it) },
242-
modifier = modifier.padding(gameContentPadding),
243-
onClose = onBackToHost
228+
modifier = contentModifier
244229
)
245230
else -> {
246231
val extraActions: @Composable () -> Unit = {
247232
GameChip(onClick = { state.selectedGame = null }) {
248233
Icon(Icons.Outlined.SportsEsports, contentDescription = null, modifier = Modifier.size(20.dp))
249234
}
250-
if (onBackToHost != null) {
251-
GameChip(onClick = onBackToHost) {
252-
Icon(Icons.Outlined.BarChart, contentDescription = null, modifier = Modifier.size(20.dp))
253-
}
254-
}
255235
}
256236
when (selected) {
257237
MiniGame.GAME_2048 -> Game2048Board(
258238
state = state.game2048,
259-
modifier = modifier.padding(gameContentPadding),
239+
modifier = contentModifier,
260240
progress = progress,
261241
extraActions = extraActions
262242
)
263243
MiniGame.FLAPPY -> FlappyBirdGame(
264244
state = state.flappy,
265-
modifier = modifier.padding(gameContentPadding),
245+
modifier = contentModifier,
266246
progress = progress,
267247
extraActions = extraActions
268248
)
269249
MiniGame.SNAKE -> SnakeGame(
270250
state = state.snake,
271-
modifier = modifier.padding(gameContentPadding),
251+
modifier = contentModifier,
272252
progress = progress,
273253
extraActions = extraActions
274254
)
275255
MiniGame.DINO -> DinoGame(
276256
state = state.dino,
277-
modifier = modifier.padding(gameContentPadding),
257+
modifier = contentModifier,
278258
progress = progress,
279259
extraActions = extraActions
280260
)

0 commit comments

Comments
 (0)