|
|
@@ -1,5 +1,6 @@
|
|
|
package com.yingyang.livebroadcast.dialog
|
|
|
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.os.Bundle
|
|
|
import android.text.TextUtils
|
|
|
import android.view.LayoutInflater
|
|
|
@@ -78,20 +79,21 @@ class GameTasksDialog : DialogFragment() {
|
|
|
btnGame = rootView.findViewById(R.id.btnGame)
|
|
|
}
|
|
|
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
private fun init() {
|
|
|
if (TextUtils.isEmpty(gameData).not()) {
|
|
|
val gameTasksBean = GsonUtil.GsonToBean(gameData, GameTasksBean::class.java)
|
|
|
if (gameTasksBean != null) {
|
|
|
GlideImgUtil.loadImg(requireActivity(), gameTasksBean.gameCoverImage, gameImage!!)
|
|
|
- tvGameType!!.text = gameTasksBean.gameType
|
|
|
- tvGameName!!.text = gameTasksBean.gameName
|
|
|
- tvGameDifficulty!!.text = gameTasksBean.gameDifficulty
|
|
|
+ tvGameType!!.text = "游戏类型:" + gameTasksBean.gameType
|
|
|
+ tvGameName!!.text = "游戏名称:" + gameTasksBean.gameName
|
|
|
+ tvGameDifficulty!!.text = "游戏难度:" + gameDifficultyInfo(gameTasksBean.gameDifficulty)
|
|
|
}
|
|
|
btnGame!!.setOnSingleClickListener {
|
|
|
if (gameTasksBean != null) {
|
|
|
ARouter.getInstance().build(RouterUrlCommon.playGame)
|
|
|
.withString("gameCode", gameTasksBean.gameCode)
|
|
|
- .withString("playClass", gameTasksBean.playClass)
|
|
|
+ .withString("playClass", "A")
|
|
|
.withString("url", gameTasksBean.url)
|
|
|
.withString("gameType", gameTasksBean.gameType)
|
|
|
.withString("gameTotalScore", gameTasksBean.gameTotalScore)
|
|
|
@@ -103,8 +105,22 @@ class GameTasksDialog : DialogFragment() {
|
|
|
.withTransition(R.anim.leftin, R.anim.leftout)
|
|
|
.navigation(requireActivity())
|
|
|
}
|
|
|
+ dismiss()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 游戏难度
|
|
|
+ */
|
|
|
+ private fun gameDifficultyInfo(gameDifficulty: String): String {
|
|
|
+ return if (TextUtils.equals("A", gameDifficulty)) {
|
|
|
+ "简单"
|
|
|
+ } else if (TextUtils.equals("B", gameDifficulty)) {
|
|
|
+ "中等"
|
|
|
+ } else {
|
|
|
+ "困难"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|