Finish all works!
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
@property (nonatomic, strong) UIButton *goButton;
|
||||
@property (nonatomic, assign) NSString *gameID;
|
||||
@property (nonatomic, strong) SVGAParser *parser;
|
||||
@property(nonatomic, assign) bool alreadyCancel;
|
||||
|
||||
@property (nonatomic, copy) void(^completeDisplay)(void);
|
||||
@property (nonatomic, copy) void(^didTapGo)(NSInteger gameID);
|
||||
@@ -50,7 +51,7 @@
|
||||
|
||||
@kWeakify(bannerView);
|
||||
[bannerView popEnterAnimation:^(BOOL finished) {
|
||||
if (finished) {
|
||||
if (finished && bannerView.alreadyCancel == NO) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
@kStrongify(bannerView);
|
||||
[bannerView popLeaveAnimation:^(bool finished) {
|
||||
@@ -76,6 +77,7 @@
|
||||
}
|
||||
|
||||
- (void)dismissBanner {
|
||||
self.alreadyCancel = YES;
|
||||
[self pop_removeAllAnimations]; // 停止所有动画
|
||||
|
||||
[self popLeaveAnimation:^(bool finished) {
|
||||
|
@@ -142,7 +142,7 @@ exitCurrentRoom:(void(^)(void))exit {
|
||||
|
||||
- (void)popEnterAnimation:(void(^)(BOOL finished))finish {
|
||||
POPSpringAnimation *enterAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewFrame];
|
||||
enterAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, kGetScaleWidth(kBannerWidth), kGetScaleWidth(kBannerHeight))];
|
||||
enterAnimation.toValue = [NSValue valueWithCGRect:CGRectMake((KScreenWidth - kGetScaleWidth(kBannerWidth))/2, 0, kGetScaleWidth(kBannerWidth), kGetScaleWidth(kBannerHeight))];
|
||||
enterAnimation.springBounciness = 10; // 弹性系数
|
||||
enterAnimation.springSpeed = 12; // 动画速度
|
||||
enterAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) {
|
||||
|
@@ -19,9 +19,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface PIUniversalBannerView : UIView
|
||||
@property (nonatomic,assign) BOOL isSvga;
|
||||
@property (nonatomic,strong) PIUniversalBannerModel *model;
|
||||
|
||||
@property (nonatomic, copy) void(^allowToPlay)(void);
|
||||
@property (nonatomic,weak) id<PIUniversalBannerViewDelegate> delegate;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -15,6 +15,7 @@
|
||||
@property (strong, nonatomic) SVGAParser *parser;
|
||||
@property (nonatomic,strong) SVGAImageView *svgaView;
|
||||
@property (nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic, strong) NetImageView *imageView;
|
||||
@property (nonatomic,strong) UILabel *titleView;
|
||||
@property (nonatomic,strong) UIButton *clickBtn;
|
||||
@property(nonatomic,strong) SVGAVideoEntity *videoItem;
|
||||
@@ -69,36 +70,71 @@
|
||||
_model.fontSize = 12;
|
||||
}
|
||||
CGFloat font = _model.fontSize;
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:font],NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:_model.textColor]}];
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:kFontRegular(font), NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:_model.textColor]}];
|
||||
|
||||
for (PIUniversalBannerItemModel *model in _model.contents) {
|
||||
if([model.type isEqualToString:@"TEXT"]){
|
||||
NSDictionary *subTextDic = model.text;
|
||||
if(subTextDic.allKeys.count > 0){
|
||||
NSString *subText = subTextDic[key] == nil ? subTextDic[subTextDic.allKeys.firstObject] : subTextDic[key];
|
||||
NSAttributedString *attText = [[NSAttributedString alloc]initWithString:subText attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:model.textColor],NSFontAttributeName:[UIFont systemFontOfSize:font]}];
|
||||
if ([attribute.string containsString:[NSString stringWithFormat:@"{%@}",model.key]]){
|
||||
[attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attText];
|
||||
dispatch_group_t g = dispatch_group_create();
|
||||
@kWeakify(self);
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
for (PIUniversalBannerItemModel *model in self.model.contents) {
|
||||
if([model.type isEqualToString:@"TEXT"]){
|
||||
dispatch_group_enter(g);
|
||||
NSDictionary *subTextDic = model.text;
|
||||
if(subTextDic.allKeys.count > 0){
|
||||
NSString *subText = subTextDic[key] == nil ? subTextDic[subTextDic.allKeys.firstObject] : subTextDic[key];
|
||||
NSAttributedString *attText = [[NSAttributedString alloc]initWithString:subText attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:model.textColor],NSFontAttributeName:[UIFont systemFontOfSize:font]}];
|
||||
if ([attribute.string containsString:[NSString stringWithFormat:@"{%@}",model.key]]){
|
||||
[attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attText];
|
||||
}
|
||||
}
|
||||
dispatch_group_leave(g);
|
||||
}else if ([model.type isEqualToString:@"IMAGE"]) {
|
||||
if (![NSString isEmpty:model.key] ||
|
||||
![NSString isEmpty:model.image]) {
|
||||
dispatch_group_enter(g);
|
||||
[[[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:model.image] completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (error == nil && data != nil) {
|
||||
UIImage *image = [UIImage imageWithData:data];
|
||||
if (image != nil) {
|
||||
if ([attribute.string containsString:[NSString stringWithFormat:@"{%@}",model.key]]){
|
||||
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
|
||||
|
||||
attachment.image = [image setCornerWithRadius:model.height/2 andSize:CGSizeMake(model.width, model.height)];
|
||||
attachment.bounds = CGRectMake(0, -model.height/3, model.width, model.height);
|
||||
NSAttributedString *attImage = [NSAttributedString attributedStringWithAttachment:attachment];
|
||||
[attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attImage];
|
||||
}
|
||||
}
|
||||
}
|
||||
dispatch_group_leave(g);
|
||||
}] resume];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_isSvga == YES){
|
||||
self.bgImageView.hidden = YES;
|
||||
self.svgaView.hidden = NO;
|
||||
self.titleView.hidden = NO;
|
||||
self.svgaView.loops = 1;
|
||||
self.titleView.attributedText = attribute;
|
||||
self.svgaView.clearsAfterStop = NO;
|
||||
self.svgaView.videoItem = _model.videoItem;
|
||||
[self.svgaView startAnimation];
|
||||
}else{
|
||||
self.bgImageView.hidden = NO;
|
||||
self.bgImageView.image = _model.image;
|
||||
self.titleView.hidden = NO;
|
||||
self.svgaView.hidden = YES;
|
||||
self.titleView.attributedText = attribute;
|
||||
}
|
||||
|
||||
dispatch_group_notify(g, dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
if(self.isSvga == YES){
|
||||
self.bgImageView.hidden = YES;
|
||||
self.svgaView.hidden = NO;
|
||||
self.titleView.hidden = NO;
|
||||
self.svgaView.loops = 1;
|
||||
self.titleView.attributedText = attribute;
|
||||
self.svgaView.clearsAfterStop = NO;
|
||||
self.svgaView.videoItem = self.model.videoItem;
|
||||
[self.svgaView startAnimation];
|
||||
}else{
|
||||
self.bgImageView.hidden = NO;
|
||||
self.bgImageView.image = self.model.image;
|
||||
self.titleView.hidden = NO;
|
||||
self.svgaView.hidden = YES;
|
||||
self.titleView.attributedText = attribute;
|
||||
}
|
||||
|
||||
if (self.allowToPlay) {
|
||||
self.allowToPlay();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
-(void)clickAction{
|
||||
|
@@ -44,9 +44,12 @@
|
||||
#import "LuckyGiftWinningFlagView.h"
|
||||
#import "LuckyGiftWinningBannerView.h"
|
||||
#import "RoomHighValueGiftBannerAnimation.h"
|
||||
#import "LuckyPackageBannerView.h"
|
||||
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
|
||||
#import "RoomEnterModel.h"
|
||||
|
||||
// Old Methods
|
||||
#import "DatingInfoModel.h"
|
||||
#import "XPWebViewController.h"
|
||||
@@ -144,10 +147,16 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
@property (nonatomic,strong) SVGAImageView *luckyGiftEffectView; ///福袋礼物送礼物的特效
|
||||
@property (nonatomic, strong) VAPView *luckyVapGiftEffectView; ///福袋礼物VAP特效
|
||||
|
||||
@property(nonatomic, strong) PIUniversalBannerView *tempUniversalBanner; // 防止内存没有被持有而过早回收
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomAnimationView
|
||||
|
||||
- (void)setIsPlayOfB:(BOOL)isPlayOfB {
|
||||
_isPlayOfB = isPlayOfB;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||
@@ -307,7 +316,8 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
// 开始执行动画
|
||||
[self playUserEnterRoomAnimation:[dic objectForKey:@"title"]
|
||||
experLevelSeq:[dic objectForKey:@"experLevelSeq"]
|
||||
effectPath:[dic objectForKey:@"effectPath"]];
|
||||
effectPath:[dic objectForKey:@"effectPath"]
|
||||
isCPEnter:[[dic objectForKey:@"isCP"] boolValue]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +343,8 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
- (void)playUserEnterRoomAnimation:(NSString *)title
|
||||
experLevelSeq:(NSString *)experLevelSeq
|
||||
effectPath:(NSString *)effectPath {
|
||||
effectPath:(NSString *)effectPath
|
||||
isCPEnter:(BOOL)isCP {
|
||||
|
||||
NSDictionary *attributes = @{
|
||||
NSFontAttributeName:kFontRegular(26),
|
||||
@@ -346,7 +357,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
BOOL hasEffectPath = ![NSString isEmpty:effectPath];
|
||||
[self addEnterEffectView: hasEffectPath];
|
||||
|
||||
if (hasEffectPath) {
|
||||
if (isCP) {
|
||||
[self playCPPPPEnterRoomSvgaWith:attributeString];
|
||||
} else if (hasEffectPath) {
|
||||
[self playEnterRoomSvga:effectPath
|
||||
content:attributeString
|
||||
needMoveAnimation:YES];
|
||||
@@ -378,6 +391,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
@kStrongify(self);
|
||||
self.enterEffectView.alpha = 1;
|
||||
self.enterEffectView.hidden = NO;
|
||||
self.enterEffectView.videoItem = videoItem;
|
||||
[self.enterEffectView setAttributedText:content forKey:@"room_text"];
|
||||
[self.enterEffectView startAnimation];
|
||||
@@ -403,6 +417,29 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[self playEnterRoomSvga:targetPath content:content needMoveAnimation:NO];
|
||||
}
|
||||
|
||||
- (void)playCPPPPEnterRoomSvgaWith:(NSAttributedString *)content {
|
||||
if ([NSString isEmpty:content.string]) {
|
||||
[self endAnimationEnterEffect];
|
||||
return;
|
||||
}
|
||||
NSString *path = @"CP进场";
|
||||
@kWeakify(self);
|
||||
SVGAParser *parser = [[SVGAParser alloc] init];
|
||||
[parser parseWithNamed:path inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
@kStrongify(self);
|
||||
self.enterEffectView.loops = 0;
|
||||
self.enterEffectView.alpha = 1;
|
||||
self.enterEffectView.hidden = NO;
|
||||
self.enterEffectView.videoItem = videoItem;
|
||||
[self.enterEffectView setAttributedText:content forKey:@"room_text"];
|
||||
[self.enterEffectView startAnimation];
|
||||
[self popAnimationEnterEffect];
|
||||
} failureBlock:^(NSError * _Nonnull error) {
|
||||
@kStrongify(self);
|
||||
[self endAnimationEnterEffect];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)popAnimationEnterEffect {
|
||||
@kWeakify(self);
|
||||
[self enterRoomAnimationFor:self.enterEffectView
|
||||
@@ -433,6 +470,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
return;
|
||||
}
|
||||
if (self.isRoomBannerV2Displaying) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 从队列中取出第一个元素并移出队列
|
||||
AttachmentModel *nextAttachment = [self.roomBannertModelsQueueV2 firstObject];
|
||||
@@ -462,11 +502,42 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
case Custom_Message_Sub_Gift_ChannelNotify:
|
||||
[self playRoomGiftBanner:nextAttachment];
|
||||
break;
|
||||
case Custom_Message_Sub_LuckyPackage:
|
||||
[self playLuckyPackageBanner:nextAttachment];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)receiveLuckyPackageBanner:(AttachmentModel *)obj {
|
||||
[self.roomBannertModelsQueueV2 addObject:obj];
|
||||
if (!self.isRoomBannerV2Displaying) {
|
||||
[self processNextRoomEffectAttachment];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)playLuckyPackageBanner:(AttachmentModel *)obj {
|
||||
if (!obj.data) {
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
return;
|
||||
}
|
||||
@kWeakify(self);
|
||||
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
|
||||
[LuckyPackageBannerView display:self.bannerContainer
|
||||
inRoomUid:roomInfo.uid
|
||||
with:obj
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
} exitCurrentRoom:^{
|
||||
@kStrongify(self);
|
||||
[self.hostDelegate exitRoom];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)receiveRoomGiftBanner:(AttachmentModel *)obj {
|
||||
[self.roomBannertModelsQueueV2 addObject:obj];
|
||||
if (!self.isRoomBannerV2Displaying) {
|
||||
@@ -476,6 +547,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
- (void)playRoomGiftBanner:(AttachmentModel *)obj {
|
||||
if (!obj.data) {
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
return;
|
||||
}
|
||||
@@ -485,6 +557,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
with:obj
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
}];
|
||||
}
|
||||
@@ -502,6 +575,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
with:attachment
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
}];
|
||||
}
|
||||
@@ -512,6 +586,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
with:attachMent
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
}];
|
||||
}
|
||||
@@ -522,6 +597,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
with:attachMent
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
}];
|
||||
}
|
||||
@@ -549,6 +625,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
with:nextAttachment
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
} exitCurrentRoom:^{
|
||||
@kStrongify(self);
|
||||
@@ -589,6 +666,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
with:attachment
|
||||
complete:^{
|
||||
@kStrongify(self);
|
||||
self.isRoomBannerV2Displaying = NO;
|
||||
[self processNextRoomEffectAttachment];
|
||||
} goToGame:^(NSInteger gameID) {
|
||||
@kStrongify(self);
|
||||
@@ -609,7 +687,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
}
|
||||
[self.hostDelegate.getSuperView addSubview:vc.view];
|
||||
vc.view.tag = 913;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}];
|
||||
@@ -720,6 +798,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
if (giftInfo == nil) {
|
||||
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:receiveInfo.giftId];
|
||||
}
|
||||
if (giftInfo == nil) {
|
||||
giftInfo = [receiveInfo.displayGift xpSafeObjectAtIndex:0];
|
||||
}
|
||||
|
||||
receiveInfo.gift = giftInfo;
|
||||
RoomInfoModel * roomInfo = [self.hostDelegate getRoomInfo];
|
||||
@@ -858,25 +939,26 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
[self playGiftEffectWithVapUrl:giftInfo.luckyGiftSvgaUrl];
|
||||
}
|
||||
} else {
|
||||
[self stopCarEffect:giftInfo.goldPrice];
|
||||
if (giftInfo.otherViewType == GiftOtherViewTypePag ||
|
||||
giftInfo.otherViewType == GiftOtherViewTypeMp4) {
|
||||
[self stopCarEffect:giftInfo.goldPrice];
|
||||
if (giftInfo.otherViewType == GiftOtherViewTypePag) {
|
||||
if (giftInfo.otherViewType == GiftOtherViewTypePag) {
|
||||
[self playGiftEffectWithPagUrl:giftInfo.viewUrl];
|
||||
targetURL = giftInfo.viewUrl;
|
||||
} else {
|
||||
} else {
|
||||
self.mp4TempReceiveInfoModel = receiveInfo;
|
||||
[self playGiftEffectWithVapUrl:giftInfo.viewUrl];
|
||||
targetURL = giftInfo.viewUrl;
|
||||
}
|
||||
} else if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0) {
|
||||
[self stopCarEffect:giftInfo.goldPrice];
|
||||
[self playGiftEffectWithVggUrl:giftInfo.vggUrl];
|
||||
targetURL = giftInfo.vggUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 兜底,同时判断是否可以执行 svga
|
||||
if ([NSString isEmpty:targetURL] && giftInfo.hasVggPic && giftInfo.vggUrl.length > 0) {
|
||||
[self playGiftEffectWithVggUrl:giftInfo.vggUrl];
|
||||
targetURL = giftInfo.vggUrl;
|
||||
}
|
||||
}
|
||||
|
||||
NSLog(@"******************* 执行播放 %@ - %@, self.svgaQueue num: %@", @(giftInfo.otherViewType), targetURL, @(self.svgaQueue.count));
|
||||
NSLog(@"******************* 执行播放, 是否MP4:%@,URL: %@, self.svgaQueue num: %@", @(giftInfo.otherViewType), targetURL, @(self.svgaQueue.count));
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"kExchangeRoomAnimationViewAndGameViewIndex"
|
||||
object:nil];
|
||||
@@ -983,6 +1065,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
}
|
||||
|
||||
- (void)playVGG:(SVGAVideoEntity *)videoItem {
|
||||
[self.vggGiftEffectView stopAnimation];
|
||||
[self _addSubviewToMiddleContainer:self.vggGiftEffectView];
|
||||
[self _updateGiftEffectContentMode:self.vggGiftEffectView
|
||||
size:videoItem.videoSize];
|
||||
@@ -1182,6 +1265,12 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
switch (attachment.first) {
|
||||
case CustomMessageType_User_Enter_Room:
|
||||
[self _handleEnterRoomMessage:message];
|
||||
break;
|
||||
case CustomMessageType_RedPacket:
|
||||
[self _handleLuckyPackageMessage:attachment];
|
||||
break;
|
||||
case CustomMessageType_Gift:
|
||||
[self _handleGiftMessage:attachment];
|
||||
break;
|
||||
@@ -1248,6 +1337,73 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_handleEnterRoomMessage:(NIMMessage *)message {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment == nil || ![obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
return;
|
||||
}
|
||||
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
switch (attachment.second) {
|
||||
case Custom_Message_Sub_User_Enter_Room: {
|
||||
RoomEnterModel *model = [RoomEnterModel modelWithJSON:attachment.data];
|
||||
if (model.platformRole == 1) {
|
||||
return;
|
||||
}
|
||||
if (model.enterHide) {
|
||||
//隐身进房
|
||||
if ([message.from isEqualToString:[AccountInfoStorage instance].getUid]) {
|
||||
[self createEnterHideAnimation];
|
||||
}
|
||||
} else {
|
||||
NSString *userName = model.nick;
|
||||
if (model.cpList.count > 0 && model.screenType < 3) {
|
||||
for (RoomEnterCPListModel *cp in model.cpList) {
|
||||
NSString *cpName = cp.cpNick;
|
||||
NSString *cpLevelTitle = [NSString stringWithFormat:@"RoomEffect_CP_lv_%@", @(cp.cpLevel)];
|
||||
NSString *title = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_31"), userName, YMLocalizedString(cpLevelTitle), cpName];
|
||||
|
||||
NSDictionary * dic= @{@"title":title,
|
||||
@"experLevelSeq":[NSString stringWithFormat:@"%ld", model.experLevelSeq],
|
||||
@"effectPath" : @"",
|
||||
@"isCP":@(YES)
|
||||
};
|
||||
[self.enterRoomAnimationQueue addObject:dic];
|
||||
}
|
||||
} else {
|
||||
NSString *title = [NSString stringWithFormat:YMLocalizedString(@"XPRoomAnimationView0"), userName];
|
||||
|
||||
NSDictionary * dic= @{@"title":title,
|
||||
@"experLevelSeq":[NSString stringWithFormat:@"%ld", model.experLevelSeq],
|
||||
@"effectPath" : model.enterRoomEffects.length ? model.enterRoomEffects : @""};
|
||||
[self.enterRoomAnimationQueue addObject:dic];
|
||||
}
|
||||
[self tryDequeueAnimation];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_handleLuckyPackageMessage:(AttachmentModel *)attachment {
|
||||
if ([self _isInSudGame]) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (attachment.second) {
|
||||
case Custom_Message_Sub_LuckyPackage:
|
||||
[self receiveLuckGiftBanner:attachment];
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_handleGiftMessage:(AttachmentModel *)attachment {
|
||||
if ([self _isInSudGame]) {
|
||||
return;
|
||||
@@ -1256,7 +1412,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||
[receiveInfo giftDataAlignment];
|
||||
|
||||
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_Gift_LuckySend);
|
||||
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_Gift_LuckySend ||
|
||||
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);
|
||||
receiveInfo.isComboBatch = (attachment.second == Custom_Message_Sub_AllMicroSend);
|
||||
@@ -1277,9 +1435,30 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
case Custom_Message_Sub_Gift_EmbeddedStyle:
|
||||
[self _handleGiftEmbeddedStyle:receiveInfo attachment:attachment];
|
||||
break;
|
||||
case 607:
|
||||
[self receiveLuckGiftBanner:attachment];
|
||||
break;
|
||||
case Custom_Message_Sub_Gift_LuckySend:
|
||||
case Custom_Message_Sub_AllMicroLuckySend:
|
||||
case Custom_Message_Sub_AllBatchMicroLuckySend:
|
||||
{
|
||||
[self _handleGift:receiveInfo attachment:attachment];
|
||||
// if (receiveInfo.mp4Url.length > 0) {
|
||||
// [self playLuckyGiftEffectWithVapUrl:receiveInfo.mp4Url];
|
||||
// } else {
|
||||
// NSString * svgaString = receiveInfo.luckyGiftSvgaUrl.length > 0 ? receiveInfo.luckyGiftSvgaUrl : receiveInfo.gift.luckyGiftSvgaUrl;
|
||||
// NSURL * luckyGiftSvgaUrl = [NSURL URLWithString:svgaString];
|
||||
// if (luckyGiftSvgaUrl.absoluteString.length > 0) {
|
||||
// [self play:luckyGiftSvgaUrl];
|
||||
// }
|
||||
// }
|
||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// [self receiveGift:receiveInfo];
|
||||
// });
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1293,8 +1472,10 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
// 全服礼物,但由自己发送,不在此逻辑播放
|
||||
return;
|
||||
}
|
||||
// 处理从位置 发送者 到 接受者 的礼物移动动画
|
||||
[self receiveGiftHandleSendGiftAnimationWith:receiveInfo
|
||||
attachment:attachment];
|
||||
// 播放礼物动画(svga/mp4)(如果有的话)
|
||||
[self receiveGift:receiveInfo];
|
||||
}
|
||||
}
|
||||
@@ -1468,6 +1649,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
}
|
||||
switch (attachment.second) {
|
||||
case Custom_Message_Sub_Room_Gift_LuckBag_FullScree:
|
||||
case Custom_Message_Sub_Room_Gift_LuckBag_Server:
|
||||
[self receiveLuckyGiftBigPrize:attachment];
|
||||
break;
|
||||
|
||||
@@ -1597,20 +1779,21 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
|
||||
#pragma mark - RoomGuestDelegate: NIMNotificationMessageDelegate
|
||||
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (content.eventType) {
|
||||
case NIMChatroomEventTypeEnter:
|
||||
[self enterRoom:message content:content];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
// NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
// NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||
// if (!content) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// switch (content.eventType) {
|
||||
// case NIMChatroomEventTypeEnter:
|
||||
// [self enterRoom:message content:content];
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
#pragma mark - NIMBroadcastManagerDelegate
|
||||
@@ -1851,7 +2034,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
if (_enterEffectView == nil) {
|
||||
_enterEffectView = [[SVGAImageView alloc]init];
|
||||
_enterEffectView.delegate = self;
|
||||
_enterEffectView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_enterEffectView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_enterEffectView.frame = CGRectMake(0, 0, KScreenWidth, 50);
|
||||
_enterEffectView.backgroundColor = [UIColor clearColor];
|
||||
_enterEffectView.alpha = 0;
|
||||
@@ -2492,40 +2675,48 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
||||
-(void)showGeneralFloatingScreenView:(PIUniversalBannerView *)bannerView model:(PIUniversalBannerModel *)model{
|
||||
BOOL isSvga = [model.resourceType isEqualToString:@"SVGA"];
|
||||
bannerView.isSvga = isSvga;
|
||||
bannerView.model = model;
|
||||
bannerView.delegate = self;
|
||||
[self.topContainer addSubview:bannerView];
|
||||
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
springAnimation.springSpeed = 12;
|
||||
springAnimation.springBounciness = 10.f;
|
||||
springAnimation.fromValue = [NSValue valueWithCGPoint:bannerView.center];
|
||||
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(bannerView.frame.size.width / 2, bannerView.center.y)];
|
||||
self.tempUniversalBanner = bannerView;
|
||||
@kWeakify(bannerView);
|
||||
@kWeakify(self);
|
||||
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
||||
if (finished) {
|
||||
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, bannerView.center.y)];
|
||||
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, bannerView.center.y)];
|
||||
moveAnimation.beginTime = CACurrentMediaTime() + 5;
|
||||
moveAnimation.duration = 0.5;
|
||||
moveAnimation.repeatCount = 1;
|
||||
moveAnimation.removedOnCompletion = YES;
|
||||
[bannerView setAllowToPlay:^{
|
||||
@kStrongify(self);
|
||||
@kStrongify(bannerView);
|
||||
[self.topContainer addSubview:bannerView];
|
||||
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
springAnimation.springSpeed = 12;
|
||||
springAnimation.springBounciness = 10.f;
|
||||
springAnimation.fromValue = [NSValue valueWithCGPoint:bannerView.center];
|
||||
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(bannerView.frame.size.width / 2, bannerView.center.y)];
|
||||
@kWeakify(self);
|
||||
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
||||
if (finished) {
|
||||
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, bannerView.center.y)];
|
||||
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, bannerView.center.y)];
|
||||
moveAnimation.beginTime = CACurrentMediaTime() + 5;
|
||||
moveAnimation.duration = 0.5;
|
||||
moveAnimation.repeatCount = 1;
|
||||
moveAnimation.removedOnCompletion = YES;
|
||||
|
||||
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
||||
@kStrongify(self);
|
||||
if (finished) {
|
||||
[bannerView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
||||
@kStrongify(self);
|
||||
if (finished) {
|
||||
[bannerView removeFromSuperview];
|
||||
self.isPlayOfB = NO;
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
}];
|
||||
[bannerView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
||||
}
|
||||
}];
|
||||
[bannerView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
||||
}
|
||||
}];
|
||||
[bannerView pop_addAnimation:springAnimation forKey:@"starKitchenOutAnimation"];
|
||||
}];
|
||||
[bannerView pop_addAnimation:springAnimation forKey:@"starKitchenOutAnimation"];
|
||||
|
||||
bannerView.model = model;
|
||||
}
|
||||
|
||||
- (void)roomDatingPublicResult:(AttachmentModel *)attachment {
|
||||
|
@@ -1,22 +0,0 @@
|
||||
//
|
||||
// YMRoomAnimationView.h
|
||||
// YUMI
|
||||
//
|
||||
// Created by YUMI on 2021/12/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XPRoomAnimationHitView.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomGuestDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomAnimationView : XPRoomAnimationHitView <RoomGuestDelegate>
|
||||
-(void)resumeTimer;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
|
||||
- (void)receiveLuckGiftWinning:( AttachmentModel * _Nullable )attachment;
|
||||
- (void)receiveLuckGiftBanner:(AttachmentModel *)attachment ;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user