Files
yinmeng-ios/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationView.m

1931 lines
81 KiB
Mathematica
Raw Normal View History

//
// XPRoomAnimationView.m
// xplan-ios
//
// Created by on 2021/12/6.
//
#import "XPRoomAnimationView.h"
///Third
#import <Masonry/Masonry.h>
#import <SVGA.h>
#import <NIMSDK/NIMSDK.h>
#import <POP.h>
2022-03-18 15:18:50 +08:00
#import "QGVAPConfigModel.h"
2022-03-30 18:46:22 +08:00
#import "UIView+VAP.h"
#import <YYText/YYText.h>
2022-08-23 18:01:34 +08:00
#import <UIImageView+WebCache.h>
///Tool
#import "XPGiftStorage.h"
#import "XPMacro.h"
#import "ThemeColor+Room.h"
#import "NetImageView.h"
2022-03-18 15:18:50 +08:00
#import "XPRoomGiftAnimationParser.h"
#import "XCCurrentVCStackManager.h"
2022-02-16 15:20:48 +08:00
#import "AccountInfoStorage.h"
#import "ClientConfig.h"
///Model
#import "MicroQueueModel.h"
#import "MicroStateModel.h"
#import "UserInfoModel.h"
#import "GiftReceiveInfoModel.h"
#import "GiftInfoModel.h"
#import "RoomInfoModel.h"
#import "AttachmentModel.h"
#import "XPGiftBigPrizeModel.h"
#import "XPGiftBannerUserInfoModel.h"
#import "XPRoomGiftBroadCastModel.h"
2021-12-17 15:18:34 +08:00
#import "XPMessageRemoteExtModel.h"
2022-01-05 21:48:21 +08:00
#import "DatingInfoModel.h"
2022-01-12 17:44:40 +08:00
#import "AcrossRoomPKPrizeModel.h"
2022-06-07 17:51:32 +08:00
#import "RoomHalfHourRankModel.h"
///View
#import "XPRoomGiftBannerView.h"
#import "XPRoomGiftBroadcastView.h"
#import "XPRoomCandyGiftView.h"
2022-01-05 21:48:21 +08:00
#import "XPRoomDatingAnimationView.h"
#import "XPRoomNobleLevelUpView.h"
2022-03-18 15:18:50 +08:00
#import "QGVAPWrapView.h"
2022-01-12 17:44:40 +08:00
#import "XPAcrossRoomPKPrizeView.h"
#import "XPRoomViewController.h"
2022-04-15 14:49:04 +08:00
#import "XPRoomAnchorRankBannerView.h"
2022-04-26 18:41:17 +08:00
#import "XPRoomEnterHideTipView.h"
2022-06-13 19:07:07 +08:00
#import "XPRoomLicneseHourRankView.h"
2022-06-15 14:20:09 +08:00
#import "XPRoomLuckyBigPrizeView.h"
2022-08-05 15:38:21 +08:00
#import "XPRoomGiftCompoundView.h"
2022-08-19 17:42:14 +08:00
#import "XPSailingAnimationView.h"
2022-08-23 18:01:34 +08:00
#import "XPRoomGraffitiGiftAnimationView.h"
2022-08-23 18:01:34 +08:00
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate>
///
///
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
///
@property (nonatomic,strong) XPRoomAnimationHitView * middleLevelView;
///
@property (nonatomic,strong) XPRoomAnimationHitView * highLevleView;
///
@property (strong, nonatomic) SVGAParser *parser;
2022-03-18 15:18:50 +08:00
///VAP
@property (nonatomic, strong) XPRoomGiftAnimationParser *vapParser;
///
@property (nonatomic,strong) SVGAImageView *giftEffectView;
2022-03-18 15:18:50 +08:00
///VAP
2022-03-30 18:46:22 +08:00
@property (nonatomic, strong) VAPView *vapGiftEffectView;
///
@property (nonatomic,strong) SVGAImageView *luckyGiftEffectView;
///VAP
@property (nonatomic, strong) VAPView *luckyVapGiftEffectView;
///
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
///
@property (nonatomic,strong) NSMutableArray<GiftReceiveInfoModel *> *giftEffectQueue;
///
@property (strong,nonatomic)NSMutableSet * bannerDequePool;
///
@property (strong,nonatomic)NSMutableSet * bannerVisiablePool;
/// 6s
@property (nonatomic,strong)dispatch_source_t giftEffectTimer;
///
@property (nonatomic,strong) NSMutableArray<XPGiftBigPrizeModel *> *bigPrizeGiftQueue;
///
@property (nonatomic,strong)dispatch_source_t luckyprizeTimer;
///广
@property (nonatomic,strong) NSMutableArray<XPRoomGiftBroadCastModel *> *giftBroadcastQueue;
#pragma mark -
///
@property (nonatomic,strong) NSMutableArray<GiftReceiveInfoModel *> *giftQueue;
///
@property (nonatomic ,strong)dispatch_source_t giftTimer;
///
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftReuseArray;
///
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray;
///
@property (nonatomic,strong) NSMutableArray *candyTreegiftQueue;
2022-08-05 15:38:21 +08:00
///
@property (nonatomic,strong) NSMutableArray *compoundGiftQueue;
///
@property (nonatomic, strong) NSMutableArray *nobleLevelUpQueue;
///
@property (nonatomic,assign) BOOL isLargeGiftAnimating;
2021-12-17 15:18:34 +08:00
#pragma mark -
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *carEffectQueue;
2021-12-16 20:22:01 +08:00
@property (nonatomic,strong) SVGAImageView *carEffectView;
///VAP
2022-03-30 18:46:22 +08:00
@property (nonatomic, strong) VAPView *carVapEffectView;
2021-12-17 15:18:34 +08:00
#pragma mark -
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *enterEffectQueue;
@property (nonatomic,strong) SVGAImageView *enterEffectView;
2022-01-05 21:48:21 +08:00
#pragma mark -
@property (nonatomic, strong) NSMutableArray<DatingInfoModel *> *datingEffectQueue;
@property (nonatomic,strong) SVGAImageView *datingEffectView;
2022-01-12 17:44:40 +08:00
#pragma mark - PK
@property (nonatomic, strong) NSMutableArray<AcrossRoomPKPrizeModel *> *acrossRoomPKQueue;
2022-08-19 17:42:14 +08:00
#pragma mark -
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *sailingQueue;
2022-08-23 18:01:34 +08:00
#pragma mark -
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *graffitiGiftQueue;
2022-06-15 14:20:09 +08:00
///
@property (nonatomic,assign) BOOL isLuckyGiftAnimation;
2022-10-21 18:03:00 +08:00
#pragma mark -
@property (nonatomic,strong) SVGAImageView *wishGiftEffectView;
@end
@implementation XPRoomAnimationView
- (void)dealloc {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
2021-12-16 20:22:01 +08:00
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
}
2022-01-13 18:45:17 +08:00
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
self.delegate = delegate;
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.lowLevelView];
[self addSubview:self.middleLevelView];
[self addSubview:self.highLevleView];
}
- (void)initSubViewConstraints {
[self.lowLevelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.middleLevelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.highLevleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
}
2022-02-16 15:20:48 +08:00
//
- (BOOL)isInSudGame {
BOOL isGamePlaying = NO;
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
for (int i = -1; i<5; i++) {
NSMutableDictionary * micQueue = self.delegate.getMicroQueue;
MicroQueueModel *micSequence = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i]];
if (micSequence == nil || micSequence.userInfo == nil) {
continue;
}
if (micSequence.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue && micSequence.userInfo.gameStatus == LittleGamePlayStatus_Plying) {
isGamePlaying = YES;
break;
}
}
}
return isGamePlaying;
}
#pragma mark - NIMBroadcastDelegate
// 广
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage{
if (broadcastMessage.content) {
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_ChannelNotify){///广
[self receiveBroadcastGift:attachment];
2022-01-12 16:33:57 +08:00
} else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Noble_LevelUp_Suspend) {///
[self receiveNobleLevelUp:attachment];
}
}
}
2022-01-12 16:33:57 +08:00
2021-12-16 20:22:01 +08:00
#pragma mark - RoomGuestDelegate
2021-12-25 16:57:50 +08:00
- (void)handleNIMCustomMessage:(NIMMessage *)message {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_Gift) {
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend;
receiveInfo.isBatch = YES;
[self receiveGiftHandleSendGiftAnimation:attachment];
if (receiveInfo.isLuckyBagGift) {
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
if (receiveInfo.viewUrl.length > 0) {
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
} else {
NSString * svgaString = receiveInfo.luckyGiftSvgaUrl.length > 0 ? receiveInfo.luckyGiftSvgaUrl : receiveInfo.gift.luckyGiftSvgaUrl;
NSURL * luckyGiftSvgaUrl = [NSURL URLWithString:svgaString];
if (luckyGiftSvgaUrl.absoluteString.length <= 0) {
luckyGiftSvgaUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"room_lucky_gift_bg" ofType:@"svga"]];
}
[self playLuckyGiftEffect:luckyGiftSvgaUrl];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self receiveGift:receiveInfo];
});
} else {
[self receiveGift:receiveInfo];
}
2021-12-25 16:57:50 +08:00
} else if (attachment.first == CustomMessageType_AllMicroSend) { //
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
[self receiveGiftHandleSendGiftAnimation:attachment];
if (receiveInfo.isLuckyBagGift) {
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
if (receiveInfo.viewUrl.length > 0) {
[self playLuckyGiftEffectWithVapUrl:receiveInfo.viewUrl];
} else {
NSString * svgaString = receiveInfo.luckyGiftSvgaUrl.length > 0 ? receiveInfo.luckyGiftSvgaUrl : receiveInfo.gift.luckyGiftSvgaUrl;
NSURL * luckyGiftSvgaUrl = [NSURL URLWithString:svgaString];
if (luckyGiftSvgaUrl.absoluteString.length <= 0) {
luckyGiftSvgaUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"room_lucky_gift_bg" ofType:@"svga"]];
}
[self playLuckyGiftEffect:luckyGiftSvgaUrl];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self receiveGift:receiveInfo];
});
} else {
[self receiveGift:receiveInfo];
}
2021-12-25 16:57:50 +08:00
} else if (attachment.first == CustomMessageType_LuckyBag) {//
[self receiveLuckyGiftBigPrize:attachment];
} else if (attachment.first == CustomMessageType_Candy_Tree && (attachment.second == Custom_Message_Sub_Candy_Tree_InRoom_NeedAllMicSend || attachment.second == Custom_Message_Sub_Candy_Tree_AllRoom_Notify) ) {//
[self receiveCandyTreeGiftHighLevle:attachment];
} else if (attachment.first == CustomMessageType_Car_Notify && attachment.second == Custom_Message_Sub_Car_EnterRoom ) {//
[self receiveDriveCarEnterRoom:attachment];
2022-01-05 21:48:21 +08:00
} else if(attachment.first == CustomMessageType_RoomPlay_Dating && attachment.second == Custom_Message_Sub_Room_Play_Dating_Public_Result) {
[self roomDatingPublicResult:attachment];
2022-01-12 17:44:40 +08:00
} else if(attachment.first == CustomMessageType_Across_Room_PK && attachment.second == Custom_Message_Sub_AcrossRoomPK_Result) {
[self acrossRoomPKBannerAnimation:attachment];
2022-04-11 11:50:25 +08:00
} else if (attachment.first == CustomMessageType_Anchor_FansTeam && attachment.second == Custom_Message_Sub_FansTeam_Join_Success) {///
GiftReceiveInfoModel *receiveInfo = [[GiftReceiveInfoModel alloc] init];
GiftInfoModel *giftInfo = [GiftInfoModel modelWithJSON:attachment.data[@"giftVo"]];
receiveInfo.gift = giftInfo;
receiveInfo.giftInfo = giftInfo;
[self receiveFansTeamGiftHandleSendGiftAnimation:attachment];
2022-04-11 10:20:00 +08:00
[self receiveGift:receiveInfo];
} else if (attachment.first == CustomMessageType_Across_Room_PK && attachment.second == Custom_Message_Sub_AnchorPK_Result) {//PK
[self acrossRoomPKBannerAnimation:attachment];
} else if (attachment.first == CustomMessageType_Anchor_Hour_Rank && attachment.second == Custom_Message_Sub_Anchor_Hour_Rank) {///
[self receiveAnchorHourRank:attachment];
2022-06-07 17:51:32 +08:00
} else if (attachment.first == CustomMessageType_Licnese_Hour_Rank && attachment.second == Custom_Message_Sub_Licnese_Hour_Rank) {///
[self receiveLicneseHourRank:attachment];
2022-08-05 15:38:21 +08:00
} else if (attachment.first == CustomMessageType_Gift_Compound && attachment.second == Custom_Message_Sub_Gift_Compound) {///
[self receiveGiftCompound:attachment];
2022-08-25 12:20:32 +08:00
} else if(attachment.first == CustomMessageType_Room_Sailing && (attachment.second == Custom_Message_Sub_Sailing_AllRoom_Notify || attachment.second == Custom_Message_Sub_Sailing_InRoom_NeedAllMicSend)) {
2022-08-19 17:42:14 +08:00
[self receiveRoomSailing:attachment];
2022-08-23 18:01:34 +08:00
} else if(attachment.first == CustomMessageType_Graffiti_Gift) {///
[self receiveRoomGraffitiGift:attachment];
2022-10-21 18:03:00 +08:00
} else if(attachment.first == CustomMessageType_Wish_Gift && attachment.second == Custom_Message_Sub_Wish_Gift_Gelebrate) {
[self receiveRoomWishGiftCelebrate:attachment];
2022-08-19 17:42:14 +08:00
}
2021-12-16 20:22:01 +08:00
}
}
2021-12-17 15:18:34 +08:00
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
if (content.eventType == NIMChatroomEventTypeEnter) {
NIMMessageChatroomExtension * messageExt = (NIMMessageChatroomExtension *)message.messageExt;
NSDictionary * dic = [(NSDictionary *)messageExt.roomExt.toJSONObject objectForKey:message.from];
XPMessageRemoteExtModel * extModel = [XPMessageRemoteExtModel modelWithJSON:dic];
2022-04-28 11:24:41 +08:00
if (extModel.enterHide) {//
2022-04-26 18:41:17 +08:00
if ([message.from isEqualToString:[AccountInfoStorage instance].getUid]) {
[self createEnterHideAnimation:dic];
}
return;
}
2021-12-17 15:18:34 +08:00
[self userEnterRoom:content ext:extModel];
}
}
2022-08-23 18:01:34 +08:00
#pragma mark -
- (void)receiveRoomGraffitiGift:(AttachmentModel *)attacment {
if (self.graffitiGiftQueue.count == 0) {
[self startGraffitiGiftAnimation:attacment];
}
[self.graffitiGiftQueue addObject:attacment];
}
- (void)startGraffitiGiftAnimation:(AttachmentModel *)model {
NSDictionary * dic = model.data;
NSNumber * giftId = dic[@"giftId"];
GiftInfoModel * giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftId.stringValue];
NSArray * array = dic[@"drawFixedArray"];
if (giftInfo.giftUrl.length > 0 && array.count > 0) {
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:giftInfo.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
if (error == nil && image) {
XPRoomGraffitiGiftAnimationView *graffitiView = [[XPRoomGraffitiGiftAnimationView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
graffitiView.giftImage = image;
graffitiView.delegate = self;
graffitiView.model = model;
graffitiView.pointArray = array;
[graffitiView beginDrawAnimation];
[self.highLevleView addSubview:graffitiView];
} else {
[self.graffitiGiftQueue removeObject:model];
if (self.graffitiGiftQueue.count > 0) {
[self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject];
}
}
}];
} else {
[self.graffitiGiftQueue removeObject:model];
if (self.graffitiGiftQueue.count > 0) {
[self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject];
}
}
}
- (void)xPRoomGraffitiGiftAnimationViewCompletion:(XPRoomGraffitiGiftAnimationView *)view attachment:(nonnull AttachmentModel *)attachment{
[view removeFromSuperview];
if ([self.graffitiGiftQueue containsObject:attachment]) {
[self.graffitiGiftQueue removeObject:attachment];
}
if (self.graffitiGiftQueue.count > 0) {
[self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject];
}
}
2022-01-12 17:44:40 +08:00
#pragma mark - PK
- (void)acrossRoomPKBannerAnimation:(AttachmentModel *)attacment {
AcrossRoomPKPrizeModel * prizeModel = [AcrossRoomPKPrizeModel modelWithJSON:attacment.data];
if (attacment.second == Custom_Message_Sub_AnchorPK_Result) {
prizeModel.pkType = 1;
} else {
prizeModel.pkType = 0;
}
2022-01-12 17:44:40 +08:00
[self.acrossRoomPKQueue addObject:prizeModel];
if (self.acrossRoomPKQueue.count > 0) {
[self startAcrossRoomPKAnimation:self.acrossRoomPKQueue.firstObject];
}
}
- (void)startAcrossRoomPKAnimation:(AcrossRoomPKPrizeModel *)model {
XPAcrossRoomPKPrizeView *wishEffectView = [[XPAcrossRoomPKPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight+40, KScreenWidth, 87)];
2022-01-12 17:44:40 +08:00
wishEffectView.data = model;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPkWinRoom:)];
[wishEffectView addGestureRecognizer:tap];
[self.highLevleView addSubview:wishEffectView];
2022-01-12 17:44:40 +08:00
[UIView animateWithDuration:0.5 animations:^{
wishEffectView.frame = CGRectMake(0, kNavigationHeight+40, KScreenWidth, 87);
2022-01-12 17:44:40 +08:00
} completion:^(BOOL finished) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.5 animations:^{
wishEffectView.hidden = YES;
} completion:^(BOOL finished) {
[wishEffectView removeFromSuperview];
[self.acrossRoomPKQueue removeObject:model];
if (self.acrossRoomPKQueue.count > 0) {
[self startAcrossRoomPKAnimation:self.acrossRoomPKQueue.firstObject];
}
}];
});
}];
}
- (void)gotoPkWinRoom:(UITapGestureRecognizer *)tap {
XPAcrossRoomPKPrizeView * view = (XPAcrossRoomPKPrizeView *)tap.view;
if (view.data.winUid.length > 0) {
2022-01-12 17:44:40 +08:00
[self.delegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:view.data.winUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
2022-01-12 17:44:40 +08:00
}
}
2022-01-05 21:48:21 +08:00
#pragma mark -
- (void)roomDatingPublicResult:(AttachmentModel *)attachment {
self.datingEffectQueue = [NSMutableArray array];
///
NSArray * results = [DatingInfoModel modelsWithArray:attachment.data[@"list"]];
[self.datingEffectQueue addObjectsFromArray:results];
if (self.datingEffectQueue.count > 0) {
[self startDatingAnimation:self.datingEffectQueue.firstObject];
}
}
- (void)startDatingAnimation:(DatingInfoModel *)datingModel {
[[NSNotificationCenter defaultCenter] postNotificationName:@"message" object:[self createRoomDatingResultMessage:datingModel]];
NSString * targetUid= [NSString stringWithFormat:@"%ld", datingModel.targetUid];
NSString * uid= [NSString stringWithFormat:@"%ld", datingModel.uid];
if (datingModel.hasHeart || datingModel.hasSelectUser) {
2022-01-13 18:45:17 +08:00
datingModel.originPoint = [self.delegate animationPointAtStageViewByUid:uid];
datingModel.targetPoint = [self.delegate animationPointAtStageViewByUid:targetUid];
2022-01-05 21:48:21 +08:00
}
XPRoomDatingAnimationView * datingView = [[XPRoomDatingAnimationView alloc] init];
[self.highLevleView addSubview:datingView];
[datingView startAnimationWithModel:datingModel finishBlock:^(BOOL finish) {
2022-01-06 10:47:52 +08:00
[datingView removeFromSuperview];
2022-01-05 21:48:21 +08:00
[self.datingEffectQueue removeObject:datingModel];
2022-01-06 10:47:52 +08:00
if (self.datingEffectQueue.count > 0) {
2022-01-05 21:48:21 +08:00
DatingInfoModel * datingModel = [self.datingEffectQueue firstObject];
[self startDatingAnimation:datingModel];
}
}];
}
- (NIMMessage *)createRoomDatingResultMessage:(DatingInfoModel *)datingModel {
NIMMessage * message = [[NIMMessage alloc] init];
NIMSession * session = [NIMSession session:[NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId] type:NIMSessionTypeChatroom];
[message setValue:session forKey:@"session"];
AttachmentModel * attach = [[AttachmentModel alloc] init];
attach.first = CustomMessageType_RoomPlay_Dating;
if (datingModel.hasHeart) {///
attach.second = Custom_Message_Sub_Room_Play_Dating_Result_Mutual;
} else {
attach.second = Custom_Message_Sub_Room_Play_Dating_Result_Not_Mutual;
}
attach.data = [datingModel model2dictionary];
NIMCustomObject * object = [[NIMCustomObject alloc] init];
object.attachment = attach;
message.messageObject = object;
return message;
}
2021-12-17 15:18:34 +08:00
#pragma mark - XXX
- (void)userEnterRoom:(NIMChatroomNotificationContent *)content ext:(XPMessageRemoteExtModel *)extModel {
if (extModel.experLevelSeq < 30) return;
NSString * title = [NSString stringWithFormat:@"【%@】进入了房间", content.source.nick];
2021-12-17 15:18:34 +08:00
if (self.enterEffectQueue.count ==0) {
2022-04-28 11:24:41 +08:00
[self playUserEnterRoomAnimation:title experLevelSeq:extModel.experLevelSeq effectPath:extModel.enterRoomEffects];
2021-12-17 15:18:34 +08:00
}
2022-04-28 11:24:41 +08:00
NSDictionary * dic= @{@"title":title, @"experLevelSeq":[NSString stringWithFormat:@"%ld", extModel.experLevelSeq], @"effectPath" : extModel.enterRoomEffects.length ? extModel.enterRoomEffects : @""};
2021-12-17 15:18:34 +08:00
[self.enterEffectQueue addObject:dic];
}
2022-04-28 11:24:41 +08:00
- (void)playUserEnterRoomAnimation:(NSString *)title experLevelSeq:(NSInteger)experLevelSeq effectPath:(NSString *)effectPath {
2021-12-17 15:18:34 +08:00
NSString * path;
if (experLevelSeq >= 30 && experLevelSeq <= 39) {
path = @"svga_member_in_lv30";
} else if (experLevelSeq >= 40 && experLevelSeq <= 49) {
path = @"svga_member_in_lv40";
} else if (experLevelSeq >= 50 && experLevelSeq <= 59) {
path = @"svga_member_in_lv50";
} else if (experLevelSeq >= 60 && experLevelSeq <= 69) {
path = @"svga_member_in_lv60";
2021-12-17 15:18:34 +08:00
} else if (experLevelSeq >= 70 && experLevelSeq <= 79) {
path = @"svga_member_in_lv70";
2021-12-17 15:18:34 +08:00
} else if (experLevelSeq >= 80 && experLevelSeq <= 89) {
path = @"svga_member_in_lv80";
2021-12-17 15:18:34 +08:00
} else {
path = @"svga_member_in_lv90";
2021-12-17 15:18:34 +08:00
}
if (self.enterEffectView.superview == nil) {
self.enterEffectView.frame = CGRectMake(KScreenWidth, 339 + kSafeAreaTopHeight, KScreenWidth, effectPath.length ? 75 : 40);
2021-12-17 15:18:34 +08:00
[self.lowLevelView addSubview:self.enterEffectView];
}
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:26], NSForegroundColorAttributeName:[UIColor whiteColor]}];
[attribute setYy_alignment:NSTextAlignmentLeft];
2022-04-28 11:24:41 +08:00
if (effectPath.length > 0) {
@kWeakify(self);
[self.parser parseWithURL:[NSURL URLWithString:effectPath] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.enterEffectView.loops = 1;
self.enterEffectView.hidden = NO;
self.enterEffectView.clearsAfterStop = NO;
self.enterEffectView.alpha = 1;
self.enterEffectView.videoItem = videoItem;
[self.enterEffectView setAttributedText:attribute forKey:@"room_text"];
[self.enterEffectView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
} else {
@kWeakify(self);
[self.parser parseWithNamed:path inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.enterEffectView.loops = 1;
self.enterEffectView.hidden = NO;
self.enterEffectView.clearsAfterStop = NO;
self.enterEffectView.alpha = 1;
self.enterEffectView.videoItem = videoItem;
[self.enterEffectView setAttributedText:attribute forKey:@"room_text"];
[self.enterEffectView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
}
2021-12-17 15:18:34 +08:00
[UIView animateWithDuration:0.5 animations:^{
self.enterEffectView.frame = CGRectMake(0, 339 + kSafeAreaTopHeight, KScreenWidth, effectPath.length ? 75 : 40);
2021-12-17 15:18:34 +08:00
} completion:^(BOOL finished) {
}];
}
2022-04-26 18:41:17 +08:00
///
- (void)createEnterHideAnimation:(NSDictionary *)dic {
XPRoomEnterHideTipView *enterHideTipView = [[XPRoomEnterHideTipView alloc] initWithFrame:CGRectMake(KScreenWidth, (KScreenHeight - 48) * 0.5, KScreenWidth, 48)];
[self.highLevleView addSubview:enterHideTipView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:enterHideTipView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(enterHideTipView.frame.size.width / 2, enterHideTipView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, enterHideTipView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, enterHideTipView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
[enterHideTipView removeFromSuperview];
}
}];
[enterHideTipView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[enterHideTipView pop_addAnimation:springAnimation forKey:@"roomEnterTipUpspingOutAnimation"];
}
2021-12-16 20:22:01 +08:00
#pragma mark -
- (void)receiveDriveCarEnterRoom:(AttachmentModel *)attatchment {
if (self.isLargeGiftAnimating) {return;}
2022-02-16 15:20:48 +08:00
if ([self isInSudGame]) {return;}
2021-12-25 18:34:54 +08:00
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
NSInteger otherViewType = [attatchment.data[@"otherViewType"] integerValue];
NSString *viewUrl = attatchment.data[@"viewUrl"];
2021-12-16 20:22:01 +08:00
NSString * effect = attatchment.data[@"effect"];
if (viewUrl.length) {
NSDictionary * dic = @{@"otherViewType":@(otherViewType), @"viewUrl":viewUrl};
if (self.carEffectQueue.count == 0) {
[self playCarEffect:dic];
}
[self.carEffectQueue addObject:dic];
} else if(effect.length) {
NSDictionary * dic = @{@"effect":effect};
if (self.carEffectQueue.count == 0) {
[self playCarEffect:dic];
}
[self.carEffectQueue addObject:dic];
}
2021-12-16 20:22:01 +08:00
}
2022-02-16 15:20:48 +08:00
- (void)playCarEffect:(NSDictionary *)effectDict {
NSString *viewUrl = [effectDict objectForKey:@"viewUrl"];
NSString *carEffect = [effectDict objectForKey:@"effect"];
if (viewUrl.length) {
2022-03-30 18:46:22 +08:00
self.carVapEffectView.hidden = NO;
if (self.carVapEffectView.superview == nil) {
[self.middleLevelView addSubview:self.carVapEffectView];
[self.carVapEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
}
[self.vapParser parseWithURL:viewUrl completionBlock:^(NSString * _Nullable videoUrl) {
if (videoUrl.length) {
2022-03-30 18:46:22 +08:00
[self.carVapEffectView setMute:YES];
[self.carVapEffectView playHWDMP4:videoUrl repeatCount:1 delegate:self];
}
} failureBlock:^(NSError * _Nullable error) {
}];
} else if (carEffect.length) {
if (self.carEffectView.superview == nil) {
[self.middleLevelView addSubview:self.carEffectView];
[self.carEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
}
[self.parser parseWithURL:[NSURL URLWithString:carEffect] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
if (videoItem != nil) {
CGFloat width = videoItem.videoSize.width;
CGFloat height = videoItem.videoSize.height;
if (width > height) {
2022-03-30 18:46:22 +08:00
self.carEffectView.contentMode = UIViewContentModeScaleAspectFit;
} else {//
CGFloat resizeH = KScreenWidth * height / width;//
if (resizeH > KScreenHeight) {//
2022-03-30 18:46:22 +08:00
self.carEffectView.contentMode = UIViewContentModeScaleAspectFill;
} else {//
2022-03-30 18:46:22 +08:00
self.carEffectView.contentMode = UIViewContentModeScaleAspectFit;
}
}
self.carEffectView.hidden = NO;
self.carEffectView.alpha = 1;
self.carEffectView.loops = 1;
self.carEffectView.clearsAfterStop = YES;
self.carEffectView.videoItem = videoItem;
[self.carEffectView startAnimation];
}
} failureBlock:^(NSError * _Nullable error) {
}];
}
}
#pragma mark -
- (void)receiveCandyTreeGiftHighLevle:(AttachmentModel *)attatchment {
2022-02-16 15:20:48 +08:00
if ([self isInSudGame]) {return;}
if (self.candyTreegiftQueue.count == 0) {
2022-03-11 16:53:55 +08:00
[self createCandyTreeBannerAnimation:attatchment];
}
2022-03-11 16:53:55 +08:00
[self.candyTreegiftQueue addObject:attatchment];
}
2022-03-11 16:53:55 +08:00
- (void)createCandyTreeBannerAnimation:(AttachmentModel *)attatchment {
XPRoomCandyGiftView *candyTreeView = [[XPRoomCandyGiftView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 45)];
2022-03-11 16:53:55 +08:00
candyTreeView.isMaxLargeGift = attatchment.second == Custom_Message_Sub_Candy_Tree_InRoom_NeedAllMicSend;
candyTreeView.candyInfo = attatchment.data;
[self.middleLevelView addSubview:candyTreeView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:candyTreeView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(candyTreeView.frame.size.width / 2, candyTreeView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
2021-12-11 12:00:24 +08:00
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, candyTreeView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, candyTreeView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[candyTreeView removeFromSuperview];
[self.candyTreegiftQueue removeObjectAtIndex:0];
if (self.candyTreegiftQueue.count > 0) {
[self createCandyTreeBannerAnimation:self.candyTreegiftQueue.firstObject];
}
}
}];
[candyTreeView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[candyTreeView pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"];
}
2022-08-19 17:42:14 +08:00
#pragma mark -
- (void)receiveRoomSailing:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
if (self.sailingQueue.count == 0) {
[self createSailingBannerAnimation:attachment];
}
[self.sailingQueue addObject:attachment];
}
- (void)createSailingBannerAnimation:(AttachmentModel *)attatchment {
CGFloat kscale = (CGFloat)60 / (CGFloat)375;
XPSailingAnimationView *sailingView = [[XPSailingAnimationView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, KScreenWidth * kscale)];
sailingView.prizeInfo = attatchment.data;
[self.middleLevelView addSubview:sailingView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:sailingView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(sailingView.frame.size.width / 2, sailingView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, sailingView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, sailingView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[sailingView removeFromSuperview];
[self.sailingQueue removeObjectAtIndex:0];
if (self.sailingQueue.count > 0) {
[self createSailingBannerAnimation:self.sailingQueue.firstObject];
}
}
}];
[sailingView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[sailingView pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"];
}
#pragma mark -
- (void)receiveNobleLevelUp:(AttachmentModel *)attachment {
if (self.nobleLevelUpQueue.count == 0) {
[self createNobleLevelUpBannerAnimation:attachment.data];
}
[self.nobleLevelUpQueue addObject:attachment.data];
}
- (void)createNobleLevelUpBannerAnimation:(NSDictionary *)dic {
XPRoomNobleLevelUpView *nobleLevelUpView = [[XPRoomNobleLevelUpView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 90)];
nobleLevelUpView.nobleInfo = dic;
[self.highLevleView addSubview:nobleLevelUpView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:nobleLevelUpView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(nobleLevelUpView.frame.size.width / 2, nobleLevelUpView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, nobleLevelUpView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, nobleLevelUpView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[nobleLevelUpView removeFromSuperview];
[self.nobleLevelUpQueue removeObjectAtIndex:0];
if (self.nobleLevelUpQueue.count > 0) {
[self createNobleLevelUpBannerAnimation:self.nobleLevelUpQueue.firstObject];
}
}
}];
[nobleLevelUpView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[nobleLevelUpView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"];
}
2022-08-05 15:38:21 +08:00
#pragma mark -
- (void)receiveGiftCompound:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
if (self.compoundGiftQueue.count == 0) {
[self createGiftCompoundBannerAnimation:attachment];
}
[self.compoundGiftQueue addObject:attachment];
}
- (void)createGiftCompoundBannerAnimation:(AttachmentModel *)attachment {
XPRoomGiftCompoundView *compoundGiftView = [[XPRoomGiftCompoundView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 45)];
compoundGiftView.compoundGiftInfo = attachment.data;
[self.middleLevelView addSubview:compoundGiftView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:compoundGiftView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(compoundGiftView.frame.size.width / 2, compoundGiftView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, compoundGiftView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, compoundGiftView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[compoundGiftView removeFromSuperview];
[self.compoundGiftQueue removeObjectAtIndex:0];
if (self.compoundGiftQueue.count > 0) {
[self createGiftCompoundBannerAnimation:self.compoundGiftQueue.firstObject];
}
}
}];
[compoundGiftView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[compoundGiftView pop_addAnimation:springAnimation forKey:@"compoundGiftSpingOutAnimation"];
}
2022-06-13 19:07:07 +08:00
#pragma mark -
2022-06-07 17:51:32 +08:00
- (void)receiveLicneseHourRank:(AttachmentModel *)attachment {
2022-06-13 19:07:07 +08:00
XPRoomLicneseHourRankView *anchorRankView = [[XPRoomLicneseHourRankView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, 375, 60)];
anchorRankView.delegate = self;
2022-06-07 17:51:32 +08:00
anchorRankView.licneseRankInfo = [RoomHalfHourRankModel modelWithDictionary:attachment.data];
[self.highLevleView addSubview:anchorRankView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:anchorRankView.center];
2022-06-13 19:07:07 +08:00
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, anchorRankView.center.y)];
2022-06-07 17:51:32 +08:00
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
2022-06-13 19:07:07 +08:00
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, anchorRankView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth, anchorRankView.center.y)];
2022-06-07 17:51:32 +08:00
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
2022-06-13 19:07:07 +08:00
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
[anchorRankView removeFromSuperview];
}];
2022-06-07 17:51:32 +08:00
[anchorRankView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[anchorRankView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"];
2022-04-15 14:49:04 +08:00
}
- (void)xPRoomLicneseHourRankView:(XPRoomLicneseHourRankView *)view rankInfo:(RoomHalfHourRankModel *)rankInfo {
2022-06-21 17:25:18 +08:00
if (rankInfo.uid.integerValue > 0 && self.delegate.getRoomInfo.uid != rankInfo.uid.integerValue) {
2022-06-07 17:51:32 +08:00
[self.delegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:rankInfo.uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
2022-06-07 17:51:32 +08:00
});
}
}
#pragma mark -
- (void)receiveAnchorHourRank:(AttachmentModel *)attachment {
XPRoomAnchorRankBannerView *anchorRankView = [[XPRoomAnchorRankBannerView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 60)];
anchorRankView.anchorRankInfo = [RoomHalfHourRankModel modelWithDictionary:attachment.data];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoTopRankAnchorRoom:)];
[anchorRankView addGestureRecognizer:tap];
[self.highLevleView addSubview:anchorRankView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:anchorRankView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(anchorRankView.frame.size.width / 2, anchorRankView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, anchorRankView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, anchorRankView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
[anchorRankView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[anchorRankView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"];
2022-04-15 14:49:04 +08:00
}
- (void)gotoTopRankAnchorRoom:(UITapGestureRecognizer *)tap {
XPRoomAnchorRankBannerView * view = (XPRoomAnchorRankBannerView *)tap.view;
2022-06-07 17:51:32 +08:00
if (view.anchorRankInfo.uid.integerValue > 0) {
[self.delegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
2022-06-07 17:51:32 +08:00
[XPRoomViewController openRoom:view.anchorRankInfo.uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
}
2022-04-11 11:50:25 +08:00
#pragma mark -
- (void)receiveFansTeamGiftHandleSendGiftAnimation:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
GiftReceiveInfoModel *receiveInfo = [[GiftReceiveInfoModel alloc] init];
GiftInfoModel *gift = [GiftInfoModel modelWithJSON:attachment.data[@"giftVo"]];
receiveInfo.gift = gift;
receiveInfo.giftInfo = gift;
receiveInfo.targetUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
2022-04-11 11:50:25 +08:00
GiftInfoModel * giftInfo = receiveInfo.gift ? receiveInfo.gift : receiveInfo.giftInfo;
if (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend) {
NSString * giftId = [NSString stringWithFormat:@"%ld", receiveInfo.luckyGiftList.giftList.firstObject.giftId];
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftId];
}
if (giftInfo == nil) {
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:receiveInfo.giftId];
}
/// 使
receiveInfo.gift = giftInfo;
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend);
[self.giftQueue addObject:receiveInfo];
if (self.giftTimer == nil && self.giftQueue > 0) {
[self startGiftQueueTimer];
}
}
#pragma mark -
- (void)receiveGiftHandleSendGiftAnimation:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
2021-12-25 18:34:54 +08:00
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
GiftInfoModel * giftInfo = receiveInfo.gift ? receiveInfo.gift : receiveInfo.giftInfo;
if (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend) {
NSString * giftId = [NSString stringWithFormat:@"%ld", receiveInfo.luckyGiftList.giftList.firstObject.giftId];
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftId];
}
if (giftInfo == nil) {
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:receiveInfo.giftId];
}
/// 使
receiveInfo.gift = giftInfo;
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend);
[self.giftQueue addObject:receiveInfo];
if (self.giftTimer == nil && self.giftQueue > 0) {
[self startGiftQueueTimer];
}
}
//
- (void)startGiftQueueTimer {
NSTimeInterval period = 0.5; //
dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
dispatch_source_set_timer(_timer, DISPATCH_TIME_NOW, period * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(_timer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
if (self.giftQueue.count) {
GiftReceiveInfoModel * receiveInfo = self.giftQueue.firstObject;
[self handoutGiftDistributeAnimation:receiveInfo];
[self.giftQueue removeObject:receiveInfo];
}else {
dispatch_source_cancel(_timer);
self.giftTimer = nil;
}
});
});
dispatch_resume(_timer);
self.giftTimer = _timer;
}
///
- (void)handoutGiftDistributeAnimation:(GiftReceiveInfoModel *)receiveInfo {
GiftInfoModel * giftInfo = receiveInfo.gift;
NSString * sendUid = receiveInfo.uid;
CGPoint starPoint = [self getGiftAnimationPoint:sendUid isEnd:NO];
CGPoint endPoint;
NSArray * targetUids;
if (receiveInfo.isLuckyBagGift) {
targetUids = @[receiveInfo.targetUid];
} else {
targetUids = receiveInfo.targetUids;
if (targetUids.count <= 0) {
targetUids = [receiveInfo.targetUsers valueForKeyPath:@"uid"];
if (targetUids.count <=0) {
targetUids = @[receiveInfo.targetUid];
}
}
}
for (NSString *targetUid in targetUids) {
NSString * userId = targetUid;
if ([userId isKindOfClass:[NSNumber class]]) {
userId = ((NSNumber *)userId).stringValue;
}
endPoint = [self getGiftAnimationPoint:userId isEnd:YES];
dispatch_time_t timer = dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC);
dispatch_after(timer, dispatch_get_main_queue(), ^{
[self beginGiftAnimation:giftInfo.giftUrl startPoint:starPoint endPoint:endPoint];
});
}
}
///
- (CGPoint)getGiftAnimationPoint:(NSString *)uid isEnd:(BOOL)isEnd{
2022-01-13 18:45:17 +08:00
CGPoint point = [self.delegate animationPointAtStageViewByUid:uid];
//
if (point.x <= 0 || point.y <= 0) {
if (isEnd) {
point = CGPointMake([UIScreen mainScreen].bounds.size.width /2 + 30, 44 + kSafeAreaTopHeight);
} else {
point = CGPointMake([UIScreen mainScreen].bounds.size.width / 2, 44 + kSafeAreaTopHeight);
}
}
return point;
}
- (void)beginGiftAnimation:(NSString *)giftUrl startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
NetImageView * giftImageView = [self.giftReuseArray anyObject];
if (giftImageView == nil) {
giftImageView = [[NetImageView alloc]initWithFrame:CGRectMake(0, 0 , 55, 55)];
giftImageView.center = startPoint;
giftImageView.alpha = 1;
giftImageView.layer.anchorPoint = CGPointMake(0.5, 0.5);
giftImageView.imageUrl = giftUrl;
[self.giftVisibleArray addObject:giftImageView];
}else {
[self.giftReuseArray removeObject:giftImageView];
}
giftImageView.hidden = NO;
giftImageView.imageUrl = giftUrl;
[self.lowLevelView addSubview:giftImageView];
CAAnimationGroup *group = [self createGiftAnimationStartPoint:startPoint endPoint:endPoint];
[giftImageView.layer addAnimation:group forKey:@"giftDisplayViewAnimation"];
[self performSelector:@selector(aniationDidFinish:) withObject:giftImageView afterDelay:(3.2+0.25)];
}
///
/// @param startPoint
/// @param endPoint
- (CAAnimationGroup *)createGiftAnimationStartPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint{
CGPoint centerPoint = CGPointMake(KScreenWidth / 2, KScreenHeight / 2);
CAKeyframeAnimation *animation0 = [CAKeyframeAnimation animation];
animation0.duration = 0.8;
animation0.keyPath = @"transform.scale";
animation0.values = @[@1.0,@1.5,@2.0,@1.5];
animation0.repeatCount = 1;
animation0.calculationMode = kCAAnimationCubic;
animation0.removedOnCompletion = NO;
animation0.fillMode = kCAFillModeForwards;
CAKeyframeAnimation *animation1 = [CAKeyframeAnimation animation];
animation1.duration = 0.8;
animation1.beginTime = 0.8;
animation1.keyPath = @"transform.scale";
animation1.values = @[@1.5,@2.0,@2.5,@3.0];
animation1.repeatCount = 1;
animation1.calculationMode = kCAAnimationCubic;
animation1.removedOnCompletion = NO;
animation1.fillMode = kCAFillModeForwards;
CAKeyframeAnimation *animation2 = [CAKeyframeAnimation animation];
animation2.duration = 0.8;
animation2.beginTime = 0.8;
animation2.keyPath = @"position";
animation2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];;
animation2.values = @[[NSValue valueWithCGPoint:startPoint],[NSValue valueWithCGPoint:CGPointMake(centerPoint.x ,centerPoint.y)]];
animation2.repeatCount = 1;
animation2.removedOnCompletion = NO;
animation2.fillMode = kCAFillModeForwards;
CAKeyframeAnimation *animation3 = [CAKeyframeAnimation animation];
animation3.duration = 0.8;
animation3.beginTime = 2.6;//0.8+0.8+1
animation3.keyPath = @"transform.scale";
animation3.values = @[@3,@2.5,@2,@1.5,@1];
animation3.repeatCount = 1;
CAKeyframeAnimation *animation4 = [CAKeyframeAnimation animation];
animation4.duration = 0.8;
animation4.beginTime = 2.6;
animation4.keyPath = @"position";
animation4.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
animation4.values = @[[NSValue valueWithCGPoint:CGPointMake(centerPoint.x ,centerPoint.y)],[NSValue valueWithCGPoint:endPoint]];
animation4.repeatCount = 1;
CAAnimationGroup *group = [CAAnimationGroup animation];
group.duration = 3.2;
group.animations = @[animation0,animation1,animation2, animation3,animation4];
group.repeatCount = 1;
group.removedOnCompletion = NO;
group.fillMode = kCAFillModeForwards;
return group;
}
- (void)aniationDidFinish:(NetImageView *)giftImageView{
[giftImageView removeFromSuperview];
giftImageView.image = nil;
giftImageView.hidden = YES;
[self.giftVisibleArray removeObject:giftImageView];
[self.giftReuseArray addObject:giftImageView];
}
#pragma mark -
- (void)receiveBroadcastGift:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
XPRoomGiftBroadCastModel *giftNotifyInfo = [XPRoomGiftBroadCastModel modelWithJSON:attachment.data];
if (self.giftBroadcastQueue.count == 0) {
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
}
[self.giftBroadcastQueue addObject:giftNotifyInfo];
}
- (void)createGiftBroadcastViewAnimation:(XPRoomGiftBroadCastModel *)giftModel {
XPRoomGiftBroadcastView * view = [[XPRoomGiftBroadcastView alloc] init];
view.delegate = self;
view.frame = CGRectMake(KScreenWidth, 35 + statusbarHeight, KScreenWidth, 150);
view.broadcastModel = giftModel;
[self.highLevleView addSubview:view];
[self beginGiftBraodcastViewAnimation:view notifyStaySecond:giftModel.notifyStaySecond];
}
- (void)beginGiftBraodcastViewAnimation:(XPRoomGiftBroadcastView *)view notifyStaySecond:(int)notifyStaySecond{
CGFloat startTime = notifyStaySecond > 0 ? notifyStaySecond : 3.0;
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(0 + view.frame.size.width / 2, view.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
[self removeGiftBroadcastOutAnimation:view stayTime:startTime];
}
}];
[view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
}
- (void)removeGiftBroadcastOutAnimation:(XPRoomGiftBroadcastView *)view stayTime:(CGFloat)stayTime{
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, view.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + stayTime;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[view removeFromSuperview];
[self.giftBroadcastQueue removeObjectAtIndex:0];
if (self.giftBroadcastQueue.count > 0) {
[self createGiftBroadcastViewAnimation:self.giftBroadcastQueue.firstObject];
}
}
}];
[view pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
#pragma mark - XPRoomGiftBroadcastViewDelegate
- (void)xPRoomGiftBroadcastView:(XPRoomGiftBroadcastView *)view enterRoom:(NSString *)roomUid {
if (roomUid.length > 0 && self.delegate.getRoomInfo.uid != roomUid.integerValue) {
[self.delegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
}
- (void)xPRoomGiftBroadcastView:(XPRoomGiftBroadcastView *)view didClickClose:(XPRoomGiftBroadCastModel *)broadcastModel {
[view removeFromSuperview];
[view pop_removeAllAnimations];
if ([self.giftBroadcastQueue containsObject:broadcastModel]) {
[self.giftBroadcastQueue removeObject:broadcastModel];
}
if (self.giftBroadcastQueue.count > 0) {
[self createGiftBroadcastViewAnimation:self.giftBroadcastQueue.firstObject];
}
}
#pragma mark -
- (void)receiveLuckyGiftBigPrize:(AttachmentModel *)attachment {
2022-02-16 15:20:48 +08:00
if ([self isInSudGame]) {return;}
if (attachment.second == Custom_Message_Sub_Room_Gift_LuckBag || attachment.second == Custom_Message_Sub_Room_Gift_LuckBag_Server) {
2022-06-15 14:20:09 +08:00
XPGiftBigPrizeModel * prizeModel = [XPGiftBigPrizeModel modelWithDictionary:attachment.data];
prizeModel.isInRoomVisiable = attachment.second == Custom_Message_Sub_Room_Gift_LuckBag;
[self.bigPrizeGiftQueue addObject:prizeModel];
if (self.luckyprizeTimer == nil) {
[self startHandleBigPrizeGiftTimer];
}
}
}
- (void)startHandleBigPrizeGiftTimer {
NSTimeInterval period = 1.0; //
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), period * NSEC_PER_SEC, 0); //
@kWeakify(self);
dispatch_source_set_event_handler(_timer, ^{
@kStrongify(self)
if (self.bigPrizeGiftQueue.count > 0) {
dispatch_sync(dispatch_get_main_queue(), ^{
2022-06-15 14:20:09 +08:00
if (self.isLuckyGiftAnimation) {
return;
}
XPGiftBigPrizeModel * prizeModel = [self.bigPrizeGiftQueue firstObject];
[self createBigPrizeAnimation:prizeModel];
[self.bigPrizeGiftQueue removeObject:prizeModel];
});
}else {
dispatch_source_cancel(_timer);
self.luckyprizeTimer = nil;
}
});
dispatch_resume(_timer);
self.luckyprizeTimer = _timer;
}
- (void)createBigPrizeAnimation:(XPGiftBigPrizeModel *)prizeModel {
2022-06-15 14:20:09 +08:00
self.isLuckyGiftAnimation = YES;
XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] init];
luckyGiftEffectView.delegate = self;
[self.highLevleView addSubview:luckyGiftEffectView];
[luckyGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self).offset(kNavigationHeight + 15);
make.size.mas_equalTo(CGSizeMake(375, 60));
}];
2022-06-15 14:20:09 +08:00
luckyGiftEffectView.giftInfo = prizeModel;
[self performSelector:@selector(LuckyBigPrizeAnimationFinish:) withObject:luckyGiftEffectView afterDelay:6];
}
2022-06-15 14:20:09 +08:00
- (void)LuckyBigPrizeAnimationFinish:(XPRoomLuckyBigPrizeView *)player {
[player removeFromSuperview];
player.hidden = YES;
self.isLuckyGiftAnimation = NO;
}
2022-06-15 14:20:09 +08:00
#pragma mark - XPRoomLuckyBigPrizeViewDelegate
- (void)xPRoomLuckyBigPrizeView:(XPRoomLuckyBigPrizeView *)view luckyGiftInfo:(XPGiftBigPrizeModel *)giftInfo {
if (!giftInfo.isInRoomVisiable && giftInfo.roomUid.length > 0 && giftInfo.roomUid.integerValue != self.delegate.getRoomInfo.uid) {
[self.delegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:giftInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
}
#pragma mark -
///
- (void)receiveGift:(GiftReceiveInfoModel *)receiveInfo {
if ([self isInSudGame]) {return;}
///CPU
RoomInfoModel * roomInfor = [self.delegate getRoomInfo];
if (receiveInfo.isLuckyBagGift) {
if (receiveInfo.isShowAnimation) {
// SVGA
if (receiveInfo.displayGift.count > 0) {
[receiveInfo.displayGift enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.otherViewType == GiftOtherViewTypeMp4 && obj.viewUrl && obj.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
model.viewUrl = obj.viewUrl;
[self.giftEffectQueue addObject:model];
} else if (obj.hasVggPic && roomInfor.hasAnimationEffect) {
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
model.vggUrl = obj.vggUrl;
[self.giftEffectQueue addObject:model];
}
}];
}
} else {
}
} else {
GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
if (!giftInfo) {
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId];
}
///
if (giftInfo) {
receiveInfo.gift = giftInfo;
}
if (receiveInfo.targetUsers.count > 0 && receiveInfo.targetUids.count <= 0) {
receiveInfo.targetUids = [receiveInfo.targetUsers valueForKeyPath:@"uid"];
}
NSInteger giftTotal = 0;
if (receiveInfo.targetUids.count > 0) {
giftTotal = receiveInfo.giftNum * giftInfo.goldPrice * receiveInfo.targetUids.count;
} else {
giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
}
///
if (giftTotal >= 520) {
///
2022-03-18 15:18:50 +08:00
receiveInfo.vggUrl = giftInfo.vggUrl;
receiveInfo.viewUrl = giftInfo.viewUrl;
[self.giftEffectQueue addObject:receiveInfo];
} else {
2022-03-18 15:18:50 +08:00
if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
receiveInfo.viewUrl = giftInfo.viewUrl;
[self.giftEffectQueue addObject:receiveInfo];
} else if (giftInfo.hasVggPic && roomInfor.hasAnimationEffect) {///SVGA
receiveInfo.vggUrl = giftInfo.vggUrl;
[self.giftEffectQueue addObject:receiveInfo];
}
}
}
if (self.giftEffectTimer == nil && self.giftEffectQueue.count > 0) {
[self startHandleGiftEffectTimer];
}
}
///
- (void)startHandleGiftEffectTimer {
NSTimeInterval period = 6.0; // 6 1svga 2.svga 3
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), period * NSEC_PER_SEC, 0); //
@kWeakify(self);
dispatch_source_set_event_handler(_timer, ^{
@kStrongify(self)
if (self.giftEffectQueue.count > 0) {
dispatch_sync(dispatch_get_main_queue(), ^{
GiftReceiveInfoModel * receiveModel = [self.giftEffectQueue firstObject];
[self createGiftBannerViewAnimation:receiveModel];
[self.giftEffectQueue removeObject:receiveModel];
});
}else {
dispatch_source_cancel(_timer);
self.giftEffectTimer = nil;
}
});
dispatch_resume(_timer);
self.giftEffectTimer = _timer;
}
- (void)createGiftBannerViewAnimation:(GiftReceiveInfoModel *)receiveInfo {
GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
if (!giftInfo) {
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId];
}
NSInteger giftTotal = 0;
if (receiveInfo.targetUids.count > 0) {
giftTotal = receiveInfo.giftNum * giftInfo.goldPrice * receiveInfo.targetUids.count;
} else {
giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
}
if (giftTotal >= 520) {
__block XPRoomGiftBannerView *view = [self.bannerDequePool anyObject];
if (view == nil) {
view = [[XPRoomGiftBannerView alloc] init];
[self.bannerVisiablePool addObject:view];
}else{
[self.bannerDequePool removeObject:view];
}
[self removeGiftBannerView:view];
[view configGiftBanner:receiveInfo users:[self makeBannerUsers]];
view.frame = CGRectMake(KScreenWidth, 100, KScreenWidth, 153);
[self.lowLevelView addSubview:view];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(view.frame.size.width / 2, view.center.y)];
@kWeakify(self);
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[self removeAnimation:view];
}
}];
[springAnimation setAnimationDidStartBlock:^(POPAnimation *anim) {
@kStrongify(self);
2022-03-18 15:18:50 +08:00
if (giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
[self largeGiftStopCarEffect:giftInfo.goldPrice];
2022-03-18 15:18:50 +08:00
[self playGiftEffectWithVapUrl:giftInfo.viewUrl];
} else if (giftInfo.hasVggPic && [self.delegate getRoomInfo].hasAnimationEffect) {
[self largeGiftStopCarEffect:giftInfo.goldPrice];
[self playGiftEffect:giftInfo.vggUrl];
}
}];
[view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
} else {
2022-03-18 15:18:50 +08:00
if (receiveInfo.viewUrl.length > 0) {//vap
[self largeGiftStopCarEffect:giftInfo.goldPrice];
2022-03-18 15:18:50 +08:00
[self playGiftEffectWithVapUrl:receiveInfo.viewUrl];
} else if (receiveInfo.vggUrl.length > 0) {///
[self largeGiftStopCarEffect:giftInfo.goldPrice];
[self playGiftEffect:receiveInfo.vggUrl];
}
}
}
- (void)largeGiftStopCarEffect:(double)goldPrice {
if ([ClientConfig shareConfig].configInfo.hideCarEffectGiftPrice <= goldPrice) {
self.isLargeGiftAnimating = YES;
[self.carEffectView stopAnimation];
[self.carVapEffectView stopHWDMP4];
[self.carEffectQueue removeAllObjects];
}
}
//
- (void)removeAnimation:(XPRoomGiftBannerView *)view{
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(view.center.x - KScreenWidth, view.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() +5;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
[view pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
- (NSArray<XPGiftBannerUserInfoModel *> *)makeBannerUsers {
NSArray<MicroQueueModel *> * microArray = [self.delegate getMicroQueue].allValues;
NSMutableArray * array = [NSMutableArray array];
[microArray enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
XPGiftBannerUserInfoModel * bannserUser = [[XPGiftBannerUserInfoModel alloc] init];
bannserUser.position = obj.microState.position;
bannserUser.uid = obj.userInfo.uid;
[array addObject:bannserUser];
}];
return array;
}
/// SVGA
- (void)playGiftEffect:(NSString *)vggUrl {
2022-02-16 15:20:48 +08:00
if ([self isInSudGame]) {return;}
self.giftEffectView.hidden = NO;
if (self.giftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.giftEffectView];
[self.giftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
2021-12-16 20:22:01 +08:00
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
}
[self.parser parseWithURL:[NSURL URLWithString:vggUrl] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
if (videoItem != nil) {
CGFloat width = videoItem.videoSize.width;
CGFloat height = videoItem.videoSize.height;
if (width > height) {
self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit;
} else {//
CGFloat resizeH = KScreenWidth * height / width;//
if (resizeH > KScreenHeight) {//
self.giftEffectView.contentMode = UIViewContentModeScaleAspectFill;
} else {//
self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit;
}
}
self.giftEffectView.alpha = 1;
self.giftEffectView.loops = 1;
self.giftEffectView.clearsAfterStop = YES;
self.giftEffectView.videoItem = videoItem;
[self.giftEffectView startAnimation];
}
} failureBlock:^(NSError * _Nullable error) {
}];
}
2022-03-18 15:18:50 +08:00
/// vap
- (void)playGiftEffectWithVapUrl:(NSString *)vapUrl {
2022-03-30 18:46:22 +08:00
self.vapGiftEffectView.hidden = NO;
if (self.vapGiftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.vapGiftEffectView];
[self.vapGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
2022-03-18 15:18:50 +08:00
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
}
[self.vapParser parseWithURL:vapUrl completionBlock:^(NSString * _Nullable videoUrl) {
if (videoUrl.length) {
2022-03-30 18:46:22 +08:00
[self.vapGiftEffectView setMute:YES];
[self.vapGiftEffectView playHWDMP4:videoUrl repeatCount:1 delegate:self];
2022-03-18 15:18:50 +08:00
}
} failureBlock:^(NSError * _Nullable error) {
}];
}
/// SVGA
- (void)playLuckyGiftEffect:(NSURL *)vggUrl {
if ([self isInSudGame]) {return;}
self.luckyGiftEffectView.hidden = NO;
if (self.luckyGiftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.luckyGiftEffectView];
[self.luckyGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
}
[self.parser parseWithURL:vggUrl completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
if (videoItem != nil) {
CGFloat width = videoItem.videoSize.width;
CGFloat height = videoItem.videoSize.height;
if (width > height) {
self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFit;
} else {//
CGFloat resizeH = KScreenWidth * height / width;//
if (resizeH > KScreenHeight) {//
self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFill;
} else {//
self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFit;
}
}
self.luckyGiftEffectView.alpha = 1;
self.luckyGiftEffectView.loops = 1;
self.luckyGiftEffectView.clearsAfterStop = YES;
self.luckyGiftEffectView.videoItem = videoItem;
[self.luckyGiftEffectView startAnimation];
}
} failureBlock:^(NSError * _Nullable error) {
}];
}
/// vap
- (void)playLuckyGiftEffectWithVapUrl:(NSString *)vapUrl {
self.luckyVapGiftEffectView.hidden = NO;
if (self.luckyVapGiftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.luckyVapGiftEffectView];
[self.luckyVapGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
}
[self.vapParser parseWithURL:vapUrl completionBlock:^(NSString * _Nullable videoUrl) {
if (videoUrl.length) {
[self.luckyVapGiftEffectView setMute:YES];
[self.luckyVapGiftEffectView playHWDMP4:videoUrl repeatCount:1 delegate:self];
}
} failureBlock:^(NSError * _Nullable error) {
}];
}
2022-03-18 15:18:50 +08:00
///veiw
- (void)removeGiftBannerView:(XPRoomGiftBannerView *)view {
[view removeFromSuperview];
[view resetData];
[self.bannerVisiablePool removeObject:view];
[self.bannerDequePool addObject:view];
///svga
[self.giftEffectView stopAnimation];
self.giftEffectView.hidden = YES;
}
#pragma mark -
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
if (player == self.giftEffectView) {
self.giftEffectView.hidden = YES;
if (self.isLargeGiftAnimating) {
self.isLargeGiftAnimating = NO;
}
} else if (player == self.luckyGiftEffectView) {
self.luckyGiftEffectView.hidden = YES;
} else if(player == self.carEffectView) {
2021-12-17 15:18:34 +08:00
self.carEffectView.hidden = YES;
[self.carEffectView removeFromSuperview];
if (self.carEffectQueue.count > 0) {
[self.carEffectQueue removeObjectAtIndex:0];
}
2021-12-16 20:22:01 +08:00
if (self.carEffectQueue.count > 0) {
[self playCarEffect:self.carEffectQueue.firstObject];
2021-12-17 15:18:34 +08:00
}
} else if(player == self.enterEffectView) {
self.enterEffectView.hidden = YES;
[self.enterEffectView removeFromSuperview];
[self.enterEffectQueue removeObjectAtIndex:0];
if (self.enterEffectQueue.count > 0) {
NSString * title = [self.enterEffectQueue.firstObject objectForKey:@"title"];
NSInteger experLevelSeq = [(NSString *)[self.enterEffectQueue.firstObject objectForKey:@"experLevelSeq"] integerValue];
NSString *effectPath = [self.enterEffectQueue.firstObject objectForKey:@"effectPath"];
2022-04-28 11:24:41 +08:00
[self playUserEnterRoomAnimation:title experLevelSeq:experLevelSeq effectPath:effectPath];
2021-12-16 20:22:01 +08:00
}
}
}
2022-10-21 18:03:00 +08:00
#pragma mark -
- (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment {
if (self.wishGiftEffectView.superview == nil) {
[self.lowLevelView addSubview:self.wishGiftEffectView];
CGFloat x = random() % 300;
CGFloat y= random() % 20 + kNavigationHeight;
[self.wishGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(x);
make.top.mas_equalTo(y);
make.width.mas_equalTo(200);
make.height.mas_equalTo(167);
}];
}
[self.parser parseWithNamed:@"room_wish_gift_sendCelebrate" inBundle:NSBundle.mainBundle completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
self.wishGiftEffectView.alpha = 1;
self.wishGiftEffectView.loops = 1;
self.wishGiftEffectView.clearsAfterStop = YES;
self.wishGiftEffectView.videoItem = videoItem;
[self.wishGiftEffectView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
}
2022-03-30 18:46:22 +08:00
#pragma mark - HWDMP4PlayDelegate
//truefalse
- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config {
CGFloat width = config.info.size.width;
CGFloat height = config.info.size.height;
container.center = self.center;
[container mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenWidth * height / width);
}];
2022-03-18 15:18:50 +08:00
return YES;
}
2022-03-30 18:46:22 +08:00
- (void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container {
2022-03-18 15:18:50 +08:00
dispatch_async(dispatch_get_main_queue(), ^{
container.hidden = YES;
2022-03-30 18:46:22 +08:00
if (container == self.carVapEffectView) {
[self.carVapEffectView removeFromSuperview];
self.carVapEffectView = nil;
if (self.carEffectQueue.count > 0) {
[self.carEffectQueue removeObjectAtIndex:0];
}
if (self.carEffectQueue.count > 0) {
[self playCarEffect:self.carEffectQueue.firstObject];
}
2022-03-30 18:46:22 +08:00
} else if (container == self.vapGiftEffectView) {
if (self.isLargeGiftAnimating) {
self.isLargeGiftAnimating = NO;
}
2022-03-30 18:46:22 +08:00
[self.vapGiftEffectView removeFromSuperview];
self.vapGiftEffectView = nil;
} else if(container == self.luckyVapGiftEffectView) {
[self.luckyVapGiftEffectView removeFromSuperview];
self.luckyVapGiftEffectView = nil;
}
2022-03-18 15:18:50 +08:00
});
}
- (void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container {
dispatch_async(dispatch_get_main_queue(), ^{
container.hidden = YES;
if (container == self.carVapEffectView) {
[self.carVapEffectView removeFromSuperview];
self.carVapEffectView = nil;
[self.carEffectQueue removeObjectAtIndex:0];
if (self.carEffectQueue.count > 0) {
[self playCarEffect:self.carEffectQueue.firstObject];
}
} else if (container == self.vapGiftEffectView) {
[self.vapGiftEffectView removeFromSuperview];
self.vapGiftEffectView = nil;
} else if(container == self.luckyVapGiftEffectView) {
[self.luckyVapGiftEffectView removeFromSuperview];
self.luckyVapGiftEffectView = nil;
}
});
2022-03-30 18:46:22 +08:00
}
#pragma mark - Getters And Setters
- (SVGAImageView *)giftEffectView {
if (!_giftEffectView) {
_giftEffectView = [[SVGAImageView alloc]init];
_giftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
_giftEffectView.userInteractionEnabled = NO;
_giftEffectView.delegate = self;
_giftEffectView.hidden = YES;
}
return _giftEffectView;
}
2022-03-30 18:46:22 +08:00
- (VAPView *)vapGiftEffectView {
if (!_vapGiftEffectView) {
_vapGiftEffectView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
_vapGiftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
_vapGiftEffectView.contentMode = UIViewContentModeScaleAspectFill;
_vapGiftEffectView.hidden = YES;
2022-03-18 15:18:50 +08:00
}
2022-03-30 18:46:22 +08:00
return _vapGiftEffectView;
2022-03-18 15:18:50 +08:00
}
- (SVGAImageView *)luckyGiftEffectView {
if (!_luckyGiftEffectView) {
_luckyGiftEffectView = [[SVGAImageView alloc]init];
_luckyGiftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
_luckyGiftEffectView.userInteractionEnabled = NO;
_luckyGiftEffectView.delegate = self;
_luckyGiftEffectView.hidden = YES;
}
return _luckyGiftEffectView;
}
- (VAPView *)luckyVapGiftEffectView {
if (!_luckyVapGiftEffectView) {
_luckyVapGiftEffectView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
_luckyVapGiftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
_luckyVapGiftEffectView.contentMode = UIViewContentModeScaleAspectFill;
_luckyVapGiftEffectView.hidden = YES;
}
return _luckyVapGiftEffectView;
}
2022-03-30 18:46:22 +08:00
- (VAPView *)carVapEffectView {
if (!_carVapEffectView) {
_carVapEffectView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
_carVapEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
_carVapEffectView.contentMode = UIViewContentModeScaleAspectFill;
_carVapEffectView.hidden = YES;
}
2022-03-30 18:46:22 +08:00
return _carVapEffectView;
}
2022-03-18 15:18:50 +08:00
- (XPRoomGiftAnimationParser *)vapParser {
if (!_vapParser) {
_vapParser = [[XPRoomGiftAnimationParser alloc] init];
}
return _vapParser;
}
- (SVGAParser *)parser {
if (!_parser) {
_parser = [[SVGAParser alloc]init];
}
return _parser;
}
- (NSMutableArray<GiftReceiveInfoModel *> *)giftEffectQueue {
if (!_giftEffectQueue) {
_giftEffectQueue = [NSMutableArray array];
}
return _giftEffectQueue;
}
- (NSMutableArray<XPGiftBigPrizeModel *> *)bigPrizeGiftQueue {
if (!_bigPrizeGiftQueue) {
_bigPrizeGiftQueue = [NSMutableArray array];
}
return _bigPrizeGiftQueue;
}
- (NSMutableArray<XPRoomGiftBroadCastModel *> *)giftBroadcastQueue {
if (!_giftBroadcastQueue) {
_giftBroadcastQueue = [NSMutableArray array];
}
return _giftBroadcastQueue;
}
- (NSMutableSet *)bannerDequePool {
if (!_bannerDequePool) {
_bannerDequePool = [NSMutableSet set];
}
return _bannerDequePool;
}
- (NSMutableSet *)bannerVisiablePool {
if (!_bannerVisiablePool) {
_bannerVisiablePool = [NSMutableSet set];
}
return _bannerVisiablePool;
}
- (XPRoomAnimationHitView *)lowLevelView {
if (!_lowLevelView) {
_lowLevelView = [[XPRoomAnimationHitView alloc] init];
_lowLevelView.backgroundColor = [UIColor clearColor];
_lowLevelView.userInteractionEnabled = YES;
}
return _lowLevelView;
}
- (XPRoomAnimationHitView *)middleLevelView {
if (!_middleLevelView) {
_middleLevelView = [[XPRoomAnimationHitView alloc] init];
_middleLevelView.backgroundColor = [UIColor clearColor];
_middleLevelView.userInteractionEnabled = YES;
}
return _middleLevelView;
}
- (XPRoomAnimationHitView *)highLevleView {
if (!_highLevleView) {
_highLevleView = [[XPRoomAnimationHitView alloc] init];
_highLevleView.backgroundColor = [UIColor clearColor];
_highLevleView.userInteractionEnabled = YES;
}
return _highLevleView;
}
- (NSMutableArray<GiftReceiveInfoModel *> *)giftQueue {
if (!_giftQueue) {
_giftQueue = [NSMutableArray array];
}
return _giftQueue;
}
- (NSMutableSet<NetImageView *> *)giftReuseArray {
if (!_giftReuseArray) {
_giftReuseArray = [NSMutableSet set];
}
return _giftReuseArray;
}
- (NSMutableSet<NetImageView *> *)giftVisibleArray {
if (!_giftVisibleArray) {
_giftVisibleArray = [NSMutableSet set];
}
return _giftVisibleArray;
}
- (NSMutableArray *)candyTreegiftQueue {
if (!_candyTreegiftQueue) {
_candyTreegiftQueue = [NSMutableArray array];
}
return _candyTreegiftQueue;
}
2022-08-05 15:38:21 +08:00
- (NSMutableArray *)compoundGiftQueue {
if (!_compoundGiftQueue) {
_compoundGiftQueue = [NSMutableArray array];
}
return _compoundGiftQueue;
}
- (NSMutableArray *)nobleLevelUpQueue {
if (!_nobleLevelUpQueue) {
_nobleLevelUpQueue = [NSMutableArray array];
}
return _nobleLevelUpQueue;
}
- (NSMutableArray<NSDictionary *> *)carEffectQueue {
2021-12-16 20:22:01 +08:00
if (_carEffectQueue == nil) {
_carEffectQueue = [NSMutableArray array];
}
return _carEffectQueue;
}
- (SVGAImageView *)carEffectView {
if (_carEffectView == nil) {
_carEffectView = [[SVGAImageView alloc]init];
_carEffectView.delegate = self;
_carEffectView.contentMode = UIViewContentModeScaleAspectFit;
_carEffectView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
_carEffectView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
_carEffectView.alpha = 0;
_carEffectView.userInteractionEnabled = NO;
}
return _carEffectView;
}
2021-12-17 15:18:34 +08:00
- (NSMutableArray<NSDictionary *> *)enterEffectQueue {
if (_enterEffectQueue == nil) {
_enterEffectQueue = [NSMutableArray array];
}
return _enterEffectQueue;
}
- (SVGAImageView *)enterEffectView {
if (_enterEffectView == nil) {
_enterEffectView = [[SVGAImageView alloc]init];
_enterEffectView.delegate = self;
_enterEffectView.contentMode = UIViewContentModeScaleAspectFit;
_enterEffectView.frame = CGRectMake(0, 0, KScreenWidth, 40);
_enterEffectView.backgroundColor = [UIColor clearColor];
_enterEffectView.alpha = 0;
_enterEffectView.userInteractionEnabled = NO;
}
return _enterEffectView;
}
2022-01-05 21:48:21 +08:00
- (SVGAImageView *)datingEffectView {
if (_datingEffectView == nil) {
_datingEffectView = [[SVGAImageView alloc]init];
_datingEffectView.delegate = self;
_datingEffectView.contentMode = UIViewContentModeScaleAspectFit;
_datingEffectView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
_datingEffectView.backgroundColor = [UIColor clearColor];
_datingEffectView.alpha = 0;
_datingEffectView.userInteractionEnabled = NO;
}
return _datingEffectView;
}
2022-01-12 17:44:40 +08:00
- (NSMutableArray<AcrossRoomPKPrizeModel *> *)acrossRoomPKQueue {
if (!_acrossRoomPKQueue) {
_acrossRoomPKQueue = [NSMutableArray array];
}
return _acrossRoomPKQueue;
}
2022-08-19 17:42:14 +08:00
- (NSMutableArray<AttachmentModel *> *)sailingQueue {
if (!_sailingQueue) {
_sailingQueue = [NSMutableArray array];
}
return _sailingQueue;
}
2022-08-23 18:01:34 +08:00
- (NSMutableArray<AttachmentModel *> *)graffitiGiftQueue {
if (!_graffitiGiftQueue) {
_graffitiGiftQueue = [NSMutableArray array];
}
return _graffitiGiftQueue;
}
2022-01-05 21:48:21 +08:00
2022-10-21 18:03:00 +08:00
- (SVGAImageView *)wishGiftEffectView {
if (_wishGiftEffectView == nil) {
_wishGiftEffectView = [[SVGAImageView alloc]init];
_wishGiftEffectView.delegate = self;
_wishGiftEffectView.contentMode = UIViewContentModeScaleAspectFit;
_wishGiftEffectView.frame = CGRectMake(0, 0, 210, 183);
_wishGiftEffectView.backgroundColor = [UIColor clearColor];
_wishGiftEffectView.alpha = 1;
_wishGiftEffectView.userInteractionEnabled = NO;
}
return _wishGiftEffectView;
}
@end