mirror of
https://github.com/nacabaro/vbhelper.git
synced 2026-01-28 00:15:32 +00:00
Compare commits
2 Commits
61dfc2ce0d
...
489e27b038
| Author | SHA1 | Date | |
|---|---|---|---|
| 489e27b038 | |||
| 6be167bbed |
@ -15,7 +15,7 @@ android {
|
|||||||
minSdk = 28
|
minSdk = 28
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "Alpha 0.6.1"
|
versionName = "Alpha 0.6.2"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CardColors
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@ -44,6 +45,9 @@ fun CharacterEntry(
|
|||||||
disabled: Boolean = false,
|
disabled: Boolean = false,
|
||||||
shape: Shape = MaterialTheme.shapes.medium,
|
shape: Shape = MaterialTheme.shapes.medium,
|
||||||
multiplier: Int = 4,
|
multiplier: Int = 4,
|
||||||
|
cardColors: CardColors = CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceContainerHighest
|
||||||
|
),
|
||||||
onClick: () -> Unit = { }
|
onClick: () -> Unit = { }
|
||||||
) {
|
) {
|
||||||
val bitmap = remember (icon.bitmap) {
|
val bitmap = remember (icon.bitmap) {
|
||||||
@ -61,7 +65,8 @@ fun CharacterEntry(
|
|||||||
},
|
},
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
.padding(8.dp)
|
.padding(8.dp),
|
||||||
|
colors = cardColors
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
contentAlignment = Alignment.BottomCenter,
|
contentAlignment = Alignment.BottomCenter,
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.github.nacabaro.vbhelper.daos
|
|||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import com.github.nacabaro.vbhelper.dtos.CharacterDtos
|
import com.github.nacabaro.vbhelper.dtos.CharacterDtos
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
@ -37,7 +38,7 @@ interface AdventureDao {
|
|||||||
JOIN Adventure a ON uc.id = a.characterId
|
JOIN Adventure a ON uc.id = a.characterId
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
suspend fun getAdventureCharacters(): List<CharacterDtos.AdventureCharacterWithSprites>
|
fun getAdventureCharacters(): Flow<List<CharacterDtos.AdventureCharacterWithSprites>>
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
DELETE FROM Adventure
|
DELETE FROM Adventure
|
||||||
|
|||||||
@ -69,7 +69,8 @@ interface UserCharacterDao {
|
|||||||
c.nameWidth as nameSpriteWidth,
|
c.nameWidth as nameSpriteWidth,
|
||||||
c.nameHeight as nameSpriteHeight,
|
c.nameHeight as nameSpriteHeight,
|
||||||
d.isBEm as isBemCard,
|
d.isBEm as isBemCard,
|
||||||
a.characterId = uc.id as isInAdventure
|
a.characterId = uc.id as isInAdventure,
|
||||||
|
uc.isActive as active
|
||||||
FROM UserCharacter uc
|
FROM UserCharacter uc
|
||||||
JOIN CardCharacter c ON uc.charId = c.id
|
JOIN CardCharacter c ON uc.charId = c.id
|
||||||
JOIN Card d ON d.id = c.cardId
|
JOIN Card d ON d.id = c.cardId
|
||||||
@ -93,7 +94,8 @@ interface UserCharacterDao {
|
|||||||
c.nameWidth as nameSpriteWidth,
|
c.nameWidth as nameSpriteWidth,
|
||||||
c.nameHeight as nameSpriteHeight,
|
c.nameHeight as nameSpriteHeight,
|
||||||
d.isBEm as isBemCard,
|
d.isBEm as isBemCard,
|
||||||
a.characterId = uc.id as isInAdventure
|
a.characterId = uc.id as isInAdventure,
|
||||||
|
uc.isActive as active
|
||||||
FROM UserCharacter uc
|
FROM UserCharacter uc
|
||||||
JOIN CardCharacter c ON uc.charId = c.id
|
JOIN CardCharacter c ON uc.charId = c.id
|
||||||
JOIN Card d ON c.cardId = d.id
|
JOIN Card d ON c.cardId = d.id
|
||||||
@ -130,7 +132,8 @@ interface UserCharacterDao {
|
|||||||
c.nameWidth as nameSpriteWidth,
|
c.nameWidth as nameSpriteWidth,
|
||||||
c.nameHeight as nameSpriteHeight,
|
c.nameHeight as nameSpriteHeight,
|
||||||
d.isBEm as isBemCard,
|
d.isBEm as isBemCard,
|
||||||
a.characterId as isInAdventure
|
a.characterId as isInAdventure,
|
||||||
|
uc.isActive as active
|
||||||
FROM UserCharacter uc
|
FROM UserCharacter uc
|
||||||
JOIN CardCharacter c ON uc.charId = c.id
|
JOIN CardCharacter c ON uc.charId = c.id
|
||||||
JOIN Card d ON c.cardId = d.id
|
JOIN Card d ON c.cardId = d.id
|
||||||
@ -194,7 +197,8 @@ interface UserCharacterDao {
|
|||||||
c.nameWidth as nameSpriteWidth,
|
c.nameWidth as nameSpriteWidth,
|
||||||
c.nameHeight as nameSpriteHeight,
|
c.nameHeight as nameSpriteHeight,
|
||||||
d.isBEm as isBemCard,
|
d.isBEm as isBemCard,
|
||||||
a.characterId = uc.id as isInAdventure
|
a.characterId = uc.id as isInAdventure,
|
||||||
|
uc.isActive as active
|
||||||
FROM UserCharacter uc
|
FROM UserCharacter uc
|
||||||
JOIN CardCharacter c ON uc.charId = c.id
|
JOIN CardCharacter c ON uc.charId = c.id
|
||||||
JOIN Card d ON d.id = c.cardId
|
JOIN Card d ON d.id = c.cardId
|
||||||
@ -219,7 +223,8 @@ interface UserCharacterDao {
|
|||||||
c.nameWidth as nameSpriteWidth,
|
c.nameWidth as nameSpriteWidth,
|
||||||
c.nameHeight as nameSpriteHeight,
|
c.nameHeight as nameSpriteHeight,
|
||||||
d.isBEm as isBemCard,
|
d.isBEm as isBemCard,
|
||||||
a.characterId = uc.id as isInAdventure
|
a.characterId = uc.id as isInAdventure,
|
||||||
|
uc.isActive as active
|
||||||
FROM UserCharacter uc
|
FROM UserCharacter uc
|
||||||
JOIN CardCharacter c ON uc.charId = c.id
|
JOIN CardCharacter c ON uc.charId = c.id
|
||||||
JOIN Card d ON d.id = c.cardId
|
JOIN Card d ON d.id = c.cardId
|
||||||
|
|||||||
@ -31,7 +31,8 @@ object CharacterDtos {
|
|||||||
val nameSpriteWidth: Int,
|
val nameSpriteWidth: Int,
|
||||||
val nameSpriteHeight: Int,
|
val nameSpriteHeight: Int,
|
||||||
val isBemCard: Boolean,
|
val isBemCard: Boolean,
|
||||||
val isInAdventure: Boolean
|
val isInAdventure: Boolean,
|
||||||
|
val active: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
data class CardCharacterInfo(
|
data class CardCharacterInfo(
|
||||||
|
|||||||
@ -9,12 +9,11 @@ import androidx.compose.foundation.lazy.items
|
|||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.produceState
|
import androidx.compose.runtime.produceState
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -29,7 +28,6 @@ import com.github.nacabaro.vbhelper.navigation.NavigationItems
|
|||||||
import com.github.nacabaro.vbhelper.source.StorageRepository
|
import com.github.nacabaro.vbhelper.source.StorageRepository
|
||||||
import com.github.nacabaro.vbhelper.utils.BitmapData
|
import com.github.nacabaro.vbhelper.utils.BitmapData
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -37,16 +35,17 @@ fun AdventureScreen(
|
|||||||
navController: NavController,
|
navController: NavController,
|
||||||
storageScreenController: AdventureScreenControllerImpl
|
storageScreenController: AdventureScreenControllerImpl
|
||||||
) {
|
) {
|
||||||
val coroutineScope = rememberCoroutineScope()
|
|
||||||
val application = LocalContext.current.applicationContext as VBHelper
|
val application = LocalContext.current.applicationContext as VBHelper
|
||||||
val database = application.container.db
|
val database = application.container.db
|
||||||
val storageRepository = StorageRepository(database)
|
val storageRepository = StorageRepository(database)
|
||||||
val characterList = remember {
|
val characterList by storageRepository.getAdventureCharacters().collectAsState(emptyList())
|
||||||
mutableStateOf<List<CharacterDtos.AdventureCharacterWithSprites>>(emptyList())
|
|
||||||
}
|
|
||||||
var obtainedItem by remember {
|
var obtainedItem by remember {
|
||||||
mutableStateOf<ItemDtos.PurchasedItem?>(null)
|
mutableStateOf<ItemDtos.PurchasedItem?>(null)
|
||||||
}
|
}
|
||||||
|
var obtainedCurrency by remember {
|
||||||
|
mutableStateOf(0)
|
||||||
|
}
|
||||||
|
|
||||||
val currentTime by produceState(initialValue = Instant.now().epochSecond) {
|
val currentTime by produceState(initialValue = Instant.now().epochSecond) {
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -59,13 +58,6 @@ fun AdventureScreen(
|
|||||||
mutableStateOf<CharacterDtos.AdventureCharacterWithSprites?>(null)
|
mutableStateOf<CharacterDtos.AdventureCharacterWithSprites?>(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(storageRepository) {
|
|
||||||
coroutineScope.launch {
|
|
||||||
characterList.value = storageRepository
|
|
||||||
.getAdventureCharacters()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopBanner(
|
TopBanner(
|
||||||
@ -76,7 +68,7 @@ fun AdventureScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { contentPadding ->
|
) { contentPadding ->
|
||||||
if (characterList.value.isEmpty()) {
|
if (characterList.isEmpty()) {
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
@ -91,7 +83,7 @@ fun AdventureScreen(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(top = contentPadding.calculateTopPadding())
|
.padding(top = contentPadding.calculateTopPadding())
|
||||||
) {
|
) {
|
||||||
items(characterList.value) {
|
items(characterList) {
|
||||||
AdventureEntry(
|
AdventureEntry(
|
||||||
icon = BitmapData(
|
icon = BitmapData(
|
||||||
bitmap = it.spriteIdle,
|
bitmap = it.spriteIdle,
|
||||||
@ -102,8 +94,9 @@ fun AdventureScreen(
|
|||||||
onClick = {
|
onClick = {
|
||||||
if (it.finishesAdventure < currentTime) {
|
if (it.finishesAdventure < currentTime) {
|
||||||
storageScreenController
|
storageScreenController
|
||||||
.getItemFromAdventure(it.id) { adventureResult ->
|
.getItemFromAdventure(it.id) { adventureResult, generatedCurrency ->
|
||||||
obtainedItem = adventureResult
|
obtainedItem = adventureResult
|
||||||
|
obtainedCurrency = generatedCurrency
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cancelAdventureDialog = it
|
cancelAdventureDialog = it
|
||||||
@ -118,6 +111,7 @@ fun AdventureScreen(
|
|||||||
if (obtainedItem != null) {
|
if (obtainedItem != null) {
|
||||||
ObtainedItemDialog(
|
ObtainedItemDialog(
|
||||||
obtainedItem = obtainedItem!!,
|
obtainedItem = obtainedItem!!,
|
||||||
|
obtainedCurrency = obtainedCurrency,
|
||||||
onClickDismiss = {
|
onClickDismiss = {
|
||||||
obtainedItem = null
|
obtainedItem = null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,6 @@ import com.github.nacabaro.vbhelper.dtos.ItemDtos
|
|||||||
|
|
||||||
interface AdventureScreenController {
|
interface AdventureScreenController {
|
||||||
fun sendCharacterToAdventure(characterId: Long, timeInMinutes: Long)
|
fun sendCharacterToAdventure(characterId: Long, timeInMinutes: Long)
|
||||||
fun getItemFromAdventure(characterId: Long, onResult: (ItemDtos.PurchasedItem) -> Unit)
|
fun getItemFromAdventure(characterId: Long, onResult: (ItemDtos.PurchasedItem, Int) -> Unit)
|
||||||
fun cancelAdventure(characterId: Long, onResult: () -> Unit)
|
fun cancelAdventure(characterId: Long, onResult: () -> Unit)
|
||||||
}
|
}
|
||||||
@ -38,19 +38,29 @@ class AdventureScreenControllerImpl(
|
|||||||
|
|
||||||
override fun getItemFromAdventure(
|
override fun getItemFromAdventure(
|
||||||
characterId: Long,
|
characterId: Long,
|
||||||
onResult: (ItemDtos.PurchasedItem) -> Unit
|
onResult: (ItemDtos.PurchasedItem, Int) -> Unit
|
||||||
) {
|
) {
|
||||||
componentActivity.lifecycleScope.launch(Dispatchers.IO) {
|
componentActivity.lifecycleScope.launch(Dispatchers.IO) {
|
||||||
database
|
database
|
||||||
.adventureDao()
|
.adventureDao()
|
||||||
.deleteAdventure(characterId)
|
.deleteAdventure(characterId)
|
||||||
|
|
||||||
|
val generatedCurrency = generateRandomCurrency()
|
||||||
|
|
||||||
val generatedItem = generateItem(characterId)
|
val generatedItem = generateItem(characterId)
|
||||||
|
|
||||||
onResult(generatedItem)
|
onResult(generatedItem, generatedCurrency)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun generateRandomCurrency(): Int {
|
||||||
|
val currentValue = application.container.currencyRepository.currencyValue.first()
|
||||||
|
val random = (2..6).random() * 1000
|
||||||
|
application.container.currencyRepository.setCurrencyValue(currentValue + random)
|
||||||
|
|
||||||
|
return random
|
||||||
|
}
|
||||||
|
|
||||||
override fun cancelAdventure(characterId: Long, onResult: () -> Unit) {
|
override fun cancelAdventure(characterId: Long, onResult: () -> Unit) {
|
||||||
componentActivity.lifecycleScope.launch(Dispatchers.IO) {
|
componentActivity.lifecycleScope.launch(Dispatchers.IO) {
|
||||||
database
|
database
|
||||||
|
|||||||
@ -55,6 +55,7 @@ fun HomeScreen(
|
|||||||
var adventureMissionsFinished by rememberSaveable { mutableStateOf(false) }
|
var adventureMissionsFinished by rememberSaveable { mutableStateOf(false) }
|
||||||
var betaWarning by rememberSaveable { mutableStateOf(true) }
|
var betaWarning by rememberSaveable { mutableStateOf(true) }
|
||||||
var collectedItem by remember { mutableStateOf<ItemDtos.PurchasedItem?>(null) }
|
var collectedItem by remember { mutableStateOf<ItemDtos.PurchasedItem?>(null) }
|
||||||
|
var collectedCurrency by remember { mutableStateOf<Int?>(null) }
|
||||||
|
|
||||||
LaunchedEffect(storageRepository, activeMon, collectedItem) {
|
LaunchedEffect(storageRepository, activeMon, collectedItem) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
@ -123,8 +124,9 @@ fun HomeScreen(
|
|||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
specialMissions = vbSpecialMissions.value,
|
specialMissions = vbSpecialMissions.value,
|
||||||
homeScreenController = homeScreenController,
|
homeScreenController = homeScreenController,
|
||||||
onClickCollect = { item ->
|
onClickCollect = { item, currency ->
|
||||||
collectedItem = item
|
collectedItem = item
|
||||||
|
collectedCurrency = currency
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -134,8 +136,10 @@ fun HomeScreen(
|
|||||||
if (collectedItem != null) {
|
if (collectedItem != null) {
|
||||||
ObtainedItemDialog(
|
ObtainedItemDialog(
|
||||||
obtainedItem = collectedItem!!,
|
obtainedItem = collectedItem!!,
|
||||||
|
obtainedCurrency = collectedCurrency!!,
|
||||||
onClickDismiss = {
|
onClickDismiss = {
|
||||||
collectedItem = null
|
collectedItem = null
|
||||||
|
collectedCurrency = null
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,5 +5,5 @@ import com.github.nacabaro.vbhelper.dtos.ItemDtos
|
|||||||
|
|
||||||
interface HomeScreenController {
|
interface HomeScreenController {
|
||||||
fun didAdventureMissionsFinish(onCompletion: (Boolean) -> Unit)
|
fun didAdventureMissionsFinish(onCompletion: (Boolean) -> Unit)
|
||||||
fun clearSpecialMission(missionId: Long, missionCompletion: SpecialMission.Status, onCleared: (ItemDtos.PurchasedItem?) -> Unit)
|
fun clearSpecialMission(missionId: Long, missionCompletion: SpecialMission.Status, onCleared: (ItemDtos.PurchasedItem?, Int?) -> Unit)
|
||||||
}
|
}
|
||||||
@ -23,6 +23,7 @@ class HomeScreenControllerImpl(
|
|||||||
val adventureCharacters = database
|
val adventureCharacters = database
|
||||||
.adventureDao()
|
.adventureDao()
|
||||||
.getAdventureCharacters()
|
.getAdventureCharacters()
|
||||||
|
.first()
|
||||||
|
|
||||||
val finishedAdventureCharacters = adventureCharacters.filter { character ->
|
val finishedAdventureCharacters = adventureCharacters.filter { character ->
|
||||||
character.finishesAdventure <= currentTime
|
character.finishesAdventure <= currentTime
|
||||||
@ -32,7 +33,7 @@ class HomeScreenControllerImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun clearSpecialMission(missionId: Long, missionCompletion: SpecialMission.Status, onCleared: (ItemDtos.PurchasedItem?) -> Unit) {
|
override fun clearSpecialMission(missionId: Long, missionCompletion: SpecialMission.Status, onCleared: (ItemDtos.PurchasedItem?, Int?) -> Unit) {
|
||||||
componentActivity.lifecycleScope.launch {
|
componentActivity.lifecycleScope.launch {
|
||||||
database
|
database
|
||||||
.specialMissionDao()
|
.specialMissionDao()
|
||||||
@ -64,9 +65,13 @@ class HomeScreenControllerImpl(
|
|||||||
itemType = randomItem.itemType
|
itemType = randomItem.itemType
|
||||||
)
|
)
|
||||||
|
|
||||||
onCleared(purchasedItem)
|
val randomAmount = (2..6).random() * 1000
|
||||||
|
val currentCurrency = application.container.currencyRepository.currencyValue.first()
|
||||||
|
application.container.currencyRepository.setCurrencyValue(currentCurrency + randomAmount)
|
||||||
|
|
||||||
|
onCleared(purchasedItem, randomAmount)
|
||||||
} else {
|
} else {
|
||||||
onCleared(null)
|
onCleared(null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ fun VBDiMHomeScreen(
|
|||||||
homeScreenController: HomeScreenControllerImpl,
|
homeScreenController: HomeScreenControllerImpl,
|
||||||
transformationHistory: List<CharacterDtos.TransformationHistory>,
|
transformationHistory: List<CharacterDtos.TransformationHistory>,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
onClickCollect: (ItemDtos.PurchasedItem?) -> Unit
|
onClickCollect: (ItemDtos.PurchasedItem?, Int?) -> Unit
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import com.github.nacabaro.vbhelper.dtos.ItemDtos
|
|||||||
@Composable
|
@Composable
|
||||||
fun ObtainedItemDialog(
|
fun ObtainedItemDialog(
|
||||||
obtainedItem: ItemDtos.PurchasedItem,
|
obtainedItem: ItemDtos.PurchasedItem,
|
||||||
|
obtainedCurrency: Int,
|
||||||
onClickDismiss: () -> Unit
|
onClickDismiss: () -> Unit
|
||||||
) {
|
) {
|
||||||
Dialog(
|
Dialog(
|
||||||
@ -84,7 +85,16 @@ fun ObtainedItemDialog(
|
|||||||
text = "You have obtained ${obtainedItem.itemAmount} of this item",
|
text = "You have obtained ${obtainedItem.itemAmount} of this item",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(5.dp)
|
.padding(top = 4.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
fontSize = MaterialTheme.typography.bodySmall.fontSize,
|
||||||
|
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
||||||
|
text = "You also got $obtainedCurrency credits",
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(bottom = 4.dp)
|
||||||
)
|
)
|
||||||
Button(
|
Button(
|
||||||
onClick = onClickDismiss,
|
onClick = onClickDismiss,
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.github.nacabaro.vbhelper.screens.settingsScreen
|
package com.github.nacabaro.vbhelper.screens.settingsScreen
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@ -13,6 +15,7 @@ import androidx.compose.material3.Scaffold
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
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
|
||||||
@ -25,6 +28,8 @@ fun SettingsScreen(
|
|||||||
navController: NavController,
|
navController: NavController,
|
||||||
settingsScreenController: SettingsScreenControllerImpl,
|
settingsScreenController: SettingsScreenControllerImpl,
|
||||||
) {
|
) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
|
||||||
Scaffold (
|
Scaffold (
|
||||||
topBar = {
|
topBar = {
|
||||||
TopBanner(
|
TopBanner(
|
||||||
@ -44,19 +49,22 @@ fun SettingsScreen(
|
|||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
) {
|
) {
|
||||||
SettingsSection("NFC Communication")
|
SettingsSection("NFC Communication")
|
||||||
SettingsEntry(title = "Import APK", description = "Import Secrets From Vital Arean 2.1.0 APK") {
|
SettingsEntry(title = "Import APK", description = "Import Secrets From Vital Arena 2.1.0 APK") {
|
||||||
settingsScreenController.onClickImportApk()
|
settingsScreenController.onClickImportApk()
|
||||||
}
|
}
|
||||||
SettingsSection("DiM/BEm management")
|
SettingsSection("DiM/BEm management")
|
||||||
SettingsEntry(title = "Import card", description = "Import DiM/BEm card file") {
|
SettingsEntry(title = "Import card", description = "Import DiM/BEm card file") {
|
||||||
settingsScreenController.onClickImportCard()
|
settingsScreenController.onClickImportCard()
|
||||||
}
|
}
|
||||||
SettingsEntry(title = "Rename DiM/BEm", description = "Set card name") { }
|
|
||||||
SettingsSection("About and credits")
|
SettingsSection("About and credits")
|
||||||
SettingsEntry(title = "Credits", description = "Credits") {
|
SettingsEntry(title = "Credits", description = "Credits") {
|
||||||
navController.navigate(NavigationItems.Credits.route)
|
navController.navigate(NavigationItems.Credits.route)
|
||||||
}
|
}
|
||||||
SettingsEntry(title = "About", description = "About") { }
|
SettingsEntry(title = "About", description = "About") {
|
||||||
|
val browserIntent = Intent(
|
||||||
|
Intent.ACTION_VIEW, Uri.parse("https://github.com/nacabaro/vbhelper/"))
|
||||||
|
context.startActivity(browserIntent)
|
||||||
|
}
|
||||||
SettingsSection("Data management")
|
SettingsSection("Data management")
|
||||||
SettingsEntry(title = "Export data", description = "Export application database") {
|
SettingsEntry(title = "Export data", description = "Export application database") {
|
||||||
settingsScreenController.onClickOpenDirectory()
|
settingsScreenController.onClickOpenDirectory()
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import androidx.compose.foundation.lazy.grid.GridCells
|
|||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.material3.CardDefaults
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -98,6 +100,16 @@ fun StorageScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
cardColors = if (index.active) {
|
||||||
|
CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceContainerHighest
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class StorageRepository (
|
|||||||
return db.userCharacterDao().deleteCharacterById(id)
|
return db.userCharacterDao().deleteCharacterById(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getAdventureCharacters(): List<CharacterDtos.AdventureCharacterWithSprites> {
|
fun getAdventureCharacters(): Flow<List<CharacterDtos.AdventureCharacterWithSprites>> {
|
||||||
return db.adventureDao().getAdventureCharacters()
|
return db.adventureDao().getAdventureCharacters()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user