Selaa lähdekoodia

feat: 活动飘条

tongmengxiao 3 kuukautta sitten
vanhempi
commit
ec73601ee3

+ 36 - 0
baseswago/src/main/java/com/swago/baseswago/im/GroupMsgParser.kt

@@ -10,6 +10,8 @@ import com.swago.baseswago.im.ImConstant.beauty_game_grab_host
 import com.swago.baseswago.im.ImConstant.beauty_game_grab_host_two
 import com.swago.baseswago.im.ImConstant.beauty_game_host
 import com.swago.baseswago.im.ImConstant.bind_anchor
+import com.swago.baseswago.im.ImConstant.break_egg_rewards
+import com.swago.baseswago.im.ImConstant.break_egg_sum
 import com.swago.baseswago.im.ImConstant.cancel_forbid_speak
 import com.swago.baseswago.im.ImConstant.change_user_name
 import com.swago.baseswago.im.ImConstant.close_account
@@ -21,6 +23,7 @@ import com.swago.baseswago.im.ImConstant.follow_anchor_success
 import com.swago.baseswago.im.ImConstant.forbid_speak
 import com.swago.baseswago.im.ImConstant.force_close_live_room
 import com.swago.baseswago.im.ImConstant.fruit_game
+import com.swago.baseswago.im.ImConstant.game_key_rewards
 import com.swago.baseswago.im.ImConstant.game_win_big_prize
 import com.swago.baseswago.im.ImConstant.house_open_live
 import com.swago.baseswago.im.ImConstant.invite_user_on_mic
@@ -49,6 +52,7 @@ import com.swago.baseswago.im.ImConstant.room_dan_mu
 import com.swago.baseswago.im.ImConstant.send_wish_gift
 import com.swago.baseswago.im.ImConstant.set_room_admin
 import com.swago.baseswago.im.ImConstant.svg_gift
+import com.swago.baseswago.im.ImConstant.today_star_rewards
 import com.swago.baseswago.im.ImConstant.update_audience
 import com.swago.baseswago.im.ImConstant.update_mic_list_data
 import com.swago.baseswago.im.ImConstant.user_agree_invite_by_anchor
@@ -377,6 +381,38 @@ class GroupMsgParser : IGroupNewMsgParser {
                     )
                     parserModel = gson.fromJson(resultString,parameterizedTypeImpl)
                 }
+                today_star_rewards -> {
+                    parameterizedTypeImpl = ParameterizedTypeImpl(
+                        arrayOf<Type>(PiaoTiaoRewardsData::class.java),
+                        CusNewMsgBean::class.java,
+                        CusNewMsgBean::class.java
+                    )
+                    parserModel = gson.fromJson(resultString,parameterizedTypeImpl)
+                }
+                game_key_rewards -> {
+                    parameterizedTypeImpl = ParameterizedTypeImpl(
+                        arrayOf<Type>(PiaoTiaoRewardsData::class.java),
+                        CusNewMsgBean::class.java,
+                        CusNewMsgBean::class.java
+                    )
+                    parserModel = gson.fromJson(resultString,parameterizedTypeImpl)
+                }
+                break_egg_rewards -> {
+                    parameterizedTypeImpl = ParameterizedTypeImpl(
+                        arrayOf<Type>(PiaoTiaoRewardsData::class.java),
+                        CusNewMsgBean::class.java,
+                        CusNewMsgBean::class.java
+                    )
+                    parserModel = gson.fromJson(resultString,parameterizedTypeImpl)
+                }
+                break_egg_sum -> {
+                    parameterizedTypeImpl = ParameterizedTypeImpl(
+                        arrayOf<Type>(PiaoTiaoRewardsData::class.java),
+                        CusNewMsgBean::class.java,
+                        CusNewMsgBean::class.java
+                    )
+                    parserModel = gson.fromJson(resultString,parameterizedTypeImpl)
+                }
 
             }
             parserModel?.v2TIMMessage = v2TIMMessage

+ 17 - 0
baseswago/src/main/java/com/swago/baseswago/im/ImConstant.kt

@@ -246,6 +246,23 @@ object ImConstant {
      * 主播开播
      * */
     const val house_open_live = 504
+    /**
+     * 今日之星奖励发放
+     * */
+    const val today_star_rewards = 505
+    /**
+     * 游戏之王奖励发放
+     * */
+    const val game_key_rewards = 506
+    /**
+     * 砸金蛋中奖发放
+     * */
+    const val break_egg_rewards = 507
+    /**
+     * 砸金蛋奖池金额
+     * */
+    const val break_egg_sum = 508
+
 
     /**********游戏相关IM********/
     const val fruit_game = 1001

+ 9 - 0
baseswago/src/main/java/com/swago/baseswago/model/im/PiaoTiaoRewardsData.kt

@@ -0,0 +1,9 @@
+package com.swago.baseswago.model.im
+
+ class PiaoTiaoRewardsData :IPiaoTiao {
+    var type:Int = 0
+    val userName: String = ""
+    val sort: String = ""
+    val winCoin: String = ""
+    val actCoin: String = ""
+}

+ 30 - 0
room/src/main/java/com/swago/room/piaotiao/WaftView.kt

@@ -13,6 +13,7 @@ import android.widget.FrameLayout
 import android.widget.LinearLayout
 import com.swago.baseswago.model.im.GamePrize
 import com.swago.baseswago.model.im.IPiaoTiao
+import com.swago.baseswago.model.im.PiaoTiaoRewardsData
 import com.swago.baseswago.model.live.gift.IMGiftModel
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.DpPxUtil
@@ -146,6 +147,35 @@ class WaftView : FrameLayout {
                     }
                 }
             }
