From 7dca9a1ed572091a9b226677aebdd2b89d6ed82c Mon Sep 17 00:00:00 2001 From: max Date: Tue, 4 Jun 2024 19:49:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/chwl/app/game/ui/result/GameResultDialog.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/module_game/java/com/chwl/app/game/ui/result/GameResultDialog.kt b/app/src/module_game/java/com/chwl/app/game/ui/result/GameResultDialog.kt index bd080bff0..38084ea40 100644 --- a/app/src/module_game/java/com/chwl/app/game/ui/result/GameResultDialog.kt +++ b/app/src/module_game/java/com/chwl/app/game/ui/result/GameResultDialog.kt @@ -14,12 +14,13 @@ import com.chwl.app.ui.widget.recyclerview.decoration.SpacingDecoration import com.chwl.core.auth.AuthModel import com.chwl.library.common.util.Utils import com.example.lib_utils.ktx.singleClick +import com.example.lib_utils.log.ILog class GameResultDialog( private val list: List, private var onClose: (() -> Unit)?, private var onRestart: (() -> Unit)? -) : DialogFragment() { +) : DialogFragment(), ILog { private var binding: GameResultDialogBinding? = null @@ -29,11 +30,13 @@ class GameResultDialog( super.onViewCreated(view, savedInstanceState) initView() adapter.setNewData(list.sortedBy { it.rank }) - val isWin = list.firstOrNull()?.uid == AuthModel.get().currentUid - if (isWin) { - binding?.ivState?.setBackgroundResource(R.drawable.game_result_bg_win) + val isWin = list.firstOrNull { + it.uid == AuthModel.get().currentUid + }?.isWin + if (isWin == true) { + binding?.ivState?.setImageResource(R.drawable.game_result_bg_win) } else { - binding?.ivState?.setBackgroundResource(R.drawable.game_result_bg_fail) + binding?.ivState?.setImageResource(R.drawable.game_result_bg_fail) } }