fix送礼物特效

This commit is contained in:
oujunhui
2020-08-19 14:04:10 +08:00
parent c0a2c58dc2
commit 3f95b4d8e7

View File

@@ -322,57 +322,55 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
, 1800);
}
handler.postDelayed(() -> drawLuckyGiftAnimation(giftReceiveInfos,totalCoin,targetUsers,giftReceiveType),1808);
handler.postDelayed(() -> drawLuckyGiftAnimation(roomInfo,giftReceiveInfos,totalCoin,targetUsers,giftReceiveType),1200);
}
}
}
private void drawLuckyGiftAnimation(List<GiftReceiveInfo> giftReceiveInfos,int totalCoin,List<GiftReceiver> targetUsers,int giftReceiveType){
// for (int i = 0; i < giftReceiveInfos.size(); i++) {
// GiftReceiveInfo giftReceiveInfo = giftReceiveInfos.get(i);
// SparseArray<Point> micViewPoint = AvRoomDataManager.get().mMicPointMap;
// GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftReceiveInfo.getGiftId());
// if (giftInfo == null || TextUtils.isEmpty(giftInfo.getGiftUrl())) {
// giftInfo = giftReceiveInfo.getGift();
// }
// if (giftInfo == null) {
// return;
// }
// // 算出发送者和接受者的位置
// int senderPosition = AvRoomDataManager.get().getMicPosition(giftReceiveInfo.getUid());
// int receivePosition = AvRoomDataManager.get().getMicPosition(giftReceiveInfo.getTargetUid());
//
// // 离开模式给房主送礼
// if (roomInfo.isLeaveMode() && giftReceiveInfo.getTargetUid() == roomInfo.getUid())
// receivePosition = -1;
//
// if (micViewPoint == null) {
// //产生空的原因是麦位坐标初始化有500ms延迟
// LogUtil.print("gift micViewPoint is null");
// continue;
// }
//
// Point senderPoint = micViewPoint.get(senderPosition);
// Point receivePoint = micViewPoint.get(receivePosition);
// if (receivePoint == null) { //这种情况就是接收者已经不在麦上
// //礼物送到上面中间的位置
// receivePoint = new Point(UIUtil.getScreenWidth(context) / 2,
// UIUtil.dip2px(context, 35));
// }
// giftReceiveInfo.setGift(giftInfo);
// drawGiftView(senderPoint, receivePoint, giftReceiveInfo);
//
// totalCoin += giftInfo.getGoldPrice() * giftReceiveInfo.getGiftNum();
//
//
// GiftReceiver giftReceiver = new GiftReceiver();
// giftReceiver.setUid(giftReceiveInfo.getTargetUid());
// giftReceiver.setAvatar(giftReceiveInfo.getTargetAvatar());
// giftReceiver.setNick(giftReceiveInfo.getTargetNick());
// targetUsers.add(giftReceiver);
// }
private void drawLuckyGiftAnimation(RoomInfo roomInfo,List<GiftReceiveInfo> giftReceiveInfos,int totalCoin,List<GiftReceiver> targetUsers,int giftReceiveType){
for (int i = 0; i < giftReceiveInfos.size(); i++) {
GiftReceiveInfo giftReceiveInfo = giftReceiveInfos.get(i);
SparseArray<Point> micViewPoint = AvRoomDataManager.get().mMicPointMap;
GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftReceiveInfo.getGiftId());
if (giftInfo == null || TextUtils.isEmpty(giftInfo.getGiftUrl())) {
giftInfo = giftReceiveInfo.getGift();
}
if (giftInfo == null) {
return;
}
// 算出发送者和接受者的位置
int senderPosition = AvRoomDataManager.get().getMicPosition(giftReceiveInfo.getUid());
int receivePosition = AvRoomDataManager.get().getMicPosition(giftReceiveInfo.getTargetUid());
// 离开模式给房主送礼
if (roomInfo.isLeaveMode() && giftReceiveInfo.getTargetUid() == roomInfo.getUid())
receivePosition = -1;
if (micViewPoint == null) {
//产生空的原因是麦位坐标初始化有500ms延迟
LogUtil.print("gift micViewPoint is null");
continue;
}
Point senderPoint = micViewPoint.get(senderPosition);
Point receivePoint = micViewPoint.get(receivePosition);
if (receivePoint == null) { //这种情况就是接收者已经不在麦上
//礼物送到上面中间的位置
receivePoint = new Point(UIUtil.getScreenWidth(context) / 2,
UIUtil.dip2px(context, 35));
}
giftReceiveInfo.setGift(giftInfo);
drawGiftView(senderPoint, receivePoint, giftReceiveInfo);
totalCoin += giftInfo.getGoldPrice() * giftReceiveInfo.getGiftNum();
GiftReceiver giftReceiver = new GiftReceiver();
giftReceiver.setUid(giftReceiveInfo.getTargetUid());
giftReceiver.setAvatar(giftReceiveInfo.getTargetAvatar());
giftReceiver.setNick(giftReceiveInfo.getTargetNick());
targetUsers.add(giftReceiver);
}
GiftReceiveInfo giftReceiveInfo = giftReceiveInfos.get(0);
GiftInfo giftInfo = giftReceiveInfo.getGift();
if (totalCoin >= 520 || (giftInfo != null && giftInfo.isHasEffect())) {