基本完成 #64 功能
1. 移除旧游戏入口,增加新游戏入口 2. GameMenuView 增加同时支持玩法和小游戏 3. 增加房间类型的判断 4. 补充提示文本,部份未作多语言化,需要核对 优化: 1. 修正部分不正确的单词 2. 优化部份 API 的调用时机
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user