房间玩法
This commit is contained in:
@@ -938,6 +938,9 @@
|
||||
E8A1E460276220DA00B294CA /* candyTree_banner.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8A1E45D276220DA00B294CA /* candyTree_banner.svga */; };
|
||||
E8A1E461276220DA00B294CA /* candyTree.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8A1E45E276220DA00B294CA /* candyTree.svga */; };
|
||||
E8A1E462276220DA00B294CA /* candyTree_light.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8A1E45F276220DA00B294CA /* candyTree_light.svga */; };
|
||||
E8A1F794290642500099C952 /* XPRoomMorePlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A1F793290642500099C952 /* XPRoomMorePlayViewController.m */; };
|
||||
E8A1F7972906426B0099C952 /* XPRoomMorePlayPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A1F7962906426B0099C952 /* XPRoomMorePlayPresenter.m */; };
|
||||
E8A1F79C290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A1F79B290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.m */; };
|
||||
E8A30BDA28533E59003B4873 /* SessionDiscoverNewTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BD928533E59003B4873 /* SessionDiscoverNewTableViewCell.m */; };
|
||||
E8A30BE328534A28003B4873 /* XPSessionFindNewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BE228534A28003B4873 /* XPSessionFindNewViewController.m */; };
|
||||
E8A30BE828534A63003B4873 /* XPSessionFindNewTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BE728534A63003B4873 /* XPSessionFindNewTableViewCell.m */; };
|
||||
@@ -2926,6 +2929,13 @@
|
||||
E8A1E45D276220DA00B294CA /* candyTree_banner.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = candyTree_banner.svga; sourceTree = "<group>"; };
|
||||
E8A1E45E276220DA00B294CA /* candyTree.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = candyTree.svga; sourceTree = "<group>"; };
|
||||
E8A1E45F276220DA00B294CA /* candyTree_light.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = candyTree_light.svga; sourceTree = "<group>"; };
|
||||
E8A1F792290642500099C952 /* XPRoomMorePlayViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMorePlayViewController.h; sourceTree = "<group>"; };
|
||||
E8A1F793290642500099C952 /* XPRoomMorePlayViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMorePlayViewController.m; sourceTree = "<group>"; };
|
||||
E8A1F7952906426B0099C952 /* XPRoomMorePlayPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMorePlayPresenter.h; sourceTree = "<group>"; };
|
||||
E8A1F7962906426B0099C952 /* XPRoomMorePlayPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMorePlayPresenter.m; sourceTree = "<group>"; };
|
||||
E8A1F7982906427D0099C952 /* XPRoomMorePlayProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMorePlayProtocol.h; sourceTree = "<group>"; };
|
||||
E8A1F79A290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMorePlayCollectionViewCell.h; sourceTree = "<group>"; };
|
||||
E8A1F79B290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMorePlayCollectionViewCell.m; sourceTree = "<group>"; };
|
||||
E8A30BD828533E59003B4873 /* SessionDiscoverNewTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionDiscoverNewTableViewCell.h; sourceTree = "<group>"; };
|
||||
E8A30BD928533E59003B4873 /* SessionDiscoverNewTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SessionDiscoverNewTableViewCell.m; sourceTree = "<group>"; };
|
||||
E8A30BE128534A28003B4873 /* XPSessionFindNewViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionFindNewViewController.h; sourceTree = "<group>"; };
|
||||
@@ -4773,15 +4783,6 @@
|
||||
path = Api;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9BAC92EF28E6A03E00147DD8 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9BAC92F028E6A05600147DD8 /* XPRoomActivityPlayModel.h */,
|
||||
9BAC92F128E6A05600147DD8 /* XPRoomActivityPlayModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9BB549632782F96F0090CD26 /* SubViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -7225,6 +7226,62 @@
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8A1F78D290641D80099C952 /* MorePlay */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8A1F791290642040099C952 /* Model */,
|
||||
E8A1F790290641FB0099C952 /* View */,
|
||||
E8A1F78F290641EB0099C952 /* Presenter */,
|
||||
E8A1F78E290641E50099C952 /* Protocol */,
|
||||
);
|
||||
path = MorePlay;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8A1F78E290641E50099C952 /* Protocol */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8A1F7982906427D0099C952 /* XPRoomMorePlayProtocol.h */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8A1F78F290641EB0099C952 /* Presenter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8A1F7952906426B0099C952 /* XPRoomMorePlayPresenter.h */,
|
||||
E8A1F7962906426B0099C952 /* XPRoomMorePlayPresenter.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8A1F790290641FB0099C952 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8A1F799290644C20099C952 /* Cell */,
|
||||
E8A1F792290642500099C952 /* XPRoomMorePlayViewController.h */,
|
||||
E8A1F793290642500099C952 /* XPRoomMorePlayViewController.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8A1F791290642040099C952 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9BAC92F028E6A05600147DD8 /* XPRoomActivityPlayModel.h */,
|
||||
9BAC92F128E6A05600147DD8 /* XPRoomActivityPlayModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8A1F799290644C20099C952 /* Cell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8A1F79A290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.h */,
|
||||
E8A1F79B290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8A30BDB28534667003B4873 /* FindNew */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -7471,6 +7528,7 @@
|
||||
E8AEAED8271413530017FCE0 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8A1F78D290641D80099C952 /* MorePlay */,
|
||||
E8A3538628FE5C5B0014A784 /* WishGift */,
|
||||
9B2F72CD28E45A1C0000E4FA /* QuickMessageView */,
|
||||
9BA812D328BF52A500783EA7 /* SendRedPacket */,
|
||||
@@ -7520,7 +7578,6 @@
|
||||
E8AEAEE527141ACC0017FCE0 /* ActivityContainerView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9BAC92EF28E6A03E00147DD8 /* Model */,
|
||||
E8AE427127153A3500BEEBB2 /* XPRoomActivityContainerView.h */,
|
||||
E8AE427227153A3500BEEBB2 /* XPRoomActivityContainerView.m */,
|
||||
9BAC92EC28E6989400147DD8 /* XPRoomActivityPlayView.h */,
|
||||
@@ -9282,6 +9339,7 @@
|
||||
9B8585D3278837CE00D7D5C6 /* NobleLevelUpModel.m in Sources */,
|
||||
9BD9A17927A0EC57004186FE /* XPMineVisitorPresenter.m in Sources */,
|
||||
E8BD0F8828A9E9E400DE050D /* RoomSailingPrizeModel.m in Sources */,
|
||||
E8A1F79C290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.m in Sources */,
|
||||
E8659909273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m in Sources */,
|
||||
E8B846CB26FDD7CD00A777FE /* XPMineRechargeViewController.m in Sources */,
|
||||
E86596512701A1C000846EBD /* StatisticsService.m in Sources */,
|
||||
@@ -9506,6 +9564,7 @@
|
||||
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */,
|
||||
E8664ED927E4355C000171BA /* XPRoomPKRecordTableViewCell.m in Sources */,
|
||||
E8C6FFD027548256004DC9F0 /* XPHomeListCollectionViewCell.m in Sources */,
|
||||
E8A1F794290642500099C952 /* XPRoomMorePlayViewController.m in Sources */,
|
||||
E84BF7DD277C765400EF8877 /* XPRoomRoleEmptyTableViewCell.m in Sources */,
|
||||
E8E859C428264C2300EE4857 /* HTTPDynamicFileResponse.m in Sources */,
|
||||
E8E859D028264C2300EE4857 /* DDData.m in Sources */,
|
||||
@@ -9532,6 +9591,7 @@
|
||||
E8DEC99E2764A5B60078CB70 /* XPRoomMoreMenuViewController.m in Sources */,
|
||||
E82325F2274E2DE6003A3332 /* XPUserCardViewController.m in Sources */,
|
||||
E8E859D228264C2300EE4857 /* HTTPServer.m in Sources */,
|
||||
E8A1F7972906426B0099C952 /* XPRoomMorePlayPresenter.m in Sources */,
|
||||
E8F65C222869A36F009BB5B9 /* ContentShareMonentsModel.m in Sources */,
|
||||
E8C167182806A03800ECB15C /* XPSuperAdminSetPresenter.m in Sources */,
|
||||
9B6E856E281AABAB0041A321 /* XPRoomRecommendModel.m in Sources */,
|
||||
|
22
xplan-ios/Assets.xcassets/Room/MoreMenu/room_menu_play_tip_bg.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/MoreMenu/room_menu_play_tip_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_menu_play_tip_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_menu_play_tip_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_menu_play_tip_bg.imageset/room_menu_play_tip_bg@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_menu_play_tip_bg.imageset/room_menu_play_tip_bg@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_menu_play_tip_bg.imageset/room_menu_play_tip_bg@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_menu_play_tip_bg.imageset/room_menu_play_tip_bg@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
22
xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_play.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_play.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_more_menu_play@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_more_menu_play@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_play.imageset/room_more_menu_play@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_play.imageset/room_more_menu_play@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_play.imageset/room_more_menu_play@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_play.imageset/room_more_menu_play@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
@@ -36,15 +36,13 @@
|
||||
#import "XPSailingViewController.h"
|
||||
#import "XPRoomActivityPlayView.h"
|
||||
|
||||
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate, XPRoomActivityPlayViewDelegate>
|
||||
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate>
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///轮播图
|
||||
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
|
||||
///
|
||||
@property (nonatomic,strong) UIView * placeHolderView;
|
||||
///玩法容器
|
||||
@property (nonatomic, strong) XPRoomActivityPlayView *playModeView;
|
||||
///首充的
|
||||
@property (nonatomic,strong) UIImageView *firstRechargeImageView;
|
||||
///参加相亲
|
||||
@@ -57,12 +55,7 @@
|
||||
@property (nonatomic,strong) NSMutableArray<NSString *> *imageUrlList;
|
||||
///是否加载了活动
|
||||
@property (nonatomic,assign) BOOL isLoadActivity;
|
||||
///房间玩法列表
|
||||
@property (nonatomic, strong) NSMutableArray *playModeArray;
|
||||
///航海玩法
|
||||
@property (nonatomic, strong) XPRoomActivityPlayModel *sailingModel;
|
||||
///糖果树玩法
|
||||
@property (nonatomic, strong) XPRoomActivityPlayModel *candyTreeModel;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -75,7 +68,6 @@
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self requestActivityList];
|
||||
[self configCandyTree];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -87,7 +79,6 @@
|
||||
[self.stackView addArrangedSubview:self.placeHolderView];
|
||||
[self.stackView addArrangedSubview:self.firstRechargeImageView];
|
||||
[self.stackView addArrangedSubview:self.joinDatingView];
|
||||
[self addSubview:self.playModeView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -96,12 +87,6 @@
|
||||
make.bottom.mas_equalTo(self);
|
||||
}];
|
||||
CGFloat itemWidth = KScreenHeight > 667 ? 65 : 55 * kScreenHeightScale;
|
||||
[self.playModeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self);
|
||||
make.top.mas_equalTo(itemWidth + 9);
|
||||
make.width.mas_equalTo(18);
|
||||
make.height.mas_equalTo(53);
|
||||
}];
|
||||
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth , itemWidth));
|
||||
}];
|
||||
@@ -124,7 +109,6 @@
|
||||
return [subView hitTest:convertPoint withEvent:event];
|
||||
}
|
||||
}
|
||||
[self xPRoomActivityPlayViewHideMorePlay];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -159,23 +143,6 @@
|
||||
} roomId:roomId type:@"2"];
|
||||
}
|
||||
|
||||
- (void)configCandyTree {
|
||||
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
if (userInfo.userLevelVo.experLevelSeq >= [ClientConfig shareConfig].openCandyTreeLimitLevel && [ClientConfig shareConfig].openCandyTree && roomInfo.boxSwitchVo.openBoxSwitch) {
|
||||
if (![self.playModeArray containsObject:self.candyTreeModel]) {
|
||||
[self.playModeArray addObject:self.candyTreeModel];
|
||||
}
|
||||
if (roomInfo.boxSwitchVo.openBoxIcon.length > 0) {
|
||||
self.candyTreeModel.imageName = roomInfo.boxSwitchVo.openBoxIcon;
|
||||
} else {
|
||||
self.candyTreeModel.imageName = @"openBoxIcon";
|
||||
}
|
||||
} else {
|
||||
[self.playModeArray removeObject:self.candyTreeModel];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)configLittleGameActivity {
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
||||
@@ -281,8 +248,6 @@
|
||||
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
|
||||
if (roomInfo.type == RoomType_MiniGame) {
|
||||
self.firstRechargeImageView.hidden = YES;
|
||||
[self.playModeArray removeAllObjects];
|
||||
[self updatePlayModeView];
|
||||
if (self.isLoadActivity) {
|
||||
[self configLittleGameActivity];
|
||||
} else {
|
||||
@@ -313,16 +278,6 @@
|
||||
} else {
|
||||
self.joinDatingView.hidden = YES;
|
||||
}
|
||||
|
||||
if ([ClientConfig shareConfig].configInfo.linearlyPoolOpenLevel <= self.hostDelegate.getUserInfo.userLevelVo.experLevelSeq) {
|
||||
if (![self.playModeArray containsObject:self.sailingModel]) {
|
||||
[self.playModeArray addObject:self.sailingModel];
|
||||
}
|
||||
} else {
|
||||
[self.playModeArray removeObject:self.sailingModel];
|
||||
}
|
||||
[self configCandyTree];
|
||||
[self updatePlayModeView];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,20 +285,6 @@
|
||||
[self onRoomUpdate];
|
||||
}
|
||||
|
||||
- (void)updatePlayModeView {
|
||||
CGFloat height = 53;
|
||||
if (self.playModeArray.count) {
|
||||
[self.playModeView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(height);
|
||||
}];
|
||||
} else {
|
||||
self.playModeView.playArray = nil;
|
||||
[self.playModeView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(0);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleNIMCustomMessage:(NIMMessage *)message {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
@@ -395,12 +336,8 @@
|
||||
if (self.activityList.count > index) {
|
||||
ActivityInfoModel * info = [self.activityList objectAtIndex:index];
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_banner_click eventAttributes:@{@"bannerName": info.bannerName}];
|
||||
if ([info.bannerName isEqualToString:@"糖果树"]) {
|
||||
[self candyTreeTapRecognizer];
|
||||
} else if([info.bannerName isEqualToString:@"首充有礼"]) {
|
||||
if([info.bannerName isEqualToString:@"首充有礼"]) {
|
||||
[self firstRechargeTapRecognizer];
|
||||
} else if ([info.bannerName isEqualToString:@"航海"]) {
|
||||
[self sailingTapRecognizer];
|
||||
} else {
|
||||
if (info.skipType == ActivitySkipType_Room) {
|
||||
[self.hostDelegate exitRoom];
|
||||
@@ -431,20 +368,6 @@
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)candyTreeTapRecognizer {
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_pop_click eventAttributes:@{@"bannerName": @"糖果树"}];
|
||||
XPCandyTreeViewController * candyTreeVC = [[XPCandyTreeViewController alloc] initWithDelegate:self.hostDelegate];
|
||||
candyTreeVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
[self.hostDelegate.getCurrentNav presentViewController:candyTreeVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)sailingTapRecognizer {
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_pop_click eventAttributes:@{@"bannerName": @"航海"}];
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
XPSailingViewController * sailingVC = [[XPSailingViewController alloc] initWithRoomUid:roomUid];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:sailingVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)firstRechargeTapRecognizer {
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_pop_click eventAttributes:@{@"bannerName": @"首充有礼"}];
|
||||
XPFirstRechargeViewController * firstRechargeVC = [[XPFirstRechargeViewController alloc] initWithNavigation:self.hostDelegate.getCurrentNav];
|
||||
@@ -478,39 +401,6 @@
|
||||
[self.hostDelegate.getCurrentNav presentViewController:arrangeMicVC animated:YES completion:nil];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomActivityPlayViewDelegate
|
||||
///展示更多玩法
|
||||
- (void)xPRoomActivityPlayViewShowMorePlay {
|
||||
self.playModeView.playArray = self.playModeArray;
|
||||
CGFloat itemWidth = 45;
|
||||
[self.playModeView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth * 2 + 20, 53));
|
||||
}];
|
||||
for (XPRoomActivityPlayModel *model in self.playModeArray) {
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_pop_show eventAttributes:@{@"bannerName": model.name}];
|
||||
}
|
||||
}
|
||||
|
||||
///隐藏更多玩法
|
||||
- (void)xPRoomActivityPlayViewHideMorePlay {
|
||||
if (self.hostDelegate.getRoomInfo.type != RoomType_MiniGame) {
|
||||
self.playModeView.playArray = nil;
|
||||
[self.playModeView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(18, 53));
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
///点击了某个玩法
|
||||
- (void)xPRoomActivityPlayViewDidClickPlay:(XPRoomActivityPlayModel *)model {
|
||||
if (model.playType == RoomActivityPlayTypeSailing) {
|
||||
[self sailingTapRecognizer];
|
||||
} else if (model.playType == RoomActivityPlayTypeCandyTree) {
|
||||
[self candyTreeTapRecognizer];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (SDCycleScrollView *)cycleScrollView {
|
||||
if (!_cycleScrollView) {
|
||||
@@ -580,39 +470,4 @@
|
||||
return _activityList;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)playModeArray {
|
||||
if (!_playModeArray) {
|
||||
_playModeArray = [NSMutableArray array];
|
||||
}
|
||||
return _playModeArray;
|
||||
}
|
||||
|
||||
- (XPRoomActivityPlayModel *)sailingModel {
|
||||
if (!_sailingModel) {
|
||||
_sailingModel = [[XPRoomActivityPlayModel alloc] init];
|
||||
_sailingModel.name = @"航海";
|
||||
_sailingModel.imageName = @"room_sailiing_enter";
|
||||
_sailingModel.playType = RoomActivityPlayTypeSailing;
|
||||
}
|
||||
return _sailingModel;
|
||||
}
|
||||
|
||||
- (XPRoomActivityPlayModel *)candyTreeModel {
|
||||
if (!_candyTreeModel) {
|
||||
_candyTreeModel = [[XPRoomActivityPlayModel alloc] init];
|
||||
_candyTreeModel.name = @"糖果树";
|
||||
_candyTreeModel.imageName = @"room_candy_tree_enter";
|
||||
_candyTreeModel.playType = RoomActivityPlayTypeCandyTree;
|
||||
}
|
||||
return _candyTreeModel;
|
||||
}
|
||||
|
||||
- (XPRoomActivityPlayView *)playModeView {
|
||||
if (!_playModeView) {
|
||||
_playModeView = [[XPRoomActivityPlayView alloc] init];
|
||||
_playModeView.delegate = self;
|
||||
}
|
||||
return _playModeView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -18,6 +18,7 @@ typedef NS_ENUM(NSInteger, XPRoomMenuItemType) {
|
||||
XPRoomMenuItemType_ArrangeMic,///排麦
|
||||
XPRoomMenuItemType_Gift,///礼物
|
||||
XPRoomMenuItemType_Noble,///贵族
|
||||
XPRoomMenuItemType_Play,///更多玩法
|
||||
};
|
||||
|
||||
@interface XPRoomMenuItem : NSObject
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#import "Themecolor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "ClientConfig.h"
|
||||
///Model
|
||||
#import "XPRoomMenuItem.h"
|
||||
#import "MicroQueueModel.h"
|
||||
@@ -33,6 +34,9 @@
|
||||
#import "XPRoomFaceViewController.h"
|
||||
#import "XPRoomHalfMessageView.h"
|
||||
#import "XPRoomMessageBubbleView.h"
|
||||
#import "XPRoomMorePlayViewController.h"
|
||||
|
||||
NSString * const kRoomPlayEnterKey = @"kRoomPlayEnterKey";
|
||||
|
||||
@interface XPRoomMenuContainerView ()<XPRoomMessageBubbleViewDelegate>
|
||||
///滚动的容器
|
||||
@@ -60,6 +64,12 @@
|
||||
@property (nonatomic,strong) XPRoomMessageBubbleView *miniMessageView;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate> delegate;
|
||||
///更多玩法
|
||||
@property (nonatomic,strong) UIButton *playButton;
|
||||
///玩法的提示
|
||||
@property (nonatomic,strong) UIImageView *playTipsImgView;
|
||||
///进房房间玩法tips 倒计时
|
||||
@property (strong, nonatomic) dispatch_source_t timer;
|
||||
@end
|
||||
|
||||
|
||||
@@ -174,6 +184,14 @@
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_noble_click];
|
||||
XPNobleCenterViewController * nobleVC = [[XPNobleCenterViewController alloc] initWithRoomUid:self.delegate.getRoomInfo.uid];
|
||||
[self.delegate.getCurrentNav pushViewController:nobleVC animated:YES];
|
||||
}
|
||||
break;
|
||||
case XPRoomMenuItemType_Play: {
|
||||
[self.playTipsImgView removeFromSuperview];
|
||||
[[NSUserDefaults standardUserDefaults] setValue:@"hasDisplay" forKey:kRoomPlayEnterKey];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
XPRoomMorePlayViewController * playVC = [[XPRoomMorePlayViewController alloc] initWithdelegate:self.delegate];
|
||||
[self.delegate.getCurrentNav presentViewController:playVC animated:YES completion:nil];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -207,6 +225,7 @@
|
||||
[self.stackView addArrangedSubview:self.arrangeMicButton];
|
||||
[self.stackView addArrangedSubview:self.messageButton];
|
||||
[self.stackView addArrangedSubview:self.moreButton];
|
||||
[self.stackView addArrangedSubview:self.playButton];
|
||||
[self.stackView addArrangedSubview:self.nobleButton];
|
||||
}
|
||||
|
||||
@@ -286,6 +305,62 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - 配置房间玩法
|
||||
- (void)configRoomPlayEnter {
|
||||
UserInfoModel * userInfo = self.delegate.getUserInfo;
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
if (([ClientConfig shareConfig].configInfo.linearlyPoolOpenLevel <= userInfo.userLevelVo.experLevelSeq) || (userInfo.userLevelVo.experLevelSeq >= [ClientConfig shareConfig].openCandyTreeLimitLevel && [ClientConfig shareConfig].openCandyTree && roomInfo.boxSwitchVo.openBoxSwitch)) {
|
||||
|
||||
NSString * hasDispaly = [[NSUserDefaults standardUserDefaults] objectForKey:kRoomPlayEnterKey];
|
||||
if (hasDispaly.length > 0) {
|
||||
return;
|
||||
}
|
||||
self.playButton.hidden = NO;
|
||||
if (!self.playTipsImgView.superview) {
|
||||
[self.superview insertSubview:self.playTipsImgView aboveSubview:self];
|
||||
[self.superview bringSubviewToFront:self.playTipsImgView];
|
||||
[self.playTipsImgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.playButton).offset(-24);
|
||||
make.bottom.mas_equalTo(self.playButton.mas_top).offset(-2);
|
||||
make.size.mas_equalTo(CGSizeMake(136, 23));
|
||||
}];
|
||||
|
||||
[self openCountdownWithTime:5];
|
||||
}
|
||||
} else {
|
||||
self.playButton.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
// 开始倒计时
|
||||
- (void)openCountdownWithTime:(int)totalTime{
|
||||
if (time <= 0) {
|
||||
return;
|
||||
}
|
||||
__block int time = totalTime; //倒计时时间
|
||||
if (self.timer != nil) {
|
||||
dispatch_source_cancel(self.timer);
|
||||
}
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
||||
dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行
|
||||
__weak typeof(self) weakself = self;
|
||||
dispatch_source_set_event_handler(self.timer, ^{
|
||||
__strong typeof(weakself) self = weakself;
|
||||
if(time <= 0){ //倒计时结束,关闭
|
||||
dispatch_source_cancel(self.timer);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.playTipsImgView.hidden = YES;
|
||||
[[NSUserDefaults standardUserDefaults] setValue:@"hasDisplay" forKey:kRoomPlayEnterKey];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
});
|
||||
}else{
|
||||
time--;
|
||||
}
|
||||
});
|
||||
dispatch_resume(self.timer);
|
||||
}
|
||||
|
||||
#pragma mark - RoomGuestDelegate
|
||||
- (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
||||
MicroQueueModel * model = [self findMySelfMicro:queue];
|
||||
@@ -304,6 +379,7 @@
|
||||
NSInteger unreadCount = [[NIMSDK sharedSDK].conversationManager allUnreadCount];
|
||||
self.messageButton.selected = unreadCount > 0;
|
||||
[self onRoomUpdate];
|
||||
[self configRoomPlayEnter];
|
||||
}
|
||||
|
||||
- (void)onRoomUpdate {
|
||||
@@ -508,6 +584,18 @@
|
||||
return _giftButton;
|
||||
}
|
||||
|
||||
- (UIButton *)playButton {
|
||||
if (!_playButton) {
|
||||
_playButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_playButton setImage:[UIImage imageNamed:@"room_more_menu_play"] forState:UIControlStateNormal];
|
||||
[_playButton setImage:[UIImage imageNamed:@"room_more_menu_play"] forState:UIControlStateSelected];
|
||||
_playButton.tag = XPRoomMenuItemType_Play;
|
||||
[_playButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _playButton;
|
||||
}
|
||||
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
@@ -548,4 +636,13 @@
|
||||
return _miniMessageView;
|
||||
}
|
||||
|
||||
- (UIImageView *)playTipsImgView {
|
||||
if (!_playTipsImgView) {
|
||||
_playTipsImgView = [[UIImageView alloc] init];
|
||||
_playTipsImgView.userInteractionEnabled = YES;
|
||||
_playTipsImgView.image = [UIImage imageNamed:@"room_menu_play_tip_bg"];
|
||||
}
|
||||
return _playTipsImgView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPRoomMorePlayPresenter.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/24.
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class RoomInfoModel, UserInfoModel;
|
||||
@interface XPRoomMorePlayPresenter : BaseMvpPresenter
|
||||
|
||||
- (void)getRoomMorePlayData:(RoomInfoModel *)roomInfo userInfo:(UserInfoModel *)userInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// XPRoomMorePlayPresenter.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/24.
|
||||
//
|
||||
|
||||
#import "XPRoomMorePlayPresenter.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "XPRoomActivityPlayModel.h"
|
||||
#import "ClientConfig.h"
|
||||
#import "XPRoomMorePlayProtocol.h"
|
||||
|
||||
@implementation XPRoomMorePlayPresenter
|
||||
|
||||
- (void)getRoomMorePlayData:(RoomInfoModel *)roomInfo userInfo:(UserInfoModel *)userInfo {
|
||||
NSMutableArray * data = [NSMutableArray array];
|
||||
///航海玩法
|
||||
XPRoomActivityPlayModel *sailingModel = [[XPRoomActivityPlayModel alloc] init];
|
||||
sailingModel.name = @"航海";
|
||||
sailingModel.imageName = @"room_sailiing_enter";
|
||||
sailingModel.playType = RoomActivityPlayTypeSailing;
|
||||
///糖果树玩法
|
||||
XPRoomActivityPlayModel * candyTreeModel = [[XPRoomActivityPlayModel alloc] init];
|
||||
candyTreeModel.name = @"糖果树";
|
||||
candyTreeModel.imageName = @"room_candy_tree_enter";
|
||||
candyTreeModel.playType = RoomActivityPlayTypeCandyTree;
|
||||
|
||||
if ([ClientConfig shareConfig].configInfo.linearlyPoolOpenLevel <= userInfo.userLevelVo.experLevelSeq) {
|
||||
[data addObject:sailingModel];
|
||||
}
|
||||
|
||||
if (userInfo.userLevelVo.experLevelSeq >= [ClientConfig shareConfig].openCandyTreeLimitLevel && [ClientConfig shareConfig].openCandyTree && roomInfo.boxSwitchVo.openBoxSwitch) {
|
||||
[data addObject:candyTreeModel];
|
||||
if (roomInfo.boxSwitchVo.openBoxIcon.length > 0) {
|
||||
candyTreeModel.imageName = roomInfo.boxSwitchVo.openBoxIcon;
|
||||
} else {
|
||||
candyTreeModel.imageName = @"room_candy_tree_enter";
|
||||
}
|
||||
}
|
||||
|
||||
[[self getView] getMorePlaysSuccess:data];
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// XPRoomMorePlayProtocol.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/24.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPRoomMorePlayProtocol <NSObject>
|
||||
|
||||
///获取更多玩法成功
|
||||
- (void)getMorePlaysSuccess:(NSArray *)list;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPRoomMorePlayCollectionViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/24.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPRoomActivityPlayModel;
|
||||
@interface XPRoomMorePlayCollectionViewCell : UICollectionViewCell
|
||||
@property (nonatomic,strong) XPRoomActivityPlayModel *playModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// XPRoomMorePlayCollectionViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/24.
|
||||
//
|
||||
|
||||
#import "XPRoomMorePlayCollectionViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "NetImageView.h"
|
||||
///Model
|
||||
#import "XPRoomActivityPlayModel.h"
|
||||
|
||||
@interface XPRoomMorePlayCollectionViewCell ()
|
||||
///显示logo
|
||||
@property (nonatomic,strong) NetImageView *logoImageView;
|
||||
///显示文案
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomMorePlayCollectionViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.contentView addSubview:self.logoImageView];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(64, 64));
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(7);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setPlayModel:(XPRoomActivityPlayModel *)playModel {
|
||||
_playModel = playModel;
|
||||
if (_playModel) {
|
||||
if ([_playModel.imageName hasPrefix:@"http"]) {
|
||||
self.logoImageView.imageUrl = _playModel.imageName;
|
||||
} else {
|
||||
self.logoImageView.image = [UIImage imageNamed:_playModel.imageName];
|
||||
}
|
||||
self.titleLabel.text = _playModel.name;
|
||||
}
|
||||
}
|
||||
|
||||
- (NetImageView *)logoImageView {
|
||||
if (!_logoImageView) {
|
||||
_logoImageView = [[NetImageView alloc] init];
|
||||
_logoImageView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _logoImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:10];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPRoomMorePlayViewController.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/24.
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomMorePlayViewController : MvpViewController
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,195 @@
|
||||
//
|
||||
// XPRoomMorePlayViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/24.
|
||||
//
|
||||
|
||||
#import "XPRoomMorePlayViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "XPMacro.h"
|
||||
#import "UIView+Corner.h"
|
||||
#import "StatisticsServiceHelper.h"
|
||||
///Model
|
||||
#import "XPRoomActivityPlayModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
///View
|
||||
#import "XPRoomMorePlayCollectionViewCell.h"
|
||||
#import "XPCandyTreeViewController.h"
|
||||
#import "XPSailingViewController.h"
|
||||
///P
|
||||
#import "XPRoomMorePlayPresenter.h"
|
||||
#import "XPRoomMorePlayProtocol.h"
|
||||
|
||||
@interface XPRoomMorePlayViewController ()<UICollectionViewDelegate, UICollectionViewDataSource, XPRoomMorePlayProtocol>
|
||||
///顶部
|
||||
@property (nonatomic,strong) UIView *topView;
|
||||
///列表
|
||||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSArray<XPRoomActivityPlayModel *> *datasource;
|
||||
///蒙层
|
||||
@property (nonatomic,strong) UIVisualEffectView *effectView;
|
||||
///host 代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
|
||||
@end
|
||||
|
||||
@implementation XPRoomMorePlayViewController
|
||||
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
||||
if (self = [super init]) {
|
||||
self.hostDelegate = delegate;
|
||||
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPRoomMorePlayPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self.presenter getRoomMorePlayData:self.hostDelegate.getRoomInfo userInfo:self.hostDelegate.getUserInfo];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.topView];
|
||||
[self.view addSubview:self.effectView];
|
||||
[self.view addSubview:self.collectionView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.collectionView.mas_top);
|
||||
}];
|
||||
|
||||
[self.effectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.collectionView);
|
||||
}];
|
||||
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(81 + 16 + kSafeAreaBottomHeight + 10);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)dismissVC {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.datasource.count;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPRoomMorePlayCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPRoomMorePlayCollectionViewCell class]) forIndexPath:indexPath];
|
||||
cell.playModel = [self.datasource objectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPRoomActivityPlayModel * info = [self.datasource objectAtIndex:indexPath.row];
|
||||
switch (info.playType) {
|
||||
case RoomActivityPlayTypeCandyTree:
|
||||
{
|
||||
[self dismissVC];
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_pop_click eventAttributes:@{@"bannerName": @"糖果树"}];
|
||||
XPCandyTreeViewController * candyTreeVC = [[XPCandyTreeViewController alloc] initWithDelegate:self.hostDelegate];
|
||||
candyTreeVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
[self.hostDelegate.getCurrentNav presentViewController:candyTreeVC animated:YES completion:nil];
|
||||
}
|
||||
break;
|
||||
case RoomActivityPlayTypeSailing:
|
||||
{
|
||||
[self dismissVC];
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_pop_click eventAttributes:@{@"bannerName": @"航海"}];
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
XPSailingViewController * sailingVC = [[XPSailingViewController alloc] initWithRoomUid:roomUid];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:sailingVC animated:YES completion:nil];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomMorePlayProtocol
|
||||
- (void)getMorePlaysSuccess:(NSArray *)list {
|
||||
self.datasource = list;
|
||||
CGFloat contentHeight= 24 + kSafeAreaBottomHeight + 10;
|
||||
CGFloat itemHeight = 81;
|
||||
int page = list.count % 3;
|
||||
int scale = (int)list.count / (int)3;
|
||||
if (page == 0) {
|
||||
contentHeight += (scale *itemHeight);
|
||||
} else {
|
||||
contentHeight += ((scale+1) *itemHeight + scale * 12);
|
||||
}
|
||||
CAShapeLayer * layer = [CAShapeLayer layer];
|
||||
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
|
||||
layer.path = path.CGPath;
|
||||
self.collectionView.layer.mask = layer;
|
||||
[self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(contentHeight);
|
||||
}];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)topView {
|
||||
if (!_topView) {
|
||||
_topView = [[UIView alloc] init];
|
||||
_topView.backgroundColor = [UIColor clearColor];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissVC)];
|
||||
[_topView addGestureRecognizer:tap];
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(KScreenWidth / 3.0, 81);
|
||||
layout.sectionInset = UIEdgeInsetsMake(16, 0, 0, 0);
|
||||
layout.minimumLineSpacing = 10;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerClass:[XPRoomMorePlayCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPRoomMorePlayCollectionViewCell class])];
|
||||
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (UIVisualEffectView *)effectView {
|
||||
if (!_effectView) {
|
||||
UIBlurEffect *beffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
_effectView = [[UIVisualEffectView alloc] initWithEffect:beffect];
|
||||
|
||||
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, KScreenHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
|
||||
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
||||
maskLayer.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||||
maskLayer.path = maskPath.CGPath;
|
||||
_effectView.layer.mask = maskLayer;
|
||||
}
|
||||
return _effectView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
Reference in New Issue
Block a user