|
@@ -121,7 +121,6 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
binding.tvPlay.text = gameShortDesn
|
|
binding.tvPlay.text = gameShortDesn
|
|
|
binding.tvIntroduce.text = gameShortDesn
|
|
binding.tvIntroduce.text = gameShortDesn
|
|
|
}
|
|
}
|
|
|
- binding.tvFullScreen.show(TextUtils.equals("0", fullFlag))
|
|
|
|
|
binding.tvGameLevel.show(TextUtils.equals("D", playClass).not())
|
|
binding.tvGameLevel.show(TextUtils.equals("D", playClass).not())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -129,9 +128,7 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
override fun initListener() {
|
|
override fun initListener() {
|
|
|
binding {
|
|
binding {
|
|
|
imagePause.setOnTouchListener(this@PlayGameActivity)
|
|
imagePause.setOnTouchListener(this@PlayGameActivity)
|
|
|
- iamgePauses.setOnTouchListener(this@PlayGameActivity)
|
|
|
|
|
tvFullScreen.setOnTouchListener(this@PlayGameActivity)
|
|
tvFullScreen.setOnTouchListener(this@PlayGameActivity)
|
|
|
- tvReduce.setOnTouchListener(this@PlayGameActivity)
|
|
|
|
|
}
|
|
}
|
|
|
binding.gameLayout.viewTreeObserver.addOnGlobalLayoutListener(object :
|
|
binding.gameLayout.viewTreeObserver.addOnGlobalLayoutListener(object :
|
|
|
ViewTreeObserver.OnGlobalLayoutListener {
|
|
ViewTreeObserver.OnGlobalLayoutListener {
|
|
@@ -143,13 +140,26 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @SuppressLint("SetTextI18n")
|
|
|
|
|
override fun initData() {
|
|
override fun initData() {
|
|
|
Glide.with(mContext)
|
|
Glide.with(mContext)
|
|
|
.asGif()
|
|
.asGif()
|
|
|
.load(R.drawable.fish)
|
|
.load(R.drawable.fish)
|
|
|
.into(binding.loadingImage)
|
|
.into(binding.loadingImage)
|
|
|
initLiveData()
|
|
initLiveData()
|
|
|
|
|
+ setScreenData()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 设置屏幕样式
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun setScreenData() {
|
|
|
|
|
+ binding.tvFullScreen.show(TextUtils.equals("0", fullFlag))
|
|
|
|
|
+ if (TextUtils.equals("0", fullFlag)) {
|
|
|
|
|
+ binding.tvFullScreen.text = "全屏"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ binding.tvFullScreen.text = "缩放"
|
|
|
|
|
+ }
|
|
|
|
|
+ setReduce()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onNewIntent(intent: Intent?) {
|
|
override fun onNewIntent(intent: Intent?) {
|
|
@@ -249,14 +259,14 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean {
|
|
override fun onTouch(v: View, event: MotionEvent): Boolean {
|
|
|
when (event.action) {
|
|
when (event.action) {
|
|
|
MotionEvent.ACTION_DOWN -> {
|
|
MotionEvent.ACTION_DOWN -> {
|
|
|
- if (v.id == R.id.imagePause || v.id == R.id.iamgePauses || v.id == R.id.tvFullScreen || v.id == R.id.tvReduce) {
|
|
|
|
|
|
|
+ if (v.id == R.id.imagePause || v.id == R.id.tvFullScreen) {
|
|
|
v.startAnimation(getScaleAnimation())
|
|
v.startAnimation(getScaleAnimation())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
MotionEvent.ACTION_UP -> {
|
|
MotionEvent.ACTION_UP -> {
|
|
|
v.startAnimation(getEndAnimation())
|
|
v.startAnimation(getEndAnimation())
|
|
|
when (v.id) {
|
|
when (v.id) {
|
|
|
- R.id.imagePause, R.id.iamgePauses -> {
|
|
|
|
|
|
|
+ R.id.imagePause -> {
|
|
|
runOnUiThread {
|
|
runOnUiThread {
|
|
|
if (TextUtils.equals("D", playClass)) {
|
|
if (TextUtils.equals("D", playClass)) {
|
|
|
finish()
|
|
finish()
|
|
@@ -277,18 +287,20 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
}
|
|
}
|
|
|
R.id.tvFullScreen -> {
|
|
R.id.tvFullScreen -> {
|
|
|
runOnUiThread {
|
|
runOnUiThread {
|
|
|
- setReduce(false)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- R.id.tvReduce -> {
|
|
|
|
|
- runOnUiThread {
|
|
|
|
|
- setReduce(true)
|
|
|
|
|
|
|
+ if (TextUtils.equals("0", fullFlag)) {
|
|
|
|
|
+ fullFlag = "1"
|
|
|
|
|
+ binding.tvFullScreen.text = "全屏"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fullFlag = "0"
|
|
|
|
|
+ binding.tvFullScreen.text = "缩放"
|
|
|
|
|
+ }
|
|
|
|
|
+ setReduce()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
|
- if (v.id == R.id.imagePause || v.id == R.id.iamgePauses || v.id == R.id.tvFullScreen || v.id == R.id.tvReduce) {
|
|
|
|
|
|
|
+ if (v.id == R.id.imagePause || v.id == R.id.tvFullScreen) {
|
|
|
v.startAnimation(getEndAnimation())
|
|
v.startAnimation(getEndAnimation())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -521,14 +533,6 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
LiveEventBusUtil.observer<String>(this, RxBusCodes.COUNTDOWNSUCCESS) {
|
|
LiveEventBusUtil.observer<String>(this, RxBusCodes.COUNTDOWNSUCCESS) {
|
|
|
countdownSuccess = true
|
|
countdownSuccess = true
|
|
|
}
|
|
}
|
|
|
- //游戏设置全屏
|
|
|
|
|
- LiveEventBusUtil.observer<String>(this, RxBusCodes.GAMEFULLSCREEN) {
|
|
|
|
|
- binding.webView.post {
|
|
|
|
|
- if (TextUtils.equals("0", fullFlag)) {
|
|
|
|
|
- setReduce(false)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
//播放音乐
|
|
//播放音乐
|
|
|
LiveEventBusUtil.observer<String>(this, RxBusCodes.STARTMUSIC) {
|
|
LiveEventBusUtil.observer<String>(this, RxBusCodes.STARTMUSIC) {
|
|
|
callPlayBgMusic()
|
|
callPlayBgMusic()
|
|
@@ -669,24 +673,18 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
/**
|
|
/**
|
|
|
* 是否缩放
|
|
* 是否缩放
|
|
|
*/
|
|
*/
|
|
|
- private fun setReduce(isReduce: Boolean) {
|
|
|
|
|
|
|
+ private fun setReduce() {
|
|
|
binding.webView.post {
|
|
binding.webView.post {
|
|
|
binding {
|
|
binding {
|
|
|
- tvFullScreen.show(isReduce)
|
|
|
|
|
- tvReduce.show(isReduce.not())
|
|
|
|
|
- tvScores.show(isReduce.not())
|
|
|
|
|
- tvTimes.show(isReduce.not())
|
|
|
|
|
- iamgePauses.show(isReduce.not())
|
|
|
|
|
- tvGameLevels.show(isReduce.not())
|
|
|
|
|
|
|
+ gameFullLayout.show(TextUtils.equals("0", fullFlag))
|
|
|
}
|
|
}
|
|
|
- if (isReduce) {
|
|
|
|
|
|
|
+ if (TextUtils.equals("0", fullFlag).not()) {
|
|
|
val params = ConstraintLayout.LayoutParams(
|
|
val params = ConstraintLayout.LayoutParams(
|
|
|
mWebViewWidth,
|
|
mWebViewWidth,
|
|
|
mWebViewHeight
|
|
mWebViewHeight
|
|
|
)
|
|
)
|
|
|
binding.gameLayout.radius = 49F
|
|
binding.gameLayout.radius = 49F
|
|
|
binding.gameLayout.layoutParams = params
|
|
binding.gameLayout.layoutParams = params
|
|
|
- binding.gameFullLayout.show(isReduce)
|
|
|
|
|
mConstrainSet_one?.applyTo(binding.gameParentLayout)
|
|
mConstrainSet_one?.applyTo(binding.gameParentLayout)
|
|
|
} else {
|
|
} else {
|
|
|
val params = FrameLayout.LayoutParams(
|
|
val params = FrameLayout.LayoutParams(
|
|
@@ -695,7 +693,6 @@ class PlayGameActivity : BaseMVVMActivity<ActivityPlayGameBinding, PlayGameViewM
|
|
|
)
|
|
)
|
|
|
binding.gameLayout.radius = 0F
|
|
binding.gameLayout.radius = 0F
|
|
|
binding.gameLayout.layoutParams = params
|
|
binding.gameLayout.layoutParams = params
|
|
|
- binding.gameFullLayout.show(isReduce.not())
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|