[BugFix]福袋特效优化

This commit is contained in:
wushaocheng
2023-07-20 16:12:37 +08:00
parent fdfec8610d
commit 951c42592e
8 changed files with 76 additions and 55 deletions

View File

@@ -291,7 +291,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}
}
private void drawLuckyGift(GiftReceiveInfo giftReceiveInfos, int giftReceiveType, boolean isShowAnimation, String svgaUrl) {
private void drawLuckyGift(GiftReceiveInfo giftReceiveInfos, int giftReceiveType, boolean isShowAnimation, String svgaUrl, int pos) {
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo != null) {
List<GiftReceiver> targetUsers = new ArrayList<>();
@@ -306,11 +306,11 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
}, 1800);
}
handler.postDelayed(() -> drawLuckyGiftAnimation(roomInfo, giftReceiveInfos, totalCoin, targetUsers, giftReceiveType, isShowAnimation), 1200);
handler.postDelayed(() -> drawLuckyGiftAnimation(roomInfo, giftReceiveInfos, totalCoin, targetUsers, giftReceiveType, isShowAnimation, pos), 1200);
}
}
private void drawLuckyGiftAnimation(RoomInfo roomInfo, GiftReceiveInfo giftReceiveInfo, int totalCoin, List<GiftReceiver> targetUsers, int giftReceiveType, boolean isShowAnimation) {
private void drawLuckyGiftAnimation(RoomInfo roomInfo, GiftReceiveInfo giftReceiveInfo, int totalCoin, List<GiftReceiver> targetUsers, int giftReceiveType, boolean isShowAnimation, int pos) {
SparseArray<Point> micViewPoint = AvRoomDataManager.get().mMicPointMap;
GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftReceiveInfo.getGiftId());
if (giftInfo == null || TextUtils.isEmpty(giftInfo.getGiftUrl())) {
@@ -353,7 +353,7 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
giftReceiver.setNick(giftReceiveInfo.getTargetNick());
targetUsers.add(giftReceiver);
if (!isShowAnimation) return;
giftInfo = giftReceiveInfo.getDisplayGift().get(0);
giftInfo = giftReceiveInfo.getDisplayGift().get(pos);
if (totalCoin >= 520 || (giftInfo != null && giftInfo.isHasEffect())) {
Message msg = Message.obtain();
msg.what = 0;
@@ -361,14 +361,13 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
giftEffectInfo.setUid(giftReceiveInfo.getUid());
giftEffectInfo.setNick(giftReceiveInfo.getNick());
giftEffectInfo.setAvatar(giftReceiveInfo.getAvatar());
giftEffectInfo.setGiftId(giftReceiveInfo.getDisplayGift().get(0).getGiftId());
giftEffectInfo.setGiftId(giftReceiveInfo.getDisplayGift().get(pos).getGiftId());
giftEffectInfo.setGiftNum(giftReceiveInfo.getGiftNum());
giftEffectInfo.setGift(giftInfo);
giftEffectInfo.setTargetUsers(targetUsers);
giftEffectInfo.setGiftReceiveType(giftReceiveType);
msg.obj = giftEffectInfo;
handler.sendMessageDelayed(msg, 200);
}
}
@@ -427,19 +426,22 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
public void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
if (giftMultiReceiverInfo != null) {
setVisibility(VISIBLE);
GiftReceiveInfo giftReceiveInfo = new GiftReceiveInfo();
giftReceiveInfo.setUid(giftMultiReceiverInfo.getUid());
giftReceiveInfo.setTargetNick(giftMultiReceiverInfo.getUser().getNick());
giftReceiveInfo.setTargetUid(giftMultiReceiverInfo.getUser().getUid());
giftReceiveInfo.setGiftNum(giftMultiReceiverInfo.getGiftNum());
giftReceiveInfo.setDisplayGift(giftMultiReceiverInfo.getDisplayGift());
giftReceiveInfo.setNick(giftMultiReceiverInfo.getNick());
giftReceiveInfo.setGiftId(giftMultiReceiverInfo.getGiftList().get(0).getGiftId());
giftReceiveInfo.setGift(giftMultiReceiverInfo.getDisplayGift().get(0));
//礼物值
giftReceiveInfo.setGiftValueVos(giftMultiReceiverInfo.getGiftValueVos());
giftReceiveInfo.setCurrentTime(giftMultiReceiverInfo.getCurrentTime());
drawLuckyGift(giftReceiveInfo, GiftEffectInfo.GIFT_RECEIVE_TYPE_LUCKY, giftMultiReceiverInfo.isShowAnimation(), giftMultiReceiverInfo.getLuckyGiftSvgaUrl());
int size = Math.min(giftMultiReceiverInfo.getDisplayGift().size(), 6);
for (int i = 0; i < size; i++) {
GiftReceiveInfo giftReceiveInfo = new GiftReceiveInfo();
giftReceiveInfo.setUid(giftMultiReceiverInfo.getUid());
giftReceiveInfo.setTargetNick(giftMultiReceiverInfo.getUser().getNick());
giftReceiveInfo.setTargetUid(giftMultiReceiverInfo.getUser().getUid());
giftReceiveInfo.setGiftNum(giftMultiReceiverInfo.getGiftNum());
giftReceiveInfo.setDisplayGift(giftMultiReceiverInfo.getDisplayGift());
giftReceiveInfo.setNick(giftMultiReceiverInfo.getNick());
giftReceiveInfo.setGiftId(giftMultiReceiverInfo.getGiftList().get(0).getGiftId());
giftReceiveInfo.setGift(giftMultiReceiverInfo.getDisplayGift().get(i));
//礼物值
giftReceiveInfo.setGiftValueVos(giftMultiReceiverInfo.getGiftValueVos());
giftReceiveInfo.setCurrentTime(giftMultiReceiverInfo.getCurrentTime());
drawLuckyGift(giftReceiveInfo, GiftEffectInfo.GIFT_RECEIVE_TYPE_LUCKY, giftMultiReceiverInfo.isShowAnimation(), giftMultiReceiverInfo.getLuckyGiftSvgaUrl(), i);
}
}
}
@@ -549,9 +551,10 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
/**
* 获取当前是否有飘屏正在显示
*
* @return
*/
public boolean getIsAnim(){
public boolean getIsAnim() {
return giftEffectView.isAnim();
}

View File

@@ -1240,7 +1240,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesRoomPK.size > 0 }
.subscribe {
if(binding.flRoomPkNotify.childCount == 0) {
if (binding.flRoomPkNotify.childCount == 0) {
showRoomPKNotify(messagesRoomPK.removeAt(0))
}
}
@@ -1286,7 +1286,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesSingleRoomPK.size > 0 }
.subscribe {
if(binding.flSingleRoomPkNotify.childCount == 0) {
if (binding.flSingleRoomPkNotify.childCount == 0) {
showSingleRoomPKNotify(messagesSingleRoomPK.removeAt(0))
}
}

View File

@@ -31,6 +31,7 @@ import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.avroom.helper.AnimHelper
import com.yizhuan.erban.common.svga.SimpleSvgaCallback
import com.yizhuan.erban.databinding.LayoutRoomEffectBinding
import com.yizhuan.erban.treasurefairy.HomeFairyActivity
import com.yizhuan.erban.ui.utils.ImageLoadUtils
import com.yizhuan.erban.ui.utils.isDestroyed
import com.yizhuan.erban.ui.utils.load
@@ -163,23 +164,19 @@ class RoomEffectView @JvmOverloads constructor(
.subscribe { roomEvent: RoomEvent? ->
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
when (roomEvent.event) {
RoomEvent.BOX_NOTIFY -> {
if ((mContext as AVRoomActivity).isTopActivity) {
addBoxNotify(roomEvent.chatRoomMessage)
}
RoomEvent.BOX_NOTIFY -> {//寻爱
addBoxNotify(roomEvent.chatRoomMessage)
}
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱svga
addBoxNotifyBySVGA(roomEvent.chatRoomMessage)
}
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE ->//全服福袋
//廳內福袋
addLuckyBagNotify(roomEvent.chatRoomMessage)
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
RoomEvent.BOX_NOTIFY_SVGA -> {
if ((mContext as AVRoomActivity).isTopActivity) {
addBoxNotifyBySVGA(roomEvent.chatRoomMessage)
}
}
RoomEvent.RADISH_NOTIFY,
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
RoomEvent.ROOM_GIFT_COMPOUND -> addGiftCompoundNotify(roomEvent.chatRoomMessage)
RoomEvent.RECEIVE_ROOM_LUCKY_BAG_NOTICE, RoomEvent.RECEIVE_SERVICE_LUCKY_BAG_NOTICE -> //全服福袋
//廳內福袋
addLuckyBagNotify(roomEvent.chatRoomMessage)
RoomEvent.DATING_PUBLISH_RESULT -> showHandAnim((roomEvent.chatRoomMessage.attachment as DatingAttachment).datingNotifyInfo)
RoomEvent.RECEIVE_MEMBER_IN_NOTICE -> //進入房間
addMemberInNotify(roomEvent.chatRoomMessage)
@@ -802,12 +799,10 @@ class RoomEffectView @JvmOverloads constructor(
.observeOn(AndroidSchedulers.mainThread())
.takeWhile { messagesBoxSVGA.size > 0 }
.subscribe {
if ((mContext as AVRoomActivity).isTopActivity) {
if (binding.flSvgaBoxNotify.childCount == 0) {
showBoxNotifyBySVGA(
messagesBoxSVGA.removeAt(0)
)
}
if (binding.flSvgaBoxNotify.childCount == 0) {
showBoxNotifyBySVGA(
messagesBoxSVGA.removeAt(0)
)
}
}
}

View File

@@ -0,0 +1,27 @@
package com.yizhuan.erban.ui.widget.viewpager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView;
public class ScrollViewPager extends RollPagerView {
public ScrollViewPager(Context context) {
super(context);
}
public ScrollViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ScrollViewPager(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
getParent().requestDisallowInterceptTouchEvent(true); //设置不拦截
return super.dispatchTouchEvent(ev);
}
}

View File

@@ -42,7 +42,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yizhuan.erban.ui.widget.rollviewpager.RollPagerView
<com.yizhuan.erban.ui.widget.viewpager.ScrollViewPager
android:id="@+id/roll_view"
android:layout_width="0dp"
android:layout_height="0dp"

View File

@@ -98,6 +98,8 @@ dependencies {
api 'com.google.android.gms:play-services-wallet:19.1.0'
api 'com.android.billingclient:billing:4.1.0'
api 'org.jetbrains.kotlin:kotlin-reflect:1.5.20'
api project(':nim_uikit')
api project(':library')
api project(':trtc_release')

View File

@@ -768,8 +768,6 @@ public final class IMNetEaseManager {
messages.add(msg);
gift = true;
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_LUCKY_GIFT) {
MultiLuckyGiftAttachment luckyGiftAttachment = (MultiLuckyGiftAttachment) attachment;
GiftModel.get().addNewGift(luckyGiftAttachment.getMultiLuckyGiftReceiveInfo().getDisplayGift().get(0));
messages.add(msg);
gift = true;
}
@@ -791,13 +789,9 @@ public final class IMNetEaseManager {
messages.add(msg);
gift = true;
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_ALL_MIC_LUCKY_GIFT) {
MultiLuckyGiftAttachment luckyGiftAttachment = (MultiLuckyGiftAttachment) attachment;
GiftModel.get().addNewGift(luckyGiftAttachment.getMultiLuckyGiftReceiveInfo().getDisplayGift().get(0));
messages.add(msg);
gift = true;
} else if (customAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_MULTI_LUCK_GIFT) {
MultiLuckyGiftAttachment luckyGiftAttachment = (MultiLuckyGiftAttachment) attachment;
GiftModel.get().addNewGift(luckyGiftAttachment.getMultiLuckyGiftReceiveInfo().getDisplayGift().get(0));
messages.add(msg);
gift = true;
}

View File

@@ -4,32 +4,32 @@ data class FairyMsgInfo(
/**
* uid
*/
val uid: Long? = null,
val uid: Long = 0L,
/**
* 昵称
*/
val nick: String? = null,
val nick: String = "",
/**
* 所在房间uid
*/
val roomUid: Long? = null,
val roomUid: Long = 0L,
/**
* 奖励类型
*/
val rewardType: String? = null,
val rewardType: String = "",
/**
* 奖励名称
*/
val rewardName: String? = null,
val rewardName: String = "",
/**
* 奖励等级
*/
val rewardLevel: Int? = null,
val rewardLevel: Int = 0,
/**
* 奖励数量
@@ -39,10 +39,10 @@ data class FairyMsgInfo(
/**
* 限制等级
*/
val userLevelLimit: Int? = null,
val userLevelLimit: Int = 0,
/**
* 展示价值
*/
val rewardShowValue: Int? = null
val rewardShowValue: Int = 0
)