年度礼物可以在房间外显示
This commit is contained in:
@@ -1096,6 +1096,10 @@
|
|||||||
- (void)receiveBroadcastGift:(AttachmentModel *)attachment {
|
- (void)receiveBroadcastGift:(AttachmentModel *)attachment {
|
||||||
if ([self isInSudGame]) {return;}
|
if ([self isInSudGame]) {return;}
|
||||||
XPRoomGiftBroadCastModel *giftNotifyInfo = [XPRoomGiftBroadCastModel modelWithJSON:attachment.data];
|
XPRoomGiftBroadCastModel *giftNotifyInfo = [XPRoomGiftBroadCastModel modelWithJSON:attachment.data];
|
||||||
|
///年度飘屏是广播 在tabbar中监听
|
||||||
|
if (giftNotifyInfo.ceremonyGift) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (self.giftBroadcastQueue.count == 0) {
|
if (self.giftBroadcastQueue.count == 0) {
|
||||||
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
|
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#import <NIMSDK/NIMSDK.h>
|
#import <NIMSDK/NIMSDK.h>
|
||||||
#import <Masonry/Masonry.h>
|
#import <Masonry/Masonry.h>
|
||||||
#import <AudioToolbox/AudioToolbox.h>
|
#import <AudioToolbox/AudioToolbox.h>
|
||||||
|
#import <POP.h>
|
||||||
///Tool
|
///Tool
|
||||||
#import "XPMacro.h"
|
#import "XPMacro.h"
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
#import "FirstRechargeModel.h"
|
#import "FirstRechargeModel.h"
|
||||||
#import "MonentsUnReadModel.h"
|
#import "MonentsUnReadModel.h"
|
||||||
#import "XPReceiveRedPacketModel.h"
|
#import "XPReceiveRedPacketModel.h"
|
||||||
|
#import "XPRoomGiftBroadCastModel.h"
|
||||||
///VC
|
///VC
|
||||||
#import "TabbarViewController.h"
|
#import "TabbarViewController.h"
|
||||||
#import "BaseViewController.h"
|
#import "BaseViewController.h"
|
||||||
@@ -69,6 +71,7 @@
|
|||||||
#import "XPMonentsRecommendViewController.h"
|
#import "XPMonentsRecommendViewController.h"
|
||||||
#import "XPMonentsViewController.h"
|
#import "XPMonentsViewController.h"
|
||||||
#import "XPReceiveRedPacketView.h"
|
#import "XPReceiveRedPacketView.h"
|
||||||
|
#import "XPRoomYearActivityView.h"
|
||||||
///Present
|
///Present
|
||||||
#import "MainPresenter.h"
|
#import "MainPresenter.h"
|
||||||
#import "MainProtocol.h"
|
#import "MainProtocol.h"
|
||||||
@@ -81,7 +84,7 @@ NSString * const kLastShowAnchorCardTime = @"kLastShowAnchorCardTime";
|
|||||||
UIKIT_EXTERN NSString * kNewUserRechargeKey;
|
UIKIT_EXTERN NSString * kNewUserRechargeKey;
|
||||||
UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||||
|
|
||||||
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol, NIMLoginManagerDelegate, NIMSystemNotificationManagerDelegate, NIMChatManagerDelegate, XPAnchorCardViewDelegate, NIMBroadcastManagerDelegate>
|
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol, NIMLoginManagerDelegate, NIMSystemNotificationManagerDelegate, NIMChatManagerDelegate, XPAnchorCardViewDelegate, NIMBroadcastManagerDelegate, XPRoomYearActivityViewDelegate>
|
||||||
|
|
||||||
@property (nonatomic, strong) MainPresenter *presenter;
|
@property (nonatomic, strong) MainPresenter *presenter;
|
||||||
///房间最小化
|
///房间最小化
|
||||||
@@ -100,6 +103,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
@property (nonatomic, strong) XPTaskCompleteTipView *taskTipView;
|
@property (nonatomic, strong) XPTaskCompleteTipView *taskTipView;
|
||||||
///代理
|
///代理
|
||||||
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
||||||
|
///全服广播 年度飘屏
|
||||||
|
@property (nonatomic,strong) NSMutableArray<XPRoomGiftBroadCastModel *> *giftBroadcastQueue;
|
||||||
///青少年模式
|
///青少年模式
|
||||||
@property (nonatomic, assign) BOOL parentMode;
|
@property (nonatomic, assign) BOOL parentMode;
|
||||||
|
|
||||||
@@ -427,6 +432,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
[currentVc.view addSubview:view];
|
[currentVc.view addSubview:view];
|
||||||
[currentVc.view bringSubviewToFront:view];
|
[currentVc.view bringSubviewToFront:view];
|
||||||
}
|
}
|
||||||
|
} else if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_ChannelNotify){///广播 年度飘屏
|
||||||
|
[self receiveBroadcastGift:attachment];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,6 +743,71 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - 年度礼物飘屏
|
||||||
|
- (void)receiveBroadcastGift:(AttachmentModel *)attachment {
|
||||||
|
XPRoomGiftBroadCastModel *giftNotifyInfo = [XPRoomGiftBroadCastModel modelWithJSON:attachment.data];
|
||||||
|
if (self.giftBroadcastQueue.count == 0) {
|
||||||
|
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
|
||||||
|
}
|
||||||
|
[self.giftBroadcastQueue addObject:giftNotifyInfo];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)createGiftBroadcastViewAnimation:(XPRoomGiftBroadCastModel *)giftModel {
|
||||||
|
XPRoomYearActivityView * view = [[XPRoomYearActivityView alloc] init];
|
||||||
|
view.delegate = self;
|
||||||
|
view.frame = CGRectMake(KScreenWidth, 35 + statusbarHeight, KScreenWidth, 150);
|
||||||
|
view.model = giftModel;
|
||||||
|
[self.view addSubview:view];
|
||||||
|
[self beginGiftBraodcastViewAnimation:view notifyStaySecond:giftModel.notifyStaySecond];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)beginGiftBraodcastViewAnimation:(XPRoomYearActivityView *)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:(XPRoomYearActivityView *)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)xPRoomYearActivityViewEnterRoom:(NSString *)roomUid{
|
||||||
|
if (roomUid.length > 0) {
|
||||||
|
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];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (XPMiniRoomView *)roomMineView {
|
- (XPMiniRoomView *)roomMineView {
|
||||||
if (!_roomMineView) {
|
if (!_roomMineView) {
|
||||||
@@ -762,4 +834,11 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
return _taskTipView;
|
return _taskTipView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSMutableArray<XPRoomGiftBroadCastModel *> *)giftBroadcastQueue {
|
||||||
|
if (!_giftBroadcastQueue) {
|
||||||
|
_giftBroadcastQueue = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
return _giftBroadcastQueue;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user