Parcourir la source

1.优化进入游戏倒计时播放功能
2.优化游戏介绍页面点击返回畅玩蓝豚页面弹窗点击确定页面直接跳转功能

王鹏鹏 il y a 2 ans
Parent
commit
b4ad2c8e1d

+ 1 - 1
.idea/misc.xml

@@ -521,7 +521,7 @@
         <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/activity_game_settlement.xml" value="0.6" />
         <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/activity_main.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/activity_play_game.xml" value="0.3953084274543875" />
-        <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/dialog_completion_training.xml" value="0.6" />
+        <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/dialog_completion_training.xml" value="0.536" />
         <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/dialog_count_down.xml" value="0.5676056338028169" />
         <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/dialog_exit_game.xml" value="0.2" />
         <entry key="..\:/workspace/hcp-pads/game/src/main/res/layout/dialog_game_loading.xml" value="0.23697916666666666" />

+ 5 - 0
baselib/src/main/java/com/yingyangfly/baselib/utils/RxBusCodes.kt

@@ -117,4 +117,9 @@ object RxBusCodes {
      * 购买问诊服务成功
      */
     const val purchaseConsultationEvent = 9009
+
+    /**
+     * 关闭畅玩蓝豚页面
+     */
+    const val FINISHFREETRAIN = "finishFreeTrain"
 }

+ 14 - 4
game/src/main/java/com/yingyangfly/game/dialog/CountdownDialog.kt

@@ -39,6 +39,7 @@ class CountdownDialog : DialogFragment() {
     private var oneStep = ""
     private var twoStep = ""
     private var threeStep = ""
+    private var voicePlayer: VoicePlayer? = null
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -83,6 +84,7 @@ class CountdownDialog : DialogFragment() {
             activity, R.layout.dialog_count_down, container, 2388, 1668
         )
         content = activity
+        voicePlayer = VoicePlayer.getInstance(content)
         findId(rootView)
         initData()
         initTimer()
@@ -119,21 +121,28 @@ class CountdownDialog : DialogFragment() {
                 "1" -> {
                     imageCountdown!!.setBackgroundResource(R.mipmap.icon_one)
                     imageCountdown!!.post {
-                        VoicePlayer.getInstance(content!!).play(oneStep) {
+                        if (voicePlayer != null) {
+                            voicePlayer?.play(oneStep) {
+                            }
                         }
+
                     }
                 }
                 "2" -> {
                     imageCountdown!!.setBackgroundResource(R.mipmap.icon_two)
                     imageCountdown!!.post {
-                        VoicePlayer.getInstance(content!!).play(twoStep) {
+                        if (voicePlayer != null) {
+                            voicePlayer?.play(twoStep) {
+                            }
                         }
                     }
                 }
                 "3" -> {
                     imageCountdown!!.setBackgroundResource(R.mipmap.icon_three)
                     imageCountdown!!.post {
-                        VoicePlayer.getInstance(content!!).play(threeStep) {
+                        if (voicePlayer != null) {
+                            voicePlayer?.play(threeStep) {
+                            }
                         }
                     }
                 }
@@ -156,7 +165,8 @@ class CountdownDialog : DialogFragment() {
         }
 
         //游戏加载完成
-        LiveEventBusUtil.observer<String>(this, RxBusCodes.LOADINGOVER) {
+        LiveEventBusUtil.observer<String>(this, RxBusCodes.LOADINGOVER)
+        {
             loadingOver = true
         }
     }

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

@@ -20,6 +20,7 @@ import com.yingyangfly.baselib.ext.*
 import com.yingyangfly.baselib.mvvm.BaseMVVMActivity
 import com.yingyangfly.baselib.player.VoicePlayer
 import com.yingyangfly.baselib.router.RouterUrlCommon
+import com.yingyangfly.baselib.utils.JumpUtil
 import com.yingyangfly.baselib.utils.LiveEventBusUtil
 import com.yingyangfly.baselib.utils.RxBusCodes
 import com.yingyangfly.baselib.utils.img.ImgUtil
@@ -193,8 +194,7 @@ class GameIntroductionActivity :
                             if (isEnterGame) {
                                 val exitGameDialog = ExitGameDialog()
                                 exitGameDialog.onDialogClickListener = {
-                                    LiveEventBusUtil.send(RxBusCodes.CALLQUITGAME, "")
-                                    finish()
+                                    JumpUtil.jumpActivity(RouterUrlCommon.freeTrain, mContext)
                                 }
                                 exitGameDialog.show(supportFragmentManager, "exitGameDialog")
                             } else {

+ 1 - 0
home/src/main/java/com/yingyangfly/home/activity/HomeActivity.kt

@@ -163,6 +163,7 @@ class HomeActivity : BaseMVVMActivity<ActivityHomeBinding, HomeViewModel>(),
                     .into(fishImage)
             }
             LiveEventBusUtil.send(RxBusCodes.FINISHGAME, "")
+            LiveEventBusUtil.send(RxBusCodes.FINISHFREETRAIN, "")
         }
     }
 

+ 6 - 14
workbenches/src/main/AndroidManifest.xml

@@ -4,41 +4,33 @@
 
     <application>
         <activity
-            android:name="com.yingyang.workbenches.WorkbenchesActivity"
+            android:name=".orderlist.OrderListActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
-
         <activity
-            android:name=".traindata.TrainDataActivity"
+            android:name=".traincontentdetails.TrainContentDetailsActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
-
         <activity
-            android:name=".servicepackage.ServicePackageActivity"
+            android:name=".freetraining.FreeTrainActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
+            android:launchMode="singleInstance"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
-
         <activity
             android:name=".leisurebrain.LeisureBrainActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
-
-        <activity
-            android:name=".freetraining.FreeTrainActivity"
-            android:configChanges="keyboardHidden|orientation|screenSize"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustResize|adjustPan" />
         <activity
-            android:name=".traincontentdetails.TrainContentDetailsActivity"
+            android:name=".traindata.TrainDataActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
         <activity
-            android:name=".orderlist.OrderListActivity"
+            android:name=".servicepackage.ServicePackageActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />

+ 12 - 1
workbenches/src/main/java/com/yingyang/workbenches/freetraining/FreeTrainActivity.kt

@@ -136,7 +136,7 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
     }
 
     override fun initData() {
-
+        finishFreeTrain()
     }
 
     override fun onResume() {
@@ -256,4 +256,15 @@ class FreeTrainActivity : BaseMVVMActivity<ActivityFreeTrainBinding, FreeTrainVi
         return true
     }
 
+    /**
+     * 关闭畅玩蓝豚
+     */
+    private fun finishFreeTrain() {
+        LiveEventBusUtil.observer<String>(this, RxBusCodes.FINISHFREETRAIN) {
+            runOnUiThread {
+                finish()
+            }
+        }
+    }
+
 }

+ 1 - 5
workbenches/src/main/manifest/AndroidManifest.xml

@@ -17,6 +17,7 @@
             android:name=".freetraining.FreeTrainActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
+            android:launchMode="singleInstance"
             android:windowSoftInputMode="adjustResize|adjustPan" />
         <activity
             android:name=".leisurebrain.LeisureBrainActivity"
@@ -28,11 +29,6 @@
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:screenOrientation="landscape"
             android:windowSoftInputMode="adjustResize|adjustPan" />
-        <activity
-            android:name="com.yingyang.workbenches.WorkbenchesActivity"
-            android:configChanges="keyboardHidden|orientation|screenSize"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustResize|adjustPan" />
         <activity
             android:name=".servicepackage.ServicePackageActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"