fix:修复游戏结果状态显示错误问题
This commit is contained in:
@@ -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<GameResultBean>,
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user