房间贵族小喇叭UI调整
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#import "XPRoomMessageTableViewCell.h"
|
||||
#import "XPRoomMessageHeaderView.h"
|
||||
#import "View/XPRoomMessageHeaderView.h"
|
||||
#import "XPRoomTrumpetView.h"
|
||||
|
||||
NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
|
||||
@@ -55,12 +54,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
@property (nonatomic, strong) NSMutableArray *messageBubbles;
|
||||
///messageView 持有这个工具类 进行数据的分发操作 TODO: 有需要在改
|
||||
@property (nonatomic,strong) XPRoomMessageParser *messageParser;
|
||||
///小喇叭
|
||||
@property (nonatomic, strong) XPRoomTrumpetView *trumpetView;
|
||||
///小喇叭队列
|
||||
@property (nonatomic, strong) NSMutableArray *trumpetQueue;
|
||||
///小喇叭动画定时器
|
||||
@property (nonatomic, strong) dispatch_source_t trumpetTimer;
|
||||
///是否是大的 只有在小游戏的时候有用
|
||||
@property (nonatomic,assign) BOOL isLarge;
|
||||
@end
|
||||
@@ -70,9 +63,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
if (self.trumpetTimer != nil) {
|
||||
dispatch_source_cancel(self.trumpetTimer);
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
@@ -98,14 +88,13 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
[self addSubview:self.messageTableView];
|
||||
[self addSubview:self.messageTipsBtn];
|
||||
self.messageTableView.tableHeaderView = self.headerView;
|
||||
[self addSubview:self.trumpetView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.messageTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self).offset(15);
|
||||
make.bottom.right.mas_equalTo(self);
|
||||
make.top.mas_equalTo(self.trumpetView.mas_bottom);
|
||||
make.top.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.messageTipsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -114,12 +103,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
make.bottom.mas_equalTo(self.mas_bottom).offset(-5);
|
||||
make.left.mas_equalTo(self);
|
||||
}];
|
||||
[self.trumpetView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self);
|
||||
make.left.mas_equalTo(15);
|
||||
make.right.mas_equalTo(0);
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
}
|
||||
|
||||
///是否是当前房间
|
||||
@@ -357,43 +340,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
[[XPRoomMiniManager shareManager] resetLocalMessage];
|
||||
[self addRoomMessage:message];
|
||||
return;
|
||||
} else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Trumpet) {
|
||||
if (self.trumpetQueue.count) {
|
||||
[self.trumpetQueue addObject:attachment.data];
|
||||
} else {
|
||||
[self.trumpetQueue addObject:attachment.data];
|
||||
__block NSInteger time = 5.0; //倒计时时间
|
||||
if (_trumpetTimer != nil) {
|
||||
dispatch_source_cancel(_trumpetTimer);
|
||||
}
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
_trumpetTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
||||
dispatch_source_set_timer(_trumpetTimer,dispatch_walltime(NULL, 0),time*NSEC_PER_SEC, 0); //每秒执行
|
||||
dispatch_source_set_event_handler(_trumpetTimer, ^{
|
||||
if (self.trumpetQueue.count) {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self createTrumpetAnimation:self.trumpetQueue.firstObject];
|
||||
[self.trumpetQueue removeObjectAtIndex:0];
|
||||
});
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
self.trumpetView.hidden = YES;
|
||||
[self.trumpetView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
[self.messageTableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.trumpetView.mas_bottom);
|
||||
}];
|
||||
});
|
||||
|
||||
if (self->_trumpetTimer != nil) {
|
||||
dispatch_source_cancel(self->_trumpetTimer);
|
||||
}
|
||||
}
|
||||
});
|
||||
dispatch_resume(_trumpetTimer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
||||
@@ -546,59 +492,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
}
|
||||
|
||||
|
||||
- (void)createTrumpetAnimation:(NSDictionary *)attatchment {
|
||||
self.trumpetView.data = attatchment;
|
||||
self.trumpetView.hidden = NO;
|
||||
[self.trumpetView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
[self.messageTableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.trumpetView.mas_bottom).mas_offset(4);
|
||||
}];
|
||||
POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
|
||||
animation2.beginTime = CACurrentMediaTime();
|
||||
animation2.duration = 0.1;
|
||||
CGFloat width = self.frame.size.width - 15;
|
||||
CGFloat height = 32;
|
||||
animation2.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 0, width, height)];
|
||||
animation2.toValue = [NSValue valueWithCGRect:CGRectMake(0, -height/2, width, height)];
|
||||
animation2.removedOnCompletion = NO;
|
||||
animation2.repeatCount = 1;
|
||||
|
||||
POPBasicAnimation *animation3 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
|
||||
animation3.duration = 0.1;
|
||||
animation3.beginTime = CACurrentMediaTime();
|
||||
animation3.fromValue = @1;
|
||||
animation3.toValue = @0;
|
||||
animation3.repeatCount = 1;
|
||||
animation3.removedOnCompletion = NO;
|
||||
|
||||
[animation2 setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
||||
if (finished) {
|
||||
POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
|
||||
animation2.beginTime = CACurrentMediaTime();
|
||||
animation2.duration = 0.1;
|
||||
CGFloat width = self.frame.size.width - 15;
|
||||
CGFloat height = 32;
|
||||
animation2.fromValue = [NSValue valueWithCGRect:CGRectMake(0, height/2, width, height)];
|
||||
animation2.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, width, height)];
|
||||
animation2.removedOnCompletion = NO;
|
||||
animation2.repeatCount = 1;
|
||||
|
||||
POPBasicAnimation *animation3 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
|
||||
animation3.duration = 0.1;
|
||||
animation3.beginTime = CACurrentMediaTime();
|
||||
animation3.fromValue = @0;
|
||||
animation3.toValue = @1;
|
||||
animation3.repeatCount = 1;
|
||||
animation3.removedOnCompletion = NO;
|
||||
[self.trumpetView.mainView.layer pop_addAnimation:animation2 forKey:@"animation4"];
|
||||
[self.trumpetView.mainView.layer pop_addAnimation:animation3 forKey:@"animation5"];
|
||||
}
|
||||
}];
|
||||
[self.trumpetView.mainView.layer pop_addAnimation:animation2 forKey:@"animation2"];
|
||||
[self.trumpetView.mainView.layer pop_addAnimation:animation3 forKey:@"animation3"];
|
||||
}
|
||||
#pragma mark - XPRoomMessageTableViewCellDelegate
|
||||
- (void)xPRoomMessageTableViewCellDidTapEmpty:(XPRoomMessageTableViewCell *)view {
|
||||
if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||
@@ -679,19 +572,4 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
return _messageParser;
|
||||
}
|
||||
|
||||
- (XPRoomTrumpetView *)trumpetView {
|
||||
if (!_trumpetView) {
|
||||
_trumpetView = [[XPRoomTrumpetView alloc] init];
|
||||
_trumpetView.hidden = YES;
|
||||
}
|
||||
return _trumpetView;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)trumpetQueue {
|
||||
if (!_trumpetQueue) {
|
||||
_trumpetQueue = [NSMutableArray array];
|
||||
}
|
||||
return _trumpetQueue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user