Jelajahi Sumber

1.添加游戏结算页面

王鹏鹏 2 tahun lalu
induk
melakukan
12166d77c4

+ 13 - 0
game/src/main/java/com/yingyangfly/game/entity/GameBean.java

@@ -63,6 +63,9 @@ public class GameBean implements Serializable {
     }
 
     public String getGameDifficulty() {
+        if (TextUtils.isEmpty(gameDifficulty)) {
+            return "";
+        }
         return gameDifficulty;
     }
 
@@ -194,4 +197,14 @@ public class GameBean implements Serializable {
     public void setGameInbetweenImage(String gameInbetweenImage) {
         this.gameInbetweenImage = gameInbetweenImage;
     }
+
+    public String gameDifficultyInfo() {
+        if (TextUtils.equals("A", gameDifficulty)) {
+            return "简单";
+        } else if (TextUtils.equals("B", gameDifficulty)) {
+            return "中等";
+        } else {
+            return "困难";
+        }
+    }
 }

+ 33 - 1
game/src/main/java/com/yingyangfly/game/introduction/GameIntroductionActivity.kt

@@ -9,8 +9,11 @@ import android.view.MotionEvent
 import android.view.View
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.alibaba.android.arouter.launcher.ARouter
+import com.tencent.liteav.demo.superplayer.SuperPlayerModel
+import com.yingyangfly.baselib.config.AccountConfig
 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.mvvm.BaseMVVMActivity
 import com.yingyangfly.baselib.router.RouterUrlCommon
@@ -63,7 +66,13 @@ class GameIntroductionActivity :
     }
 
     override fun initData() {
-
+        binding {
+            val model = SuperPlayerModel()
+            model.appId = AccountConfig.TENCENT_APPID // 配置 AppId
+            model.url = videoUrl // 配置您的播放视频 url
+            binding.playTxCloudView.showOrHideBackBtn(false)
+            binding.playTxCloudView.playWithModelNeedLicence(model)
+        }
     }
 
     override fun onNewIntent(intent: Intent?) {
@@ -86,6 +95,29 @@ class GameIntroductionActivity :
             if (it != null) {
                 gameBean = it
                 binding.data = it
+                when (it.gameDifficulty) {
+                    "A" -> {
+                        binding {
+                            imageDifficultyOne.show(true)
+                            imageDifficultyTwo.show(false)
+                            imageDifficultyThree.show(false)
+                        }
+                    }
+                    "B" -> {
+                        binding {
+                            imageDifficultyOne.show(true)
+                            imageDifficultyTwo.show(true)
+                            imageDifficultyThree.show(false)
+                        }
+                    }
+                    else -> {
+                        binding {
+                            imageDifficultyOne.show(true)
+                            imageDifficultyTwo.show(true)
+                            imageDifficultyThree.show(true)
+                        }
+                    }
+                }
             }
         })
     }

+ 7 - 1
game/src/main/res/layout/activity_game_introduction.xml

@@ -109,6 +109,11 @@
                             app:layout_constraintStart_toStartOf="parent"
                             app:layout_constraintTop_toTopOf="parent">
 
+                            <com.tencent.liteav.demo.superplayer.SuperPlayerView
+                                android:id="@+id/play_tx_cloud_view"
+                                android:layout_width="match_parent"
+                                android:layout_height="match_parent"
+                                android:layout_gravity="center" />
 
                         </androidx.cardview.widget.CardView>
 
@@ -150,6 +155,7 @@
                                     android:layout_width="wrap_content"
                                     android:layout_height="wrap_content"
                                     android:layout_marginTop="@dimen/divider_18px"
+                                    android:text="@{data.desn}"
                                     android:textColor="@color/color_FFA54A0B"
                                     android:textSize="@dimen/divider_20px"
                                     app:layout_constraintEnd_toEndOf="parent"
@@ -192,7 +198,7 @@
                     android:layout_height="wrap_content"
                     android:layout_marginStart="@dimen/divider_114px"
                     android:layout_marginBottom="@dimen/divider_71px"
-                    android:text='@{"游戏难度: "+data.gameTotalScore}'
+                    android:text='@{"游戏难度: "+data.gameDifficultyInfo()}'
                     android:textColor="@color/color_FF333333"
                     android:textSize="@dimen/divider_28px"
                     app:layout_constraintBottom_toBottomOf="parent"