|
|
@@ -1,6 +1,7 @@
|
|
|
package com.yingyangfly.game.introduction
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
+import android.content.Intent
|
|
|
import android.os.Bundle
|
|
|
import android.view.MotionEvent
|
|
|
import android.view.View
|
|
|
@@ -28,6 +29,7 @@ class GameIntroductionActivity :
|
|
|
BaseMVVMActivity<ActivityGameIntroductionBinding, GameIntroductionViewModel>(),
|
|
|
View.OnTouchListener {
|
|
|
|
|
|
+ private var isEnterGame = false
|
|
|
private var gameCode: String = ""
|
|
|
private var playClass: String = ""
|
|
|
private var gameBean: GameBean? = null
|
|
|
@@ -55,6 +57,11 @@ class GameIntroductionActivity :
|
|
|
|
|
|
}
|
|
|
|
|
|
+ override fun onNewIntent(intent: Intent?) {
|
|
|
+ super.onNewIntent(intent)
|
|
|
+ isEnterGame = true
|
|
|
+ }
|
|
|
+
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
getGameDetailByCode()
|
|
|
@@ -86,15 +93,20 @@ class GameIntroductionActivity :
|
|
|
v.startAnimation(getEndAnimation())
|
|
|
if (v.id == R.id.homeImage) {
|
|
|
runOnUiThread {
|
|
|
- val exitGameDialog = ExitGameDialog()
|
|
|
- exitGameDialog.onDialogClickListener = {
|
|
|
- RxBus.get().send(RxBusCodes.CALLQUITGAME)
|
|
|
+ if (isEnterGame) {
|
|
|
+ val exitGameDialog = ExitGameDialog()
|
|
|
+ exitGameDialog.onDialogClickListener = {
|
|
|
+ RxBus.get().send(RxBusCodes.CALLQUITGAME)
|
|
|
+ }
|
|
|
+ exitGameDialog.show(supportFragmentManager, "exitGameDialog")
|
|
|
+ } else {
|
|
|
+ finish()
|
|
|
}
|
|
|
- exitGameDialog.show(supportFragmentManager, "exitGameDialog")
|
|
|
}
|
|
|
|
|
|
} else if (v.id == R.id.btnStartGame) {
|
|
|
runOnUiThread {
|
|
|
+ isEnterGame = true
|
|
|
ARouter.getInstance().build(RouterUrlCommon.playGame)
|
|
|
.withSerializable("bean", gameBean)
|
|
|
.withTransition(R.anim.leftin, R.anim.leftout)
|