@@ -24,7 +24,6 @@ typedef NS_ENUM(NSInteger, ActivityType) {
|
||||
ActivityType_Love = 1,///寻爱
|
||||
ActivityType_First = 2,///首充
|
||||
ActivityType_Fairy = 3,///夺宝精灵
|
||||
|
||||
};
|
||||
|
||||
@interface ActivityInfoModel : PIBaseModel
|
||||
|
@@ -8,10 +8,12 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ActivityInfoModel.h"
|
||||
#import "LittleGameInfoModel.h"
|
||||
#import "XPRoomMoreItemModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomMenuGameCell : UICollectionViewCell
|
||||
@property(nonatomic,strong) ActivityInfoModel *model;
|
||||
@property(nonatomic,strong) XPRoomMoreItemModel *moreItemModel;
|
||||
@property(nonatomic,strong) LittleGameInfoModel *littleGameModel;
|
||||
@end
|
||||
|
||||
|
@@ -45,6 +45,11 @@
|
||||
_textView.text = _model.name;
|
||||
}
|
||||
|
||||
- (void)setMoreItemModel:(XPRoomMoreItemModel *)moreItemModel {
|
||||
_moreItemModel = moreItemModel;
|
||||
_gameView.image = [UIImage imageNamed:moreItemModel.imageName];
|
||||
}
|
||||
|
||||
- (void)setLittleGameModel:(LittleGameInfoModel *)littleGameModel{
|
||||
_littleGameModel = littleGameModel;
|
||||
_gameView.image = nil;
|
||||
|
@@ -11,8 +11,8 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, MSRoomMenuType) {
|
||||
MSRoomMenuTypeGame,
|
||||
MSRoomMenuTypeLittleGame,
|
||||
MSRoomMenuTypeGame, // 玩法
|
||||
MSRoomMenuTypeLittleGame, // 小游戏
|
||||
};
|
||||
|
||||
|
||||
|
@@ -15,7 +15,12 @@
|
||||
#import "XPRoomViewController.h"
|
||||
#import "MSRoomGameWebVC.h"
|
||||
#import "XPRoomAnimationView.h"
|
||||
#import "XPRoomMoreItemModel.h"
|
||||
#import "GuildSuperAdminInfoModel.h"
|
||||
#import "XPRoomPKViewController.h"
|
||||
#import "XPAcrossRoomPKViewController.h"
|
||||
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "Api+LittleGame.h"
|
||||
#import "Api+RoomSetting.h"
|
||||
|
||||
@@ -75,7 +80,7 @@
|
||||
-(void)getGameData{
|
||||
NSMutableArray *resourceList = [self.hostDelegate getPlayList];
|
||||
if(resourceList.count > 0){
|
||||
_gameView.playList = resourceList;
|
||||
[self updateGamePlayList:resourceList];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,11 +90,69 @@
|
||||
if (code == 200) {
|
||||
@kStrongify(self);
|
||||
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
|
||||
self.gameView.playList = [[NSMutableArray alloc]initWithArray:array];
|
||||
[self updateGamePlayList:array];
|
||||
}
|
||||
} roomId:roomId];
|
||||
}
|
||||
|
||||
- (void)updateGamePlayList:(NSArray *)array {
|
||||
NSMutableArray *tempArray = [[NSMutableArray alloc] initWithArray:array];
|
||||
|
||||
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
if (uid.length > 0) {
|
||||
BOOL meIsSuperAdmin = NO;
|
||||
for (GuildSuperAdminInfoModel *managerInfo in self.hostDelegate.getRoomSuperAdminList) {
|
||||
if ([managerInfo.uid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
||||
meIsSuperAdmin = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = roomId;
|
||||
request.userIds = @[uid];
|
||||
@kWeakify(self);
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
@kStrongify(self);
|
||||
if (error == nil) {
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
BOOL isCreator = member.type == NIMChatroomMemberTypeCreator;
|
||||
BOOL isManager = member.type == NIMChatroomMemberTypeManager;
|
||||
if (isCreator && roomInfo.type != RoomType_MiniGame) {
|
||||
if(roomInfo.type != RoomType_Anchor){
|
||||
[tempArray insertObject:[self createCrossRoomPKModel:roomInfo] atIndex:0];
|
||||
}
|
||||
}
|
||||
if ((isCreator || isManager || meIsSuperAdmin) && roomInfo.type != RoomType_MiniGame && roomInfo.type != RoomType_Anchor) {
|
||||
[tempArray insertObject:[self createRoomPKModel:roomInfo] atIndex:0];
|
||||
}
|
||||
}
|
||||
self.gameView.playList = tempArray;
|
||||
}];
|
||||
}
|
||||
|
||||
self.gameView.playList = tempArray;
|
||||
}
|
||||
|
||||
- (XPRoomMoreItemModel *)createRoomPKModel:(RoomInfoModel *)roomInfo {
|
||||
XPRoomMoreItemModel * roomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
roomPK.imageName= @"room_pk_menu_icon";
|
||||
roomPK.type = (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) ?
|
||||
RoomMoreMenuType_Room_PK_Close :
|
||||
RoomMoreMenuType_Room_PK_Open;
|
||||
return roomPK;
|
||||
}
|
||||
|
||||
- (XPRoomMoreItemModel *)createCrossRoomPKModel:(RoomInfoModel *)roomInfo {
|
||||
XPRoomMoreItemModel * acrossRoomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
acrossRoomPK.imageName = @"crossroom_pk_menu_icon";
|
||||
acrossRoomPK.type = (roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) ?
|
||||
RoomMoreMenuType_Room_Across_PK_Close :
|
||||
RoomMoreMenuType_Room_Across_PK_Open;
|
||||
return acrossRoomPK;
|
||||
}
|
||||
|
||||
- (void)getLittleGameList {
|
||||
NSMutableArray *resourceList = [self.hostDelegate getLittleGameList];
|
||||
if(resourceList.count > 0){
|
||||
@@ -176,8 +239,56 @@
|
||||
} params:params];
|
||||
}
|
||||
|
||||
-(void)ms_didSelectItemAtIndexPath:(ActivityInfoModel *)model {
|
||||
self.gameView.hidden = YES;
|
||||
- (void)handleMoreItem:(XPRoomMoreItemModel *)model {
|
||||
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
|
||||
switch (model.type) {
|
||||
case RoomMoreMenuType_Room_PK_Close: {
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click
|
||||
eventAttributes:@{@"roomMoreMenuType" : @"closeRoomPk"}];
|
||||
XPRoomPKViewController * roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:self.hostDelegate];
|
||||
[self.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_PK_Open: {
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController20")];
|
||||
} else if (roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController21")];
|
||||
} else {
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click
|
||||
eventAttributes:@{@"roomMoreMenuType" : @"openRoomPk"}];
|
||||
XPRoomPKViewController * roomPKVC = [[XPRoomPKViewController alloc] initWithDelegate:self.hostDelegate];
|
||||
[self.hostDelegate.getCurrentNav pushViewController:roomPKVC animated:YES];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Across_PK_Close: {
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"closeAcrossPk"}];
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController15")];
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Across_PK_Open:{
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController13")];
|
||||
return;
|
||||
}
|
||||
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomMoreMenuViewController14")];
|
||||
return;
|
||||
}
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openAcrossPk"}];
|
||||
XPAcrossRoomPKViewController *acrossRoomPKVC = [[XPAcrossRoomPKViewController alloc] initWithRoomUid:[NSString stringWithFormat:@"%ld", roomInfo.uid]];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil];
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleActivityInfo:(ActivityInfoModel *)model {
|
||||
if ([model.code isEqualToString:@"FIND_LOVE"]) {
|
||||
[self lookLoveTapRecognizer];
|
||||
} else if([model.code isEqualToString:@"NAUTICAL_ADVENTURE"]) {
|
||||
@@ -196,7 +307,7 @@
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
fairyVC.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||||
}completion:^(BOOL finished) {
|
||||
|
||||
|
||||
}];
|
||||
}
|
||||
} else if(model.skipType == ActivitySkipType_Web) {
|
||||
@@ -208,12 +319,24 @@
|
||||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
webVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
||||
webVC.url = model.skipContent;
|
||||
[self.hostDelegate.getCurrentNav pushViewController:webVC animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)ms_didSelectItemAtIndexPath:(id)model {
|
||||
self.gameView.hidden = YES;
|
||||
|
||||
if ([model isKindOfClass:[XPRoomMoreItemModel class]]) {
|
||||
// TODO: 跳转到 PK
|
||||
[self handleMoreItem:(XPRoomMoreItemModel *)model];
|
||||
} else if ([model isKindOfClass:[ActivityInfoModel class]]) {
|
||||
[self handleActivityInfo:(ActivityInfoModel *)model];
|
||||
}
|
||||
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
-(void)clickGameVC:(ActivityInfoModel *)model{
|
||||
|
@@ -14,12 +14,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
-(void)didClickBackBtnAction;
|
||||
-(void)ms_didSelectLittleGameItemAtIndexPath:(LittleGameInfoModel *)model;
|
||||
-(void)ms_didSelectItemAtIndexPath:(ActivityInfoModel *)model;
|
||||
-(void)ms_didSelectItemAtIndexPath:(id)model;
|
||||
@end
|
||||
|
||||
|
||||
@interface MSRoomMenuGameView : UIView
|
||||
@property(nonatomic,strong) NSMutableArray<ActivityInfoModel *> *playList;
|
||||
@property(nonatomic,strong) NSMutableArray *playList; // ActivityInfoModel & XPRoomMoreItemModel
|
||||
@property(nonatomic,strong) NSMutableArray<LittleGameInfoModel *> *littleGameList;
|
||||
@property(nonatomic,weak) id<MSRoomMenuGameViewDelegate>delegate;
|
||||
@end
|
||||
|
@@ -51,7 +51,7 @@ static const NSInteger kItemsPerRow = 5;
|
||||
[self.delegate didClickBackBtnAction];
|
||||
}
|
||||
}
|
||||
-(void)setPlayList:(NSMutableArray<ActivityInfoModel *> *)playList{
|
||||
-(void)setPlayList:(NSMutableArray *)playList {
|
||||
_playList = playList;
|
||||
[self updateViewHeightWithItemCount:playList.count];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
@@ -68,7 +68,6 @@ static const NSInteger kItemsPerRow = 5;
|
||||
}
|
||||
|
||||
- (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) {
|
||||
@@ -101,7 +100,12 @@ static const NSInteger kItemsPerRow = 5;
|
||||
if (_littleGameList.count > 0){
|
||||
cell.littleGameModel = [self.littleGameList safeObjectAtIndex1:indexPath.row];
|
||||
} else {
|
||||
cell.model = [self.playList safeObjectAtIndex1:indexPath.row];
|
||||
id model = [self.playList safeObjectAtIndex1:indexPath.row];
|
||||
if ([model isKindOfClass:[XPRoomMoreItemModel class]]) {
|
||||
cell.moreItemModel = model;
|
||||
} else if ([model isKindOfClass:[ActivityInfoModel class]]) {
|
||||
cell.model = model;
|
||||
}
|
||||
}
|
||||
|
||||
return cell;
|
||||
|
@@ -26,12 +26,18 @@
|
||||
@implementation XPMoreMenuPresenter
|
||||
|
||||
- (void)getMoreMenuDataSource:(RoomInfoModel *)roomInfo isSuperAdmin:(BOOL)isSuperAdmin {
|
||||
XPRoomMoreItemModel * roomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
roomPK.title = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ?YMLocalizedString(@"XPMoreMenuPresenter26") : YMLocalizedString(@"XPMoreMenuPresenter1");
|
||||
roomPK.imageName= @"room_more_menu_room_pk";
|
||||
roomPK.type = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ? RoomMoreMenuType_Room_PK_Close : RoomMoreMenuType_Room_PK_Open;
|
||||
roomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
// XPRoomMoreItemModel * roomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
// roomPK.title = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ?YMLocalizedString(@"XPMoreMenuPresenter26") : YMLocalizedString(@"XPMoreMenuPresenter1");
|
||||
// roomPK.imageName= @"room_pk_menu_icon";
|
||||
// roomPK.type = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ? RoomMoreMenuType_Room_PK_Close : RoomMoreMenuType_Room_PK_Open;
|
||||
// roomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
// XPRoomMoreItemModel * acrossRoomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
// acrossRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? YMLocalizedString(@"XPMoreMenuPresenter30") : YMLocalizedString(@"XPMoreMenuPresenter31");
|
||||
// acrossRoomPK.imageName = @"crossroom_pk_menu_icon";
|
||||
// acrossRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Across_PK_Close : RoomMoreMenuType_Room_Across_PK_Open;
|
||||
// acrossRoomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
// XPRoomMoreItemModel * giftValue = [[XPRoomMoreItemModel alloc] init];
|
||||
// giftValue.title = roomInfo.showGiftValue ? YMLocalizedString(@"XPMoreMenuPresenter27") : YMLocalizedString(@"XPMoreMenuPresenter3");
|
||||
// giftValue.imageName= @"room_more_menu_gift_value";
|
||||
@@ -55,12 +61,6 @@
|
||||
dating.imageName = @"room_more_menu_dating";
|
||||
dating.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? RoomMoreMenuType_Room_Dating_Close : RoomMoreMenuType_Room_Dating_Open;
|
||||
dating.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * acrossRoomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
acrossRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? YMLocalizedString(@"XPMoreMenuPresenter30") : YMLocalizedString(@"XPMoreMenuPresenter31");
|
||||
acrossRoomPK.imageName = @"room_more_menu_cross_pk";
|
||||
acrossRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Across_PK_Close : RoomMoreMenuType_Room_Across_PK_Open;
|
||||
acrossRoomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * anchorRoomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
anchorRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? YMLocalizedString(@"XPMoreMenuPresenter32") : YMLocalizedString(@"XPMoreMenuPresenter33");
|
||||
@@ -123,8 +123,6 @@
|
||||
redPacket.type = RoomMoreMenuType_Room_redPacket;
|
||||
redPacket.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
|
||||
|
||||
|
||||
|
||||
XPRoomMoreItemModel * report = [[XPRoomMoreItemModel alloc] init];
|
||||
report.title = YMLocalizedString(@"XPMoreMenuPresenter36");
|
||||
report.imageName = @"room_info_report";
|
||||
@@ -152,15 +150,15 @@
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
BOOL isCreator = member.type == NIMChatroomMemberTypeCreator;
|
||||
BOOL isManager = member.type == NIMChatroomMemberTypeManager;
|
||||
if ((isCreator || isManager || isSuperAdmin) && roomInfo.type != RoomType_MiniGame && roomInfo.type != RoomType_Anchor) {
|
||||
[array addObject:roomPK];
|
||||
}
|
||||
// if ((isCreator || isManager || isSuperAdmin) && roomInfo.type != RoomType_MiniGame && roomInfo.type != RoomType_Anchor) {
|
||||
// [array addObject:roomPK];
|
||||
// }
|
||||
|
||||
if (isCreator && roomInfo.type != RoomType_MiniGame) {
|
||||
if(roomInfo.type != RoomType_Anchor){
|
||||
[array addObject:acrossRoomPK];
|
||||
}
|
||||
}
|
||||
// if (isCreator && roomInfo.type != RoomType_MiniGame) {
|
||||
// if(roomInfo.type != RoomType_Anchor){
|
||||
// [array addObject:acrossRoomPK];
|
||||
// }
|
||||
// }
|
||||
|
||||
if (isCreator && roomInfo.type == RoomType_Anchor) {
|
||||
[array addObject:anchorRoomPK];
|
||||
|
16
YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.h
Normal file
16
YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPRoomPKPanelView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/6/13.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomPKPanelView : UIView
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
20
YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.m
Normal file
20
YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.m
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// XPRoomPKPanelView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by P on 2024/6/13.
|
||||
//
|
||||
|
||||
#import "XPRoomPKPanelView.h"
|
||||
|
||||
@implementation XPRoomPKPanelView
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
Reference in New Issue
Block a user