+            is PiaoTiaoRewardsData -> {
+                when(next.type) {
+                    505 -> {
+                        val sendName = "<font color='#FFDB43'>${next.userName}</font>"
+                        val coin = "<font color='#FFDB43'>${next.sort}</font>"
+                        binding?.ll?.setBackgroundResource(R.mipmap.waft_game_bg)
+                        binding?.marqueeTextView?.text = "恭喜XXXX成为本场今日之星活动第1名"
+                    }
+                    506 -> {
+                        val sendName = "<font color='#FFDB43'>${next.userName}</font>"
+                        val coin = "<font color='#FFDB43'>${next.sort}</font>"
+                        binding?.ll?.setBackgroundResource(R.mipmap.waft_game_bg)
+                        binding?.marqueeTextView?.text = "恭喜XXXX成为本场游戏之王活动第1名"
+                    }
+                    507 -> {
+                        val sendName = "<font color='#FFDB43'>${next.userName}</font>"
+                        val coin = "<font color='#FFDB43'>${next.sort}</font>"
+                        binding?.ll?.setBackgroundResource(R.mipmap.waft_game_bg)
+                        binding?.marqueeTextView?.text = "太幸运啦,恭喜XXXX在砸金蛋活动中得到XXX金币奖励"
+                    }
+                    508 -> {
+                        val sendName = "<font color='#FFDB43'>${next.userName}</font>"
+                        val coin = "<font color='#FFDB43'>${next.sort}</font>"
+                        binding?.ll?.setBackgroundResource(R.mipmap.waft_game_bg)
+                        binding?.marqueeTextView?.text = "砸金蛋活动奖池已经达到xxxx,大家快去参与呀"
+                    }
+                }
+
+            }
 
         }
 

+ 36 - 1
room/src/main/java/com/swago/room/vm/MsgVm.kt

@@ -9,11 +9,14 @@ import com.swago.baseswago.baseroom.viewmodel.AbsMsgVm
 import com.swago.baseswago.im.IRoomChat
 import com.swago.baseswago.im.ImConstant
 import com.swago.baseswago.im.ImConstant.anchor_close_room
+import com.swago.baseswago.im.ImConstant.break_egg_rewards
+import com.swago.baseswago.im.ImConstant.break_egg_sum
 import com.swago.baseswago.im.ImConstant.cancel_forbid_speak
 import com.swago.baseswago.im.ImConstant.delete_room_admin
 import com.swago.baseswago.im.ImConstant.follow_anchor_success
 import com.swago.baseswago.im.ImConstant.forbid_speak
 import com.swago.baseswago.im.ImConstant.force_close_live_room
+import com.swago.baseswago.im.ImConstant.game_key_rewards
 import com.swago.baseswago.im.ImConstant.game_win_big_prize
 import com.swago.baseswago.im.ImConstant.house_open_live
 import com.swago.baseswago.im.ImConstant.invite_user_on_mic
@@ -36,6 +39,7 @@ import com.swago.baseswago.im.ImConstant.room_dan_mu
 import com.swago.baseswago.im.ImConstant.send_wish_gift
 import com.swago.baseswago.im.ImConstant.set_room_admin
 import com.swago.baseswago.im.ImConstant.svg_gift
+import com.swago.baseswago.im.ImConstant.today_star_rewards
 import com.swago.baseswago.im.ImConstant.update_audience
 import com.swago.baseswago.im.ImConstant.update_mic_list_data
 import com.swago.baseswago.im.ImConstant.user_agree_invite_by_anchor
@@ -781,7 +785,38 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                 }
             }
         }
-
+        imGroupNewMsgListener.handleMsgType<CusNewMsgBean<PiaoTiaoRewardsData>>(today_star_rewards) {
+            if (isReady) {
+                it.data?.let {
+                    it.type = 505
+                    waftFun?.invoke(it)
+                }
+            }
+        }
+        imGroupNewMsgListener.handleMsgType<CusNewMsgBean<PiaoTiaoRewardsData>>(game_key_rewards) {
+            if (isReady) {
+                it.data?.let {
+                    it.type = 506
+                    waftFun?.invoke(it)
+                }
+            }
+        }
+        imGroupNewMsgListener.handleMsgType<CusNewMsgBean<PiaoTiaoRewardsData>>(break_egg_rewards) {
+            if (isReady) {
+                it.data?.let {
+                    it.type = 507
+                    waftFun?.invoke(it)
+                }
+            }
+        }
+        imGroupNewMsgListener.handleMsgType<CusNewMsgBean<PiaoTiaoRewardsData>>(break_egg_sum) {
+            if (isReady) {
+                it.data?.let {
+                    it.type = 508
+                    waftFun?.invoke(it)
+                }
+            }
+        }
     }