基本完成 #64 功能
1. 移除旧游戏入口,增加新游戏入口 2. GameMenuView 增加同时支持玩法和小游戏 3. 增加房间类型的判断 4. 补充提示文本,部份未作多语言化,需要核对 优化: 1. 修正部分不正确的单词 2. 优化部份 API 的调用时机
This commit is contained in:
22
YuMi/Assets.xcassets/chat/ms_room_game_button.imageset/Contents.json
vendored
Normal file
22
YuMi/Assets.xcassets/chat/ms_room_game_button.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_room_game_button@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_room_game_button@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/chat/ms_room_game_button.imageset/ms_room_game_button@2x.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/chat/ms_room_game_button.imageset/ms_room_game_button@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
BIN
YuMi/Assets.xcassets/chat/ms_room_game_button.imageset/ms_room_game_button@3x.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/chat/ms_room_game_button.imageset/ms_room_game_button@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
22
YuMi/Assets.xcassets/chat/ms_room_game_switch_button.imageset/Contents.json
vendored
Normal file
22
YuMi/Assets.xcassets/chat/ms_room_game_switch_button.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_room_game_switch_button@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_room_game_switch_button@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/chat/ms_room_game_switch_button.imageset/ms_room_game_switch_button@2x.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/chat/ms_room_game_switch_button.imageset/ms_room_game_switch_button@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
YuMi/Assets.xcassets/chat/ms_room_game_switch_button.imageset/ms_room_game_switch_button@3x.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/chat/ms_room_game_switch_button.imageset/ms_room_game_switch_button@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@@ -69,7 +69,6 @@
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
} showLoading:NO errorToast:NO] uid:roomUid intoUid:uid];
|
||||
}
|
||||
|
@@ -11,16 +11,19 @@
|
||||
#import "XPRedPacketModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "ActivityInfoModel.h"
|
||||
#import "LittleGameInfoModel.h"
|
||||
|
||||
typedef void(^OpenRedPacketHandle)(XPRedPacketModel *_Nullable,RoomType type ,BOOL isChangeRoom);
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomActivityContainerView : UIView<RoomGuestDelegate>
|
||||
@property(nonatomic,strong) NSMutableArray *redPacketList;
|
||||
@property(nonatomic,copy)OpenRedPacketHandle openRedPacketHandle;
|
||||
@property(nonatomic,strong) NSMutableArray *redPacketList;
|
||||
@property(nonatomic,strong) NSMutableArray<ActivityInfoModel *> *playList;
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate;
|
||||
@property(nonatomic,strong) NSMutableArray<LittleGameInfoModel *> *littleGameList;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
- (void)updateView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "Api+Room.h"
|
||||
#import "Api+TreasureFairy.h"
|
||||
#import "Api+LittleGame.h"
|
||||
#import "ClientConfig.h"
|
||||
#import "NetImageView.h"
|
||||
#import "TTPopup.h"
|
||||
@@ -26,6 +27,7 @@
|
||||
#import "FirstRechargeModel.h"
|
||||
#import "TreasureFairyLimitModel.h"
|
||||
#import "XPRedPacketResultModel.h"
|
||||
|
||||
///View
|
||||
#import "XPRoomHalfWebView.h"
|
||||
#import "XPCandyTreeViewController.h"
|
||||
@@ -41,6 +43,8 @@
|
||||
#import "PIRoomActivityWebView.h"
|
||||
#import "PIRoomActivityClickView.h"
|
||||
#import "PIRoomActivityChoosePlayView.h"
|
||||
#import "MSRoomMenuGameVC.h"
|
||||
|
||||
UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate,PIRoomEnterRedPacketViewDelegate,PIRoomActivityClickViewDelegate,PIRoomActivityChoosePlayViewDelegate>
|
||||
///容器
|
||||
@@ -50,8 +54,9 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
|
||||
///红包
|
||||
@property(nonatomic,strong) PIRoomEnterRedPacketView *redPacketView;
|
||||
///玩法
|
||||
@property(nonatomic,strong) PIRoomActivityClickView *clickPlayView;
|
||||
|
||||
///游戏菜单按钮
|
||||
@property(nonatomic, strong) UIButton *gameMenuButton;
|
||||
|
||||
///参加相亲
|
||||
@property (nonatomic,strong) UIImageView *joinDatingView;
|
||||
@@ -68,18 +73,24 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.hostDelegate = delegate;
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self requestActivityList];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)updateView {
|
||||
if (self.isLoadActivity) {
|
||||
[self configLittleGameActivity];
|
||||
} else {
|
||||
[self requestActivityList];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.stackView];
|
||||
@@ -88,9 +99,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
[self.stackView addArrangedSubview:emptyView];
|
||||
[self.stackView addArrangedSubview:self.redPacketView];
|
||||
[self.stackView addArrangedSubview:self.joinDatingView];
|
||||
[self.stackView addArrangedSubview:self.clickPlayView];
|
||||
|
||||
|
||||
[self.stackView addArrangedSubview:self.gameMenuButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -102,68 +111,76 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
[self.pi_cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(itemWidth , itemWidth));
|
||||
}];
|
||||
|
||||
[self.redPacketView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(58));
|
||||
}];
|
||||
|
||||
|
||||
[self.clickPlayView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
[self.gameMenuButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(0);
|
||||
make.size.mas_equalTo(CGSizeMake(81, 66));
|
||||
make.size.mas_equalTo(CGSizeMake(76, 76));
|
||||
}];
|
||||
|
||||
|
||||
[self.joinDatingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(35 * kScreenHeightScale);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)requestActivityList {
|
||||
|
||||
|
||||
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];
|
||||
@kWeakify(self);
|
||||
RACSubject* playRAC = [RACSubject subject];
|
||||
RACSubject* littleGameRAC = [RACSubject subject];
|
||||
[[RACSignal combineLatest:@[playRAC, littleGameRAC]
|
||||
reduce:^id(NSArray<ActivityInfoModel*> *playModels, NSArray<LittleGameInfoModel*> *littleGameModels){
|
||||
@kStrongify(self);
|
||||
self.playList = [NSMutableArray arrayWithArray:playModels];
|
||||
self.littleGameList = [NSMutableArray arrayWithArray:littleGameModels];
|
||||
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];
|
||||
[list sendNext:array];
|
||||
[list sendCompleted];
|
||||
return;
|
||||
}
|
||||
[list sendError:nil];
|
||||
} roomId:roomId];
|
||||
|
||||
|
||||
}] subscribeError:^(NSError * _Nullable error) {}];
|
||||
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
|
||||
[Api roomActivityList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if (code == 200) {
|
||||
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
|
||||
self.activityList = [NSMutableArray arrayWithArray:array];
|
||||
[self dealWithData];
|
||||
}
|
||||
} roomId:roomId];
|
||||
|
||||
[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;
|
||||
[playRAC sendNext:array];
|
||||
[playRAC sendCompleted];
|
||||
} else {
|
||||
[playRAC sendError:nil];
|
||||
}
|
||||
[play sendError:nil];
|
||||
} roomId:roomId];
|
||||
|
||||
|
||||
|
||||
|
||||
[Api getLittleGameList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSArray * array = [LittleGameInfoModel modelsWithArray:data.data];
|
||||
[littleGameRAC sendNext:array];
|
||||
[littleGameRAC sendCompleted];
|
||||
} else {
|
||||
[littleGameRAC sendError:nil];
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)dealWithData{
|
||||
self.isLoadActivity = YES;
|
||||
self.pi_cycleScrollView.hidden = NO;
|
||||
|
||||
if (self.hostDelegate.getRoomInfo.type == RoomType_Anchor) {
|
||||
[self.gameMenuButton removeFromSuperview];
|
||||
} else {
|
||||
self.gameMenuButton.hidden = NO;
|
||||
}
|
||||
|
||||
if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||
[self configLittleGameActivity];
|
||||
} else {
|
||||
|
||||
NSMutableArray *picArray = [NSMutableArray array];
|
||||
for (ActivityInfoModel *model in self.activityList) {
|
||||
[picArray addObject:model.icon];
|
||||
@@ -175,25 +192,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
} else {
|
||||
[self.pi_cycleScrollView setAutoScroll:NO];
|
||||
}
|
||||
|
||||
if(self.playList.count > 0){
|
||||
ActivityInfoModel *playModel = self.playList.firstObject;
|
||||
self.clickPlayView.model = playModel;
|
||||
// if(self.isShowChoosePlayView == NO){
|
||||
// self.clickPlayView.hidden = NO;
|
||||
// }
|
||||
}else{
|
||||
self.clickPlayView.hidden = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)configLittleGameActivity {
|
||||
|
||||
|
||||
NSMutableArray *list = [NSMutableArray array];
|
||||
|
||||
[list addObjectsFromArray:self.activityList];
|
||||
@@ -232,8 +234,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}];
|
||||
}
|
||||
self.redPacketView.hidden = YES;
|
||||
self.clickPlayView.hidden = YES;
|
||||
|
||||
|
||||
if (self.isLoadActivity) {
|
||||
[self configLittleGameActivity];
|
||||
} else {
|
||||
@@ -252,16 +253,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
} else {
|
||||
[self.pi_cycleScrollView setAutoScroll:NO];
|
||||
}
|
||||
|
||||
if(self.playList.count > 0){
|
||||
ActivityInfoModel *playModel = self.playList.firstObject;
|
||||
self.clickPlayView.model = playModel;
|
||||
// if(self.isShowChoosePlayView == NO){
|
||||
// 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 getLanguageImage:@"room_pk_normal_member_enter"];
|
||||
@@ -284,9 +276,6 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
} else {
|
||||
self.joinDatingView.hidden = YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(self.openRedPacketHandle){
|
||||
@@ -375,7 +364,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
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];
|
||||
// [fairyVC.navigationController setNavigationBarHidden:YES animated:NO];
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.view addSubview:fairyVC.view];
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
|
||||
@@ -409,12 +398,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
|
||||
-(void)jumpPlayActionWithIndex:(NSInteger)index imageUrlList:(NSArray *)imageUrlList{
|
||||
|
||||
if (imageUrlList.count > index) {
|
||||
NSString *pic = imageUrlList[index];
|
||||
NSMutableArray *inftList = [NSMutableArray array];
|
||||
NSMutableArray *modelList = [NSMutableArray array];
|
||||
[modelList addObjectsFromArray:self.playList];
|
||||
[modelList addObjectsFromArray:self.activityList];
|
||||
ActivityInfoModel * info;
|
||||
for (int i = 0 ; i < modelList.count; i++) {
|
||||
@@ -422,7 +409,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
if([getInfo.icon isEqualToString:pic]){
|
||||
info = getInfo;
|
||||
}
|
||||
if(getInfo.skipType == 3 && i > self.playList.count){
|
||||
if(getInfo.skipType == 3){
|
||||
[inftList addObject:getInfo];
|
||||
}
|
||||
}
|
||||
@@ -449,25 +436,22 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
|
||||
}];
|
||||
}else {
|
||||
|
||||
if(index < self.playList.count){
|
||||
|
||||
if(info.showType == ActivityShowType_Half){
|
||||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
webView.isPlayView = YES;
|
||||
webView.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
webView.url = info.skipContent;
|
||||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
return;
|
||||
}
|
||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
webVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
webVC.url = info.skipContent;
|
||||
[self.hostDelegate.getCurrentNav pushViewController:webVC animated:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// if(index < self.playList.count){
|
||||
// if(info.showType == ActivityShowType_Half){
|
||||
// XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
// webView.isPlayView = YES;
|
||||
// webView.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
// webView.url = info.skipContent;
|
||||
// [TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
// return;
|
||||
// }
|
||||
// XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
// webVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
// webVC.url = info.skipContent;
|
||||
// [self.hostDelegate.getCurrentNav pushViewController:webVC animated:YES];
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (info.skipType == ActivitySkipType_Room) {
|
||||
[self.hostDelegate exitRoom];
|
||||
|
||||
@@ -504,7 +488,6 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)firstRechargeTapRecognizer {
|
||||
@@ -544,20 +527,25 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
XPSailingViewController * sailingVC = [[XPSailingViewController alloc] initWithRoomUid:roomUid];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:sailingVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)didTapGameMenuButton {
|
||||
MSRoomMenuGameVC *vc = [[MSRoomMenuGameVC alloc] initWithDelegate:self.hostDelegate roomMenuType:MSRoomMenuTypeLittleGame];
|
||||
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
[self.hostDelegate.getCurrentNav presentViewController:vc animated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark- PIRoomEnterRedPacketViewDelegate
|
||||
-(void)openRedPacketWtihModel:(XPRedPacketModel *)redModel{
|
||||
-(void)openRedPacketWithModel:(XPRedPacketModel *)redModel{
|
||||
if(self.openRedPacketHandle){
|
||||
self.openRedPacketHandle(redModel,self.hostDelegate.getRoomInfo.type,NO);
|
||||
}
|
||||
}
|
||||
#pragma mark - PIRoomActivityClickViewDelegate
|
||||
- (void)showChoosePlayViewAction{
|
||||
self.clickPlayView.hidden = YES;
|
||||
self.isShowChoosePlayView = YES;
|
||||
// self.isShowChoosePlayView = 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;
|
||||
choosePlayView.tag = 98021;
|
||||
[self.hostDelegate.getSuperView addSubview:choosePlayView];
|
||||
@@ -612,7 +600,6 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
[UIView animateWithDuration:0.1 animations:^{
|
||||
view.frame = isMSRTL() ? CGRectMake(-201, y, 201, 124) : CGRectMake(KScreenWidth, y, 201, 124);
|
||||
}completion:^(BOOL finished) {
|
||||
// self.clickPlayView.hidden = NO;
|
||||
[view removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
@@ -637,14 +624,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
for (UIView *subView in _pi_cycleScrollView.subviews) {
|
||||
subView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
|
||||
}
|
||||
|
||||
}
|
||||
return _pi_cycleScrollView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
@@ -652,14 +635,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentCenter;
|
||||
_stackView.spacing = 0;
|
||||
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (UIImageView *)joinDatingView {
|
||||
if (!_joinDatingView) {
|
||||
_joinDatingView = [[UIImageView alloc] init];
|
||||
@@ -680,10 +659,6 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
return _activityList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- (PIRoomEnterRedPacketView *)redPacketView{
|
||||
if(!_redPacketView){
|
||||
_redPacketView = [[PIRoomEnterRedPacketView alloc]initWithFrame:CGRectZero];
|
||||
@@ -692,13 +667,17 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
|
||||
}
|
||||
return _redPacketView;
|
||||
}
|
||||
- (PIRoomActivityClickView *)clickPlayView{
|
||||
if(!_clickPlayView){
|
||||
_clickPlayView = [[PIRoomActivityClickView alloc]initWithFrame:CGRectZero];
|
||||
_clickPlayView.hidden = YES;
|
||||
_clickPlayView.delegate = self;
|
||||
|
||||
- (UIButton *)gameMenuButton {
|
||||
if (!_gameMenuButton) {
|
||||
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[b setImage:[UIImage imageNamed:@"ms_room_game_button"] forState:UIControlStateNormal];
|
||||
[b addTarget:self action:@selector(didTapGameMenuButton) forControlEvents:UIControlEventTouchUpInside];
|
||||
b.hidden = YES;
|
||||
_gameMenuButton = b;
|
||||
}
|
||||
return _clickPlayView;
|
||||
return _gameMenuButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface XPRoomFunctionContainerView : UIView <RoomGuestDelegate>
|
||||
///是否第一次更新在线人数
|
||||
@property(nonatomic,assign) BOOL isFirstUpdate;
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
- (void)hiddenSudGamePostionView;
|
||||
///获取当前的音乐
|
||||
- (Music *)getCurrentMusic;
|
||||
|
@@ -176,7 +176,7 @@
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.delegate = delegate;
|
||||
@@ -1857,6 +1857,7 @@
|
||||
}
|
||||
return _gameListView;
|
||||
}
|
||||
|
||||
- (XPAnchorPkPanelView *)anchorPKPanelView {
|
||||
if (!_anchorPKPanelView) {
|
||||
_anchorPKPanelView = [[XPAnchorPkPanelView alloc] init];
|
||||
|
@@ -17,8 +17,6 @@
|
||||
@interface XPLittleGameRoomListView ()<UITableViewDelegate, UITableViewDataSource>
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///当前游戏的类型
|
||||
@property (nonatomic,strong) UIButton *gamePlayButton;
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///原始数据源
|
||||
@@ -37,7 +35,6 @@
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -50,7 +47,6 @@
|
||||
self.layer.borderColor = UIColorRGBAlpha(0xffffff, 0.6).CGColor;
|
||||
self.backgroundColor = UIColorRGBAlpha(0x000000, 0.2);
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.gamePlayButton];
|
||||
[self.stackView addArrangedSubview:self.tableView];
|
||||
}
|
||||
|
||||
@@ -64,10 +60,6 @@
|
||||
make.leading.trailing.top.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.gamePlayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(25);
|
||||
}];
|
||||
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(25);
|
||||
}];
|
||||
@@ -111,7 +103,6 @@
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
self.tableView.hidden = YES;
|
||||
self.gamePlayButton.selected = NO;
|
||||
LittleGameInfoModel *info = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
if (info.mgId.integerValue != self.mgId.integerValue) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomLittleGameListView:didSelectItem:)]) {
|
||||
@@ -121,19 +112,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)gamePlayButtonAction:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomLittleGameListView:didSelectChooseType:)]) {
|
||||
[self.delegate xPRoomLittleGameListView:self didSelectChooseType:sender];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setMgId:(NSString *)mgId {
|
||||
_mgId = mgId;
|
||||
if (self.gameList.count > 0) {
|
||||
self.datasource = [self handleGameListData:self.gameList];
|
||||
[self.gamePlayButton setTitle:self.gameInfo.name forState:UIControlStateNormal];
|
||||
} else {
|
||||
[Api getLittleGameList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
@@ -146,7 +129,6 @@
|
||||
[dataArray addObject:gameInfo];
|
||||
self.gameList = [dataArray copy];
|
||||
self.datasource = [self handleGameListData:self.gameList];
|
||||
[self.gamePlayButton setTitle:self.gameInfo.name forState:UIControlStateNormal];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -188,20 +170,4 @@
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (UIButton *)gamePlayButton {
|
||||
if (!_gamePlayButton) {
|
||||
_gamePlayButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_gamePlayButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_gamePlayButton setImage:[UIImage imageNamed:@"room_info_little_game_down_arrow"] forState:UIControlStateNormal];
|
||||
[_gamePlayButton setImage:[UIImage imageNamed:@"room_info_little_game_up_arrow"] forState:UIControlStateSelected];
|
||||
_gamePlayButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_gamePlayButton setTitle:YMLocalizedString(@"XPLittleGameRoomListView1") forState:UIControlStateNormal];
|
||||
_gamePlayButton.selected = NO;
|
||||
[_gamePlayButton addTarget:self action:@selector(gamePlayButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_gamePlayButton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
|
||||
_gamePlayButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
|
||||
}
|
||||
return _gamePlayButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -7,10 +7,12 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ActivityInfoModel.h"
|
||||
#import "LittleGameInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomMenuGameCell : UICollectionViewCell
|
||||
@property(nonatomic,strong) ActivityInfoModel *model;
|
||||
@property(nonatomic,strong) LittleGameInfoModel *littleGameModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -35,6 +35,7 @@
|
||||
make.leading.trailing.equalTo(self.contentView).inset(kGetScaleWidth(5));
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setModel:(ActivityInfoModel *)model{
|
||||
_model = model;
|
||||
_gameView.image = nil;
|
||||
@@ -42,9 +43,17 @@
|
||||
self.gameView.image = image;
|
||||
}];
|
||||
_textView.text = _model.name;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)setLittleGameModel:(LittleGameInfoModel *)littleGameModel{
|
||||
_littleGameModel = littleGameModel;
|
||||
_gameView.image = nil;
|
||||
[_gameView loadImageWithUrl:littleGameModel.pic completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.gameView.image = image;
|
||||
}];
|
||||
_textView.text = littleGameModel.name;
|
||||
}
|
||||
|
||||
#pragma mark - 懒加载
|
||||
- (NetImageView *)gameView{
|
||||
if(!_gameView){
|
||||
|
@@ -10,8 +10,15 @@
|
||||
#import "RoomGuestDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, MSRoomMenuType) {
|
||||
MSRoomMenuTypeGame,
|
||||
MSRoomMenuTypeLittleGame,
|
||||
};
|
||||
|
||||
|
||||
@interface MSRoomMenuGameVC : MvpViewController<RoomGuestDelegate>
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate roomMenuType:(MSRoomMenuType)type;
|
||||
//- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -15,8 +15,13 @@
|
||||
#import "XPRoomViewController.h"
|
||||
#import "MSRoomGameWebVC.h"
|
||||
#import "XPRoomAnimationView.h"
|
||||
|
||||
#import "Api+LittleGame.h"
|
||||
#import "Api+RoomSetting.h"
|
||||
|
||||
@interface MSRoomMenuGameVC ()<MSRoomMenuGameViewDelegate>
|
||||
@property(nonatomic,strong) MSRoomMenuGameView *gameView;
|
||||
@property(nonatomic, assign) MSRoomMenuType type;
|
||||
///host 代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
|
||||
@end
|
||||
@@ -25,6 +30,7 @@
|
||||
-(void)dealloc{
|
||||
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate{
|
||||
self = [super init];
|
||||
if(self){
|
||||
@@ -32,6 +38,17 @@
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate
|
||||
roomMenuType:(MSRoomMenuType)type {
|
||||
self = [super init];
|
||||
if(self){
|
||||
self.type = type;
|
||||
self.hostDelegate = delegate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
@@ -39,23 +56,57 @@
|
||||
[super viewDidLoad];
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
[self getGameData];
|
||||
[self loadMenuData];
|
||||
}
|
||||
|
||||
- (void)loadMenuData {
|
||||
switch (self.type) {
|
||||
case MSRoomMenuTypeGame:
|
||||
[self getGameData];
|
||||
break;
|
||||
case MSRoomMenuTypeLittleGame:
|
||||
[self getLittleGameList];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)getGameData{
|
||||
NSMutableArray *playList = [self.hostDelegate getPlayList];
|
||||
if(playList.count > 0){
|
||||
_gameView.playList = playList;
|
||||
return;
|
||||
}
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
|
||||
[Api getPlayList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
|
||||
NSMutableArray *resourceList = [self.hostDelegate getPlayList];
|
||||
if(resourceList.count > 0){
|
||||
_gameView.playList = resourceList;
|
||||
return;
|
||||
}
|
||||
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
|
||||
@kWeakify(self);
|
||||
[Api getPlayList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
@kStrongify(self);
|
||||
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
|
||||
self.gameView.playList = [[NSMutableArray alloc]initWithArray:array];
|
||||
|
||||
}
|
||||
} roomId:roomId];
|
||||
}
|
||||
} roomId:roomId];
|
||||
}
|
||||
|
||||
- (void)getLittleGameList {
|
||||
NSMutableArray *resourceList = [self.hostDelegate getLittleGameList];
|
||||
if(resourceList.count > 0){
|
||||
_gameView.littleGameList = resourceList;
|
||||
return;
|
||||
}
|
||||
|
||||
@kWeakify(self);
|
||||
[Api getLittleGameList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
@kStrongify(self);
|
||||
NSArray * array = [LittleGameInfoModel modelsWithArray:data.data];
|
||||
self.gameView.littleGameList = array.mutableCopy;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)installUI{
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.gameView];
|
||||
@@ -70,7 +121,62 @@
|
||||
- (void)didClickBackBtnAction{
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
-(void)ms_didSelectItemAtIndexPath:(ActivityInfoModel *)model{
|
||||
|
||||
-(void)ms_didSelectLittleGameItemAtIndexPath:(LittleGameInfoModel *)model {
|
||||
if (self.hostDelegate.isManagerOrOwner) {
|
||||
@kWeakify(self);
|
||||
[TTPopup alertWithMessage:@"确认开启游戏?" confirmHandler:^{
|
||||
@kStrongify(self);
|
||||
[self startLittleGameWith:model];
|
||||
} cancelHandler:^{}];
|
||||
} else {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:@"无权发起该游戏,请联系房主或管理员~"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)startLittleGameWith:(LittleGameInfoModel *)model {
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
NSMutableDictionary * params = [NSMutableDictionary dictionary];
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
[params setObject:ticket forKey:@"ticket"];
|
||||
[params setObject:uid forKey:@"uid"];
|
||||
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.uid] forKey:@"roomUid"];
|
||||
if (roomInfo.title.length > 0) {
|
||||
[params setObject:roomInfo.title forKey:@"title"];
|
||||
}
|
||||
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
[params setObject:roomInfo.roomPwd forKey:@"roomPwd"];
|
||||
} else{
|
||||
[params setObject:@"" forKey:@"roomPwd"];
|
||||
}
|
||||
|
||||
if (roomInfo.tagId > 0) {
|
||||
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.tagId] forKey:@"tagId"];
|
||||
}
|
||||
if ([model.mgId isEqualToString:@"0"]) {
|
||||
[params setObject:@(RoomType_Game) forKey:@"type"];
|
||||
[params setObject:@"0" forKey:@"mgId"];
|
||||
} else {
|
||||
[params setObject:@(RoomType_MiniGame) forKey:@"type"];
|
||||
[params setObject:model.mgId forKey:@"mgId"];
|
||||
}
|
||||
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
|
||||
|
||||
@kWeakify(self);
|
||||
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
if (code == 200) {
|
||||
|
||||
} else {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
}
|
||||
} params:params];
|
||||
}
|
||||
|
||||
-(void)ms_didSelectItemAtIndexPath:(ActivityInfoModel *)model {
|
||||
self.gameView.hidden = YES;
|
||||
if ([model.code isEqualToString:@"FIND_LOVE"]) {
|
||||
[self lookLoveTapRecognizer];
|
||||
@@ -88,9 +194,7 @@
|
||||
[fairyVC.navigationController setNavigationBarHidden:YES animated:NO];
|
||||
[vc.view addSubview:fairyVC.view];
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
|
||||
fairyVC.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||||
|
||||
}completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
@@ -128,10 +232,9 @@
|
||||
[self.hostDelegate.getSuperView addSubview:vc.view];
|
||||
[self.hostDelegate.getSuperView bringSubviewToFront:animationView];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)lookLoveTapRecognizer {
|
||||
|
||||
if ([self.hostDelegate isKindOfClass:[XPRoomViewController class]]){
|
||||
XPCandyTreeViewController * candyTreeVC = [[XPCandyTreeViewController alloc] initWithDelegate:self.hostDelegate];
|
||||
candyTreeVC.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
|
||||
@@ -145,14 +248,14 @@
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)sailTapRecognizer {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
XPSailingViewController * sailingVC = [[XPSailingViewController alloc] initWithRoomUid:roomUid];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:sailingVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - 懒加载
|
||||
- (MSRoomMenuGameView *)gameView{
|
||||
if(!_gameView){
|
||||
|
@@ -7,17 +7,20 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ActivityInfoModel.h"
|
||||
#import "LittleGameInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MSRoomMenuGameViewDelegate <NSObject>
|
||||
|
||||
-(void)didClickBackBtnAction;
|
||||
-(void)ms_didSelectLittleGameItemAtIndexPath:(LittleGameInfoModel *)model;
|
||||
-(void)ms_didSelectItemAtIndexPath:(ActivityInfoModel *)model;
|
||||
@end
|
||||
|
||||
|
||||
@interface MSRoomMenuGameView : UIView
|
||||
@property(nonatomic,strong) NSMutableArray<ActivityInfoModel *> *playList;
|
||||
@property(nonatomic,strong) NSMutableArray<LittleGameInfoModel *> *littleGameList;
|
||||
@property(nonatomic,weak) id<MSRoomMenuGameViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
|
@@ -7,7 +7,11 @@
|
||||
|
||||
#import "MSRoomMenuGameView.h"
|
||||
#import "MSRoomMenuGameCell.h"
|
||||
#import "XNDJTDDLoadingTool.h"
|
||||
#import "MSRoomMenuGameEmptyCell.h"
|
||||
|
||||
static const NSInteger kItemsPerRow = 5;
|
||||
|
||||
@interface MSRoomMenuGameView()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
|
||||
@property(nonatomic,strong) UIButton *backBtn;
|
||||
@property(nonatomic,strong) UIView *ms_bgView;
|
||||
@@ -35,8 +39,8 @@
|
||||
}];
|
||||
[self.ms_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.leading.trailing.equalTo(self).inset(kGetScaleWidth(0));
|
||||
make.height.mas_equalTo(kGetScaleWidth(247));
|
||||
|
||||
make.height.mas_equalTo(kGetScaleWidth(246));
|
||||
|
||||
}];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.ms_bgView);
|
||||
@@ -49,40 +53,71 @@
|
||||
}
|
||||
-(void)setPlayList:(NSMutableArray<ActivityInfoModel *> *)playList{
|
||||
_playList = playList;
|
||||
if(_playList.count < 6 && _playList.count > 0){
|
||||
[self.ms_bgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kGetScaleWidth(130));
|
||||
|
||||
}];
|
||||
}
|
||||
[self updateViewHeightWithItemCount:playList.count];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.collectionView reloadData];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setLittleGameList:(NSMutableArray<LittleGameInfoModel *> *)littleGameList {
|
||||
_littleGameList = littleGameList;
|
||||
[self updateViewHeightWithItemCount:littleGameList.count];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.collectionView reloadData];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)updateViewHeightWithItemCount:(NSInteger)count {
|
||||
// 调整这里,确认间距
|
||||
NSInteger lineNum = (count + kItemsPerRow - 1)/kItemsPerRow;
|
||||
CGFloat height = 20 + 56 * lineNum + 44 * (lineNum - 1) + 70;
|
||||
[self.ms_bgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kGetScaleWidth(height));
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSInteger)countOfCurrentType {
|
||||
return self.littleGameList.count > 0 ? self.littleGameList.count : self.playList.count;
|
||||
}
|
||||
|
||||
#pragma mark- UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
CGFloat width = (KScreenWidth-kGetScaleWidth(6))/5;
|
||||
return self.playList.count > 0 ? CGSizeMake(width, kGetScaleWidth(100)): CGSizeMake(KScreenWidth, kGetScaleWidth(200));
|
||||
return [self countOfCurrentType] > 0 ? CGSizeMake(width, kGetScaleWidth(100)): CGSizeMake(KScreenWidth, kGetScaleWidth(200));
|
||||
}
|
||||
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
|
||||
return self.playList.count > 0 ? UIEdgeInsetsMake(0, kGetScaleWidth(3), 0, kGetScaleWidth(3)): UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
return [self countOfCurrentType] > 0 ? UIEdgeInsetsMake(0, kGetScaleWidth(3), 0, kGetScaleWidth(3)): UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
}
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.playList.count > 0 ? self.playList.count : 1;
|
||||
return [self countOfCurrentType] > 0 ? [self countOfCurrentType] : 1;
|
||||
}
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.playList.count == 0){
|
||||
if ([self countOfCurrentType] == 0){
|
||||
MSRoomMenuGameEmptyCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([MSRoomMenuGameEmptyCell class]) forIndexPath:indexPath];
|
||||
return cell;
|
||||
}
|
||||
|
||||
MSRoomMenuGameCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([MSRoomMenuGameCell class]) forIndexPath:indexPath];
|
||||
cell.model = [self.playList safeObjectAtIndex1:indexPath.row];
|
||||
if (_littleGameList.count > 0){
|
||||
cell.littleGameModel = [self.littleGameList safeObjectAtIndex1:indexPath.row];
|
||||
} else {
|
||||
cell.model = [self.playList safeObjectAtIndex1:indexPath.row];
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(ms_didSelectItemAtIndexPath:)]){
|
||||
[self.delegate ms_didSelectItemAtIndexPath:[self.playList safeObjectAtIndex1:indexPath.row]];
|
||||
if (self.delegate) {
|
||||
if (self.littleGameList != nil &&
|
||||
self.littleGameList.count > 0 &&
|
||||
[self.delegate respondsToSelector:@selector(ms_didSelectLittleGameItemAtIndexPath:)]) {
|
||||
[self.delegate ms_didSelectLittleGameItemAtIndexPath:[self.littleGameList safeObjectAtIndex1:indexPath.row]];
|
||||
}
|
||||
else if (self.playList != nil &&
|
||||
self.playList.count > 0 &&
|
||||
[self.delegate respondsToSelector:@selector(ms_didSelectItemAtIndexPath:)]) {
|
||||
[self.delegate ms_didSelectItemAtIndexPath:[self.playList safeObjectAtIndex1:indexPath.row]];
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
@@ -104,8 +139,7 @@
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
MSBaseRTLFlowLayout *layout = [[MSBaseRTLFlowLayout alloc] init];
|
||||
|
||||
|
||||
|
||||
layout.minimumLineSpacing = 0;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
|
@@ -200,7 +200,7 @@
|
||||
break;
|
||||
case MSRoomMenuItemType_Game:
|
||||
{
|
||||
MSRoomMenuGameVC *vc = [[MSRoomMenuGameVC alloc]initWithDelegate:self.delegate];
|
||||
MSRoomMenuGameVC *vc = [[MSRoomMenuGameVC alloc]initWithDelegate:self.delegate roomMenuType:MSRoomMenuTypeGame];
|
||||
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
[self.delegate.getCurrentNav presentViewController:vc animated:YES completion:nil];
|
||||
break;
|
||||
@@ -375,7 +375,7 @@
|
||||
|
||||
- (void)onRoomUpdate {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
UserInfoModel * userInfo = self.delegate.getUserInfo;
|
||||
// UserInfoModel * userInfo = self.delegate.getUserInfo;
|
||||
|
||||
// if (userInfo.isFirstCharge) {
|
||||
// [self.giftButton setImage:[UIImage getLanguageImage:@"room_menu_gift_first_recharge"] forState:UIControlStateNormal];
|
||||
|
@@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (RoomInfoModel*)getRoomInfo;
|
||||
- (UserInfoModel*)getUserInfo;
|
||||
- (BOOL)isManagerOrOwner;
|
||||
- (void)exitRoom;
|
||||
- (void)miniRoom;
|
||||
- (UINavigationController *)getCurrentNav;
|
||||
@@ -40,7 +41,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(BOOL)getIsMiniEnter;
|
||||
///屏蔽
|
||||
-(void)requesstShieldingAction;
|
||||
-(NSMutableArray *)getPlayList;;
|
||||
|
||||
///获取活动列表
|
||||
-(NSMutableArray *)getPlayList;
|
||||
|
||||
///获取小游戏列表
|
||||
-(NSMutableArray *)getLittleGameList;
|
||||
|
||||
-(NSInteger)getPublicScreenType;
|
||||
@end
|
||||
|
||||
|
@@ -202,7 +202,7 @@
|
||||
return itemCell;
|
||||
|
||||
}
|
||||
XPGiftItemCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class]) forIndexPath:indexPath];
|
||||
XPGiftItemCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class]) forIndexPath:indexPath];
|
||||
|
||||
cell.usingplaceType = self.usingplaceType;
|
||||
cell.curUserNobleLevel = self.curUserNobleLevel;
|
||||
|
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol PIRoomEnterRedPacketViewDelegate <NSObject>
|
||||
|
||||
-(void)openRedPacketWtihModel:(XPRedPacketModel *_Nullable)redModel;
|
||||
-(void)openRedPacketWithModel:(XPRedPacketModel *_Nullable)redModel;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -203,8 +203,8 @@
|
||||
self.redPacketModel = self.redPacketList.firstObject;
|
||||
self.hidden = NO;
|
||||
self.pi_redNum = @(self.redPacketList.count).stringValue;
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(openRedPacketWtihModel:)]){
|
||||
[self.delegate openRedPacketWtihModel:self.redPacketModel];
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(openRedPacketWithModelopenRedPacketWithModelopenRedPacketWithModel:)]){
|
||||
[self.delegate openRedPacketWithModel:self.redPacketModel];
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -226,8 +226,8 @@
|
||||
}
|
||||
[self.redPacketList replaceObjectAtIndex:[self.redPacketList indexOfObject:self.redPacketModel] withObject:redModel];
|
||||
self.redPacketModel = redModel;
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(openRedPacketWtihModel:)]){
|
||||
[self.delegate openRedPacketWtihModel:self.redPacketModel];
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(openRedPacketWithModelopenRedPacketWithModelopenRedPacketWithModel:)]){
|
||||
[self.delegate openRedPacketWithModel:self.redPacketModel];
|
||||
}
|
||||
}
|
||||
} redEnvelopeId:self.redPacketModel.redEnvelopeId];
|
||||
|
@@ -94,7 +94,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
- (NSInteger)countOfMicroView {
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
|
||||
@implementation AnchorStageView
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
- (NSInteger)countOfMicroView {
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
@@ -70,7 +70,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
- (NSInteger)countOfMicroView {
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
|
||||
|
||||
@interface LittleGameScrollStageView ()
|
||||
|
||||
@property (nonatomic, strong) UIScrollView *scrolView;
|
||||
@property (nonatomic, strong) UIScrollView *scrollView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -37,50 +37,70 @@ UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
if (self = [super initWithDelegate:delegate]) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeViewState:) name:kRoomRoomLittleGameMiniStageNotificationKey object:nil];
|
||||
NSInteger microCount = self.countOfMircoView;
|
||||
for (UIView *microView in self.subviews) {
|
||||
[microView removeFromSuperview];
|
||||
- (void)setupObserver {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeViewState:) name:kRoomRoomLittleGameMiniStageNotificationKey object:nil];
|
||||
}
|
||||
|
||||
- (CGFloat)widthOfMic {
|
||||
return 70;
|
||||
}
|
||||
|
||||
- (CGFloat)spaceOfMic {
|
||||
return 16;
|
||||
// 下面的方法是用来适配屏幕的计算,不滚动,全部在屏幕内显示
|
||||
// return (KScreenWidth - mcWidth * [self countOfMicroView] - paddingH * 2) / ([self countOfMicroView] - 1);
|
||||
}
|
||||
|
||||
- (void)setupMicroScrollView {
|
||||
NSInteger microCount = self.countOfMicroView;
|
||||
for (UIView *microView in self.subviews) {
|
||||
[microView removeFromSuperview];
|
||||
}
|
||||
[self addSubview:self.scrollView];
|
||||
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
CGFloat spaceWidth = [self spaceOfMic];
|
||||
self.scrollView.contentSize = CGSizeMake((microCount - 1) * spaceWidth + paddingH * 2 + mcWidth * microCount, mcHeight);
|
||||
for (int i = 0; i < microCount; i++) {
|
||||
UIView* microView = [self microViewForIndex:i];
|
||||
if (microView) {
|
||||
microView.tag = i;
|
||||
microView.frame = [self rectForViewAtIndex:i];
|
||||
[self.scrollView addSubview:microView];
|
||||
}
|
||||
[self addSubview:self.scrolView];
|
||||
[self.scrolView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
CGFloat spaceWidth = (KScreenWidth - mcWidth * 6 - paddingH * 2) / 5;
|
||||
self.scrolView.contentSize = CGSizeMake((microCount - 1) * spaceWidth + paddingH * 2 + mcWidth * microCount, mcHeight);
|
||||
for (int i = 0; i < microCount; i++) {
|
||||
UIView* microView = [self microViewForIndex:i];
|
||||
if (microView) {
|
||||
microView.tag = i;
|
||||
microView.frame = [self rectForViewAtIndex:i];
|
||||
[self.scrolView addSubview:microView];
|
||||
}
|
||||
if (isMSRTL()) {
|
||||
self.scrollView.transform = CGAffineTransformMakeRotation(M_PI);
|
||||
NSArray *subViews = self.scrollView.subviews;
|
||||
for (UIView *subView in subViews) {
|
||||
if ([subView isKindOfClass:[LittleGameMicroView class]]) {
|
||||
subView.transform = CGAffineTransformMakeRotation(M_PI);
|
||||
}
|
||||
}
|
||||
if (isMSRTL()) {
|
||||
self.scrolView.transform = CGAffineTransformMakeRotation(M_PI);
|
||||
NSArray *subViews = self.scrolView.subviews;
|
||||
for (UIView *subView in subViews) {
|
||||
if ([subView isKindOfClass:[LittleGameMicroView class]]) {
|
||||
subView.transform = CGAffineTransformMakeRotation(M_PI);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
self.scrolView.transform = CGAffineTransformIdentity;
|
||||
NSArray *subViews = self.scrolView.subviews;
|
||||
for (UIView *subView in subViews) {
|
||||
if ([subView isKindOfClass:[LittleGameMicroView class]]) {
|
||||
subView.transform = CGAffineTransformIdentity;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
self.scrollView.transform = CGAffineTransformIdentity;
|
||||
NSArray *subViews = self.scrollView.subviews;
|
||||
for (UIView *subView in subViews) {
|
||||
if ([subView isKindOfClass:[LittleGameMicroView class]]) {
|
||||
subView.transform = CGAffineTransformIdentity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
if (self = [super initWithDelegate:delegate]) {
|
||||
|
||||
[self setupObserver];
|
||||
[self setupMicroScrollView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
return self.hostDelegate.getRoomInfo.mgMicNum ? self.hostDelegate.getRoomInfo.mgMicNum : 6;
|
||||
- (NSInteger)countOfMicroView {
|
||||
return 9; //self.hostDelegate.getRoomInfo.mgMicNum ? self.hostDelegate.getRoomInfo.mgMicNum : 6;
|
||||
}
|
||||
|
||||
- (UIView<MicroViewProtocol> *)microViewForIndex:(NSInteger)index {
|
||||
@@ -88,14 +108,11 @@ UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
|
||||
if (microView) {
|
||||
return microView;
|
||||
}
|
||||
return [[LittleGameMicroView alloc]init];
|
||||
return [[LittleGameMicroView alloc] init];
|
||||
}
|
||||
|
||||
/**
|
||||
◯ ◯ ◯ ◯ ◯ ◯
|
||||
*/
|
||||
- (CGRect)rectForViewAtIndex:(NSInteger)index {
|
||||
CGFloat spaceWidth = (KScreenWidth - mcWidth * 6 - paddingH * 2) / 5;
|
||||
CGFloat spaceWidth = [self spaceOfMic];
|
||||
|
||||
return CGRectMake(paddingH + index * (mcWidth + spaceWidth), 0, mcWidth, mcHeight);
|
||||
}
|
||||
@@ -107,9 +124,9 @@ UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
|
||||
- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid {
|
||||
NSInteger index = [self getIndexByUid:uid];
|
||||
CGPoint point = CGPointZero;
|
||||
CGFloat spaceWidth = (KScreenWidth - mcWidth * 6 - paddingH * 2) / 5;
|
||||
CGFloat spaceWidth = [self spaceOfMic];
|
||||
point= CGPointMake(paddingH + index * (mcWidth + spaceWidth) + mcWidth / 2, mcHeight / 2 - 10);
|
||||
point = [self.scrolView convertPoint:point toView:nil];
|
||||
point = [self.scrollView convertPoint:point toView:nil];
|
||||
if (point.x > KScreenWidth) {
|
||||
point = CGPointZero;
|
||||
}
|
||||
@@ -128,21 +145,20 @@ UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
|
||||
[super didSelectAtIndex:index];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - 通知
|
||||
- (void)changeViewState:(NSNotification *)notification {
|
||||
NSDictionary * dic = notification.object;
|
||||
self.hidden = [[dic objectForKey:@"isMini"] boolValue];
|
||||
}
|
||||
|
||||
- (UIScrollView *)scrolView {
|
||||
if (!_scrolView) {
|
||||
_scrolView = [[UIScrollView alloc] init];
|
||||
_scrolView.scrollEnabled = YES;
|
||||
_scrolView.showsHorizontalScrollIndicator = NO;
|
||||
_scrolView.clipsToBounds = NO;
|
||||
- (UIScrollView *)scrollView {
|
||||
if (!_scrollView) {
|
||||
_scrollView = [[UIScrollView alloc] init];
|
||||
_scrollView.scrollEnabled = YES;
|
||||
_scrollView.showsHorizontalScrollIndicator = NO;
|
||||
_scrollView.clipsToBounds = NO;
|
||||
}
|
||||
return _scrolView;
|
||||
return _scrollView;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -41,7 +41,7 @@ UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
- (NSInteger)countOfMicroView {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
@implementation SocialStageView
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
- (NSInteger)countOfMicroView {
|
||||
return 9;
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* 坑位数目
|
||||
*/
|
||||
- (NSInteger)countOfMircoView;
|
||||
- (NSInteger)countOfMicroView;
|
||||
/**
|
||||
* 坑位区域的高度(宽度默认屏幕宽度)
|
||||
*/
|
||||
|
@@ -87,7 +87,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
NSInteger microCount = self.countOfMircoView;
|
||||
NSInteger microCount = self.countOfMicroView;
|
||||
for (int i = 0; i < microCount; i++) {
|
||||
UIView* microView = [self microViewForIndex:i];
|
||||
if (microView) {
|
||||
@@ -267,7 +267,7 @@
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
BOOL leaveMode = roomInfo.leaveMode;
|
||||
NSMutableArray *statisMicArray = [NSMutableArray array];
|
||||
for (int i = 0; i < self.countOfMircoView; i++) {
|
||||
for (int i = 0; i < self.countOfMicroView; i++) {
|
||||
MicroQueueModel * model = [self.micQueue objectForKey:[self indexToPosition:i]];
|
||||
|
||||
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
||||
@@ -445,7 +445,7 @@
|
||||
- (void)onRoomUpdate {
|
||||
self.isMiniEnter = NO;
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
for (int i = 0; i < self.countOfMircoView; i++) {
|
||||
for (int i = 0; i < self.countOfMicroView; i++) {
|
||||
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
||||
[view showGiftValueMode:roomInfo.showGiftValue];
|
||||
if(roomInfo.showGiftValue == NO){
|
||||
@@ -453,7 +453,7 @@
|
||||
}
|
||||
}
|
||||
if (self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind && self.hostDelegate.getRoomInfo.blindDateState == RoomPlayDateingType_Pick) {
|
||||
for (int i = 0; i < self.countOfMircoView; i++) {
|
||||
for (int i = 0; i < self.countOfMicroView; i++) {
|
||||
MicroQueueModel * model = [self.micQueue objectForKey:[self indexToPosition:i]];
|
||||
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
||||
[view configRoomInfo:roomInfo];
|
||||
@@ -565,7 +565,7 @@
|
||||
}
|
||||
}
|
||||
if(userInfo.isNoProhibitMic == YES){
|
||||
for (int i = 0; i < self.countOfMircoView; i++) {
|
||||
for (int i = 0; i < self.countOfMicroView; i++) {
|
||||
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
||||
[view configPkBtn:userInfo];
|
||||
}
|
||||
@@ -918,7 +918,7 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
- (NSInteger)countOfMicroView {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -961,7 +961,7 @@
|
||||
}
|
||||
|
||||
- (UIView<MicroViewProtocol> *)findMicroViewByUid:(NSString *)uid {
|
||||
for (int i = 0; i < self.countOfMircoView; i++) {
|
||||
for (int i = 0; i < self.countOfMicroView; i++) {
|
||||
MicroQueueModel* model = [self.micQueue objectForKey:[self indexToPosition:i]];
|
||||
if (model.userInfo && model.userInfo.uid == uid.intValue) {
|
||||
return [self findMicroViewByIndex:i];
|
||||
@@ -1009,7 +1009,7 @@
|
||||
|
||||
- (NSMutableArray *)microViews {
|
||||
if (!_microViews) {
|
||||
_microViews = [NSMutableArray arrayWithCapacity:self.countOfMircoView];
|
||||
_microViews = [NSMutableArray arrayWithCapacity:self.countOfMicroView];
|
||||
}
|
||||
return _microViews;
|
||||
}
|
||||
@@ -1017,7 +1017,7 @@
|
||||
- (NSMutableDictionary<NSString *, MicroQueueModel *> *)micQueue {
|
||||
if (!_micQueue) {
|
||||
_micQueue= [NSMutableDictionary dictionary];
|
||||
for (int i = 0; i < self.countOfMircoView; i++) {
|
||||
for (int i = 0; i < self.countOfMicroView; i++) {
|
||||
NSString* position = [self indexToPosition:i];
|
||||
MicroQueueModel *micSequence = [[MicroQueueModel alloc]init];
|
||||
micSequence.userInfo = nil;
|
||||
|
@@ -62,6 +62,7 @@
|
||||
#import "XPWebViewController.h"
|
||||
#import "SessionViewController.h"
|
||||
#import "XPFreeGiftsObtainView.h"
|
||||
#import "MSRoomMenuGameVC.h"
|
||||
|
||||
///P
|
||||
#import "XPRoomPresenter.h"
|
||||
@@ -162,6 +163,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
@property(nonatomic,assign) BOOL isShowRedPacket;
|
||||
@property(nonatomic,copy) NSString *releaseCoins;
|
||||
@property(nonatomic,copy) NSString *myCoins;
|
||||
|
||||
@property(nonatomic,strong) UIButton *exitGameButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomViewController
|
||||
@@ -290,6 +294,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[self exitOldRoom];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self handleActivityContainerViewEvents];
|
||||
|
||||
if (self.isMiniEnter) {
|
||||
[XNDJTDDLoadingTool showAnchorLoading:self.navigationController.view];
|
||||
[self.presenter initEnterRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
|
||||
@@ -416,29 +422,6 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[self.view addSubview:self.roomHeaderView];
|
||||
[self.view addSubview:self.functionView];
|
||||
[self.view addSubview:self.animationView];
|
||||
|
||||
@kWeakify(self);
|
||||
self.activityContainerView.openRedPacketHandle = ^(XPRedPacketModel * _Nullable redModel,RoomType type,BOOL isChangeRoom) {
|
||||
@kStrongify(self);
|
||||
if(isChangeRoom == YES){
|
||||
self.redPacketView.type = type;
|
||||
self.redPacketView.redPacketList = self.activityContainerView.redPacketList;
|
||||
return;
|
||||
}
|
||||
|
||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
view.delegate = self;
|
||||
self.isShowRedPacket = YES;
|
||||
view.receiveModel = redModel;
|
||||
for (UIView *subView in self.view.subviews) {
|
||||
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
||||
view.alphaView.backgroundColor = [UIColor clearColor];
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self.view addSubview:view];
|
||||
[self.view bringSubviewToFront:view];
|
||||
};
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -543,12 +526,36 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
make.width.mas_equalTo(87);
|
||||
}];
|
||||
|
||||
|
||||
[self.functionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.anchorScrollView.middleImageView);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)handleActivityContainerViewEvents {
|
||||
@kWeakify(self);
|
||||
self.activityContainerView.openRedPacketHandle = ^(XPRedPacketModel * _Nullable redModel,RoomType type,BOOL isChangeRoom) {
|
||||
@kStrongify(self);
|
||||
if(isChangeRoom == YES){
|
||||
self.redPacketView.type = type;
|
||||
self.redPacketView.redPacketList = self.activityContainerView.redPacketList;
|
||||
return;
|
||||
}
|
||||
|
||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
view.delegate = self;
|
||||
self.isShowRedPacket = YES;
|
||||
view.receiveModel = redModel;
|
||||
for (UIView *subView in self.view.subviews) {
|
||||
if([subView isKindOfClass:[XPReceiveRedPacketView class]]) {
|
||||
view.alphaView.backgroundColor = [UIColor clearColor];
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self.view addSubview:view];
|
||||
[self.view bringSubviewToFront:view];
|
||||
};
|
||||
}
|
||||
|
||||
- (void)exitOldRoom {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", [XPRoomMiniManager shareManager].getRoomInfo.uid];
|
||||
if (roomUid.integerValue > 0 && roomUid.integerValue != self.roomUid.integerValue) {
|
||||
@@ -612,15 +619,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
self.stageView = [[AnchorStageView alloc] initWithDelegate:self];
|
||||
}
|
||||
}else if(self.roomInfo.type == RoomType_MiniGame) {
|
||||
if (self.roomInfo.mgMicNum > 6 && ![self.stageView isKindOfClass:[LittleGameScrollStageView class]]) {
|
||||
[self.stageView removeFromSuperview];
|
||||
self.stageView = nil;
|
||||
self.stageView = [[LittleGameScrollStageView alloc] initWithDelegate:self];
|
||||
} else if (self.roomInfo.mgMicNum <= 6 && ![self.stageView isKindOfClass:[LittleGameStageView class]]) {
|
||||
[self.stageView removeFromSuperview];
|
||||
self.stageView = nil;
|
||||
self.stageView = [[LittleGameStageView alloc] initWithDelegate:self];
|
||||
}
|
||||
[self.stageView removeFromSuperview];
|
||||
self.stageView = nil;
|
||||
self.stageView = [[LittleGameScrollStageView alloc] initWithDelegate:self];
|
||||
}else if(self.roomInfo.hadChangeRoomType && ![self.stageView isKindOfClass:[SocialStageView class]]) {
|
||||
[self.stageView removeFromSuperview];
|
||||
self.stageView = nil;
|
||||
@@ -628,13 +629,13 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!self.stageView.superview) {
|
||||
[self.view insertSubview:self.stageView belowSubview:self.roomHeaderView];
|
||||
}
|
||||
|
||||
|
||||
|
||||
[self addExitGameButton];
|
||||
|
||||
if (self.roomInfo.type == RoomType_MiniGame) {
|
||||
[self.stageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.mas_equalTo(self.view);
|
||||
@@ -740,15 +741,97 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
make.bottom.mas_equalTo(self.quickMessageContainerView.mas_top).mas_offset(-5);
|
||||
make.width.mas_equalTo(87);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)setRoomInfo:(RoomInfoModel *)roomInfo {
|
||||
if (_roomInfo == roomInfo) {
|
||||
return;
|
||||
}
|
||||
_roomInfo = roomInfo;
|
||||
[self.activityContainerView updateView];
|
||||
}
|
||||
|
||||
#pragma mark - Game Switch
|
||||
- (void)addExitGameButton {
|
||||
[self removeExitGameButton];
|
||||
|
||||
if (self.roomInfo.type != RoomType_MiniGame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_exitGameButton == nil) {
|
||||
_exitGameButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_exitGameButton setTitle:@"切换" forState:UIControlStateNormal];
|
||||
[_exitGameButton setImage:[UIImage imageNamed:@"ms_room_game_switch_button"] forState:UIControlStateNormal];
|
||||
[_exitGameButton addTarget:self action:@selector(didTapExitGameButton) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
[self.view addSubview:self.exitGameButton];
|
||||
[self.exitGameButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.stageView.mas_bottom).offset(10);
|
||||
make.left.mas_equalTo(self.view).offset(12);
|
||||
make.width.height.equalTo(@21);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)removeExitGameButton {
|
||||
[self.exitGameButton removeFromSuperview];
|
||||
}
|
||||
|
||||
- (void)didTapExitGameButton {
|
||||
if ([self.littleGameView isInSudGame]) {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPRoomFunctionContainerView19")];
|
||||
} else {
|
||||
@kWeakify(self);
|
||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPRoomFunctionContainerView20") confirmHandler:^{
|
||||
@kStrongify(self);
|
||||
[XNDJTDDLoadingTool showLoading];
|
||||
[self exitLittleGame];
|
||||
} cancelHandler:^{ }];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)exitLittleGame {
|
||||
RoomInfoModel * roomInfo = self.getRoomInfo;
|
||||
NSMutableDictionary * params = [NSMutableDictionary dictionary];
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
[params setObject:ticket forKey:@"ticket"];
|
||||
[params setObject:uid forKey:@"uid"];
|
||||
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.uid] forKey:@"roomUid"];
|
||||
if (roomInfo.title.length > 0) {
|
||||
[params setObject:roomInfo.title forKey:@"title"];
|
||||
}
|
||||
|
||||
if (roomInfo.roomPwd.length > 0) {
|
||||
[params setObject:roomInfo.roomPwd forKey:@"roomPwd"];
|
||||
} else{
|
||||
[params setObject:@"" forKey:@"roomPwd"];
|
||||
}
|
||||
|
||||
if (roomInfo.tagId > 0) {
|
||||
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.tagId] forKey:@"tagId"];
|
||||
}
|
||||
|
||||
[params setObject:@(RoomType_Game) forKey:@"type"];
|
||||
[params setObject:@"0" forKey:@"mgId"];
|
||||
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
|
||||
|
||||
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
} else {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
}
|
||||
} params:params];
|
||||
}
|
||||
|
||||
#pragma mark- XPReceiveRedPacketViewDelegate
|
||||
- (void)closeViewAction{
|
||||
self.isShowRedPacket = NO;
|
||||
|
||||
}
|
||||
#pragma mark- PIRoomEnterRedPacketViewDelegate
|
||||
- (void)openRedPacketWtihModel:(XPRedPacketModel *)redModel{
|
||||
- (void)openRedPacketWithModel:(XPRedPacketModel *)redModel{
|
||||
XPReceiveRedPacketView *view = [[XPReceiveRedPacketView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
view.receiveModel = redModel;
|
||||
view.delegate = self;
|
||||
@@ -1027,14 +1110,11 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
self.roomInfo = roomInfo;
|
||||
self.userInfo = userInfo;
|
||||
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
//获取一下红包信息
|
||||
[self.presenter getRedPacket:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]];
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
if (roomInfo.type == RoomType_Anchor) {//个播房,获取下一个房间
|
||||
[self handleInitAnchorRoom];
|
||||
[self showAnchorScrollTipView];
|
||||
@@ -1878,10 +1958,20 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
- (UserInfoModel *)getUserInfo {
|
||||
return self.userInfo;
|
||||
}
|
||||
|
||||
- (BOOL)isManagerOrOwner {
|
||||
return self.roomUid.integerValue == self.userInfo.uid ||
|
||||
[self.superMangerList filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"uid == %d", self.userInfo.uid]] > 0;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)getPlayList{
|
||||
return self.activityContainerView.playList;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)getLittleGameList {
|
||||
return self.activityContainerView.littleGameList;
|
||||
}
|
||||
|
||||
- (void)exitRoom {
|
||||
[self.stageView exitRoom];
|
||||
[self.menuContainerView menuResignFirstResponder];
|
||||
@@ -2296,7 +2386,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
|
||||
- (XPRoomActivityContainerView *)activityContainerView {
|
||||
if (!_activityContainerView) {
|
||||
_activityContainerView = [[XPRoomActivityContainerView alloc] initWithdelegate:self];
|
||||
_activityContainerView = [[XPRoomActivityContainerView alloc] initWithDelegate:self];
|
||||
|
||||
}
|
||||
return _activityContainerView;
|
||||
@@ -2311,7 +2401,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
|
||||
- (XPRoomFunctionContainerView *)functionView {
|
||||
if (!_functionView) {
|
||||
_functionView = [[XPRoomFunctionContainerView alloc] initWithdelegate:self];
|
||||
_functionView = [[XPRoomFunctionContainerView alloc] initWithDelegate:self];
|
||||
}
|
||||
return _functionView;
|
||||
}
|
||||
|
@@ -1723,6 +1723,8 @@ ineHeadView12" = "الحمل";
|
||||
"XPRoomFunctionContainerView12" = "لم يتم تحديد موضوع بعد";
|
||||
"XPRoomFunctionContainerView13" = "ابدأ الاختيار>";
|
||||
"XPRoomFunctionContainerView18" = "غير مسموح بتغيير اللعبة أو وضع اللعبة وأنت في اللعبة!";
|
||||
"XPRoomFunctionContainerView19" = "اللعبة جارية ولا يمكن إيقافها!";
|
||||
"XPRoomFunctionContainerView20" = "هل أنت متأكد من التبديل إلى غرفة مشتركة؟";
|
||||
|
||||
"XPRoomBackContainerView0" = "فشل تحميل صورة الخلفية الخاصة بالVIP";
|
||||
"XPRoomBackContainerView1" = "فشل تحميل صورة الخلفية الخاصة بالمشغل";
|
||||
|
@@ -1465,6 +1465,8 @@
|
||||
"XPRoomFunctionContainerView12" = "Topic not set";
|
||||
"XPRoomFunctionContainerView13" = "Start Selection>";
|
||||
"XPRoomFunctionContainerView18" = "Cannot switch games or gameplay during the game!";
|
||||
"XPRoomFunctionContainerView19" = "The game is in progress and cannot be stopped!";
|
||||
"XPRoomFunctionContainerView20" = "Are you sure you want to switch to a normal room?";
|
||||
|
||||
"XPRoomBackContainerView0" = "Exclusive background image for VIP failed to load";
|
||||
"XPRoomBackContainerView1" = "Personal broadcast background image failed to load";
|
||||
|
@@ -1076,6 +1076,8 @@
|
||||
"XPRoomFunctionContainerView12" = "暂未设置话题";
|
||||
"XPRoomFunctionContainerView13" = "开始选择>";
|
||||
"XPRoomFunctionContainerView18" = "游戏中不可切换游戏或玩法!";
|
||||
"XPRoomFunctionContainerView19" = "游戏进行中,不可中止!";
|
||||
"XPRoomFunctionContainerView20" = "確認切換成普通房嗎?";
|
||||
|
||||
"XPRoomBackContainerView0" = "VIP专属背景图加载失败";
|
||||
"XPRoomBackContainerView1" = "个播背景图加载失败";
|
||||
|
@@ -1079,6 +1079,8 @@
|
||||
"XPRoomFunctionContainerView12" = "暫未設置話題";
|
||||
"XPRoomFunctionContainerView13" = "開始選擇>";
|
||||
"XPRoomFunctionContainerView18" = "遊戲中不可切換遊戲或玩法!";
|
||||
"XPRoomFunctionContainerView19" = "遊戲進行中,不可中止!";
|
||||
"XPRoomFunctionContainerView20" = "确认切换成普通房吗?";
|
||||
|
||||
"XPRoomBackContainerView0" = "VIP專屬背景圖加載失敗";
|
||||
"XPRoomBackContainerView1" = "個播背景圖加載失敗";
|
||||
|
Reference in New Issue
Block a user