Ver Fonte

1.优化代码

王鹏鹏 há 2 anos atrás
pai
commit
592189d9f6

+ 24 - 6
game/src/main/java/com/yingyangfly/game/play/PlayGameActivity.kt

@@ -440,12 +440,30 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
                     RxBus.get().send(RxBusCodes.QUITGAME)
                     finish()
                 } else if (TextUtils.equals("3", isPass)) {
-                    //游戏通关
-                    ARouter.getInstance().build(RouterUrlCommon.gameSettlement)
-                        .withString("gameCode", gameCode)
-                        .withString("playClass", playClass)
-                        .withTransition(R.anim.leftin, R.anim.leftout)
-                        .navigation(mContext)
+                    val score: Int = gameTotalScore.toInt() + gameDataBean.curLevelScore.toInt()
+                    gameTotalScore = score.toString()
+                    if (TextUtils.equals("A", playClass)) {
+                        val completionTrainingDialog = CompletionTrainingDialog()
+                        completionTrainingDialog.setData(
+                            gameTotalScore,
+                            gameDataBean.curLevelScore
+                        )
+                        completionTrainingDialog.onDialogClickListener = {
+                            finish()
+                            LiveEventBusUtil.send(RxBusCodes.GAMEOVERTIME, "")
+                        }
+                        completionTrainingDialog.show(
+                            supportFragmentManager,
+                            "completionTrainingDialog"
+                        )
+                    } else {
+                        //游戏通关
+                        ARouter.getInstance().build(RouterUrlCommon.gameSettlement)
+                            .withString("gameCode", gameCode)
+                            .withString("playClass", playClass)
+                            .withTransition(R.anim.leftin, R.anim.leftout)
+                            .navigation(mContext)
+                    }
                 } else {
                     val score: Int = gameTotalScore.toInt() + gameDataBean.curLevelScore.toInt()
                     gameTotalScore = score.toString()