Compare commits
8
Commits
f84f72e7b6
...
2.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c856bc79c | ||
|
|
4ebde043a3 | ||
|
|
23280bfd43 | ||
|
|
0db0feba84 | ||
|
|
cb39e5482d | ||
|
|
0e9dafa482 | ||
|
|
c7d4b79180 | ||
|
|
f13bc397d4 |
@@ -7,7 +7,7 @@ LCDPet is free software licensed under the GNU General Public License v3.0.
|
||||
You may run, study, share, and modify LCDPet under the terms of that license.
|
||||
|
||||
Source code:
|
||||
https://gitlab.com/KrisKS/lcdpet
|
||||
https://notfeelingit.today/Kris/LCDPet
|
||||
|
||||
The complete license text is included in the source repository's LICENSE file.
|
||||
|
||||
|
||||
@@ -52,7 +52,8 @@ import kotlinx.coroutines.delay
|
||||
@Composable
|
||||
fun TouchGrassActivityScreen(
|
||||
lcdDark: Color,
|
||||
onGrassTap: () -> Unit
|
||||
onGrassTap: () -> Unit,
|
||||
statusText: String = "Pet is taking time alone."
|
||||
) {
|
||||
var grassFingerColumn by remember { mutableIntStateOf(-1) }
|
||||
var grassWaveTick by remember { mutableIntStateOf(0) }
|
||||
@@ -127,7 +128,7 @@ fun TouchGrassActivityScreen(
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "Pet is taking time alone.",
|
||||
text = statusText,
|
||||
color = lcdDark,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
@@ -139,7 +140,8 @@ fun WatchTvActivityScreen(
|
||||
lcdDark: Color,
|
||||
selectedChannel: TvChannel,
|
||||
weatherLabel: String,
|
||||
onChannelSelected: (TvChannel) -> Unit
|
||||
onChannelSelected: (TvChannel) -> Unit,
|
||||
statusText: String = "Pet is outside having alone time."
|
||||
) {
|
||||
var tvFrame by remember { mutableIntStateOf(0) }
|
||||
var tvPowerState by remember { mutableIntStateOf(1) }
|
||||
@@ -459,7 +461,7 @@ fun WatchTvActivityScreen(
|
||||
}
|
||||
|
||||
Text(
|
||||
text = "Pet is outside having alone time.",
|
||||
text = statusText,
|
||||
color = lcdDark,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
@@ -671,6 +671,8 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
var testWantMenuOpen by remember { mutableStateOf(false) }
|
||||
var testBondMenuOpen by remember { mutableStateOf(false) }
|
||||
var downtimeMode by remember { mutableStateOf(DowntimeMode.None) }
|
||||
var petMeTimeActive by remember { mutableStateOf(false) }
|
||||
var sleepWakeConfirm by remember { mutableStateOf(false) }
|
||||
var selectedTvChannel by remember { mutableStateOf(TvChannel.Weather) }
|
||||
|
||||
var currentWant by remember { mutableStateOf("") }
|
||||
@@ -2057,7 +2059,7 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
}
|
||||
|
||||
fun beginTradeInPet() {
|
||||
if (!isTradingInPet && !isFindingNewPet) {
|
||||
if (bond >= 25 && !isTradingInPet && !isFindingNewPet) {
|
||||
careMenuOpen = false
|
||||
socializeMenuOpen = false
|
||||
currentWant = ""
|
||||
@@ -2290,6 +2292,8 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
}
|
||||
fun wakeFromAutoSleep() {
|
||||
if (isSleeping && sleepMode == "Auto") {
|
||||
sleepWakeConfirm = false
|
||||
downtimeMode = DowntimeMode.None
|
||||
val sleptOutside = location == "Outside"
|
||||
val startedAtMs = if (autoSleepStartedAtMs > 0L) autoSleepStartedAtMs else System.currentTimeMillis()
|
||||
val sleptMs = (System.currentTimeMillis() - startedAtMs).coerceAtLeast(0L)
|
||||
@@ -2334,6 +2338,39 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
}
|
||||
}
|
||||
|
||||
fun wakeFromManualNap() {
|
||||
if (isSleeping && sleepMode == "Nap") {
|
||||
sleepWakeConfirm = false
|
||||
downtimeMode = DowntimeMode.None
|
||||
roughWakeDarkFlash = true
|
||||
activityMood = "Asleep"
|
||||
frameProp = ""
|
||||
framePropAnimation = ""
|
||||
framePropStyle = 0
|
||||
|
||||
saveScope.launch {
|
||||
delay(if (testingMode) 1_500L else 1_200L)
|
||||
|
||||
if (isSleeping && sleepMode == "Nap") {
|
||||
isSleeping = false
|
||||
sleepMode = ""
|
||||
autoSleepStartedAtMs = 0L
|
||||
restoredManualNap = false
|
||||
roughWakeDarkFlash = false
|
||||
roughWakeNervousHold = false
|
||||
|
||||
status = "Nervous"
|
||||
activityMood = "RoughWake"
|
||||
roughWakeAlert = true
|
||||
frameProp = "!?!"
|
||||
framePropAnimation = ""
|
||||
framePropStyle = 0
|
||||
happiness = (happiness - 1).coerceAtLeast(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val currentNeedsPetName by rememberUpdatedState(needsPetName)
|
||||
val currentSaveLoaded by rememberUpdatedState(saveLoaded)
|
||||
val currentLocation by rememberUpdatedState(location)
|
||||
@@ -2577,17 +2614,14 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
LaunchedEffect(saveLoaded, restoredAutoSleep) {
|
||||
if (saveLoaded && restoredAutoSleep && isSleeping && sleepMode == "Auto") {
|
||||
activityMood = "Asleep"
|
||||
roughWakeDarkFlash = true
|
||||
roughWakeDarkFlash = false
|
||||
|
||||
if (framePropAnimation != "Nap") {
|
||||
startFrameAnimation("Nap")
|
||||
}
|
||||
|
||||
delay(if (testingMode) 1_500L else 2_000L)
|
||||
|
||||
if (isSleeping && sleepMode == "Auto") {
|
||||
wakeFromAutoSleep()
|
||||
}
|
||||
// Reopening LCDPet no longer wakes an exhausted sleeping pet.
|
||||
restoredAutoSleep = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2601,46 +2635,16 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
return@LaunchedEffect
|
||||
}
|
||||
|
||||
val wakeAtMs = autoSleepStartedAtMs
|
||||
val napStillActive =
|
||||
wakeAtMs <= 0L || System.currentTimeMillis() < wakeAtMs
|
||||
|
||||
if (!napStillActive) {
|
||||
// The original Nap finished while LCDPet was closed.
|
||||
// Release the gate so the normal Nap completion effect can finish it.
|
||||
restoredManualNap = false
|
||||
return@LaunchedEffect
|
||||
}
|
||||
|
||||
// LCDPet was reopened before the manual Nap was finished.
|
||||
roughWakeDarkFlash = true
|
||||
// Reopening during a Nap no longer wakes the pet.
|
||||
// Release the restore gate so the original fixed wake deadline continues.
|
||||
roughWakeDarkFlash = false
|
||||
activityMood = "Asleep"
|
||||
frameProp = ""
|
||||
framePropAnimation = ""
|
||||
framePropStyle = 0
|
||||
|
||||
delay(if (testingMode) 1_500L else 1_200L)
|
||||
|
||||
if (
|
||||
restoredManualNap &&
|
||||
isSleeping &&
|
||||
sleepMode == "Nap"
|
||||
) {
|
||||
isSleeping = false
|
||||
sleepMode = ""
|
||||
autoSleepStartedAtMs = 0L
|
||||
restoredManualNap = false
|
||||
roughWakeDarkFlash = false
|
||||
roughWakeNervousHold = false
|
||||
|
||||
status = "Nervous"
|
||||
activityMood = "RoughWake"
|
||||
roughWakeAlert = true
|
||||
frameProp = "!?!"
|
||||
framePropAnimation = ""
|
||||
framePropStyle = 0
|
||||
happiness = (happiness - 1).coerceAtLeast(0)
|
||||
if (framePropAnimation != "Nap") {
|
||||
startFrameAnimation("Nap")
|
||||
}
|
||||
|
||||
restoredManualNap = false
|
||||
}
|
||||
|
||||
LaunchedEffect(
|
||||
@@ -3928,6 +3932,8 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
sickCount = 0
|
||||
}
|
||||
|
||||
sleepWakeConfirm = false
|
||||
downtimeMode = DowntimeMode.None
|
||||
isSleeping = false
|
||||
sleepMode = ""
|
||||
autoSleepStartedAtMs = 0L
|
||||
@@ -3950,12 +3956,12 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
val layoutScale = minOf(widthScale, heightScale)
|
||||
|
||||
val screenPadding = (16f * layoutScale).dp
|
||||
val petFrameMinHeight = (235f * layoutScale).dp
|
||||
val petFrameOuterPadding = (10f * layoutScale).dp
|
||||
val petFrameInnerPadding = (12f * layoutScale).dp
|
||||
val meterTopPadding = (16f * layoutScale).dp
|
||||
val meterSpacing = (6f * layoutScale).dp
|
||||
val controlsTopSpacing = (12f * layoutScale).dp
|
||||
val petFrameMinHeight = (360f * layoutScale).dp
|
||||
val petFrameOuterPadding = (5f * layoutScale).dp
|
||||
val petFrameInnerPadding = (6f * layoutScale).dp
|
||||
val meterTopPadding = (8f * layoutScale).dp
|
||||
val meterSpacing = (3f * layoutScale).dp
|
||||
val controlsTopSpacing = (6f * layoutScale).dp
|
||||
val actionSpacing = (8f * layoutScale).dp
|
||||
|
||||
CompositionLocalProvider(LocalContentColor provides lcdDark) {
|
||||
@@ -4204,64 +4210,38 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "PET RECORD",
|
||||
fontWeight = FontWeight.Bold,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
text = "Bond",
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Bond",
|
||||
modifier = Modifier.width(92.dp),
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(text = "$bondPercent% $bondRelationship")
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Age",
|
||||
modifier = Modifier.width(92.dp),
|
||||
text = "Time",
|
||||
modifier = Modifier.width(104.dp),
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(text = petAgeText)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Care",
|
||||
modifier = Modifier.width(92.dp),
|
||||
text = "Strength",
|
||||
modifier = Modifier.width(104.dp),
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(text = "$careScore")
|
||||
Text(text = "$bondPercent%")
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Neglect",
|
||||
modifier = Modifier.width(92.dp),
|
||||
text = "Status",
|
||||
modifier = Modifier.width(104.dp),
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(text = "$neglectScore")
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (testingMode) {
|
||||
Row {
|
||||
Text(
|
||||
text = "Want",
|
||||
modifier = Modifier.width(72.dp)
|
||||
)
|
||||
Text(text = currentWant.ifBlank { "None" })
|
||||
}
|
||||
Text(text = bondRelationship)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
@@ -4311,8 +4291,8 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
)
|
||||
} else {
|
||||
LCDSubButton(
|
||||
text = "TRADE PET IN",
|
||||
enabled = !isFindingNewPet,
|
||||
text = "SET PET FREE",
|
||||
enabled = bond >= 25 && !isFindingNewPet,
|
||||
lcdDark = lcdDark,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
@@ -4569,6 +4549,26 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
}
|
||||
)
|
||||
|
||||
LCDSubButton(
|
||||
text = "TEST ME TIME",
|
||||
enabled = !isSleeping &&
|
||||
!isBathing &&
|
||||
!isTalking &&
|
||||
!isFindingNewPet &&
|
||||
!isTradingInPet &&
|
||||
framePropAnimation.isEmpty(),
|
||||
lcdDark = lcdDark,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
petMeTimeActive = true
|
||||
downtimeMode = DowntimeMode.None
|
||||
careMenuOpen = false
|
||||
socializeMenuOpen = false
|
||||
testWantMenuOpen = false
|
||||
statsMenuOpen = false
|
||||
}
|
||||
)
|
||||
|
||||
LCDSubButton(
|
||||
text = "TEST TOUCH GRASS",
|
||||
enabled = !isSleeping &&
|
||||
@@ -4892,13 +4892,20 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
val downtimeActive =
|
||||
testingMode && downtimeMode != DowntimeMode.None
|
||||
!isSleeping &&
|
||||
!petMeTimeActive &&
|
||||
downtimeMode != DowntimeMode.None
|
||||
|
||||
val downtimeTitle = when {
|
||||
testingMode && downtimeMode == DowntimeMode.TouchGrass -> "TOUCH GRASS"
|
||||
testingMode && downtimeMode == DowntimeMode.WatchTv -> "WATCH TV"
|
||||
else -> ""
|
||||
}
|
||||
val downtimeTitle =
|
||||
if (isSleeping) {
|
||||
""
|
||||
} else {
|
||||
when (downtimeMode) {
|
||||
DowntimeMode.TouchGrass -> "TOUCH GRASS"
|
||||
DowntimeMode.WatchTv -> "WATCH TV"
|
||||
DowntimeMode.None -> ""
|
||||
}
|
||||
}
|
||||
|
||||
if (downtimeTitle.isNotEmpty()) {
|
||||
Text(
|
||||
@@ -4923,17 +4930,35 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
)
|
||||
)
|
||||
|
||||
if (testingMode && downtimeMode == DowntimeMode.TouchGrass) {
|
||||
if (!isSleeping &&
|
||||
!petMeTimeActive &&
|
||||
downtimeMode == DowntimeMode.TouchGrass
|
||||
) {
|
||||
TouchGrassActivityScreen(
|
||||
lcdDark = petFrameForeground,
|
||||
onGrassTap = {}
|
||||
onGrassTap = {},
|
||||
statusText =
|
||||
if (isSleeping) {
|
||||
"$displayPetName is sleeping."
|
||||
} else {
|
||||
"Pet is taking time alone."
|
||||
}
|
||||
)
|
||||
} else if (testingMode && downtimeMode == DowntimeMode.WatchTv) {
|
||||
} else if (!isSleeping &&
|
||||
!petMeTimeActive &&
|
||||
downtimeMode == DowntimeMode.WatchTv
|
||||
) {
|
||||
WatchTvActivityScreen(
|
||||
lcdDark = petFrameForeground,
|
||||
selectedChannel = selectedTvChannel,
|
||||
weatherLabel = weather,
|
||||
onChannelSelected = { selectedTvChannel = it }
|
||||
onChannelSelected = { selectedTvChannel = it },
|
||||
statusText =
|
||||
if (isSleeping) {
|
||||
"$displayPetName is sleeping."
|
||||
} else {
|
||||
"Pet is outside having alone time."
|
||||
}
|
||||
)
|
||||
} else {
|
||||
Text(
|
||||
@@ -4987,6 +5012,129 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(meterTopPadding))
|
||||
|
||||
Text(
|
||||
text = "┈".repeat(28),
|
||||
color = petFrameForeground,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
textAlign = TextAlign.Center,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(meterSpacing))
|
||||
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(meterSpacing)
|
||||
) {
|
||||
val meterLabelWidth = 120.dp
|
||||
val meterBarPadding = 8.dp
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Happiness",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = happinessBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Energy",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = energyBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Hunger",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = hungerBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Dirtiness",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = dirtinessBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Potty",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = pottyBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Boredom",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = boredomBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((isSleeping && location == "Inside") || roughWakeDarkFlash) {
|
||||
@@ -5424,116 +5572,6 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
}
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier.padding(top = meterTopPadding),
|
||||
verticalArrangement = Arrangement.spacedBy(meterSpacing)
|
||||
) {
|
||||
val meterLabelWidth = 120.dp
|
||||
val meterBarPadding = 8.dp
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Happiness",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = happinessBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Energy",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = energyBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Hunger",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = hungerBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Dirtiness",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = dirtinessBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Potty",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = pottyBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
|
||||
Row {
|
||||
Text(
|
||||
text = "Boredom",
|
||||
modifier = Modifier.width(meterLabelWidth),
|
||||
textAlign = TextAlign.End,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
Text(
|
||||
text = boredomBar,
|
||||
modifier = Modifier.padding(start = meterBarPadding),
|
||||
fontFamily = FontFamily.Monospace,
|
||||
maxLines = 1,
|
||||
softWrap = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(controlsTopSpacing))
|
||||
|
||||
Column(
|
||||
@@ -5541,7 +5579,8 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
verticalArrangement = Arrangement.spacedBy(actionSpacing)
|
||||
) {
|
||||
val actionInProgress =
|
||||
(testingMode && downtimeMode != DowntimeMode.None) ||
|
||||
petMeTimeActive ||
|
||||
(testingMode && downtimeMode != DowntimeMode.None) ||
|
||||
isTradingInPet ||
|
||||
isFindingNewPet ||
|
||||
isSleeping ||
|
||||
@@ -5578,6 +5617,324 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
"RecoverWeak"
|
||||
)
|
||||
|
||||
if (petMeTimeActive && !isSleeping) {
|
||||
androidx.compose.ui.window.Popup(
|
||||
alignment = Alignment.TopCenter,
|
||||
properties = androidx.compose.ui.window.PopupProperties(
|
||||
focusable = true
|
||||
)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(configuration.screenWidthDp.dp)
|
||||
.height(configuration.screenHeightDp.dp)
|
||||
.background(petHomeBackground)
|
||||
.border(2.dp, petFrameForeground)
|
||||
.padding(screenPadding)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = "$displayPetName wants some time alone.",
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = petFrameForeground,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
LCDSubMenuFrame(lcdDark = petFrameForeground) {
|
||||
LCDSubButton(
|
||||
text = "TOUCH GRASS",
|
||||
modifier = Modifier.weight(1f),
|
||||
fillWidthFraction = 1f,
|
||||
enabled = true,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
downtimeMode = DowntimeMode.TouchGrass
|
||||
}
|
||||
)
|
||||
|
||||
LCDSubButton(
|
||||
text = "WATCH TV",
|
||||
modifier = Modifier.weight(1f),
|
||||
fillWidthFraction = 1f,
|
||||
enabled = true,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
downtimeMode = DowntimeMode.WatchTv
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
when (downtimeMode) {
|
||||
DowntimeMode.TouchGrass -> {
|
||||
TouchGrassActivityScreen(
|
||||
lcdDark = petFrameForeground,
|
||||
onGrassTap = {},
|
||||
statusText = "$displayPetName wants some time alone."
|
||||
)
|
||||
}
|
||||
|
||||
DowntimeMode.WatchTv -> {
|
||||
WatchTvActivityScreen(
|
||||
lcdDark = petFrameForeground,
|
||||
selectedChannel = selectedTvChannel,
|
||||
weatherLabel = weather,
|
||||
onChannelSelected = {
|
||||
selectedTvChannel = it
|
||||
},
|
||||
statusText = "$displayPetName wants some time alone."
|
||||
)
|
||||
}
|
||||
|
||||
DowntimeMode.None -> {
|
||||
Text(
|
||||
text = petArt,
|
||||
fontSize = 24.sp,
|
||||
lineHeight = 24.sp,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
textAlign = TextAlign.Center,
|
||||
color = petFrameForeground
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
LCDMenuButton(
|
||||
text = "EXIT",
|
||||
enabled = true,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
downtimeMode = DowntimeMode.None
|
||||
(context as? android.app.Activity)
|
||||
?.moveTaskToBack(true)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isSleeping) {
|
||||
androidx.compose.ui.window.Popup(
|
||||
alignment = Alignment.TopCenter,
|
||||
properties = androidx.compose.ui.window.PopupProperties(
|
||||
focusable = true
|
||||
)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(configuration.screenWidthDp.dp)
|
||||
.height(configuration.screenHeightDp.dp)
|
||||
.background(petHomeBackground)
|
||||
.border(2.dp, petFrameForeground)
|
||||
.padding(screenPadding)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = "$displayPetName is sleeping.",
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = petFrameForeground,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
LCDSubMenuFrame(lcdDark = petFrameForeground) {
|
||||
LCDSubButton(
|
||||
text = "TOUCH GRASS",
|
||||
modifier = Modifier.weight(1f),
|
||||
fillWidthFraction = 1f,
|
||||
enabled = !roughWakeDarkFlash,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
downtimeMode = DowntimeMode.TouchGrass
|
||||
}
|
||||
)
|
||||
|
||||
LCDSubButton(
|
||||
text = "WATCH TV",
|
||||
modifier = Modifier.weight(1f),
|
||||
fillWidthFraction = 1f,
|
||||
enabled = !roughWakeDarkFlash,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
downtimeMode = DowntimeMode.WatchTv
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
when (downtimeMode) {
|
||||
DowntimeMode.TouchGrass -> {
|
||||
TouchGrassActivityScreen(
|
||||
lcdDark = petFrameForeground,
|
||||
onGrassTap = {},
|
||||
statusText = "$displayPetName is sleeping."
|
||||
)
|
||||
}
|
||||
|
||||
DowntimeMode.WatchTv -> {
|
||||
WatchTvActivityScreen(
|
||||
lcdDark = petFrameForeground,
|
||||
selectedChannel = selectedTvChannel,
|
||||
weatherLabel = weather,
|
||||
onChannelSelected = {
|
||||
selectedTvChannel = it
|
||||
},
|
||||
statusText = "$displayPetName is sleeping."
|
||||
)
|
||||
}
|
||||
|
||||
DowntimeMode.None -> {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = petArt,
|
||||
fontSize = 24.sp,
|
||||
lineHeight = 24.sp,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
textAlign = TextAlign.Center,
|
||||
color = petFrameForeground
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
Text(
|
||||
text = "ZzZ",
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = petFrameForeground
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
LCDMenuButton(
|
||||
text = "EXIT QUIETLY",
|
||||
enabled = !roughWakeDarkFlash,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
downtimeMode = DowntimeMode.None
|
||||
(context as? android.app.Activity)
|
||||
?.moveTaskToBack(true)
|
||||
}
|
||||
)
|
||||
|
||||
LCDMenuButton(
|
||||
text = "WAKE ${displayPetName.uppercase()}",
|
||||
enabled = !roughWakeDarkFlash,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
sleepWakeConfirm = true
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (sleepWakeConfirm) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.matchParentSize()
|
||||
.background(petHomeBackground),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(24.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "ARE YOU SURE?",
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = petFrameForeground,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "Wake $displayPetName?",
|
||||
color = petFrameForeground,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
LCDSubMenuFrame(
|
||||
lcdDark = petFrameForeground
|
||||
) {
|
||||
LCDSubButton(
|
||||
text = "CANCEL",
|
||||
modifier = Modifier.weight(1f),
|
||||
fillWidthFraction = 1f,
|
||||
enabled = true,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
sleepWakeConfirm = false
|
||||
}
|
||||
)
|
||||
|
||||
LCDSubButton(
|
||||
text = "WAKE",
|
||||
modifier = Modifier.weight(1f),
|
||||
fillWidthFraction = 1f,
|
||||
enabled = true,
|
||||
lcdDark = petFrameForeground,
|
||||
lcdFaded = lcdFaded,
|
||||
onClick = {
|
||||
when (sleepMode) {
|
||||
"Auto" ->
|
||||
wakeFromAutoSleep()
|
||||
|
||||
"Nap" ->
|
||||
wakeFromManualNap()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(0.dp))
|
||||
}
|
||||
|
||||
if (location == "Inside") {
|
||||
LCDMenuButton(
|
||||
text = if (careMenuOpen) "CARE ▲" else "CARE ▼",
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user