feat: 完成 代充页面修改 | 开屏 & 首页banner 支持 svga
This commit is contained in:
@@ -27,13 +27,13 @@
|
||||
#import "XPRoomAnimationView.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "XPRoomViewController.h"
|
||||
#import "PIRoomActivityWebView.h"
|
||||
#import "BoomInfoViewController.h"
|
||||
#import "XPSailingViewController.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "XPCandyTreeViewController.h"
|
||||
#import "XPFirstRechargeSuccessView.h"
|
||||
#import "XPArrangeMicViewController.h"
|
||||
#import "PIRoomActivityWebView.h"
|
||||
#import "XPTreasureFairyViewController.h"
|
||||
|
||||
UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
@@ -51,6 +51,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
@property (nonatomic,strong) UIImageView *joinView;
|
||||
@property(nonatomic,strong) PIRoomEnterRedPacketView *redPacketView;
|
||||
|
||||
@property(nonatomic, strong) UIView *scrollContain;
|
||||
@property(nonatomic, strong) UIScrollView *scrollView;
|
||||
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
|
||||
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
|
||||
@@ -69,8 +70,6 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
|
||||
@end
|
||||
|
||||
// TODO: 补充红包视图
|
||||
|
||||
@implementation RoomSideMenu
|
||||
|
||||
- (void)dealloc {
|
||||
@@ -92,8 +91,11 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
|
||||
#pragma mark - Setup
|
||||
- (void)setupViews {
|
||||
self.scrollContain = [[UIView alloc] init];
|
||||
self.scrollContain.backgroundColor = [UIColor purpleColor];
|
||||
[self addSubview:self.cycleScrollView];
|
||||
[self addSubview:self.scrollView];
|
||||
[self.scrollView addSubview:self.scrollContain];
|
||||
[self addSubview:self.expandButton];
|
||||
|
||||
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -130,7 +132,13 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
|
||||
- (void)updateMenuItem:(UIView *)itemView isRemove:(BOOL)isRemove {
|
||||
if (itemView.tag == 0) {
|
||||
return;
|
||||
}
|
||||
if (isRemove) {
|
||||
if (itemView.superview == nil) {
|
||||
return;
|
||||
}
|
||||
if ([self.menuItemViews containsObject:itemView]) {
|
||||
[self.menuItemViews removeObject:itemView];
|
||||
}
|
||||
@@ -151,7 +159,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
}];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.menuItemViewsSubject sendNext:self.menuItemViews];
|
||||
});
|
||||
}
|
||||
@@ -200,29 +208,53 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
|
||||
- (void)updateScrollView:(NSArray *)data {
|
||||
// 清空当前 scrollView 的 subviews
|
||||
[self.scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
|
||||
if (data.count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置 contentSize
|
||||
CGFloat inset = 15;
|
||||
CGFloat width = self.scrollView.bounds.size.width - 30;
|
||||
self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width,
|
||||
MAX(self.scrollView.bounds.size.height, width * data.count));
|
||||
CGFloat spacing = 4;
|
||||
CGSize size = CGSizeMake(self.scrollView.bounds.size.width-30, self.scrollView.bounds.size.width-30);
|
||||
|
||||
// 动态添加 subviews
|
||||
CGFloat yOffset = self.scrollView.contentSize.height; // 从底部开始布局
|
||||
// NSLog(@"--------------- blkaa 1 blkaa: %@", [NSValue valueWithCGRect:self.scrollView.frame]);
|
||||
|
||||
CGFloat totalHeight = size.height * data.count + spacing * data.count;
|
||||
if (totalHeight > self.scrollView.bounds.size.height) {
|
||||
[self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.cycleScrollView.mas_bottom);
|
||||
make.bottom.leading.trailing.mas_equalTo(self);
|
||||
}];
|
||||
} else {
|
||||
[self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.leading.trailing.mas_equalTo(self);
|
||||
make.height.mas_equalTo(totalHeight);
|
||||
}];
|
||||
}
|
||||
|
||||
[self layoutIfNeeded];
|
||||
|
||||
// NSLog(@"--------------- blkaa 2 blkaa: %@", [NSValue valueWithCGRect:self.scrollView.frame]);
|
||||
|
||||
self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width, totalHeight);
|
||||
|
||||
UIView *lastItemView = nil;
|
||||
CGFloat yOffset = totalHeight; // 从底部开始布局
|
||||
for (UIView *view in data) {
|
||||
yOffset -= size.height;
|
||||
[self.scrollView addSubview:view];
|
||||
yOffset -= width;
|
||||
view.frame = CGRectMake(inset, yOffset, width, width);
|
||||
[view layoutIfNeeded];
|
||||
}
|
||||
|
||||
// 滚动到底部
|
||||
if (self.scrollView.contentSize.height > self.scrollView.bounds.size.height) {
|
||||
[self.scrollView setContentOffset:CGPointMake(0, self.scrollView.contentSize.height - self.scrollView.bounds.size.height)
|
||||
animated:NO];
|
||||
view.frame = CGRectMake(inset, yOffset, size.width, size.height);
|
||||
yOffset -= spacing;
|
||||
|
||||
lastItemView = view;
|
||||
// NSLog(@"--------------- blkaa %@ blkaa: %@", @(view.tag), [NSValue valueWithCGRect:view.frame]);
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGFloat bottomOffset = self.scrollView.contentSize.height - self.scrollView.bounds.size.height;
|
||||
if (bottomOffset > 0) {
|
||||
[self.scrollView setContentOffset:CGPointMake(0, bottomOffset) animated:YES];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)configLittleGameActivity {
|
||||
@@ -401,6 +433,9 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
if(self.openRedPacketHandle){
|
||||
self.openRedPacketHandle(nil,self.hostDelegate.getRoomInfo.type,YES);
|
||||
}
|
||||
if (self.redPacketList.count > 0) {
|
||||
[self updateMenuItem:self.redPacketView isRemove:NO];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - User Response
|
||||
@@ -509,7 +544,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
|
||||
- (void)onRoomUpdate {
|
||||
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
|
||||
|
||||
|
||||
[self.menuItemViews removeAllObjects];
|
||||
[self.menuItemViewsSubject sendNext:self.menuItemViews];
|
||||
|
||||
switch (roomInfo.type) {
|
||||
case RoomType_MiniGame:
|
||||
[self displayForMiniGame];
|
||||
@@ -517,12 +555,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
break;
|
||||
case RoomType_19Mic:
|
||||
case RoomType_20Mic: {
|
||||
[self.menuItemViews removeAllObjects];
|
||||
[self.menuItemViewsSubject sendNext:self.menuItemViews];
|
||||
|
||||
[self displayExpandButton:YES];
|
||||
|
||||
[self dealWithData];
|
||||
|
||||
if (self.isExpand) {
|
||||
[self loadPKView:roomInfo];
|
||||
[self loadJoinView:roomInfo];
|
||||
@@ -537,6 +573,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
[self displayExpandButton:NO];
|
||||
|
||||
[self dealWithData];
|
||||
|
||||
[self loadPKView:roomInfo];
|
||||
[self loadJoinView:roomInfo];
|
||||
[self loadRedPacket:roomInfo];
|
||||
@@ -555,15 +592,22 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
|
||||
- (void)loadRedPacket:(RoomInfoModel *)roomInfo {
|
||||
self.redPacketView.type = roomInfo.type;
|
||||
self.redPacketView.redPacketList = self.redPacketList;
|
||||
[self updateMenuItem:self.redPacketView isRemove:NO];
|
||||
if (self.redPacketList.count > 0) {
|
||||
self.redPacketView.type = roomInfo.type;
|
||||
self.redPacketView.redPacketList = self.redPacketList;
|
||||
[self updateMenuItem:self.redPacketView isRemove:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadPKView:(RoomInfoModel *)roomInfo {
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode &&
|
||||
(roomInfo.type == RoomType_Anchor || roomInfo.roomModeType == RoomModeType_Open_Blind)) {
|
||||
[self updateMenuItem:self.pkMenuButton isRemove:NO];
|
||||
if (roomInfo.type == RoomType_Anchor || roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||||
[self updateMenuItem:self.pkMenuButton isRemove:YES];
|
||||
} else {
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||||
[self updateMenuItem:self.pkMenuButton isRemove:NO];
|
||||
} else {
|
||||
[self updateMenuItem:self.pkMenuButton isRemove:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -861,6 +905,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
if(!_redPacketView){
|
||||
_redPacketView = [[PIRoomEnterRedPacketView alloc]initWithFrame:CGRectZero];
|
||||
_redPacketView.hidden = YES;
|
||||
_redPacketView.tag = 106;
|
||||
_redPacketView.delegate = self;
|
||||
}
|
||||
return _redPacketView;
|
||||
|
Reference in New Issue
Block a user