|
|
@@ -36,9 +36,6 @@ import com.yingyangfly.game.dialog.CompletionTrainingDialog
|
|
|
import com.yingyangfly.game.dialog.CountdownDialog
|
|
|
import com.yingyangfly.game.dialog.GameResultDialog
|
|
|
import com.yingyangfly.game.utils.AndroidToJs
|
|
|
-import gorden.rxbus2.RxBus
|
|
|
-import gorden.rxbus2.Subscribe
|
|
|
-import gorden.rxbus2.ThreadMode
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -283,17 +280,6 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Subscribe(code = RxBusCodes.CALLQUITGAME, threadMode = ThreadMode.MAIN)
|
|
|
- fun callQuitGame() {
|
|
|
- runOnUiThread {
|
|
|
- binding.webView.evaluateJavascript(
|
|
|
- "javascript:CallQuitGame()"
|
|
|
- ) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
override fun onPause() {
|
|
|
super.onPause()
|
|
|
if (voicePlayer != null) {
|
|
|
@@ -389,6 +375,15 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
LiveEventBusUtil.observer<String>(this, RxBusCodes.GAMEOVERTIME) {
|
|
|
finish()
|
|
|
}
|
|
|
+ //返回首页结束游戏
|
|
|
+ LiveEventBusUtil.observer<String>(this, RxBusCodes.CALLQUITGAME) {
|
|
|
+ runOnUiThread {
|
|
|
+ binding.webView.evaluateJavascript(
|
|
|
+ "javascript:CallQuitGame()"
|
|
|
+ ) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -468,7 +463,7 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
runOnUiThread {
|
|
|
runOnUiThread {
|
|
|
if (TextUtils.equals("2", isPass)) {
|
|
|
- RxBus.get().send(RxBusCodes.QUITGAME)
|
|
|
+ LiveEventBusUtil.send(RxBusCodes.QUITGAME, "")
|
|
|
finish()
|
|
|
} else if (TextUtils.equals("3", isPass)) {
|
|
|
val score: Int = gameTotalScore.toInt() + gameDataBean.curLevelScore.toInt()
|