feat: 完成礼物连击功能

This commit is contained in:
eggmanQQQ
2024-09-12 14:01:12 +08:00
parent f668f43a42
commit 3c024b808f
52 changed files with 836 additions and 98 deletions

View File

@@ -65,9 +65,11 @@
#import "PIRoomGiftBroadcastWindow.h"
#import "PIUniversalBannerModel.h"
#import "PIUniversalBannerView.h"
#import "GiftComboFlagView.h"
#import "GiftComboManager.h"
#import "LuckyGiftWinningFlagView.h"
#import "LuckyGiftWinningBannerView.h"
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate, XPRoomStarKitchenBannerViewDelegate,PAGViewListener,XPRoomAnchorRankBannerViewDelegate,PIRoomGiftBroadcastWindowDelegate,PIUniversalBannerViewDelegate>
///
@@ -156,6 +158,9 @@
@property (nonatomic, copy) NSString *GiftDynamicEffectListPath;
@property (nonatomic, strong) NSMutableArray *roomLuckWinningBannerModels;
@property (nonatomic, assign) BOOL isDisplayLuckWinningBanner;
@end
@implementation XPRoomAnimationView
@@ -185,6 +190,7 @@
[self initSubViews];
[self initSubViewConstraints];
_roomLuckWinningBannerModels = [NSMutableArray array];
_GiftDynamicEffectListPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
}
@@ -355,6 +361,12 @@
[self receiveCommonH5Banner:attachment];
}else if (attachment.first == CustomMessageType_General_Floating_Screen && attachment.second == Custom_Message_Sub_General_Floating_Screen_One_Room){
[self receiveRoomGeneralFloatingScreen:attachment];
} else if (attachment.first == CustomMessageType_Super_Gift &&
attachment.second == Custom_Message_Sub_Super_Gift_Winning_Coins) {
[self receiveLuckGiftWinning:attachment];
} else if (attachment.first == CustomMessageType_Super_Gift &&
attachment.second == Custom_Message_Sub_Super_Gift_Winning_Coins_ALL_Room) {
[self receiveLuckGiftBanner:attachment];
}
}
}
@@ -376,23 +388,69 @@
[self userEnterRoom:content ext:extModel];
}
}
#pragma mark -
- (void)receiveLuckGiftWinning:(AttachmentModel *)attachment {
RoomInfoModel *roomInfo = self.delegate.getRoomInfo;
[LuckyGiftWinningFlagView display:self
with:attachment
roomID:roomInfo.roomId
uID:[AccountInfoStorage instance].getUid];
}
- (void)receiveLuckGiftBanner:(AttachmentModel *)attachment {
[self.roomLuckWinningBannerModels addObject:attachment];
if (!self.isDisplayLuckWinningBanner) {
[self processNextLuckWinningAttachment];
}
}
- (void)processNextLuckWinningAttachment {
//
if (self.roomLuckWinningBannerModels.count == 0) {
//
self.isDisplayLuckWinningBanner = NO;
return;
}
//
AttachmentModel *nextAttachment = [self.roomLuckWinningBannerModels firstObject];
[self.roomLuckWinningBannerModels removeObjectAtIndex:0];
//
self.isDisplayLuckWinningBanner = YES;
RoomInfoModel *roomInfo = self.delegate.getRoomInfo;
// display
@kWeakify(self);
[LuckyGiftWinningBannerView display:self inRoomUid:roomInfo.uid with:nextAttachment complete:^{
@kStrongify(self);
// Display
[self processNextLuckWinningAttachment];
} exitCurrentRoom:^{
@kStrongify(self);
[self.delegate exitRoom];
}];
}
#pragma mark -
-(void)receiveRoomGeneralFloatingScreen:(AttachmentModel *)attacment{
-(void)receiveRoomGeneralFloatingScreen:(AttachmentModel *)attachment{
PIBaseAnimationViewModel *roomGraffiti = [PIBaseAnimationViewModel new];
roomGraffiti.data = attacment.data;
roomGraffiti.data = attachment.data;
roomGraffiti.type = GiftBannerType_General_Floating_Screen;
roomGraffiti.first = attacment.first;
roomGraffiti.second = attacment.second;
roomGraffiti.first = attachment.first;
roomGraffiti.second = attachment.second;
if(self.animationListB.count == 0 && self.isPlayOfB == NO){
[self createGeneralFloatingScreenAnimation:roomGraffiti];
}
[self.animationListB addObject:roomGraffiti];
}
- (void)createGeneralFloatingScreenAnimation:(PIBaseAnimationViewModel *)attacment{
- (void)createGeneralFloatingScreenAnimation:(PIBaseAnimationViewModel *)attachment{
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15);
PIUniversalBannerModel *model = [PIUniversalBannerModel modelWithDictionary:attacment.data];
PIUniversalBannerModel *model = [PIUniversalBannerModel modelWithDictionary:attachment.data];
BOOL isSvga = [model.resourceType.uppercaseString isEqualToString:@"SVGA"];
__block PIUniversalBannerView *bannerView;
@kWeakify(self);
@@ -1532,7 +1590,11 @@
if ([[GiftComboManager sharedManager] isGiftCombing] &&
[uid isEqualToString:[AccountInfoStorage instance].getUid] &&
isEnd == false) {
point = CGPointMake([UIScreen mainScreen].bounds.size.width - 60, [UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - 60);
if (isMSRTL()) {
point = CGPointMake(kGetScaleWidth(80), [UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - kGetScaleWidth(110));
} else {
point = CGPointMake(kGetScaleWidth([UIScreen mainScreen].bounds.size.width - kGetScaleWidth(110)), [UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - kGetScaleWidth(110));
}
}
return point;