|
@@ -16,10 +16,7 @@ import com.tencent.rtmp.TXVodPlayer
|
|
|
import com.yingyangfly.baselib.db.GameSoundBean
|
|
|
import com.yingyangfly.baselib.db.VoicePlayerBean
|
|
|
import com.yingyangfly.baselib.dialog.GameLoadingDialog
|
|
|
-import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
-import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
-import com.yingyangfly.baselib.ext.show
|
|
|
-import com.yingyangfly.baselib.ext.toast
|
|
|
+import com.yingyangfly.baselib.ext.*
|
|
|
import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
|
|
|
import com.yingyangfly.baselib.player.VoicePlayer
|
|
|
import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
@@ -71,6 +68,7 @@ class GameIntroductionActivity :
|
|
|
binding {
|
|
|
homeImage.setOnTouchListener(this@GameIntroductionActivity)
|
|
|
btnStartGame.setOnTouchListener(this@GameIntroductionActivity)
|
|
|
+ viewLayout.setOnTouchListener(this@GameIntroductionActivity)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -183,55 +181,72 @@ class GameIntroductionActivity :
|
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean {
|
|
|
when (event.action) {
|
|
|
MotionEvent.ACTION_DOWN -> {
|
|
|
- if (v.id == R.id.homeImage || v.id == R.id.btnStartGame) {
|
|
|
+ if (v.id == R.id.homeImage || v.id == R.id.btnStartGame || v.id == R.id.viewLayout) {
|
|
|
v.startAnimation(getScaleAnimation())
|
|
|
}
|
|
|
}
|
|
|
MotionEvent.ACTION_UP -> {
|
|
|
v.startAnimation(getEndAnimation())
|
|
|
- if (v.id == R.id.homeImage) {
|
|
|
- runOnUiThread {
|
|
|
- if (isEnterGame) {
|
|
|
- val exitGameDialog = ExitGameDialog()
|
|
|
- exitGameDialog.onDialogClickListener = {
|
|
|
- LiveEventBusUtil.send(RxBusCodes.CALLQUITGAME, "")
|
|
|
+ when (v.id) {
|
|
|
+ R.id.homeImage -> {
|
|
|
+ runOnUiThread {
|
|
|
+ if (isEnterGame) {
|
|
|
+ val exitGameDialog = ExitGameDialog()
|
|
|
+ exitGameDialog.onDialogClickListener = {
|
|
|
+ LiveEventBusUtil.send(RxBusCodes.CALLQUITGAME, "")
|
|
|
+ }
|
|
|
+ exitGameDialog.show(supportFragmentManager, "exitGameDialog")
|
|
|
+ } else {
|
|
|
+ finish()
|
|
|
}
|
|
|
- exitGameDialog.show(supportFragmentManager, "exitGameDialog")
|
|
|
- } else {
|
|
|
- finish()
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- } else if (v.id == R.id.btnStartGame) {
|
|
|
- runOnUiThread {
|
|
|
- if (gameBean != null) {
|
|
|
- isEnterGame = true
|
|
|
- val url =
|
|
|
- gameBean!!.gameUrl + "?startLv=" + gameBean!!.gameLevel + "&maxLv=" +
|
|
|
- gameBean!!.totalNum + "&gameSetTime=" + gameBean!!.gameDuration +
|
|
|
- "&difficultyRate=" + gameBean!!.gameDifficultyRate + "&totalTime=" +
|
|
|
- gameBean!!.gameTotalTime + "&totalScore=" + gameBean!!.gameTotalScore +
|
|
|
- "&playClass=" + playClass
|
|
|
- ARouter.getInstance().build(RouterUrlCommon.playGame)
|
|
|
- .withString("gameCode", gameCode)
|
|
|
- .withString("playClass", playClass)
|
|
|
- .withString("url", url)
|
|
|
- .withString("gameType", gameBean!!.gameType)
|
|
|
- .withString("gameTotalScore", gameBean!!.gameTotalScore)
|
|
|
- .withString("gameInbetweenImage", gameBean!!.gameInbetweenImage)
|
|
|
- .withString("gameBackgroundImage", gameBean!!.gameBackgroundImage)
|
|
|
- .withString("gameShortDesn", gameBean!!.gameShortDesn)
|
|
|
- .withString("fullFlag", gameBean!!.fullFlag)
|
|
|
- .withString("frameImg", gameBean!!.frameImg)
|
|
|
- .withString("gameName", gameBean!!.gameName)
|
|
|
- .withTransition(R.anim.leftin, R.anim.leftout)
|
|
|
- .navigation(mContext)
|
|
|
+ }
|
|
|
+ R.id.btnStartGame -> {
|
|
|
+ runOnUiThread {
|
|
|
+ if (gameBean != null) {
|
|
|
+ isEnterGame = true
|
|
|
+ val url =
|
|
|
+ gameBean!!.gameUrl + "?startLv=" + gameBean!!.gameLevel + "&maxLv=" +
|
|
|
+ gameBean!!.totalNum + "&gameSetTime=" + gameBean!!.gameDuration +
|
|
|
+ "&difficultyRate=" + gameBean!!.gameDifficultyRate + "&totalTime=" +
|
|
|
+ gameBean!!.gameTotalTime + "&totalScore=" + gameBean!!.gameTotalScore +
|
|
|
+ "&playClass=" + playClass
|
|
|
+ ARouter.getInstance().build(RouterUrlCommon.playGame)
|
|
|
+ .withString("gameCode", gameCode)
|
|
|
+ .withString("playClass", playClass)
|
|
|
+ .withString("url", url)
|
|
|
+ .withString("gameType", gameBean!!.gameType)
|
|
|
+ .withString("gameTotalScore", gameBean!!.gameTotalScore)
|
|
|
+ .withString("gameInbetweenImage", gameBean!!.gameInbetweenImage)
|
|
|
+ .withString(
|
|
|
+ "gameBackgroundImage",
|
|
|
+ gameBean!!.gameBackgroundImage
|
|
|
+ )
|
|
|
+ .withString("gameShortDesn", gameBean!!.gameShortDesn)
|
|
|
+ .withString("fullFlag", gameBean!!.fullFlag)
|
|
|
+ .withString("frameImg", gameBean!!.frameImg)
|
|
|
+ .withString("gameName", gameBean!!.gameName)
|
|
|
+ .withTransition(R.anim.leftin, R.anim.leftout)
|
|
|
+ .navigation(mContext)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ R.id.viewLayout -> {
|
|
|
+ if (mVodPlayer != null) {
|
|
|
+ if (mVodPlayer?.isPlaying == true) {
|
|
|
+ mVodPlayer?.pause()
|
|
|
+ binding.imagePause.show(true)
|
|
|
+ } else {
|
|
|
+ mVodPlayer?.resume()
|
|
|
+ binding.imagePause.show(false)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
|
- if (v.id == R.id.homeImage || v.id == R.id.btnStartGame) {
|
|
|
+ if (v.id == R.id.homeImage || v.id == R.id.btnStartGame || v.id == R.id.viewLayout) {
|
|
|
v.startAnimation(getEndAnimation())
|
|
|
}
|
|
|
}
|