From aefd72680b0a74e5b34c7d1a913379a1540e39f0 Mon Sep 17 00:00:00 2001 From: renhaoting <370797079@qq.com> Date: Wed, 24 Dec 2025 18:34:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E4=B8=8E=E6=88=90=E5=8A=9F=E5=90=8E?= =?UTF-8?q?=E5=86=8D=20=E6=89=A3=E5=87=8F=E9=92=BB=E7=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gamedog/vididin/features/zero/ZeroBuyActivity.kt | 12 +++++++++--- .../vididin/features/zero/ZeroRecordAdapter.kt | 2 +- .../java/com/gamedog/vididin/login/AccountManager.kt | 4 ++-- app/src/main/res/values/strings.xml | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/gamedog/vididin/features/zero/ZeroBuyActivity.kt b/app/src/main/java/com/gamedog/vididin/features/zero/ZeroBuyActivity.kt index cc74773..04ecab8 100644 --- a/app/src/main/java/com/gamedog/vididin/features/zero/ZeroBuyActivity.kt +++ b/app/src/main/java/com/gamedog/vididin/features/zero/ZeroBuyActivity.kt @@ -70,7 +70,7 @@ class ZeroBuyActivity : AppViewsEmptyViewModelActivity() { with(recyclerView) { mAdapter = ZeroItemAdapter({ itemId, diamondCost-> - if (AccountManager.adjustDiamond(diamondCost)) { + if (AccountManager.getDiamond() >= diamondCost) { requestParticipateActivity(itemId) } else { AndroidUtil.showToast(R.string.dont_enought_diamond) @@ -156,8 +156,14 @@ class ZeroBuyActivity : AppViewsEmptyViewModelActivity() { viewModel.ZeroBuyJoinResult.collect { result -> when (result) { is Result.Loading -> { } - is Result.Success -> updateItemUI(result.data) - is Result.Error -> { } + is Result.Success -> { + result.data?.let { + AccountManager.adjustDiamond(-1 * it.cost) + } + + updateItemUI(result.data) + } + is Result.Error -> { AndroidUtil.showToast(R.string.has_join_failed_zerobuy) } } } } diff --git a/app/src/main/java/com/gamedog/vididin/features/zero/ZeroRecordAdapter.kt b/app/src/main/java/com/gamedog/vididin/features/zero/ZeroRecordAdapter.kt index e8d3cc1..c2e5562 100644 --- a/app/src/main/java/com/gamedog/vididin/features/zero/ZeroRecordAdapter.kt +++ b/app/src/main/java/com/gamedog/vididin/features/zero/ZeroRecordAdapter.kt @@ -32,7 +32,7 @@ class ZeroRecordAdapter() : ListAdapter getGold()) { + if (adjustNum < 0L && Math.abs(adjustNum) > getCash()) { return false } mAccount.cashCount += adjustNum @@ -92,7 +92,7 @@ object AccountManager { @Synchronized fun adjustDiamond(adjustNum: Int): Boolean { - if (adjustNum < 0L && Math.abs(adjustNum) > getGold()) { + if (adjustNum < 0L && Math.abs(adjustNum) > getDiamond()) { return false } mAccount.diamondCount += adjustNum diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 48e07c7..3345845 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -120,6 +120,7 @@ Total sacado até o momento: Já participou Reembolso em + participate this activity failed. You have participated this activity. There\'s no any record Get