推送及房间资源位优化
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// PIRoomActivityChoosePlayCell.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/2/20.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PIRoomActivityChoosePlayCell : UICollectionViewCell
|
||||
@property(nonatomic,copy) NSString *imageUrl;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// PIRoomActivityChoosePlayCell.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/2/20.
|
||||
//
|
||||
|
||||
#import "PIRoomActivityChoosePlayCell.h"
|
||||
@interface PIRoomActivityChoosePlayCell()
|
||||
@property(nonatomic,strong) NetImageView *playIconView;
|
||||
@end
|
||||
@implementation PIRoomActivityChoosePlayCell
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)setImageUrl:(NSString *)imageUrl{
|
||||
_imageUrl = imageUrl;
|
||||
_playIconView.image = nil;
|
||||
[_playIconView loadImageWithUrl:_imageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||
self.playIconView.image = image;
|
||||
}];
|
||||
}
|
||||
-(void)installUI{
|
||||
self.contentView.backgroundColor = UIColorRGBAlpha(0x727272, 0.6);
|
||||
self.contentView.layer.cornerRadius = 7;
|
||||
self.contentView.layer.masksToBounds = YES;
|
||||
[self.contentView addSubview:self.playIconView];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.playIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(43);
|
||||
make.center.equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (NetImageView *)playIconView{
|
||||
if(!_playIconView){
|
||||
_playIconView = [NetImageView new];
|
||||
}
|
||||
return _playIconView;
|
||||
}
|
||||
@end
|
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// PIRoomActivityChoosePlayView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/2/20.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ActivityInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class PIRoomActivityChoosePlayView;
|
||||
@protocol PIRoomActivityChoosePlayViewDelegate <NSObject>
|
||||
|
||||
-(void)hiddenViewActionWithView:(PIRoomActivityChoosePlayView *)view;
|
||||
-(void)choosePlayTypeWithView:(PIRoomActivityChoosePlayView *)view model:(ActivityInfoModel *)model;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface PIRoomActivityChoosePlayView : UIView
|
||||
@property(nonatomic,strong) NSMutableArray *playList;
|
||||
@property(nonatomic,weak) id<PIRoomActivityChoosePlayViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// PIRoomActivityChoosePlayView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/2/20.
|
||||
//
|
||||
|
||||
#import "PIRoomActivityChoosePlayView.h"
|
||||
#import "PIRoomActivityChoosePlayCell.h"
|
||||
#import "ActivityInfoModel.h"
|
||||
@interface PIRoomActivityChoosePlayView ()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property(nonatomic,strong) UIButton *clickBtn;
|
||||
@property(nonatomic,strong) UICollectionView *collectionView;
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@end
|
||||
@implementation PIRoomActivityChoosePlayView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)installUI{
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
[self addSubview:self.clickBtn];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView addSubview:self.collectionView];
|
||||
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(14);
|
||||
make.leading.equalTo(self);
|
||||
make.centerY.equalTo(self);
|
||||
}];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(-6);
|
||||
make.top.bottom.equalTo(self);
|
||||
make.width.mas_equalTo(180);
|
||||
}];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.bgImageView);
|
||||
}];
|
||||
}
|
||||
-(void)setPlayList:(NSMutableArray *)playList{
|
||||
_playList = playList;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.playList.count;
|
||||
}
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
PIRoomActivityChoosePlayCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([PIRoomActivityChoosePlayCell class]) forIndexPath:indexPath];
|
||||
ActivityInfoModel *model = [self.playList safeObjectAtIndex1:indexPath.row];
|
||||
cell.imageUrl = model.icon;
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
ActivityInfoModel *model = [self.playList safeObjectAtIndex1:indexPath.row];
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(choosePlayTypeWithView:model:)]){
|
||||
[self.delegate choosePlayTypeWithView:self model:model];
|
||||
}
|
||||
}
|
||||
-(void)clickBtnAction{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(hiddenViewActionWithView:)]){
|
||||
[self.delegate hiddenViewActionWithView:self];
|
||||
}
|
||||
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UICollectionView *)collectionView{
|
||||
if(!_collectionView){
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumLineSpacing = 8;
|
||||
layout.minimumInteritemSpacing = 8;
|
||||
layout.itemSize = CGSizeMake(48, 48);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[ PIRoomActivityChoosePlayCell class] forCellWithReuseIdentifier:NSStringFromClass([ PIRoomActivityChoosePlayCell class])];
|
||||
|
||||
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
- (UIButton *)clickBtn{
|
||||
if(!_clickBtn){
|
||||
_clickBtn = [UIButton new];
|
||||
[_clickBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
||||
[_clickBtn setImage:kImage(@"pi_room_activity_choose_play_arrow") forState:UIControlStateNormal];
|
||||
[_clickBtn addTarget:self action:@selector(clickBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _clickBtn;
|
||||
}
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
_bgImageView = [UIImageView new];
|
||||
_bgImageView.layer.cornerRadius = 12;
|
||||
_bgImageView.layer.masksToBounds = YES;
|
||||
_bgImageView.layer.borderColor = [UIColor colorWithWhite:1 alpha:0.8].CGColor;
|
||||
_bgImageView.layer.borderWidth = 1;
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
UIImage *image = [UIImage imageWithColor:[UIColor colorWithWhite:0 alpha:0.5]];
|
||||
_bgImageView.image = [UIImage setBlurImage:image value:1];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
@end
|
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// PIRoomActivityClickView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/2/20.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ActivityInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol PIRoomActivityClickViewDelegate <NSObject>
|
||||
|
||||
-(void)showChoosePlayViewAction;
|
||||
-(void)clickPlayTypeWithModel:(ActivityInfoModel *)model;
|
||||
@end
|
||||
|
||||
|
||||
@interface PIRoomActivityClickView : UIView
|
||||
@property(nonatomic,strong) ActivityInfoModel *model;
|
||||
@property(nonatomic,weak) id<PIRoomActivityClickViewDelegate>delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// PIRoomActivityClickView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/2/20.
|
||||
//
|
||||
|
||||
#import "PIRoomActivityClickView.h"
|
||||
@interface PIRoomActivityClickView()
|
||||
@property(nonatomic,strong) UIButton *clickBtn;
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic,strong) NetImageView *playIconView;
|
||||
@end
|
||||
@implementation PIRoomActivityClickView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)installUI{
|
||||
[self addSubview:self.clickBtn];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView addSubview:self.playIconView];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(14);
|
||||
make.leading.centerY.equalTo(self);
|
||||
}];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(66);
|
||||
make.centerY.equalTo(self);
|
||||
make.leading.mas_equalTo(15);
|
||||
}];
|
||||
[self.playIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(58);
|
||||
make.center.equalTo(self.bgImageView);
|
||||
}];
|
||||
}
|
||||
- (void)setModel:(ActivityInfoModel *)model{
|
||||
_model = model;
|
||||
[_playIconView loadImageWithUrl:_model.icon completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||
self.playIconView.image = image;
|
||||
}];
|
||||
}
|
||||
-(void)clickBtnAction{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(showChoosePlayViewAction)]){
|
||||
[self.delegate showChoosePlayViewAction];
|
||||
}
|
||||
}
|
||||
-(void)clickPlayImageAction{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(clickPlayTypeWithModel:)]){
|
||||
[self.delegate clickPlayTypeWithModel:self.model];
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIButton *)clickBtn{
|
||||
if(!_clickBtn){
|
||||
_clickBtn = [UIButton new];
|
||||
[_clickBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
||||
[_clickBtn setImage:kImage(@"pi_room_activity_click_arrow") forState:UIControlStateNormal];
|
||||
[_clickBtn addTarget:self action:@selector(clickBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
}
|
||||
return _clickBtn;
|
||||
}
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
_bgImageView = [UIImageView new];
|
||||
_bgImageView.layer.cornerRadius = 7;
|
||||
_bgImageView.layer.masksToBounds = YES;
|
||||
_bgImageView.layer.borderColor = [UIColor colorWithWhite:1 alpha:0.8].CGColor;
|
||||
_bgImageView.layer.borderWidth = 1;
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
UIImage *image = [UIImage imageWithColor:[UIColor colorWithWhite:0 alpha:0.6]];
|
||||
_bgImageView.image = [UIImage setBlurImage:image value:1];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
- (NetImageView *)playIconView{
|
||||
if(!_playIconView){
|
||||
_playIconView = [NetImageView new];
|
||||
_playIconView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickPlayImageAction)];
|
||||
[_playIconView addGestureRecognizer:tap];
|
||||
|
||||
}
|
||||
return _playIconView;
|
||||
}
|
||||
@end
|
@@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
#import "XPRoomActivityContainerView.h"
|
||||
#import <ReactiveObjC/ReactiveObjC.h>
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||||
@@ -38,37 +39,32 @@
|
||||
#import "PIRoomEnterRedPacketView.h"
|
||||
#import "BaseNavigationController.h"
|
||||
#import "PIRoomActivityWebView.h"
|
||||
#import "PIRoomActivityClickView.h"
|
||||
#import "PIRoomActivityChoosePlayView.h"
|
||||
UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate,PIRoomEnterRedPacketViewDelegate>
|
||||
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate,PIRoomEnterRedPacketViewDelegate,PIRoomActivityClickViewDelegate,PIRoomActivityChoosePlayViewDelegate>
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///轮播图
|
||||
@property (nonatomic,strong) SDCycleScrollView *pi_cycleScrollView;
|
||||
|
||||
///糖果树
|
||||
@property (nonatomic,strong) NetImageView *lookLoveImageView;
|
||||
|
||||
///红包
|
||||
@property(nonatomic,strong) PIRoomEnterRedPacketView *redPacketView;
|
||||
///夺宝精灵
|
||||
@property (nonatomic,strong) TreasureFairyLimitModel *fairyModel;
|
||||
///玩法
|
||||
@property(nonatomic,strong) PIRoomActivityClickView *clickPlayView;
|
||||
|
||||
///参加相亲
|
||||
@property (nonatomic,strong) UIImageView *joinDatingView;
|
||||
///host 代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
|
||||
///房间活动的列表
|
||||
@property (nonatomic,copy) NSMutableArray<ActivityInfoModel *> *activityList;
|
||||
|
||||
@property (nonatomic,strong) NSMutableArray<ActivityInfoModel *> *activityList;
|
||||
@property(nonatomic,strong) NSMutableArray<ActivityInfoModel *> *playList;
|
||||
///航海
|
||||
@property (nonatomic,strong) UIImageView *sailingImageView;
|
||||
///是否加载了活动
|
||||
@property (nonatomic,assign) BOOL isLoadActivity;
|
||||
///夺宝精灵
|
||||
@property (nonatomic,strong) ActivityInfoModel *fairyActivityModel;
|
||||
///首充
|
||||
@property (nonatomic,strong) ActivityInfoModel * firstRechargeModel;
|
||||
///寻爱之旅
|
||||
@property (nonatomic,strong) ActivityInfoModel * lookLoveModel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomActivityContainerView
|
||||
@@ -82,7 +78,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self requestActivityList];
|
||||
[self configLookLove];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -94,8 +90,9 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
[self.stackView addArrangedSubview:self.pi_cycleScrollView];
|
||||
[self.stackView addArrangedSubview:emptyView];
|
||||
[self.stackView addArrangedSubview:self.redPacketView];
|
||||
[self.stackView addArrangedSubview:self.lookLoveImageView];
|
||||
[self.stackView addArrangedSubview:self.joinDatingView];
|
||||
[self.stackView addArrangedSubview:self.clickPlayView];
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -113,127 +110,96 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}];
|
||||
|
||||
|
||||
[self.lookLoveImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth, itemWidth));
|
||||
[self.clickPlayView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(0);
|
||||
make.size.mas_equalTo(CGSizeMake(81, 66));
|
||||
}];
|
||||
|
||||
[self.joinDatingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(35* kScreenHeightScale);
|
||||
make.height.mas_equalTo(35 * kScreenHeightScale);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)requestActivityList {
|
||||
///网络请求异步加载
|
||||
dispatch_group_t group =dispatch_group_create();
|
||||
// 并行队列
|
||||
dispatch_queue_t queue =dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0);
|
||||
|
||||
dispatch_group_enter(group);
|
||||
dispatch_group_async(group, queue, ^{
|
||||
|
||||
|
||||
RACSubject* list = [RACSubject subject];
|
||||
RACSubject* play = [RACSubject subject];
|
||||
[[RACSignal combineLatest:@[list, play] reduce:^id(NSArray<ActivityInfoModel*> * listModel, NSArray<ActivityInfoModel*> * playModel){
|
||||
self.activityList = [NSMutableArray arrayWithArray:listModel];
|
||||
self.playList = [NSMutableArray arrayWithArray:playModel];
|
||||
[self dealWithData];
|
||||
return nil;
|
||||
}] subscribeError:^(NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
|
||||
[Api roomActivityList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
|
||||
[self.activityList addObjectsFromArray:array];
|
||||
[list sendNext:array];
|
||||
[list sendCompleted];
|
||||
return;
|
||||
}
|
||||
dispatch_group_leave(group);
|
||||
} roomId:roomId type:@"2"];
|
||||
[list sendError:nil];
|
||||
} roomId:roomId];
|
||||
|
||||
});
|
||||
|
||||
dispatch_group_enter(group);
|
||||
dispatch_group_async(group, queue, ^{
|
||||
|
||||
[Api treasureFailyLimitInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
TreasureFairyLimitModel * info =[TreasureFairyLimitModel modelWithDictionary:data.data];
|
||||
self.fairyModel = info;
|
||||
}
|
||||
dispatch_group_leave(group);
|
||||
}];
|
||||
|
||||
});
|
||||
|
||||
[Api getPlayList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
|
||||
[play sendNext:array];
|
||||
[play sendCompleted];
|
||||
return;
|
||||
}
|
||||
[play sendError:nil];
|
||||
} roomId:roomId];
|
||||
|
||||
|
||||
|
||||
dispatch_group_notify(group,dispatch_get_main_queue(), ^{
|
||||
self.isLoadActivity = YES;
|
||||
self.pi_cycleScrollView.hidden = NO;
|
||||
if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||
[self configLittleGameActivity];
|
||||
} else {
|
||||
///是否包含首充
|
||||
[self configFairy];
|
||||
[self configfirstRecharge];
|
||||
NSMutableArray *picArray = [NSMutableArray array];
|
||||
for (ActivityInfoModel *model in self.activityList) {
|
||||
[picArray addObject:model.bannerPic];
|
||||
}
|
||||
self.pi_cycleScrollView.imageURLStringsGroup = picArray;
|
||||
if (self.activityList.count > 1) {
|
||||
[self.pi_cycleScrollView setAutoScroll:YES];
|
||||
self.pi_cycleScrollView.autoScrollTimeInterval = 3;
|
||||
} else {
|
||||
[self.pi_cycleScrollView setAutoScroll:NO];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
///首充
|
||||
-(void)configfirstRecharge{
|
||||
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
||||
if (userInfo.isFirstCharge == YES) {
|
||||
if(![self.activityList containsObject:self.firstRechargeModel]){
|
||||
[self.activityList insertObject:self.firstRechargeModel atIndex:0];
|
||||
}
|
||||
}else{
|
||||
if([self.activityList containsObject:self.firstRechargeModel]){
|
||||
[self.activityList removeObject:self.firstRechargeModel];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
///夺宝精灵
|
||||
-(void)configFairy{
|
||||
if (self.fairyModel.open == YES) {
|
||||
if(![self.activityList containsObject:self.fairyActivityModel]){
|
||||
[self.activityList insertObject:self.fairyActivityModel atIndex:0];
|
||||
}
|
||||
}else{
|
||||
if([self.activityList containsObject:self.fairyActivityModel]){
|
||||
[self.activityList removeObject:self.fairyActivityModel];
|
||||
}
|
||||
}
|
||||
}
|
||||
///寻爱之旅
|
||||
- (void)configLookLove {
|
||||
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
if (userInfo.userLevelVo.experLevelSeq >= roomInfo.findLoveDrawSwitchVo.openLevel && roomInfo.findLoveDrawSwitchVo.open == YES) {
|
||||
self.lookLoveImageView.hidden = NO;
|
||||
self.lookLoveImageView.image = [UIImage imageNamed:@"room_candy_tree_enter"];
|
||||
-(void)dealWithData{
|
||||
self.isLoadActivity = YES;
|
||||
self.pi_cycleScrollView.hidden = NO;
|
||||
if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||
[self configLittleGameActivity];
|
||||
} else {
|
||||
self.lookLoveImageView.hidden = YES;
|
||||
|
||||
NSMutableArray *picArray = [NSMutableArray array];
|
||||
for (ActivityInfoModel *model in self.activityList) {
|
||||
[picArray addObject:model.icon];
|
||||
}
|
||||
self.pi_cycleScrollView.imageURLStringsGroup = picArray;
|
||||
if (self.activityList.count > 1) {
|
||||
[self.pi_cycleScrollView setAutoScroll:YES];
|
||||
self.pi_cycleScrollView.autoScrollTimeInterval = 3;
|
||||
} else {
|
||||
[self.pi_cycleScrollView setAutoScroll:NO];
|
||||
}
|
||||
if(self.playList.count > 0){
|
||||
ActivityInfoModel *playModel = self.playList.firstObject;
|
||||
self.clickPlayView.model = playModel;
|
||||
self.clickPlayView.hidden = NO;
|
||||
}else{
|
||||
self.clickPlayView.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)configLittleGameActivity {
|
||||
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
||||
if (userInfo.userLevelVo.experLevelSeq >= roomInfo.findLoveDrawSwitchVo.openLevel && roomInfo.findLoveDrawSwitchVo.open == YES) {
|
||||
self.lookLoveModel.bannerPic = @"room_candy_tree_enter";
|
||||
if(![self.activityList containsObject:self.lookLoveModel]){
|
||||
[self.activityList insertObject:self.lookLoveModel atIndex:0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NSMutableArray *list = [NSMutableArray array];
|
||||
[list addObjectsFromArray:self.playList];
|
||||
[list addObjectsFromArray:self.activityList];
|
||||
NSMutableArray *picArray = [NSMutableArray array];
|
||||
for (ActivityInfoModel *model in self.activityList) {
|
||||
[picArray addObject:model.bannerPic];
|
||||
for (ActivityInfoModel *model in list) {
|
||||
[picArray addObject:model.icon];
|
||||
}
|
||||
self.pi_cycleScrollView.imageURLStringsGroup = picArray;
|
||||
if (self.activityList.count > 1) {
|
||||
@@ -256,7 +222,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
self.redPacketView.type = roomInfo.type;
|
||||
if (roomInfo.type == RoomType_MiniGame) {
|
||||
self.redPacketView.hidden = YES;
|
||||
self.lookLoveImageView.hidden = YES;
|
||||
self.clickPlayView.hidden = YES;
|
||||
self.sailingImageView.hidden = YES;
|
||||
if (self.isLoadActivity) {
|
||||
[self configLittleGameActivity];
|
||||
@@ -265,16 +231,9 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
} else {
|
||||
self.redPacketView.redPacketList = self.redPacketList;
|
||||
if([self.activityList containsObject:self.lookLoveModel]){
|
||||
[self.activityList removeObject:self.lookLoveModel];
|
||||
}
|
||||
[self configLookLove];
|
||||
|
||||
[self configFairy];
|
||||
[self configfirstRecharge];
|
||||
NSMutableArray *picArray = [NSMutableArray array];
|
||||
for (ActivityInfoModel *model in self.activityList) {
|
||||
[picArray addObject:model.bannerPic];
|
||||
[picArray addObject:model.icon];
|
||||
}
|
||||
self.pi_cycleScrollView.imageURLStringsGroup = picArray;
|
||||
if (self.activityList.count > 1) {
|
||||
@@ -283,6 +242,13 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
} else {
|
||||
[self.pi_cycleScrollView setAutoScroll:NO];
|
||||
}
|
||||
if(self.playList.count > 0){
|
||||
ActivityInfoModel *playModel = self.playList.firstObject;
|
||||
self.clickPlayView.model = playModel;
|
||||
self.clickPlayView.hidden = NO;
|
||||
}else{
|
||||
self.clickPlayView.hidden = YES;
|
||||
}
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_Blind || roomInfo.roomModeType == RoomModeType_Open_PK_Mode || roomInfo.roomModeType == RoomModeType_Open_Micro_Mode) {
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode ) {
|
||||
self.joinDatingView.image = [UIImage imageNamed:@"room_pk_normal_member_enter"];
|
||||
@@ -374,9 +340,16 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
if (imageUrlList.count > index) {
|
||||
NSString *pic = imageUrlList[index];
|
||||
NSMutableArray *inftList = [NSMutableArray array];
|
||||
NSMutableArray *modelList = [NSMutableArray array];
|
||||
if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||
[modelList addObjectsFromArray:self.playList];
|
||||
[modelList addObjectsFromArray:self.activityList];
|
||||
}else{
|
||||
modelList = self.activityList;
|
||||
}
|
||||
ActivityInfoModel * info;
|
||||
for (ActivityInfoModel * getInfo in self.activityList) {
|
||||
if([getInfo.bannerPic isEqualToString:pic]){
|
||||
for (ActivityInfoModel * getInfo in modelList) {
|
||||
if([getInfo.icon isEqualToString:pic]){
|
||||
info = getInfo;
|
||||
}
|
||||
if(getInfo.skipType == 3){
|
||||
@@ -384,12 +357,13 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
}
|
||||
if(info == nil)return;
|
||||
if (info.activityType == ActivityType_Love) {
|
||||
[self lookLoveTapRecognizer];
|
||||
} else if(info.activityType == ActivityType_First) {
|
||||
if([info.code isEqualToString:@"FIRST_CHARGE"]) {
|
||||
[self firstRechargeTapRecognizer];
|
||||
}else if(info.activityType == ActivityType_Fairy){
|
||||
|
||||
}else if ([info.code isEqualToString:@"FIND_LOVE"]) {
|
||||
[self lookLoveTapRecognizer];
|
||||
} else if([info.code isEqualToString:@"NAUTICAL_ADVENTURE"]) {
|
||||
[self sailTapRecognizer];
|
||||
}else if([info.code isEqualToString:@"SEIZE_TREASURE"]){
|
||||
XPTreasureFairyViewController * fairyVC = [[XPTreasureFairyViewController alloc] initWithdelegate:self.hostDelegate];
|
||||
fairyVC.roomUid =[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
fairyVC.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
|
||||
@@ -407,19 +381,21 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
if (info.skipType == ActivitySkipType_Room) {
|
||||
[self.hostDelegate exitRoom];
|
||||
|
||||
[XPRoomViewController openRoom:info.skipUri viewController:kWindow.rootViewController];
|
||||
[XPRoomViewController openRoom:info.url viewController:kWindow.rootViewController];
|
||||
|
||||
|
||||
} else if(info.skipType == ActivitySkipType_Web) {
|
||||
|
||||
PIRoomActivityWebView * webView = [[PIRoomActivityWebView alloc]initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight)];
|
||||
webView.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
webView.url = info.url;
|
||||
webView.infoList = inftList;
|
||||
[kWindow addSubview:webView];
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
webView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||||
}];
|
||||
|
||||
|
||||
PIRoomActivityWebView * webView = [[PIRoomActivityWebView alloc]initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight)];
|
||||
webView.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
webView.url = info.skipUri;
|
||||
webView.infoList = inftList;
|
||||
[kWindow addSubview:webView];
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
webView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,6 +454,69 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
self.openRedPacketHandle(redModel,self.hostDelegate.getRoomInfo.type,NO);
|
||||
}
|
||||
}
|
||||
#pragma mark - PIRoomActivityClickViewDelegate
|
||||
- (void)showChoosePlayViewAction{
|
||||
self.clickPlayView.hidden = YES;
|
||||
PIRoomActivityChoosePlayView *choosePlayView = [[PIRoomActivityChoosePlayView alloc]initWithFrame:CGRectZero];
|
||||
choosePlayView.delegate = self;
|
||||
choosePlayView.playList = self.playList;
|
||||
CGFloat y = self.frame.size.height + self.frame.origin.y - 124;
|
||||
[self.hostDelegate.getSuperView addSubview:choosePlayView];
|
||||
choosePlayView.frame = CGRectMake(KScreenWidth, y, 201, 124);
|
||||
|
||||
[UIView animateWithDuration:0.1 animations:^{
|
||||
|
||||
choosePlayView.frame = CGRectMake(KScreenWidth - 201, y, 201, 124);
|
||||
}];
|
||||
}
|
||||
-(void)clickPlayTypeWithModel:(ActivityInfoModel *)model{
|
||||
if ([model.code isEqualToString:@"FIND_LOVE"]) {
|
||||
[self lookLoveTapRecognizer];
|
||||
} else if([model.code isEqualToString:@"NAUTICAL_ADVENTURE"]) {
|
||||
[self sailTapRecognizer];
|
||||
}else if([model.code isEqualToString:@"SEIZE_TREASURE"]){
|
||||
XPTreasureFairyViewController * fairyVC = [[XPTreasureFairyViewController alloc] initWithdelegate:self.hostDelegate];
|
||||
fairyVC.roomUid =[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
fairyVC.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC addChildViewController:fairyVC];
|
||||
[fairyVC.navigationController setNavigationBarHidden:YES animated:NO];
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.view addSubview:fairyVC.view];
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
|
||||
fairyVC.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||||
|
||||
}completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
} else if(model.skipType == ActivitySkipType_Web) {
|
||||
if(model.skipType == ActivityShowType_Half){
|
||||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
webView.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
webView.url = model.url;
|
||||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
return;
|
||||
}
|
||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
webVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
webVC.url = model.url;
|
||||
[self.hostDelegate.getCurrentNav pushViewController:webVC animated:YES];
|
||||
}
|
||||
}
|
||||
#pragma mark- PIRoomActivityChoosePlayViewDelegate
|
||||
-(void)choosePlayTypeWithView:(PIRoomActivityChoosePlayView *)view model:(ActivityInfoModel *)model{
|
||||
[self hiddenViewActionWithView:view];
|
||||
[self clickPlayTypeWithModel:model];
|
||||
self.clickPlayView.model = model;
|
||||
}
|
||||
-(void)hiddenViewActionWithView:(PIRoomActivityChoosePlayView *)view{
|
||||
CGFloat y = self.frame.size.height + self.frame.origin.y - 124;
|
||||
[UIView animateWithDuration:0.1 animations:^{
|
||||
view.frame = CGRectMake(KScreenWidth, y, 201, 124);
|
||||
}completion:^(BOOL finished) {
|
||||
self.clickPlayView.hidden = NO;
|
||||
[view removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (SDCycleScrollView *)pi_cycleScrollView {
|
||||
if (!_pi_cycleScrollView) {
|
||||
@@ -509,24 +548,11 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentCenter;
|
||||
_stackView.spacing = 0;
|
||||
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UIImageView *)lookLoveImageView {
|
||||
if (!_lookLoveImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImage imageNamed:@"room_candy_tree_enter"];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_lookLoveImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_lookLoveImageView.userInteractionEnabled = YES;
|
||||
_lookLoveImageView.hidden = YES;
|
||||
_lookLoveImageView.image = [UIImage imageNamed:@"room_candy_tree_enter"];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(lookLoveTapRecognizer)];
|
||||
[_lookLoveImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _lookLoveImageView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -561,35 +587,9 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
return _sailingImageView;
|
||||
}
|
||||
- (ActivityInfoModel *)fairyActivityModel{
|
||||
if (!_fairyActivityModel){
|
||||
ActivityInfoModel *fairyModel = [ActivityInfoModel new];
|
||||
fairyModel.bannerName = YMLocalizedString(@"XPRoomActivityContainerView3");
|
||||
fairyModel.bannerPic = @"room_treasure_fairy_enter";
|
||||
_fairyActivityModel = fairyModel;
|
||||
_fairyActivityModel.activityType = ActivityType_Fairy;
|
||||
}
|
||||
return _fairyActivityModel;
|
||||
}
|
||||
- (ActivityInfoModel *)firstRechargeModel{
|
||||
if (!_firstRechargeModel){
|
||||
ActivityInfoModel * activityInfo = [[ActivityInfoModel alloc] init];
|
||||
activityInfo.bannerPic = @"room_first_recharge_enter";
|
||||
activityInfo.bannerName = YMLocalizedString(@"XPRoomActivityContainerView0");
|
||||
_firstRechargeModel = activityInfo;
|
||||
_firstRechargeModel.activityType = ActivityType_First;
|
||||
}
|
||||
return _firstRechargeModel;
|
||||
}
|
||||
-(ActivityInfoModel *)lookLoveModel{
|
||||
if (!_lookLoveModel){
|
||||
ActivityInfoModel * activityInfo = [[ActivityInfoModel alloc] init];
|
||||
activityInfo.bannerName = YMLocalizedString(@"XPRoomActivityContainerView1");
|
||||
_lookLoveModel = activityInfo;
|
||||
_lookLoveModel.activityType = ActivityType_Love;
|
||||
}
|
||||
return _lookLoveModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (PIRoomEnterRedPacketView *)redPacketView{
|
||||
if(!_redPacketView){
|
||||
_redPacketView = [[PIRoomEnterRedPacketView alloc]initWithFrame:CGRectZero];
|
||||
@@ -598,4 +598,13 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
return _redPacketView;
|
||||
}
|
||||
- (PIRoomActivityClickView *)clickPlayView{
|
||||
if(!_clickPlayView){
|
||||
_clickPlayView = [[PIRoomActivityClickView alloc]initWithFrame:CGRectZero];
|
||||
_clickPlayView.hidden = YES;
|
||||
_clickPlayView.delegate = self;
|
||||
}
|
||||
return _clickPlayView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user