|
|
@@ -14,6 +14,7 @@ import com.yingyang.workbenches.adapter.FreeTrainTypeAdapter
|
|
|
import com.yingyang.workbenches.databinding.ActivityFreeTrainBinding
|
|
|
import com.yingyang.workbenches.entity.TrainTypeBean
|
|
|
import com.yingyangfly.baselib.bean.Record
|
|
|
+import com.yingyangfly.baselib.dialog.TipDialogFragment
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
import com.yingyangfly.baselib.ext.toast
|
|
|
@@ -72,19 +73,51 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
|
|
|
rvTrain.adapter = freeTrainListAdapter
|
|
|
freeTrainListAdapter.setType(type)
|
|
|
freeTrainListAdapter.onGameClickListener = { bean, position ->
|
|
|
- gameId = bean.id
|
|
|
- gameIndex = position
|
|
|
- ARouter.getInstance().build(RouterUrlCommon.gameIntroduction)
|
|
|
- .withString("gameCode", bean.gameCode)
|
|
|
- .withString("playClass", bean.playClass)
|
|
|
- .withString("videoUrl", bean.gameVideoUrl)
|
|
|
- .withString("desn", bean.desn)
|
|
|
- .withTransition(R.anim.leftin, R.anim.leftout)
|
|
|
- .navigation(mContext)
|
|
|
+ if (TextUtils.equals("0", bean.status)) {
|
|
|
+ TipDialogFragment.TipDialogBuilder()
|
|
|
+ .title("提示")
|
|
|
+ .content("当前游戏已通关,确定重玩吗?")
|
|
|
+ .leftBtnText("取消")
|
|
|
+ .rightBtnText("确定")
|
|
|
+ .leftClick({
|
|
|
+ }, dimiss = true)
|
|
|
+ .rightClick({
|
|
|
+ gameReplay(bean, position)
|
|
|
+ }, dimiss = true)
|
|
|
+ .show(supportFragmentManager)
|
|
|
+ } else {
|
|
|
+ jumeGame(bean, position)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 游戏重玩
|
|
|
+ */
|
|
|
+ private fun gameReplay(bean: Record, position: Int) {
|
|
|
+ viewModel.gameReplay(bean.id, fail = {
|
|
|
+ it.toast()
|
|
|
+ }, success = {
|
|
|
+ jumeGame(bean, position)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跳转游戏
|
|
|
+ */
|
|
|
+ private fun jumeGame(bean: Record, position: Int) {
|
|
|
+ gameId = bean.id
|
|
|
+ gameIndex = position
|
|
|
+ ARouter.getInstance().build(RouterUrlCommon.gameIntroduction)
|
|
|
+ .withString("gameCode", bean.gameCode)
|
|
|
+ .withString("playClass", bean.playClass)
|
|
|
+ .withString("videoUrl", bean.gameVideoUrl)
|
|
|
+ .withString("desn", bean.desn)
|
|
|
+ .withTransition(R.anim.leftin, R.anim.leftout)
|
|
|
+ .navigation(mContext)
|
|
|
+ }
|
|
|
+
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
override fun initListener() {
|
|
|
binding {
|