admin 1 سال پیش
والد
کامیت
4477c4de57
1فایلهای تغییر یافته به همراه11 افزوده شده و 0 حذف شده
  1. 11 0
      room/src/main/java/com/swago/room/audio/widget/AudioGiftAnimManager.kt

+ 11 - 0
room/src/main/java/com/swago/room/audio/widget/AudioGiftAnimManager.kt

@@ -61,6 +61,7 @@ class AudioGiftAnimManager : IRoomActiveListener {
 
     }
 
+    private var senderId = ""
     private fun initQueue(){
         loopJob = GlobalScope.launch(Dispatchers.Main,start = CoroutineStart.LAZY) {
             var isLoop = true
@@ -74,10 +75,19 @@ class AudioGiftAnimManager : IRoomActiveListener {
                         for (index in 0 until audioGiftViewList.size){
                             if (!audioGiftViewList[index].isBusy){
                                 //有空闲轨道
+                                senderId = imGiftModel.senderId
                                 LogUtil.d("giftDanDaoViewList","ddddd-$index")
                                 audioGiftViewList[index].playGiftAnim((imGiftModel))
                                 isSetData = true
                                 break
+                            }else{
+                                //如果没有空闲轨道但是呢下一个数据跟正在播放的又是同一个
+                                if (imGiftModel.senderId == senderId){
+                                    LogUtil.d("giftDanDaoViewList","ddddd-$index")
+                                    audioGiftViewList[index].playGiftAnim((imGiftModel))
+                                    isSetData = true
+                                    break
+                                }
                             }
                         }
                     }
@@ -94,6 +104,7 @@ class AudioGiftAnimManager : IRoomActiveListener {
                 }else{
                     isLoop = false
                     loopJob= null
+                    senderId = ""
                 }
             }
         }