diff --git a/QXLive.xcodeproj/project.pbxproj b/QXLive.xcodeproj/project.pbxproj index abd0656..8ee508f 100644 --- a/QXLive.xcodeproj/project.pbxproj +++ b/QXLive.xcodeproj/project.pbxproj @@ -754,7 +754,7 @@ CODE_SIGN_ENTITLEMENTS = QXLive/QXLive.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 10; DEVELOPMENT_TEAM = 8798G5VMH9; ENABLE_USER_SCRIPT_SANDBOXING = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -793,7 +793,7 @@ "$(inherited)", "$(SDKROOT)/usr/lib/swift", ); - MARKETING_VERSION = 1.1.16; + MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.qxcm.qxlive; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -820,7 +820,7 @@ CODE_SIGN_ENTITLEMENTS = QXLive/QXLive.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 10; DEVELOPMENT_TEAM = 8798G5VMH9; ENABLE_USER_SCRIPT_SANDBOXING = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -859,7 +859,7 @@ "$(inherited)", "$(SDKROOT)/usr/lib/swift", ); - MARKETING_VERSION = 1.1.16; + MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.qxcm.qxlive; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/QXLive/Base/QXGlobal.m b/QXLive/Base/QXGlobal.m index 5095b05..82d3995 100644 --- a/QXLive/Base/QXGlobal.m +++ b/QXLive/Base/QXGlobal.m @@ -65,6 +65,9 @@ } fail:^(int code, NSString * _Nullable msg) { QXLOG(@"腾讯im退出登录失败"); }]; + if (self.roomId) { + [self quitRoomWithRoomId:self.roomId removeListener:YES]; + } self.isLogin = NO; [self removeLocalData]; [self removeMemory]; @@ -306,7 +309,6 @@ } weakSelf.isClickJoinRoom = YES; [QXMineNetwork beforeJoinRoomWithRoomId:roomId successBlock:^(NSDictionary * _Nonnull dict) { - weakSelf.isClickJoinRoom = NO; if (self != nil) { if (self->_miniView) { [self->_miniView removeFromSuperview]; @@ -315,6 +317,7 @@ } [[QXRoomMessageManager shared] joinGroupWithRoomId:roomId]; [QXMineNetwork joinRoomWithRoomId:roomId successBlock:^(QXRoomModel * _Nonnull roomModel) { + weakSelf.isClickJoinRoom = NO; if (weakSelf.roomId && ![weakSelf.roomId isEqualToString:roomId]) { [weakSelf quitRoomWithRoomId:weakSelf.roomId removeListener:NO]; } @@ -329,10 +332,12 @@ [navagationController pushViewController:weakSelf.roomVC animated:YES]; weakSelf.roomId = roomId; } roomErrorBlock:^(NSString * _Nonnull roomId, NSString * _Nonnull msg) { + weakSelf.isClickJoinRoom = NO; [weakSelf showAlertWithMessage:msg roomId:roomId]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); // hideLoadingInView(KEYWINDOW) + weakSelf.isClickJoinRoom = NO; }]; } roomErrorBlock:^(NSString * _Nonnull roomId, NSString * _Nonnull msg) { weakSelf.isClickJoinRoom = NO; diff --git a/QXLive/Dynamic(语圈)/View/QXSendGiftView.m b/QXLive/Dynamic(语圈)/View/QXSendGiftView.m index 3599de7..e91a782 100644 --- a/QXLive/Dynamic(语圈)/View/QXSendGiftView.m +++ b/QXLive/Dynamic(语圈)/View/QXSendGiftView.m @@ -394,7 +394,11 @@ /// 2为背包 NSString *userId = [self.pitUserListView.selectedArray componentsJoinedByString:@","]; @weakify(self) - [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:userId heart_id:self.heartId type:type pit_number:@"" successBlock:^(NSDictionary * _Nonnull dict) { + NSString *giftBag = @""; + if (self.giftModel.activities_id.intValue == 4) { + giftBag = self.giftModel.gift_bag; + } + [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:userId heart_id:self.heartId type:type pit_number:@"" gift_bag_id:giftBag successBlock:^(NSDictionary * _Nonnull dict) { @strongify(self) if (type.intValue == 1) { if (self.roomSendSuccessBlock) { @@ -438,7 +442,11 @@ NSString *userId = [self.pitUserListView.selectedArray componentsJoinedByString:@","]; // NSString *type = self.categoryView.selectedIndex==0?@"2":@"1"; @weakify(self) - [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:userId heart_id:self.heartId type:type pit_number:@"" successBlock:^(NSDictionary * _Nonnull dict) { + NSString *giftBag = @""; + if (self.giftModel.activities_id.intValue == 4) { + giftBag = self.giftModel.gift_bag; + } + [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:userId heart_id:self.heartId type:type pit_number:@"" gift_bag_id:giftBag successBlock:^(NSDictionary * _Nonnull dict) { @strongify(self) if (type.intValue == 1) { @@ -1271,9 +1279,13 @@ -(void)sendAction{ [self startAnimation]; [[QXGlobal shareGlobal] vibrationFeedback]; + NSString *giftBag = @""; + if (self.giftModel.activities_id.intValue == 4) { + giftBag = self.giftModel.gift_bag; + } switch (self.sendType) { case QXSendGiftViewTypeRoom: - [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:self.userId heart_id:self.heartId type:@"1" pit_number:@"" successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:self.userId heart_id:self.heartId type:@"1" pit_number:@"" gift_bag_id:giftBag successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg) @@ -1287,7 +1299,7 @@ }]; break; case QXSendGiftViewTypeFriend: - [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:self.userId heart_id:self.heartId type:@"1" pit_number:@"" successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:self.userId heart_id:self.heartId type:@"1" pit_number:@"" gift_bag_id:giftBag successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg) diff --git a/QXLive/Manager/QXAgoraEngine.m b/QXLive/Manager/QXAgoraEngine.m index 651c1bc..557edeb 100755 --- a/QXLive/Manager/QXAgoraEngine.m +++ b/QXLive/Manager/QXAgoraEngine.m @@ -561,7 +561,7 @@ @"position":[NSNumber numberWithInteger:positionMs], }; NSString *jsonStr = [dict jsonStringEncoded]; - [[QXRoomMessageManager shared] sendChatMessage:jsonStr messageType:(QXRoomMessageTypeSongLrc) needInsertMessage:NO]; + [[QXRoomMessageManager shared] sendChatMessage:jsonStr messageType:(QXRoomMessageTypeSongLrc) needInsertMessage:NO isSuperRoom:NO]; // if (self.roomInfo.is_xiangqin == 1){ diff --git a/QXLive/Manager/QXRoomMessageManager.h b/QXLive/Manager/QXRoomMessageManager.h index c9f26d7..29dc946 100644 --- a/QXLive/Manager/QXRoomMessageManager.h +++ b/QXLive/Manager/QXRoomMessageManager.h @@ -166,6 +166,15 @@ typedef NS_ENUM(NSInteger) { /// 爆币推送特效 QXRoomMessageTypeCoinBoomEffect = 1100, + + /// 撩人礼物特效 + QXRoomMessageTypeSeductionEffect = 1200, + /// 约她成功 + QXRoomMessageTypeJoinBarCabinRoom = 1201, + /// 收到要被抱上麦 + QXRoomMessageTypeBarRoomHugPit = 1202, + /// 麦上用户设置了自定义礼物 + QXRoomMessageTypeBarRoomSetCustomGift = 1203, }QXRoomMessageType; NS_ASSUME_NONNULL_BEGIN @protocol QXRoomMessageManagerDelegate @@ -176,7 +185,7 @@ NS_ASSUME_NONNULL_BEGIN /// 根据用户userid 插入消息 -(void)didInsertMessge:(QXRoomChatListModel*)message userId:(NSString*)userId; /// 上下麦 --(void)didUpDownSeatWithUser:(QXUserHomeModel*)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel*)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString*)end_time; /// 上麦模式发生变化 2 自由麦 | 1 排麦 -(void)aplayPitModeDidChanged:(NSString*)upMicType; /// 排麦人数发生变化 @@ -323,6 +332,18 @@ NS_ASSUME_NONNULL_BEGIN /// 主持邀请上签约麦 -(void)signSeatInviteWithUserId:(NSString*)userId content:(NSString*)content; + + +/// 酒吧房 +/// 收到撩他特效 +-(void)barRoomSeductionEffectWithModel:(QXRoomChatListModel*)model; +/// 需要进入小黑屋 +-(void)barRoomJoinCabinRoomWithRoomId:(NSString*)room_id user_id:(NSString*)user_id meet_user_id:(NSString*)meet_user_id; +/// 收到要被抱上麦了 +-(void)barRoomHugPitWithUserId:(NSString*)userId pit_number:(NSString*)pit_number; +/// 设置了自定义礼物 +-(void)barRoomSetCustomGiftWithUserId:(NSString*)userId had_custom_gift:(BOOL)had_custom_gift; + @end @interface QXRoomMessageManager : NSObject @property (nonatomic,weak)iddelegate; @@ -334,12 +355,16 @@ NS_ASSUME_NONNULL_BEGIN /// 加入房间群组 -(void)joinGroupWithRoomId:(NSString*)roomId; +-(void)joinExGroupWithRoomId:(NSString*)roomId; +/// 退出 +-(void)quitExGroup; + /// 退出房间群组 -(void)quitGroupWithRoomId:(NSString*)roomId removeListener:(BOOL)removeListener; - --(void)sendChatMessage:(NSString *)message messageType:(QXRoomMessageType)messageType needInsertMessage:(BOOL)needInsertMessage; +/// 发送消息 +-(void)sendChatMessage:(NSString *)message messageType:(QXRoomMessageType)messageType needInsertMessage:(BOOL)needInsertMessage isSuperRoom:(BOOL)isSuperRoom; /// 发送表情 --(void)sendChatEmoji:(QXEmojiModel *)emoji; +-(void)sendChatEmoji:(QXEmojiModel *)emoji isSuperRoom:(BOOL)isSuperRoom; -(void)sendC2CMessage:(NSString *)message messageType:(QXRoomMessageType)messageType userId:(NSString*)userId; diff --git a/QXLive/Manager/QXRoomMessageManager.m b/QXLive/Manager/QXRoomMessageManager.m index fa7cadf..a9e4ddd 100644 --- a/QXLive/Manager/QXRoomMessageManager.m +++ b/QXLive/Manager/QXRoomMessageManager.m @@ -19,6 +19,8 @@ @interface QXRoomMessageManager() @property (nonatomic,strong)NSString *groupId; @property (nonatomic,strong)NSString *roomId; +@property (nonatomic,strong)NSString *exRoomId; +@property (nonatomic,strong)NSString *exGroupId; @end @implementation QXRoomMessageManager + (instancetype)shared { @@ -60,6 +62,24 @@ [QXLogger infoWithTag:@"房间日志" format:@"腾讯IM加入聊天室失败-code%d-原因%@",code,desc]; }]; } +-(void)joinExGroupWithRoomId:(NSString *)roomId{ + [[V2TIMManager sharedInstance] addGroupListener:self]; + [[V2TIMManager sharedInstance] addAdvancedMsgListener:self]; + NSString *exGroupId = [NSString stringWithFormat:@"room%@",roomId]; + self.exGroupId = exGroupId; + self.exRoomId = roomId; + [[V2TIMManager sharedInstance] joinGroup:exGroupId msg:@"大家好,我来啦" succ:^{ + QXLOG(@"腾讯IM小黑屋加入聊天室成功"); +// weakSelf.groupId = groupId; +// weakSelf.roomId = roomId; + [QXLogger infoWithTag:@"房间日志" format:@"腾讯IM小黑屋加入聊天室成功房间id=%@",roomId]; + } fail:^(int code, NSString *desc) { + // 加入群组失败 + QXLOG(@"腾讯IM小黑屋加入聊天室失败-code%d-原因%@",code,desc); + [QXLogger infoWithTag:@"房间日志" format:@"腾讯IM小黑屋加入聊天室失败-code%d-原因%@",code,desc]; + }]; +} + -(void)quitGroupWithRoomId:(NSString *)roomId removeListener:(BOOL)removeListener{ if (removeListener) { self.groupId = nil; @@ -75,6 +95,10 @@ }]; } +-(void)quitExGroup{ + self.exGroupId = nil; + self.exRoomId = nil; +} // 新成员加入 -(void)onMemberEnter:(NSString *)groupID memberList:(NSArray *)memberList{ @@ -103,7 +127,8 @@ QXRoomMessage *msg = [QXRoomMessage yy_modelWithJSON:jsonStr]; NSString *groupId = [NSString stringWithFormat:@"room%@",msg.RoomId]; [QXLogger infoWithTag:@"推送日志" format:@"房间id=%@收到系统推送%@",msg.RoomId,jsonStr]; - if ([groupId isEqualToString:self.groupId]) { + if ([groupId isEqualToString:self.groupId] || [groupId isEqualToString:self.exGroupId]) { + BOOL isSuperRoom = [self.exGroupId isEqualToString:groupId]; // 处理逻辑 NSInteger meesageType = msg.MsgType.integerValue; switch (meesageType) { @@ -116,15 +141,23 @@ QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; model.messageType = QXRoomChatMessageTypeSystem; NSString *jia_jia = [NSString stringWithFormat:@"%@",msg.Text[@"jia_jia"]]; - if (([jia_jia hasPrefix:@"http"] || [jia_jia hasPrefix:@"https"]) && ([jia_jia hasSuffix:@"svga"] || [jia_jia hasSuffix:@"mp4"])) { -// QXGiftModel *md = [[QXGiftModel alloc] init]; -// md.play_image = jia_jia; - [[QXGiftPlayerManager shareManager] displayChatEffectView:jia_jia]; + if ([self.exRoomId isExist] && [self.roomId isExist]) { + /// 酒吧房小黑屋不管大房间的特效 + if ([groupId isEqualToString:self.groupId]){ + if (([jia_jia hasPrefix:@"http"] || [jia_jia hasPrefix:@"https"]) && ([jia_jia hasSuffix:@"svga"] || [jia_jia hasSuffix:@"mp4"])) { + [[QXGiftPlayerManager shareManager] displayChatEffectView:jia_jia]; + } + } + }else{ + if (([jia_jia hasPrefix:@"http"] || [jia_jia hasPrefix:@"https"]) && ([jia_jia hasSuffix:@"svga"] || [jia_jia hasSuffix:@"mp4"])) { + [[QXGiftPlayerManager shareManager] displayChatEffectView:jia_jia]; + } } if ([model.FromUserInfo.enter_image isExist]) { [[QXDrifNobilityJoinRoomView shareView] addNobilityUserModel:model]; } if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } if ([model.FromUserInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { @@ -146,11 +179,21 @@ /// 收到礼物 QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; model.messageType = QXRoomChatMessageTypeGift; - if ([model.GiftInfo.play_image isExist]) { - NSArray *arr = [model.GiftInfo.play_image componentsSeparatedByString:@","]; - [[QXGiftPlayerManager shareManager] displayFullEffectViewWithMorePlayImages:arr]; + if ([self.exRoomId isExist] && [self.roomId isExist]) { + /// 酒吧房小黑屋不管大房间的特效 + if ([groupId isEqualToString:self.groupId]){ + NSArray *arr = [model.GiftInfo.play_image componentsSeparatedByString:@","]; + [[QXGiftPlayerManager shareManager] displayFullEffectViewWithMorePlayImages:arr]; + [[QXGiftDisplayManager sharedManager] receiveGift:model]; + } + }else{ + if ([model.GiftInfo.play_image isExist]) { + NSArray *arr = [model.GiftInfo.play_image componentsSeparatedByString:@","]; + [[QXGiftPlayerManager shareManager] displayFullEffectViewWithMorePlayImages:arr]; + } + [[QXGiftDisplayManager sharedManager] receiveGift:model]; } - [[QXGiftDisplayManager sharedManager] receiveGift:model]; + if (model.ToUserInfos.count>0) { if (self.delegate && [self.delegate respondsToSelector:@selector(didRecieveGiftWithWithUserInfos:)]) { [self.delegate didRecieveGiftWithWithUserInfos:model.ToUserInfos]; @@ -164,6 +207,7 @@ return; } if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } } @@ -184,12 +228,13 @@ if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { if (!model.is_pk) { // 非pk房间的消息插入公屏 + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } } - if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:isPK:)]) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:isPK:end_time:)]) { NSString *pit_number = [NSString stringWithFormat:@"%@",msg.Text[@"pit_number"]]; - [self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:YES pit_number:pit_number.integerValue isPK:model.is_pk]; + [self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:YES pit_number:pit_number.integerValue isPK:model.is_pk end_time:model.end_time]; } } break; @@ -200,12 +245,13 @@ if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { if (!model.is_pk) { // 非pk房间的消息插入公屏 + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } } - if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:isPK:)]) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:isPK:end_time:)]) { NSString *pit_number = [NSString stringWithFormat:@"%@",msg.Text[@"pit_number"]]; - [self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:NO pit_number:pit_number.integerValue isPK:model.is_pk]; + [self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:NO pit_number:pit_number.integerValue isPK:model.is_pk end_time:model.end_time]; } } break; @@ -744,10 +790,54 @@ NSString *jia_jia = [NSString stringWithFormat:@"%@",msg.Text[@"play_image"]]; [[QXGiftPlayerManager shareManager] displayChatEffectView:jia_jia]; if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } } break; + + case QXRoomMessageTypeSeductionEffect:{ + QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; + if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; + [self.delegate didInsertMessge:model]; + } + if (self.delegate && [self.delegate respondsToSelector:@selector(barRoomSeductionEffectWithModel:)]) { + [self.delegate barRoomSeductionEffectWithModel:model]; + } + } + break; + + case QXRoomMessageTypeJoinBarCabinRoom:{ + QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; + if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; + [self.delegate didInsertMessge:model]; + } + NSString *cabinRoomId = [NSString stringWithFormat:@"%@",msg.Text[@"room_id"]]; + NSString *user_id = [NSString stringWithFormat:@"%@",msg.Text[@"user_id"]]; + NSString *meet_user_id = [NSString stringWithFormat:@"%@",msg.Text[@"meet_user_id"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(barRoomJoinCabinRoomWithRoomId:user_id:meet_user_id:)]) { + [self.delegate barRoomJoinCabinRoomWithRoomId:cabinRoomId user_id:user_id meet_user_id:meet_user_id]; + } + } + break; + case QXRoomMessageTypeBarRoomHugPit:{ + NSString *user_id = [NSString stringWithFormat:@"%@",msg.Text[@"user_id"]]; + NSString *pit_number = [NSString stringWithFormat:@"%@",msg.Text[@"pit_number"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(barRoomHugPitWithUserId:pit_number:)]) { + [self.delegate barRoomHugPitWithUserId:user_id pit_number:pit_number]; + } + } + break; + case QXRoomMessageTypeBarRoomSetCustomGift:{ + NSString *user_id = [NSString stringWithFormat:@"%@",msg.Text[@"user_id"]]; + NSString *type = [NSString stringWithFormat:@"%@",msg.Text[@"type"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(barRoomSetCustomGiftWithUserId:had_custom_gift:)]) { + [self.delegate barRoomSetCustomGiftWithUserId:user_id had_custom_gift:type.intValue==1]; + } + } + break; default: break; } @@ -871,12 +961,16 @@ -(void)onRecvGroupCustomMessage:(NSString *)msgID groupID:(NSString *)groupID sender:(V2TIMGroupMemberInfo *)info customData:(NSData *)data{ NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; QXRoomMessage *msg = [QXRoomMessage yy_modelWithJSON:jsonStr]; - if ([groupID isEqualToString:self.groupId]) { + NSString *groupId = [NSString stringWithFormat:@"room%@",msg.RoomId]; + [QXLogger infoWithTag:@"推送日志" format:@"房间id=%@收到系统推送%@",msg.RoomId,jsonStr]; + if ([groupId isEqualToString:self.groupId] || [groupId isEqualToString:self.exGroupId]) { + BOOL isSuperRoom = [self.exGroupId isEqualToString:groupId]; NSInteger meesageType = msg.MsgType.integerValue; if (meesageType == QXRoomMessageTypeText) { QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; model.messageType = QXRoomChatMessageTypeChat; if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } }else if (meesageType == QXRoomMessageTypeClearMessage) { @@ -907,6 +1001,7 @@ QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; model.messageType = QXRoomChatMessageTypeEmoji; if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } } @@ -914,9 +1009,9 @@ } --(void)sendChatMessage:(NSString *)message messageType:(QXRoomMessageType)messageType needInsertMessage:(BOOL)needInsertMessage{ +-(void)sendChatMessage:(NSString *)message messageType:(QXRoomMessageType)messageType needInsertMessage:(BOOL)needInsertMessage isSuperRoom:(BOOL)isSuperRoom{ NSDictionary *dict = @{ - @"RoomId":self.roomId?self.roomId:@"", + @"RoomId":isSuperRoom?self.exRoomId?:@"":self.roomId?:@"", @"MsgType":[NSNumber numberWithInteger:messageType], @"Text":@{ @"FromUserInfo":@{ @@ -945,22 +1040,23 @@ model.FromUserInfo = userInfo; model.messageType = QXRoomChatMessageTypeChat; if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } } NSString *jsonStr = [dict jsonStringEncoded]; NSData *data =[jsonStr dataUsingEncoding:NSUTF8StringEncoding]; - [[V2TIMManager sharedInstance] sendGroupCustomMessage:data to:self.groupId priority:V2TIM_PRIORITY_NORMAL succ:^{ + [[V2TIMManager sharedInstance] sendGroupCustomMessage:data to:isSuperRoom?self.exGroupId?:@"":self.groupId?:@"" priority:V2TIM_PRIORITY_NORMAL succ:^{ QXLOG(@"发送自定义消息成功"); } fail:^(int code, NSString * _Nullable desc) { QXLOG(@"发送自定义消息失败"); }]; - - } --(void)sendChatEmoji:(QXEmojiModel *)emoji{ + + +-(void)sendChatEmoji:(QXEmojiModel *)emoji isSuperRoom:(BOOL)isSuperRoom{ NSDictionary *dict = @{ - @"RoomId":self.roomId?self.roomId:@"", + @"RoomId":isSuperRoom?self.exRoomId?:@"":self.roomId?:@"", @"MsgType":[NSNumber numberWithInteger:QXRoomMessageTypeEmoji], @"Text":@{ @"FromUserInfo":@{ @@ -993,11 +1089,12 @@ model.messageType = QXRoomChatMessageTypeEmoji; model.emoji = emoji; if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { + model.isSuperRoom = isSuperRoom; [self.delegate didInsertMessge:model]; } NSString *jsonStr = [dict jsonStringEncoded]; NSData *data =[jsonStr dataUsingEncoding:NSUTF8StringEncoding]; - [[V2TIMManager sharedInstance] sendGroupCustomMessage:data to:self.groupId priority:V2TIM_PRIORITY_NORMAL succ:^{ + [[V2TIMManager sharedInstance] sendGroupCustomMessage:data to:isSuperRoom?self.exGroupId?:@"":self.groupId?:@"" priority:V2TIM_PRIORITY_NORMAL succ:^{ QXLOG(@"发送自定义消息成功"); } fail:^(int code, NSString * _Nullable desc) { QXLOG(@"发送自定义消息失败"); diff --git a/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m b/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m index 8fea8b3..07ccb68 100644 --- a/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m +++ b/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m @@ -16,6 +16,7 @@ @property (nonatomic,strong)NSString* startTime; @property (nonatomic,strong)NSString* endTime; +@property (nonatomic,strong)NSString* last_id; @end @implementation QXCornRecordSubViewController @@ -32,7 +33,7 @@ [dateBg addSubview:self.dateView]; [self.view addSubview:dateBg]; [self.view addSubview:self.tableView]; - self.page = 1; + self.last_id = @""; } -(void)getData{ // [self.dataArray addObject:@""]; @@ -41,15 +42,17 @@ // [self.tableView reloadData]; // __weak typeof(self) weakSelf = self; - [QXMineNetwork roomCoinOrDiamondDetailWithPage:self.page in_out_type:[NSString stringWithFormat:@"%ld",self.type+1] start_time:self.startTime end_time:self.endTime gift_type:[NSString stringWithFormat:@"%ld",self.waterType+1] successBlock:^(NSArray * _Nonnull list) { + [QXMineNetwork roomCoinOrDiamondDetailWithLastId:self.last_id in_out_type:[NSString stringWithFormat:@"%ld",self.type+1] start_time:self.startTime end_time:self.endTime gift_type:[NSString stringWithFormat:@"%ld",self.waterType+1] successBlock:^(NSArray * _Nonnull list) { __strong typeof(weakSelf) strongSelf = weakSelf; if (!strongSelf) { NSLog(@"⚠️ self has been deallocated, skipping hide operation"); return; } - if (strongSelf.page == 1) { + if (strongSelf.last_id.length == 0) { [strongSelf.dataArray removeAllObjects]; } + QXCoinDetailModel *lastModel = list.lastObject; + weakSelf.last_id = lastModel.id; [strongSelf.dataArray addObjectsFromArray:list]; [strongSelf.tableView reloadData]; if (list.count == 0) { @@ -83,7 +86,7 @@ QXLOG(@"开始时间-%@ 结束时间-%@",startDateString,endDateString); self.startTime = startDateString; self.endTime = endDateString; - self.page = 1; + self.last_id = @""; [self getData]; } @@ -106,11 +109,10 @@ _tableView.rowHeight = UITableViewAutomaticDimension; MJWeakSelf _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ - weakSelf.page = 1; + weakSelf.last_id = @""; [weakSelf getData]; }]; _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ - weakSelf.page++; [weakSelf getData]; }]; } diff --git a/QXLive/Mine(音域)/Model/QXCoinDetailModel.h b/QXLive/Mine(音域)/Model/QXCoinDetailModel.h index f90fafb..84ed09b 100644 --- a/QXLive/Mine(音域)/Model/QXCoinDetailModel.h +++ b/QXLive/Mine(音域)/Model/QXCoinDetailModel.h @@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *remarks; /// 时间 @property (nonatomic,strong)NSString *createtime; +/// 最后一个id +@property (nonatomic,strong)NSString *id; @end diff --git a/QXLive/Mine(音域)/Model/QXGiftModel.h b/QXLive/Mine(音域)/Model/QXGiftModel.h index 8152e89..f8b6c0e 100644 --- a/QXLive/Mine(音域)/Model/QXGiftModel.h +++ b/QXLive/Mine(音域)/Model/QXGiftModel.h @@ -14,7 +14,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *num; /// 礼物名称 @property (nonatomic,strong)NSString *gift_name; -/// 礼物图片 +/// 设置自定义礼物名称 +@property (nonatomic,strong)NSString *gift_remark_name; +/// 礼物图片as @property (nonatomic,strong)NSString *base_image; /// 礼物特效 @property (nonatomic,strong)NSString *play_image; @@ -41,6 +43,9 @@ NS_ASSUME_NONNULL_BEGIN /// 是否为师徒标签 @property (nonatomic,strong)NSString *is_teacher; +/// 当前钱包余额 +@property (nonatomic,strong)NSString *user_wallet_coin; + @property (nonatomic,assign)BOOL isSelected; @end diff --git a/QXLive/Mine(音域)/Model/QXRoomModel.h b/QXLive/Mine(音域)/Model/QXRoomModel.h index 18448f1..f65ad93 100644 --- a/QXLive/Mine(音域)/Model/QXRoomModel.h +++ b/QXLive/Mine(音域)/Model/QXRoomModel.h @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *room_cover; /// 房间公告 @property (nonatomic,strong)NSString *room_intro; -/// 房间类型 type_id 1 点唱 2 拍卖 3男神 4女神 6小黑屋 7 交友房 +/// 房间类型 type_id 1k歌+普通 2 拍卖 3男神 4女神 6小黑屋 7 交友房 9点唱 10签约房 11 酒吧房 @property (nonatomic,strong)NSString *type_id; /// 房间子类型 label_id 1聊天 2 k歌 拍卖时 1真爱 2亲密 @property (nonatomic,strong)NSString *label_id; @@ -82,6 +82,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *last_pk_room_id; /// 排麦人数 @property (nonatomic,strong)NSString *queue_number; +/// 酒吧房撩人所需金币数 +@property (nonatomic,strong)NSString *sexy_coin; @end @@ -128,6 +130,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *nickname_color; @property (nonatomic,strong)NSString *is_online; +/// 酒吧房 +/// 酒吧房麦位时长 +@property (nonatomic,strong)NSString *end_time; +/// 是否有设置自定义礼物 0 没设置 1已设置 +@property (nonatomic,assign)NSInteger had_custom_gift; @property (nonatomic,assign)BOOL isSelected; @end diff --git a/QXLive/Mine(音域)/Model/QXUserModel.h b/QXLive/Mine(音域)/Model/QXUserModel.h index 7d3ec7e..d69d604 100644 --- a/QXLive/Mine(音域)/Model/QXUserModel.h +++ b/QXLive/Mine(音域)/Model/QXUserModel.h @@ -140,6 +140,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXUserHomeModel *master; +@property (nonatomic,assign)NSInteger had_custom_gift; + -(instancetype)copyModel; @end diff --git a/QXLive/Mine(音域)/Model/酒吧房/QXRoomSeatTimeModel.h b/QXLive/Mine(音域)/Model/酒吧房/QXRoomSeatTimeModel.h new file mode 100644 index 0000000..9e00f8e --- /dev/null +++ b/QXLive/Mine(音域)/Model/酒吧房/QXRoomSeatTimeModel.h @@ -0,0 +1,21 @@ +// +// QXRoomSeatTimeModel.h +// QXLive +// +// Created by 启星 on 2026/1/6. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomSeatTimeModel : NSObject +/// 时间 +@property (nonatomic,strong)NSString *time; +/// 时间字符串 +@property (nonatomic,strong)NSString *time_str; + +@property (nonatomic,assign)BOOL isSelected; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/酒吧房/QXRoomSeatTimeModel.m b/QXLive/Mine(音域)/Model/酒吧房/QXRoomSeatTimeModel.m new file mode 100644 index 0000000..c8eff89 --- /dev/null +++ b/QXLive/Mine(音域)/Model/酒吧房/QXRoomSeatTimeModel.m @@ -0,0 +1,12 @@ +// +// QXRoomSeatTimeModel.m +// QXLive +// +// Created by 启星 on 2026/1/6. +// + +#import "QXRoomSeatTimeModel.h" + +@implementation QXRoomSeatTimeModel + +@end diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.h b/QXLive/Mine(音域)/Services/QXMineNetwork.h index 52f4377..fbae158 100644 --- a/QXLive/Mine(音域)/Services/QXMineNetwork.h +++ b/QXLive/Mine(音域)/Services/QXMineNetwork.h @@ -33,6 +33,7 @@ #import "QXFamilyModel.h" #import "QXRoomActivityStatusModel.h" #import "QXConfig.h" +#import "QXRoomSeatTimeModel.h" NS_ASSUME_NONNULL_BEGIN @@ -354,6 +355,7 @@ NS_ASSUME_NONNULL_BEGIN heart_id:(NSString*)heart_id type:(NSString*)type pit_number:(NSString*)pit_number + gift_bag_id:(NSString*)gift_bag_id successBlock:(void (^)(NSDictionary* dict))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @@ -378,6 +380,7 @@ NS_ASSUME_NONNULL_BEGIN */ +(void)roomUpSeatWithRoomId:(NSString*)room_id pit_number:(NSString*)pit_number + gift_id:(NSString*)gift_id isUpSeat:(BOOL)isUpSeat successBlock:(void (^)(NSDictionary* dict))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @@ -831,7 +834,7 @@ NS_ASSUME_NONNULL_BEGIN gift_type 1金币,2收益(钻石) in_out_type 1收入2支出 */ -+(void)roomCoinOrDiamondDetailWithPage:(NSInteger)page ++(void)roomCoinOrDiamondDetailWithLastId:(NSString*)last_id in_out_type:(NSString*)in_out_type start_time:(NSString*)start_time end_time:(NSString*)end_time @@ -1493,6 +1496,81 @@ NS_ASSUME_NONNULL_BEGIN num:(NSString*)num successBlock:(void (^)(NSDictionary* dict))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + + +#pragma mark - 酒吧房 +/** + label 礼物标签(类型)不传返回所有礼物,拍卖 传99 酒吧房自定义礼物 14 酒吧房普通礼物15 酒吧房小黑屋礼物 16 酒吧房撩TA礼物17 + type 类型位置:1-房间送礼礼物,2-排麦设置插麦礼物,3-拍卖位选择拍卖礼物,4-歌手添加歌单礼物,5-动态打赏礼物 6酒吧房 + 新礼物列表 + */ ++(void)getRoomNewGiftListWithLabel:(NSString*)label + type:(NSString*)type + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 获取自定义礼物列表 + */ ++(void)getRoomCustomGiftWithUserId:(NSString*)userId + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 设置自定义礼物 + */ ++(void)setRoomCustomGiftWithGiftId:(NSString*)gift_id + roomId:(NSString*)roomId + newGiftName:(NSString*)new_gift_name + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 获取酒吧房麦位时间列表 + */ ++(void)getRoomSeatTimeListSuccessBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 房间麦位时长设置 + */ ++(void)setRoomSeatTimeWithRoomId:(NSString*)roomId + time:(NSString*)time + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 约Ta礼物详情 + */ ++(void)roomAskUserGiftWithRoomId:(NSString*)roomId + toUserId:(NSString*)toUserId + successBlock:(void (^)(QXGiftModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + + +/** + 撩他 + */ ++(void)roomSeductionWithRoomId:(NSString*)roomId + to_user_id:(NSString*)to_user_id + type:(NSString*)type + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 约他 + */ ++(void)roomBarAskWithRoomId:(NSString*)roomId + user_id:(NSString*)user_id + gift_id:(NSString*)gift_id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + @end diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.m b/QXLive/Mine(音域)/Services/QXMineNetwork.m index d3d0bcb..f5564da 100644 --- a/QXLive/Mine(音域)/Services/QXMineNetwork.m +++ b/QXLive/Mine(音域)/Services/QXMineNetwork.m @@ -617,7 +617,7 @@ +(void)joinRoomWithRoomId:(NSString *)room_id successBlock:(nonnull void (^)(QXRoomModel * _Nonnull))successBlock roomErrorBlock:(nonnull void (^)(NSString * _Nonnull, NSString * _Nonnull))roomErrorBlock failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ - @"room_id":room_id + @"room_id":room_id?:@"" }; [[QXRequset shareInstance] postWithUrl:QXJoinRoom parameters:parameters needCache:NO success:^(id responseObject) { int code = [responseObject[@"code"] intValue]; @@ -719,6 +719,7 @@ heart_id:(NSString*)heart_id type:(NSString*)type pit_number:(NSString*)pit_number + gift_bag_id:(NSString*)gift_bag_id successBlock:(void (^)(NSDictionary* dict))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ NSDictionary *parameters =@{ @@ -728,7 +729,8 @@ @"to_uid":to_uid?to_uid:@"", @"type":type?type:@"", @"pit_number":pit_number?pit_number:@"", - @"heart_id":heart_id?heart_id:@"" + @"heart_id":heart_id?heart_id:@"", + @"gift_bag_id":gift_bag_id?:@"", }; __block NSString *userId = to_uid; [[QXRequset shareInstance] postWithUrl:QXSendGift parameters:parameters needCache:NO success:^(id responseObject) { @@ -795,12 +797,14 @@ +(void)roomUpSeatWithRoomId:(NSString*)room_id pit_number:(NSString*)pit_number + gift_id:(NSString*)gift_id isUpSeat:(BOOL)isUpSeat successBlock:(void (^)(NSDictionary* dict))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ NSDictionary *parameters =@{ @"room_id":room_id, - @"pit_number":pit_number?pit_number:@"" + @"pit_number":pit_number?pit_number:@"", + @"gift_id":gift_id?:@"" }; [[QXRequset shareInstance] postWithUrl:isUpSeat?QXRoomUpSeat:QXRoomDownSeat parameters:parameters needCache:NO success:^(id responseObject) { if (successBlock) { @@ -1642,7 +1646,7 @@ }]; } -+(void)roomCoinOrDiamondDetailWithPage:(NSInteger)page ++(void)roomCoinOrDiamondDetailWithLastId:(NSString*)last_id in_out_type:(NSString *)in_out_type start_time:(NSString *)start_time end_time:(NSString *)end_time @@ -1650,11 +1654,11 @@ successBlock:(void (^)(NSArray * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ - @"page":[NSNumber numberWithInteger:page], + @"last_id":last_id?:@"", @"gift_type":gift_type?gift_type:@"", @"start_time":start_time?start_time:@"", @"end_time":end_time?end_time:@"", - @"in_out_type":in_out_type?in_out_type:@"" + @"in_out_type":in_out_type?in_out_type:@"", }; [[QXRequset shareInstance] postWithUrl:QXRoomCoinDetail parameters:parameters needCache:NO success:^(id responseObject) { if (successBlock) { @@ -3035,4 +3039,162 @@ failBlock(error,msg); }]; } + +#pragma mark - 酒吧房 ++(void)getRoomNewGiftListWithLabel:(NSString*)label + type:(NSString*)type + successBlock:(void (^)(NSArray * _Nonnull))successBlock + failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXRoomNewGiftList parameters:@{@"label":label?:@"",@"type":type?:@""} needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray*list = [NSArray yy_modelArrayWithClass:[QXGiftModel class] json:responseObject[@"data"]]; + successBlock(list); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 获取自定义礼物列表 + */ ++(void)getRoomCustomGiftWithUserId:(NSString*)userId + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"user_id":userId?:@"", + }; + [[QXRequset shareInstance] getWithUrl:QXRoomCustomGiftList parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray*list = [NSArray yy_modelArrayWithClass:[QXGiftModel class] json:responseObject[@"data"]]; + successBlock(list); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + +/** + 设置自定义礼物 + */ ++(void)setRoomCustomGiftWithGiftId:(NSString*)gift_id + roomId:(NSString*)roomId + newGiftName:(NSString*)new_gift_name + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"gift_id":gift_id?:@"", + @"gift_remark_name":new_gift_name?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXRoomSetCustom parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 获取酒吧房麦位时间列表 + */ ++(void)getRoomSeatTimeListSuccessBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXRoomSeatTimeList parameters:@{} needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray*list = [NSArray yy_modelArrayWithClass:[QXRoomSeatTimeModel class] json:responseObject[@"data"]]; + successBlock(list); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + +/** + 房间麦位时长设置 + */ ++(void)setRoomSeatTimeWithRoomId:(NSString*)roomId + time:(NSString*)time + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"room_id":roomId?:@"", + @"time":time?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXRoomSetSeatTime parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 约Ta礼物详情 + */ ++(void)roomAskUserGiftWithRoomId:(NSString*)roomId + toUserId:(NSString*)toUserId + successBlock:(void (^)(QXGiftModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"room_id":roomId?:@"", + @"to_user_id":toUserId?:@"" + }; + [[QXRequset shareInstance] getWithUrl:QXRoomGetSeatGift parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + QXGiftModel *model = [QXGiftModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + +/** + 撩他 + */ ++(void)roomSeductionWithRoomId:(NSString*)roomId + to_user_id:(NSString*)to_user_id + type:(NSString*)type + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"room_id":roomId?:@"", + @"to_user_id":to_user_id?:@"", + @"type":type?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXRoomBarSeduction parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 约她 + */ ++(void)roomBarAskWithRoomId:(NSString *)roomId + user_id:(nonnull NSString *)user_id + gift_id:(nonnull NSString *)gift_id + successBlock:(nonnull void (^)(NSDictionary * _Nonnull))successBlock + failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + NSDictionary *parameters =@{ + @"room_id":roomId?:@"", + @"user_id":user_id?:@"", + @"gift_id":gift_id?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXRoomBarAsk parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} @end diff --git a/QXLive/Other/AppDelegate.m b/QXLive/Other/AppDelegate.m index 3f2dfb0..6d9f266 100644 --- a/QXLive/Other/AppDelegate.m +++ b/QXLive/Other/AppDelegate.m @@ -57,6 +57,7 @@ #import "QXHomePageNetwork.h" #import "QXRoomNavigationController.h" #import "QXInvitePopView.h" +#import "QGVAPLogger.h" #if DEBUG #import #endif diff --git a/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/Contents.json new file mode 100644 index 0000000..c2341ac --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_cabin_heart@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_cabin_heart@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/bar_room_cabin_heart@2x.png b/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/bar_room_cabin_heart@2x.png new file mode 100644 index 0000000..cfd893c Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/bar_room_cabin_heart@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/bar_room_cabin_heart@3x.png b/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/bar_room_cabin_heart@3x.png new file mode 100644 index 0000000..e280336 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/bar_room_cabin_heart.imageset/bar_room_cabin_heart@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/Contents.json new file mode 100644 index 0000000..af5884c --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_set_room_type_bar@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_set_room_type_bar@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/room_set_room_type_bar@2x.png b/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/room_set_room_type_bar@2x.png new file mode 100644 index 0000000..0eb6678 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/room_set_room_type_bar@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/room_set_room_type_bar@3x.png b/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/room_set_room_type_bar@3x.png new file mode 100644 index 0000000..917fdb8 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/room_set_room_type_bar.imageset/room_set_room_type_bar@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_cabin_room_bg.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_cabin_room_bg.imageset/Contents.json new file mode 100644 index 0000000..046df91 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_cabin_room_bg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_cabin_room_bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_cabin_room_bg.imageset/bar_cabin_room_bg@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_cabin_room_bg.imageset/bar_cabin_room_bg@2x.png new file mode 100644 index 0000000..478865d Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_cabin_room_bg.imageset/bar_cabin_room_bg@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/Contents.json new file mode 100644 index 0000000..c1f4f4b --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_ask_ta@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_ask_ta@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/bar_room_ask_ta@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/bar_room_ask_ta@2x.png new file mode 100644 index 0000000..e191ee8 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/bar_room_ask_ta@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/bar_room_ask_ta@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/bar_room_ask_ta@3x.png new file mode 100644 index 0000000..e8f72e5 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_ask_ta.imageset/bar_room_ask_ta@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/Contents.json new file mode 100644 index 0000000..8c3661d --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_cabin_gift_bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_cabin_gift_bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/bar_room_cabin_gift_bg@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/bar_room_cabin_gift_bg@2x.png new file mode 100644 index 0000000..1809b68 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/bar_room_cabin_gift_bg@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/bar_room_cabin_gift_bg@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/bar_room_cabin_gift_bg@3x.png new file mode 100644 index 0000000..1bc3152 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_cabin_gift_bg.imageset/bar_room_cabin_gift_bg@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/Contents.json new file mode 100644 index 0000000..5dbb4fa --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_close_privite@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_close_privite@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/bar_room_close_privite@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/bar_room_close_privite@2x.png new file mode 100644 index 0000000..70d4ece Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/bar_room_close_privite@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/bar_room_close_privite@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/bar_room_close_privite@3x.png new file mode 100644 index 0000000..f6da2b5 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_close_privite.imageset/bar_room_close_privite@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/Contents.json new file mode 100644 index 0000000..fac3495 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_custom_gift@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_custom_gift@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/bar_room_custom_gift@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/bar_room_custom_gift@2x.png new file mode 100644 index 0000000..7832b62 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/bar_room_custom_gift@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/bar_room_custom_gift@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/bar_room_custom_gift@3x.png new file mode 100644 index 0000000..831095f Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_custom_gift.imageset/bar_room_custom_gift@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/Contents.json new file mode 100644 index 0000000..b6d4d5e --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_open_privite@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_open_privite@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/bar_room_open_privite@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/bar_room_open_privite@2x.png new file mode 100644 index 0000000..b5178c0 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/bar_room_open_privite@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/bar_room_open_privite@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/bar_room_open_privite@3x.png new file mode 100644 index 0000000..64bfcd4 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_open_privite.imageset/bar_room_open_privite@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/Contents.json new file mode 100644 index 0000000..f26855e --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_sea_king@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_sea_king@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/bar_room_sea_king@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/bar_room_sea_king@2x.png new file mode 100644 index 0000000..7f10b7b Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/bar_room_sea_king@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/bar_room_sea_king@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/bar_room_sea_king@3x.png new file mode 100644 index 0000000..fd07c11 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_sea_king.imageset/bar_room_sea_king@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/Contents.json new file mode 100644 index 0000000..2375e0e --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_seduction_all@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_seduction_all@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/bar_room_seduction_all@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/bar_room_seduction_all@2x.png new file mode 100644 index 0000000..7f10b7b Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/bar_room_seduction_all@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/bar_room_seduction_all@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/bar_room_seduction_all@3x.png new file mode 100644 index 0000000..fd07c11 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_all.imageset/bar_room_seduction_all@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/Contents.json new file mode 100644 index 0000000..dd17c16 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_seduction_ta@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_seduction_ta@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/bar_room_seduction_ta@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/bar_room_seduction_ta@2x.png new file mode 100644 index 0000000..e5d4158 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/bar_room_seduction_ta@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/bar_room_seduction_ta@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/bar_room_seduction_ta@3x.png new file mode 100644 index 0000000..7b0ff51 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_seduction_ta.imageset/bar_room_seduction_ta@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/Contents.json new file mode 100644 index 0000000..05ff3c5 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_set_custom_gift@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_set_custom_gift@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/bar_room_set_custom_gift@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/bar_room_set_custom_gift@2x.png new file mode 100644 index 0000000..1848877 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/bar_room_set_custom_gift@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/bar_room_set_custom_gift@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/bar_room_set_custom_gift@3x.png new file mode 100644 index 0000000..90104ad Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_custom_gift.imageset/bar_room_set_custom_gift@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/Contents.json new file mode 100644 index 0000000..a674b32 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_set_seat_time@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_set_seat_time@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/bar_room_set_seat_time@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/bar_room_set_seat_time@2x.png new file mode 100644 index 0000000..f17b612 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/bar_room_set_seat_time@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/bar_room_set_seat_time@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/bar_room_set_seat_time@3x.png new file mode 100644 index 0000000..cc2fb1b Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_set_seat_time.imageset/bar_room_set_seat_time@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/Contents.json new file mode 100644 index 0000000..eb63371 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bar_room_time_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bar_room_time_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/bar_room_time_icon@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/bar_room_time_icon@2x.png new file mode 100644 index 0000000..66e8b78 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/bar_room_time_icon@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/bar_room_time_icon@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/bar_room_time_icon@3x.png new file mode 100644 index 0000000..7d2c69f Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/bar_room_time_icon.imageset/bar_room_time_icon@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/Contents.json new file mode 100644 index 0000000..b222a8a --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_bar_ask_bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_bar_ask_bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/room_bar_ask_bg@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/room_bar_ask_bg@2x.png new file mode 100644 index 0000000..eeaa6b0 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/room_bar_ask_bg@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/room_bar_ask_bg@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/room_bar_ask_bg@3x.png new file mode 100644 index 0000000..efc11bb Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_ask_bg.imageset/room_bar_ask_bg@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/Contents.json b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/Contents.json new file mode 100644 index 0000000..0e94c7c --- /dev/null +++ b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_bar_cabin_cover@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_bar_cabin_cover@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/room_bar_cabin_cover@2x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/room_bar_cabin_cover@2x.png new file mode 100644 index 0000000..36e308d Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/room_bar_cabin_cover@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/room_bar_cabin_cover@3x.png b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/room_bar_cabin_cover@3x.png new file mode 100644 index 0000000..4407393 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/room/酒吧房/room_bar_cabin_cover.imageset/room_bar_cabin_cover@3x.png differ diff --git a/QXLive/Other/NoitceAndKey.h b/QXLive/Other/NoitceAndKey.h index 8555de3..c472d62 100644 --- a/QXLive/Other/NoitceAndKey.h +++ b/QXLive/Other/NoitceAndKey.h @@ -121,6 +121,8 @@ static NSString *const kIsCanChat = @"kIsCanChat"; static NSString *const kIsCanChatMoney = @"kIsCanChatMoney"; /// 是否开启隐身进入 static NSString *const kIsCloseDrifNobility = @"kIsCloseDrifNobility"; +/// 撩人是否弹窗 +static NSString *const kIsCloseSeductionAlert = @"kIsCloseSeductionAlert"; // 微信登录 diff --git a/QXLive/Other/QXApi.h b/QXLive/Other/QXApi.h index ea669de..6e41c3c 100644 --- a/QXLive/Other/QXApi.h +++ b/QXLive/Other/QXApi.h @@ -269,7 +269,7 @@ static NSString * QXGiftList = @"api/Gift/get_gift_list"; /// 礼物标签列表 static NSString * QXGiftLabel = @"api/Gift/get_gift_label"; /// 直播间送礼 -static NSString * QXSendGift = @"api/Room/room_give_gift"; +static NSString * QXSendGift = @"api/SendGift/send_gift"; /// 在线列表 static NSString * QXOnlineList = @"api/Room/room_online_list"; /// 用户头像 @@ -593,4 +593,25 @@ static NSString * QXShopDressList = @"api/Decorate/get_decorate_list"; static NSString * QXShopDressDetail = @"api/Decorate/get_decorate_detail"; /// 购买装扮 static NSString * QXShopBuyDress = @"api/Decorate/pay_decorate"; + + +/// 酒吧房 +/// 新礼物列表 +static NSString * QXRoomNewGiftList = @"api/GiftNew/get_gift_list"; +/// 自定义礼物列表 +static NSString * QXRoomCustomGiftList = @"api/GiftNew/get_custom_gift_list"; +/// 设置自定义礼物 +static NSString * QXRoomSetCustom = @"api/GiftNew/set_custom_gift"; +/// 酒吧房麦位时长列表 +static NSString * QXRoomSeatTimeList = @"api/BarRoom/get_pit_time_list"; +///酒吧房麦位时长设置 +static NSString * QXRoomSetSeatTime = @"api/BarRoom/set_pit_time"; +/// 约她礼物详情 +static NSString * QXRoomGetSeatGift = @"api/BarRoom/get_gift_info_ta"; +/// 获取撩他所需金币 +static NSString * QXRoomGetSeductionCoin = @"api/BarRoom/get_liao_ta_coin"; +/// 撩他 +static NSString * QXRoomBarSeduction = @"api/BarRoom/liao_ta"; +/// 约他 +static NSString * QXRoomBarAsk = @"api/BarRoom/meeting_ta"; #endif /* Api_h */ diff --git a/QXLive/Other/Resource/zizi.mp4 b/QXLive/Other/Resource/zizi.mp4 new file mode 100644 index 0000000..afc31b1 Binary files /dev/null and b/QXLive/Other/Resource/zizi.mp4 differ diff --git a/QXLive/Room(房间)/Controller/QXRoomViewController+Bar.h b/QXLive/Room(房间)/Controller/QXRoomViewController+Bar.h new file mode 100644 index 0000000..99f3ab9 --- /dev/null +++ b/QXLive/Room(房间)/Controller/QXRoomViewController+Bar.h @@ -0,0 +1,16 @@ +// +// QXRoomViewController+Bar.h +// QXLive +// +// Created by 启星 on 2026/1/7. +// + +#import "QXRoomViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomViewController (Bar) + +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/Controller/QXRoomViewController+Bar.m b/QXLive/Room(房间)/Controller/QXRoomViewController+Bar.m new file mode 100644 index 0000000..e2e893a --- /dev/null +++ b/QXLive/Room(房间)/Controller/QXRoomViewController+Bar.m @@ -0,0 +1,25 @@ +// +// QXRoomViewController+Bar.m +// QXLive +// +// Created by 启星 on 2026/1/7. +// + +#import "QXRoomViewController+Bar.h" + +@implementation QXRoomViewController (Bar) +-(void)barRoomSeductionEffectWithModel:(QXRoomChatListModel*)model{ + [self.seatContentView barRoomSeductionEffectWithModel:model]; +} +-(void)barRoomJoinCabinRoomWithRoomId:(NSString *)room_id user_id:(NSString *)user_id meet_user_id:(NSString *)meet_user_id{ + [self.seatContentView barRoomJoinCabinRoomWithRoomId:room_id user_id:user_id meet_user_id:meet_user_id]; +} +-(void)barRoomHugPitWithUserId:(NSString *)userId pit_number:(nonnull NSString *)pit_number{ + if ([userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + [self.seatContentView barRoomUpseatActionWithPitNumber:pit_number]; + } +} +-(void)barRoomSetCustomGiftWithUserId:(NSString *)userId had_custom_gift:(BOOL)had_custom_gift{ + [self.seatContentView barRoomSetCustomGiftWithUserId:userId had_custom_gift:had_custom_gift]; +} +@end diff --git a/QXLive/Room(房间)/Controller/QXRoomViewController+Friend.m b/QXLive/Room(房间)/Controller/QXRoomViewController+Friend.m index 16dbe65..e67e81b 100644 --- a/QXLive/Room(房间)/Controller/QXRoomViewController+Friend.m +++ b/QXLive/Room(房间)/Controller/QXRoomViewController+Friend.m @@ -96,6 +96,7 @@ self.navigationController.viewControllers = viewControllers; [self.navigationController popViewControllerAnimated:YES]; QXGlobal.shareGlobal.superRoomId = @""; + [[QXRoomMessageManager shared] quitExGroup]; // [self.navigationController popViewControllerAnimated:YES]; } /// 私密小屋时间发生延时 diff --git a/QXLive/Room(房间)/Controller/QXRoomViewController+Sign.m b/QXLive/Room(房间)/Controller/QXRoomViewController+Sign.m index 974f86c..c6b4837 100644 --- a/QXLive/Room(房间)/Controller/QXRoomViewController+Sign.m +++ b/QXLive/Room(房间)/Controller/QXRoomViewController+Sign.m @@ -49,7 +49,7 @@ al.type = QXAlertViewTypeSignSeat; al.message = content; al.commitBlock = ^{ - [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:@"1" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:@"1" gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); diff --git a/QXLive/Room(房间)/Controller/QXRoomViewController.m b/QXLive/Room(房间)/Controller/QXRoomViewController.m index e67a475..ec9d10c 100644 --- a/QXLive/Room(房间)/Controller/QXRoomViewController.m +++ b/QXLive/Room(房间)/Controller/QXRoomViewController.m @@ -46,7 +46,8 @@ QXRoomBottomViewDelegate, QXRoomSettingViewDelegate, QXAgoraEngineMediaPlayerDelegate, -QXRoomUserInfoViewDelegate +QXRoomUserInfoViewDelegate, +QXUpSeatViewDelegate > @property (nonatomic,strong)UIImageView *roomBgImageView; @property (nonatomic,strong)UIView *roomBgCoverView; @@ -104,9 +105,9 @@ QXRoomUserInfoViewDelegate -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:YES]; - if (QXGlobal.shareGlobal.isOpenRecharge) { - self.dayTaskTagView.hidden = NO; - } +// if (QXGlobal.shareGlobal.isOpenRecharge) { +// self.dayTaskTagView.hidden = NO; +// } } -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; @@ -381,7 +382,12 @@ QXRoomUserInfoViewDelegate if (self.roomModel.room_info.type_id.intValue != 6) { [self.roomBgImageView sd_setImageWithURL:[NSURL URLWithString:self.roomModel.room_info.room_background]]; }else{ - self.roomBgImageView.image = [UIImage imageNamed:@"cp_room_bg"]; + if ([self.roomModel.room_info.label_id isEqualToString:@"11"]) { + self.roomBgImageView.image = [UIImage imageNamed:@"bar_cabin_room_bg"]; + }else{ + self.roomBgImageView.image = [UIImage imageNamed:@"cp_room_bg"]; + } + ///bar_cabin_room_bg } if (self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4 || self.roomModel.room_info.type_id.intValue == 8) { // 点唱房 @@ -454,23 +460,41 @@ QXRoomUserInfoViewDelegate make.width.mas_equalTo(ScaleWidth(280)); }]; }else if (self.roomModel.room_info.type_id.intValue == 6) { - //小黑屋 - [self.seatContentView setType:(QXRoomSeatViewTypeCabin)]; + /// 小黑屋不显示每日任务 + self.dayTaskTagView.hidden = YES; self.titleView.hidden = YES; self.upSeatBtn.hidden = YES; - self.bottomView.isCabinRoom = YES; - [self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self.view); - make.top.mas_equalTo(kSafeAreaTop); - make.height.mas_equalTo(ScaleWidth(380)); - }]; - [self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.bottom.equalTo(self.bottomView.mas_top); - make.left.equalTo(self.view); - make.top.equalTo(self.seatContentView.mas_bottom); - make.width.mas_equalTo(ScaleWidth(280)); - }]; - [self.view insertSubview:self.movieView atIndex:0]; + if ([self.roomModel.room_info.label_id isEqualToString:@"11"]) { + self.bottomView.isBarCabinRoom = YES; + [self.seatContentView setType:(QXRoomSeatViewTypeBarCabin)]; + [self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.view); + make.top.mas_equalTo(kSafeAreaTop); + make.height.mas_equalTo(ScaleWidth(380)); + }]; + [self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bottomView.mas_top); + make.left.equalTo(self.view); + make.top.equalTo(self.seatContentView.mas_bottom); + make.width.mas_equalTo(ScaleWidth(280)); + }]; + }else{ + self.bottomView.isCabinRoom = YES; + //小黑屋 + [self.seatContentView setType:(QXRoomSeatViewTypeCabin)]; + [self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.view); + make.top.mas_equalTo(kSafeAreaTop); + make.height.mas_equalTo(ScaleWidth(380)); + }]; + [self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bottomView.mas_top); + make.left.equalTo(self.view); + make.top.equalTo(self.seatContentView.mas_bottom); + make.width.mas_equalTo(ScaleWidth(280)); + }]; + [self.view insertSubview:self.movieView atIndex:0]; + } }else if (self.roomModel.room_info.type_id.intValue == 7) { /// 交友房 [self resetFriendViews]; @@ -478,7 +502,22 @@ QXRoomUserInfoViewDelegate [self resetSingerViews]; }else if (self.roomModel.room_info.type_id.intValue == 10) { [self resetSignViews]; + }else if (self.roomModel.room_info.type_id.intValue == 11){ + [self.seatContentView setType:(QXRoomSeatViewTypeBar)]; + CGFloat seatHeight = (ScaleWidth(60-10)+51-ScaleWidth(15)-5 + ScaleWidth(12+14)-5)*2+12+ScaleWidth(65-10+32)+51-ScaleWidth(15); + [self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.view); + make.top.mas_equalTo(self.titleView.bottom+12); + make.height.mas_equalTo(seatHeight); + }]; + [self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bottomView.mas_top); + make.left.equalTo(self.view); + make.top.equalTo(self.seatContentView.mas_bottom); + make.width.mas_equalTo(ScaleWidth(280)); + }]; } + if (self.roomModel.room_info.last_pk_room_id.isExist) { if (![self.roomModel.room_info.last_pk_room_id isEqualToString:self.roomModel.pk_info.pk_room_id]) { @@ -503,15 +542,22 @@ QXRoomUserInfoViewDelegate -(void)configRoomDataIsJoin:(BOOL)isJoin{ self.seatContentView.hidden = NO; self.bottomView.hidden = NO; - NSMutableArray *userIds = [NSMutableArray array]; +// NSMutableArray *userIds = [NSMutableArray array]; // [self getUserOnlineStatusWithUserIds:[userIds componentsJoinedByString:@","]]; self.micTeamView.countLabel.text = self.roomModel.room_info.queue_number; self.titleView.roomModel = self.roomModel; if (self.roomModel.room_info.type_id.intValue == 6) { - self.bottomView.isCabinRoom = YES; + [[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:YES]; + if ([self.roomModel.room_info.label_id isEqualToString:@"11"]) { + /// 酒吧房需要加入主房间im + self.bottomView.isBarCabinRoom = YES; + [[QXRoomMessageManager shared] joinExGroupWithRoomId:QXGlobal.shareGlobal.superRoomId]; + }else{ + self.bottomView.isCabinRoom = YES; + } }else{ if (self.roomModel.user_info.pit_number.intValue > 0) { [[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:YES]; @@ -652,7 +698,12 @@ QXRoomUserInfoViewDelegate -(void)configBottomTools{ if (self.roomModel.room_info.type_id.intValue == 6) { - self.bottomView.isCabinRoom = YES; + if ([self.roomModel.room_info.label_id isEqualToString:@"11"]) { + self.bottomView.isBarCabinRoom = YES; + [[QXRoomMessageManager shared] joinExGroupWithRoomId:QXGlobal.shareGlobal.superRoomId]; + }else{ + self.bottomView.isCabinRoom = YES; + } return; } self.bottomView.roomModel = self.roomModel; @@ -839,8 +890,8 @@ QXRoomUserInfoViewDelegate } } /// 上下麦发生变化 --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ - [self.seatContentView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ + [self.seatContentView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; if ([user.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { ///点唱房的特殊处理 @@ -1271,7 +1322,7 @@ QXRoomUserInfoViewDelegate } #pragma mark - QXRoomBottomViewDelegate --(void)didClickEventType:(QXRoomBottomViewEventType)type isSelected:(BOOL)isSelected{ +-(void)didClickEventType:(QXRoomBottomViewEventType)type isSelected:(BOOL)isSelected isSuperRoom:(BOOL)isSuperRoom{ switch (type) { case QXRoomBottomViewEventTypePlayAudio:{ @@ -1303,7 +1354,7 @@ QXRoomUserInfoViewDelegate @"is_mute":[NSNumber numberWithInteger:0], }; NSString *jsonStr = [dict jsonStringEncoded]; - [[QXRoomMessageManager shared] sendChatMessage:jsonStr messageType:(QXRoomMessageTypeMuteLocalAudio) needInsertMessage:NO]; + [[QXRoomMessageManager shared] sendChatMessage:jsonStr messageType:(QXRoomMessageTypeMuteLocalAudio) needInsertMessage:NO isSuperRoom:NO]; } // [[QXAgoraEngine sharedEngine] muteLocalAudioStream:!isSelected]; @@ -1497,6 +1548,7 @@ QXRoomUserInfoViewDelegate } break; case QXRoomBottomViewEventTypeEmoji:{ + self.emojiView.isSuperRoom = isSuperRoom; [self.emojiView showInView:self.view]; } break; @@ -1561,7 +1613,7 @@ QXRoomUserInfoViewDelegate -(void)didClickSetModel:(QXRoomSettingModel *)model{ switch (model.type) { case QXRoomSettingTypeRoomClearMessage:{ - [[QXRoomMessageManager shared] sendChatMessage:@"" messageType:(QXRoomMessageTypeClearMessage) needInsertMessage:NO]; + [[QXRoomMessageManager shared] sendChatMessage:@"" messageType:(QXRoomMessageTypeClearMessage) needInsertMessage:NO isSuperRoom:NO]; [self.chatListView clearMessage]; [self.settingView hide]; showToast(@"清除消息成功"); @@ -1742,10 +1794,40 @@ QXRoomUserInfoViewDelegate -(void)micTeamAction{ self.upSeatView.isCompere = (self.seatContentView.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1); self.upSeatView.roomId = self.roomId; + self.upSeatView.delegate = self; [self.upSeatView showInView:self.view]; } + +-(void)didClickUpSeat{ + [self.seatContentView barRoomUpseatActionWithPitNumber:@""]; +} + +-(void)upSeatFinish{ + self.upSeatView.roomId = self.roomId; +} + -(void)upDownSeatNetworkWithPitNum:(NSString*)pitNum isUpSeat:(BOOL)isUpSeat{ - [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:pitNum isUpSeat:isUpSeat successBlock:^(NSDictionary * _Nonnull dict) { + if ([self.roomModel.room_info.type_id isEqualToString:@"11"]) { + if (pitNum.intValue == 9 || pitNum.intValue == 10) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:pitNum gift_id:@"" isUpSeat:isUpSeat successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + }else{ + if (isUpSeat) { + [self.seatContentView barRoomUpseatActionWithPitNumber:pitNum]; + }else{ + [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:pitNum gift_id:@"" isUpSeat:isUpSeat successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + } + } + return; + } + [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:pitNum gift_id:@"" isUpSeat:isUpSeat successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -2144,7 +2226,7 @@ QXRoomUserInfoViewDelegate -(QXRoomDayTaskTagView *)dayTaskTagView{ if (!_dayTaskTagView) { _dayTaskTagView = [[QXRoomDayTaskTagView alloc] init]; - _dayTaskTagView.hidden = YES; +// _dayTaskTagView.hidden = YES; MJWeakSelf _dayTaskTagView.startBlock = ^{ QXTaskViewController *vc = [[QXTaskViewController alloc] init]; diff --git a/QXLive/Room(房间)/View/QXRoomBottomView.h b/QXLive/Room(房间)/View/QXRoomBottomView.h index 3acca0e..4040167 100644 --- a/QXLive/Room(房间)/View/QXRoomBottomView.h +++ b/QXLive/Room(房间)/View/QXRoomBottomView.h @@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN @optional --(void)didClickEventType:(QXRoomBottomViewEventType)type isSelected:(BOOL)isSelected; +-(void)didClickEventType:(QXRoomBottomViewEventType)type isSelected:(BOOL)isSelected isSuperRoom:(BOOL)isSuperRoom; -(void)didSendMessage:(NSString*)message redpacketModel:(QXRedPacketModel*)redpacketModel; @end @@ -50,7 +50,8 @@ NS_ASSUME_NONNULL_BEGIN -(void)setRoleType:(QXRoomRoleType)roleType hasPK:(BOOL)hasPK hasSong:(BOOL)hasSong; /// 是否是小黑屋 @property (nonatomic,assign)BOOL isCabinRoom; - +/// 是否是酒吧房小黑屋 +@property (nonatomic,assign)BOOL isBarCabinRoom; -(void)atUserWithName:(NSString*)nickname; -(void)inputMessageWithName:(NSString*)message redpacketModel:(QXRedPacketModel*)redpacketModel; diff --git a/QXLive/Room(房间)/View/QXRoomBottomView.m b/QXLive/Room(房间)/View/QXRoomBottomView.m index 2a52f5e..35b4cbd 100644 --- a/QXLive/Room(房间)/View/QXRoomBottomView.m +++ b/QXLive/Room(房间)/View/QXRoomBottomView.m @@ -32,6 +32,10 @@ @property (nonatomic,strong)QXDynamicCommentInputView *commentView; @property (nonatomic,strong)QXRedPacketModel* redpacketModel; + +@property (nonatomic,strong)UIButton* openCabinBtn; +@property (nonatomic,strong)UIButton* micBtn; +@property (nonatomic,strong)UIButton* voiceBtn; @end @implementation QXRoomBottomView @@ -140,6 +144,8 @@ [self.setBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)];; self.setBtn.hidden = YES; [self addSubview:self.setBtn]; + + [self addSubview:self.openCabinBtn]; } -(void)setRoomModel:(QXRoomModel *)roomModel{ _roomModel = roomModel; @@ -156,6 +162,39 @@ btn.hidden = YES; } } + +-(void)setIsBarCabinRoom:(BOOL)isBarCabinRoom{ + _isBarCabinRoom = isBarCabinRoom; + CGFloat btnWidth = 35; + [self.sayBg mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(16); + make.top.equalTo(self); + make.height.mas_equalTo(36); + make.right.mas_equalTo(-(60+btnWidth*2+16)); + }]; + self.audioBtn.hidden = NO; + self.playAudioBtn.hidden = NO; + self.openCabinBtn.hidden = NO; + [self.openCabinBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-16); + make.centerY.equalTo(self.sayBg); + make.width.mas_equalTo(40); + make.height.mas_equalTo(35); + }]; + [self.audioBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.openCabinBtn.mas_left).offset(-5); + make.centerY.equalTo(self.sayBg); + make.width.mas_equalTo(40); + make.height.mas_equalTo(35); + }]; + [self.playAudioBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.audioBtn.mas_left); + make.centerY.equalTo(self.sayBg); + make.width.mas_equalTo(40); + make.height.mas_equalTo(35); + }]; + +} -(void)noticeUnreadNumberDidChanged:(NSNotification*)notice{ NSNumber *number = notice.object; [self.messageBtn.unreadView setNum:number.longValue]; @@ -328,6 +367,10 @@ [self.vc.view addSubview:self.commentView]; [self.commentView.textField becomeFirstResponder]; } + +-(void)openCabinAction{ + self.openCabinBtn.selected = !self.openCabinBtn.selected; +} -(void)eventAction:(UIButton*)sender{ if (sender == self.audioBtn) { @@ -340,8 +383,8 @@ if (sender == self.playAudioBtn) { sender.selected = !sender.selected; } - if (self.delegate && [self.delegate respondsToSelector:@selector(didClickEventType:isSelected:)]) { - [self.delegate didClickEventType:sender.tag isSelected:sender.selected]; + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickEventType:isSelected:isSuperRoom:)]) { + [self.delegate didClickEventType:sender.tag isSelected:sender.selected isSuperRoom:!self.openCabinBtn.selected]; } } -(void)atUserWithName:(NSString *)nickname{ @@ -367,7 +410,7 @@ return; } [[QXGlobal shareGlobal] finishTask]; - [[QXRoomMessageManager shared] sendChatMessage:text messageType:(QXRoomMessageTypeText) needInsertMessage:YES]; + [[QXRoomMessageManager shared] sendChatMessage:text messageType:(QXRoomMessageTypeText) needInsertMessage:YES isSuperRoom:!self.openCabinBtn.selected]; self.commentView.textField.text = @""; if (self.redpacketModel == nil) { @@ -434,4 +477,16 @@ } return _inputBigBgView; } +-(UIButton *)openCabinBtn{ + if (!_openCabinBtn) { + _openCabinBtn = [[UIButton alloc] init]; + [_openCabinBtn setImage:[UIImage imageNamed:@"bar_room_close_privite"] forState:(UIControlStateNormal)]; + [_openCabinBtn setImage:[UIImage imageNamed:@"bar_room_open_privite"] forState:(UIControlStateSelected)]; + [_openCabinBtn addTarget:self action:@selector(openCabinAction) forControlEvents:(UIControlEventTouchUpInside)]; + _openCabinBtn.hidden = YES; + _openCabinBtn.selected = YES; + } + return _openCabinBtn; +} + @end diff --git a/QXLive/Room(房间)/View/QXRoomChatListView.h b/QXLive/Room(房间)/View/QXRoomChatListView.h index 16876db..633791c 100644 --- a/QXLive/Room(房间)/View/QXRoomChatListView.h +++ b/QXLive/Room(房间)/View/QXRoomChatListView.h @@ -101,6 +101,7 @@ typedef NS_ENUM(NSInteger) { @interface QXRoomChatListModel : NSObject @property (nonatomic,assign)QXRoomChatMessageType messageType; +@property (nonatomic,assign)BOOL isSuperRoom; @property (nonatomic,strong)NSString* text; @property (nonatomic,strong)NSString* rights_icon; @property (nonatomic,strong)QXGiftModel* GiftInfo; diff --git a/QXLive/Room(房间)/View/QXRoomChatListView.m b/QXLive/Room(房间)/View/QXRoomChatListView.m index 8c5137e..41de730 100644 --- a/QXLive/Room(房间)/View/QXRoomChatListView.m +++ b/QXLive/Room(房间)/View/QXRoomChatListView.m @@ -13,6 +13,7 @@ #define messageNameColor RGB16(0x00C8FF) #define messageGiftColor RGB16(0xFFE309) #define messageBubbleColor RGB16A(0x000000, 0.3) +#define superRoomMessageColor RGB16(0x6B647E) #define messageBubbleMargin 2 NSArray *findAllOccurrencesOfString(NSString *fullString, NSString *substring) { NSMutableArray *occurrences = [NSMutableArray array]; @@ -54,6 +55,7 @@ NSInteger maxMessageCount = 20; @property (nonatomic,strong)UILabel *messageLabel; @property (nonatomic,strong)UIButton *messageCountBtn; @property (nonatomic,strong)AVSpeechSynthesizer *synthesizer; +@property (nonatomic,assign)BOOL isSuperRoom; @end @implementation QXRoomChatListView @@ -470,36 +472,42 @@ NSInteger maxMessageCount = 20; _message = message; // self.titleLabel.text = message.text; NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text]; - if ([message.FromUserInfo.nickname isExist]) { - [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]]; - } - if ([message.ToUserInfo.nickname isExist]) { - [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]]; - } - if ([message.GiftInfo.gift_name isExist]) { - NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","]; - for (NSString*gift_name in arr) { - NSArray *occurrences = findAllOccurrencesOfString(message.text, gift_name); - for (NSValue *rangeValue in occurrences) { - NSRange range = [rangeValue rangeValue]; - [attr yy_setColor:messageGiftColor range:range]; + if (message.isSuperRoom) { + self.nameLabel.textColor = superRoomMessageColor; + [attr yy_setColor:superRoomMessageColor range:NSMakeRange(0, attr.length)]; + }else{ + self.nameLabel.textColor = messageNameColor; + if ([message.FromUserInfo.nickname isExist]) { + [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]]; + } + if ([message.ToUserInfo.nickname isExist]) { + [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]]; + } + if ([message.GiftInfo.gift_name isExist]) { + NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","]; + for (NSString*gift_name in arr) { + NSArray *occurrences = findAllOccurrencesOfString(message.text, gift_name); + for (NSValue *rangeValue in occurrences) { + NSRange range = [rangeValue rangeValue]; + [attr yy_setColor:messageGiftColor range:range]; + } } } - } - if (message.GiftInfos.count > 0) { - for (QXGiftModel*gift in message.GiftInfos) { - if ([gift.gift_name isExist]) { - [attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]]; + if (message.GiftInfos.count > 0) { + for (QXGiftModel*gift in message.GiftInfos) { + if ([gift.gift_name isExist]) { + [attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]]; + } } } - } - if (message.ToUserInfos.count > 0) { - for (int i = 0; i < message.ToUserInfos.count; i++) { - QXUserHomeModel*md = message.ToUserInfos[i]; - NSArray *occurrences = findAllOccurrencesOfString(message.text, md.nickname); - for (NSValue *rangeValue in occurrences) { - NSRange range = [rangeValue rangeValue]; - [attr yy_setColor:messageNameColor range:range]; + if (message.ToUserInfos.count > 0) { + for (int i = 0; i < message.ToUserInfos.count; i++) { + QXUserHomeModel*md = message.ToUserInfos[i]; + NSArray *occurrences = findAllOccurrencesOfString(message.text, md.nickname); + for (NSValue *rangeValue in occurrences) { + NSRange range = [rangeValue rangeValue]; + [attr yy_setColor:messageNameColor range:range]; + } } } } @@ -729,36 +737,40 @@ NSInteger maxMessageCount = 20; _message = message; // self.titleLabel.text = message.text; NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text]; - if ([message.FromUserInfo.nickname isExist]) { - [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]]; - } - if ([message.ToUserInfo.nickname isExist]) { - [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]]; - } - if ([message.GiftInfo.gift_name isExist]) { - NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","]; - for (NSString*gift_name in arr) { - NSArray *occurrences = findAllOccurrencesOfString(message.text, gift_name); - for (NSValue *rangeValue in occurrences) { - NSRange range = [rangeValue rangeValue]; - [attr yy_setColor:messageGiftColor range:range]; + if (message.isSuperRoom) { + [attr yy_setColor:superRoomMessageColor range:NSMakeRange(0, attr.length)]; + }else{ + if ([message.FromUserInfo.nickname isExist]) { + [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]]; + } + if ([message.ToUserInfo.nickname isExist]) { + [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]]; + } + if ([message.GiftInfo.gift_name isExist]) { + NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","]; + for (NSString*gift_name in arr) { + NSArray *occurrences = findAllOccurrencesOfString(message.text, gift_name); + for (NSValue *rangeValue in occurrences) { + NSRange range = [rangeValue rangeValue]; + [attr yy_setColor:messageGiftColor range:range]; + } } } - } - if (message.GiftInfos.count > 0) { - for (QXGiftModel*gift in message.GiftInfos) { - if ([gift.gift_name isExist]) { - [attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]]; + if (message.GiftInfos.count > 0) { + for (QXGiftModel*gift in message.GiftInfos) { + if ([gift.gift_name isExist]) { + [attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]]; + } } } - } - if (message.ToUserInfos.count > 0) { - for (int i = 0; i < message.ToUserInfos.count; i++) { - QXUserHomeModel*md = message.ToUserInfos[i]; - NSArray *occurrences = findAllOccurrencesOfString(message.text, md.nickname); - for (NSValue *rangeValue in occurrences) { - NSRange range = [rangeValue rangeValue]; - [attr yy_setColor:messageNameColor range:range]; + if (message.ToUserInfos.count > 0) { + for (int i = 0; i < message.ToUserInfos.count; i++) { + QXUserHomeModel*md = message.ToUserInfos[i]; + NSArray *occurrences = findAllOccurrencesOfString(message.text, md.nickname); + for (NSValue *rangeValue in occurrences) { + NSRange range = [rangeValue rangeValue]; + [attr yy_setColor:messageNameColor range:range]; + } } } } @@ -882,7 +894,7 @@ NSInteger maxMessageCount = 20; } -(void)layoutSubviews{ [super layoutSubviews]; - [self.bgView addRoundedCornersWithRadius:self.bgView.height/2]; + [self.bgView addRoundedCornersWithRadius:10]; } -(void)loadBubble{ // if ([self.message.FromUserInfo.chat_bubble isExist]) { @@ -953,12 +965,12 @@ NSInteger maxMessageCount = 20; } -(void)setMessage:(QXRoomChatListModel *)message{ _message = message; + if (message.isSuperRoom) { + self.nameLabel.textColor = superRoomMessageColor; + }else{ + self.nameLabel.textColor = messageNameColor; + } self.nameLabel.text = message.FromUserInfo.nickname; -// if ([message.FromUserInfo.nickname_color isExist]) { -// self.nameLabel.textColor = [UIColor colorWithHexString:message.FromUserInfo.nickname_color]; -// }else{ -// self.nameLabel.textColor = RGB16(0xDED6ED); -// } [self.headerImageView setHeadIcon:message.FromUserInfo.avatar dress:@""]; [self.headerImageView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.nobility_image]]; self.iconBgView.hidden = YES; @@ -1200,47 +1212,51 @@ NSInteger maxMessageCount = 20; if (self.message.messageType == QXRoomChatMessageTypeNotice) { [self.bgView addRoundedCornersWithRadius:8]; }else{ - [self.bgView addRoundedCornersWithRadius:self.bgView.height/2]; + [self.bgView addRoundedCornersWithRadius:10]; } } -(void)setMessage:(QXRoomChatListModel *)message{ _message = message; NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text]; - if ([message.FromUserInfo.nickname isExist]) { - [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]]; - } - if ([message.ToUserInfo.nickname isExist]) { - [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]]; - } - if ([message.GiftInfo.gift_name isExist]) { - NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","]; - for (NSString*gift_name in arr) { - NSArray *occurrences = findAllOccurrencesOfString(message.text, gift_name); - for (NSValue *rangeValue in occurrences) { - NSRange range = [rangeValue rangeValue]; - [attr yy_setColor:messageGiftColor range:range]; + if (message.isSuperRoom) { + [attr yy_setColor:superRoomMessageColor range:NSMakeRange(0, attr.length)]; + }else{ + if ([message.FromUserInfo.nickname isExist]) { + [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.FromUserInfo.nickname]]; + } + if ([message.ToUserInfo.nickname isExist]) { + [attr yy_setColor:messageNameColor range:[message.text rangeOfString:message.ToUserInfo.nickname]]; + } + if ([message.GiftInfo.gift_name isExist]) { + NSArray *arr = [message.GiftInfo.gift_name componentsSeparatedByString:@","]; + for (NSString*gift_name in arr) { + NSArray *occurrences = findAllOccurrencesOfString(message.text, gift_name); + for (NSValue *rangeValue in occurrences) { + NSRange range = [rangeValue rangeValue]; + [attr yy_setColor:messageGiftColor range:range]; + } } } - } - if (message.GiftInfos.count > 0) { - for (QXGiftModel*gift in message.GiftInfos) { - if ([gift.gift_name isExist]) { - [attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]]; + if (message.GiftInfos.count > 0) { + for (QXGiftModel*gift in message.GiftInfos) { + if ([gift.gift_name isExist]) { + [attr yy_setColor:messageGiftColor range:[message.text rangeOfString:gift.gift_name]]; + } } } - } - if (message.ToUserInfos.count > 0) { - for (int i = 0; i < message.ToUserInfos.count; i++) { - QXUserHomeModel*md = message.ToUserInfos[i]; - NSArray *occurrences = findAllOccurrencesOfString(message.text, md.nickname); - for (NSValue *rangeValue in occurrences) { - NSRange range = [rangeValue rangeValue]; - [attr yy_setColor:messageNameColor range:range]; + if (message.ToUserInfos.count > 0) { + for (int i = 0; i < message.ToUserInfos.count; i++) { + QXUserHomeModel*md = message.ToUserInfos[i]; + NSArray *occurrences = findAllOccurrencesOfString(message.text, md.nickname); + for (NSValue *rangeValue in occurrences) { + NSRange range = [rangeValue rangeValue]; + [attr yy_setColor:messageNameColor range:range]; + } } } - } - if (message.messageType == QXRoomChatMessageTypeNotice) { - [attr yy_setColor:messageNoticeColor range:NSMakeRange(0, attr.length)]; + if (message.messageType == QXRoomChatMessageTypeNotice) { + [attr yy_setColor:messageNoticeColor range:NSMakeRange(0, attr.length)]; + } } self.titleLabel.attributedText = attr; } diff --git a/QXLive/Room(房间)/View/QXRoomTitleView.m b/QXLive/Room(房间)/View/QXRoomTitleView.m index d6de1e8..b562623 100644 --- a/QXLive/Room(房间)/View/QXRoomTitleView.m +++ b/QXLive/Room(房间)/View/QXRoomTitleView.m @@ -14,7 +14,7 @@ #import "QXRoomMessageManager.h" #import "QXMineNetwork.h" #import "QXDynamicNetwork.h" - +#import "QXRoomBarCabinListView.h" @interface QXRoomTitleView() /// 左侧房间信息背景 @property (nonatomic,strong) UIView *leftBgView; @@ -39,6 +39,8 @@ @property (nonatomic,strong) UIButton *noticeBtn; /// 清除魅力 @property (nonatomic,strong)UIButton *clearCharmBtn; +/// 清除魅力 +@property (nonatomic,strong)UIButton *cabinRoom; @property (nonatomic,strong) QXRoomOnlineUserListView *onlineListView; @@ -209,6 +211,23 @@ make.left.equalTo(self.noticeBtn.mas_right).offset(12); make.top.equalTo(self.leftBgView.mas_bottom).offset(12); }]; + + self.cabinRoom = [[UIButton alloc] init]; + self.cabinRoom.hidden = YES; + [self.cabinRoom setTitle:[NSString stringWithFormat:@" %@",@"交友小屋"] forState:(UIControlStateNormal)]; + self.cabinRoom.titleLabel.font = [UIFont systemFontOfSize:12]; + [self.cabinRoom setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; + [self.cabinRoom addTarget:self action:@selector(cabinAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.cabinRoom setImage:[UIImage imageNamed:@"room_clear_charm"] forState:(UIControlStateNormal)]; + self.cabinRoom.backgroundColor = RGB16A(0xFFFFFF,0.2); + [self.cabinRoom addRoundedCornersWithRadius:ScaleWidth(11)]; + [self addSubview:self.cabinRoom]; + [self.cabinRoom mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(ScaleWidth(78)); + make.height.mas_equalTo(ScaleWidth(22)); + make.left.equalTo(self.noticeBtn.mas_right).offset(12); + make.top.equalTo(self.leftBgView.mas_bottom).offset(12); + }]; } -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{ @@ -350,6 +369,12 @@ self.roomModel.user_info.is_collect = isCollect?@"1":@"0"; self.followBtn.selected = isCollect?YES:NO; } + +-(void)cabinAction{ + QXRoomBarCabinListView *cabinListView = [[QXRoomBarCabinListView alloc] init]; + [cabinListView showInView:self.viewController.view]; +} + -(void)followAction:(UIButton*)sender{ MJWeakSelf [QXDynamicNetwork followWithUserId:self.roomId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) { diff --git a/QXLive/Room(房间)/View/QXUpSeatView.m b/QXLive/Room(房间)/View/QXUpSeatView.m index 644fe45..2ea80ec 100644 --- a/QXLive/Room(房间)/View/QXUpSeatView.m +++ b/QXLive/Room(房间)/View/QXUpSeatView.m @@ -288,15 +288,15 @@ } -(void)commitAction{ -// if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUpSeat)]) { -// [self.delegate didClickUpSeat]; -// } - MJWeakSelf - [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { - [weakSelf setRoomId:weakSelf.roomId]; - } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - showToast(msg); - }]; + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUpSeat)]) { + [self.delegate didClickUpSeat]; + } +// MJWeakSelf +// [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:@"" gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { +// [weakSelf setRoomId:weakSelf.roomId]; +// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { +// showToast(msg); +// }]; } -(void)clearAction{ diff --git a/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.h b/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.h index dbcdf2c..a4eb747 100644 --- a/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.h +++ b/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.h @@ -8,6 +8,7 @@ #import #import "QXRoomRelationModel.h" #import "QXUserDressModel.h" +#import "QXRoomSeatTimeModel.h" NS_ASSUME_NONNULL_BEGIN @interface QXSelectAuctionInfoView : UIView @@ -27,6 +28,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong) QXRoomRelationModel *model; @property (nonatomic,strong) QXRoomRelationModel *timeModel; + +@property (nonatomic,strong) QXRoomSeatTimeModel *seatTimeModel; @property (nonatomic,strong) QXShopDressPriceModel *priceModel; @property (nonatomic,strong) UIButton *selectedBtn; @end diff --git a/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.m b/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.m index f8752cf..10b06a2 100644 --- a/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.m +++ b/QXLive/Room(房间)/View/拍卖房/QXSelectAuctionInfoView.m @@ -422,12 +422,23 @@ -(void)setTimeModel:(QXRoomRelationModel *)timeModel{ _timeModel = timeModel; [self.selectedBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateSelected)]; - [self.selectedBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)]; + [self.selectedBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; [self.selectedBtn setTitle:timeModel.name forState:(UIControlStateNormal)]; self.selectedBtn.layer.borderColor = RGB16(0xF1F2F3).CGColor; self.selectedBtn.layer.borderWidth = 1; self.selectedBtn.selected = timeModel.isSelected; } + +-(void)setSeatTimeModel:(QXRoomSeatTimeModel *)seatTimeModel{ + _seatTimeModel = seatTimeModel; + [self.selectedBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateSelected)]; + [self.selectedBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; + [self.selectedBtn setTitle:seatTimeModel.time_str forState:(UIControlStateNormal)]; + self.selectedBtn.layer.borderColor = RGB16(0xF1F2F3).CGColor; + self.selectedBtn.layer.borderWidth = 1; + self.selectedBtn.selected = seatTimeModel.isSelected; +} + -(void)setPriceModel:(QXShopDressPriceModel *)priceModel{ _priceModel = priceModel; [self.selectedBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateSelected)]; diff --git a/QXLive/Room(房间)/View/用户信息/QXRoomUserInfoView.m b/QXLive/Room(房间)/View/用户信息/QXRoomUserInfoView.m index 11ed739..529309b 100644 --- a/QXLive/Room(房间)/View/用户信息/QXRoomUserInfoView.m +++ b/QXLive/Room(房间)/View/用户信息/QXRoomUserInfoView.m @@ -938,7 +938,7 @@ MJWeakSelf if (sender == self.upSeatBtn) { if ([self.userId isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { - [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:self.pitNumber isUpSeat:NO successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:self.pitNumber gift_id:@"" isUpSeat:NO successBlock:^(NSDictionary * _Nonnull dict) { [weakSelf hide]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); diff --git a/QXLive/Room(房间)/View/签约房/QXSignShowTimeView.m b/QXLive/Room(房间)/View/签约房/QXSignShowTimeView.m index 4fb6a8f..62557bc 100644 --- a/QXLive/Room(房间)/View/签约房/QXSignShowTimeView.m +++ b/QXLive/Room(房间)/View/签约房/QXSignShowTimeView.m @@ -100,7 +100,7 @@ showToast(@"请选择您要展示的才艺"); return; } - [[QXRoomMessageManager shared] sendChatMessage:[NSString stringWithFormat:@"选择的才艺是 %@",self.selectedModel.name] messageType:(QXRoomMessageTypeText) needInsertMessage:YES]; + [[QXRoomMessageManager shared] sendChatMessage:[NSString stringWithFormat:@"选择的才艺是 %@",self.selectedModel.name] messageType:(QXRoomMessageTypeText) needInsertMessage:YES isSuperRoom:NO]; [self hide]; } diff --git a/QXLive/Room(房间)/View/表情/QXRoomEmojiView.h b/QXLive/Room(房间)/View/表情/QXRoomEmojiView.h index 5b1c840..d7d0c4e 100644 --- a/QXLive/Room(房间)/View/表情/QXRoomEmojiView.h +++ b/QXLive/Room(房间)/View/表情/QXRoomEmojiView.h @@ -10,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN @interface QXRoomEmojiView : UIView +@property (nonatomic,assign)BOOL isSuperRoom; -(void)showInView:(UIView *)view; @end diff --git a/QXLive/Room(房间)/View/表情/QXRoomEmojiView.m b/QXLive/Room(房间)/View/表情/QXRoomEmojiView.m index dfc1e2a..9b8e728 100644 --- a/QXLive/Room(房间)/View/表情/QXRoomEmojiView.m +++ b/QXLive/Room(房间)/View/表情/QXRoomEmojiView.m @@ -82,10 +82,13 @@ }]; } +-(void)setIsSuperRoom:(BOOL)isSuperRoom{ + _isSuperRoom = isSuperRoom; +} -(void)didSelectedEmoji:(QXEmojiModel *)model{ [self hide]; - [[QXRoomMessageManager shared] sendChatEmoji:model]; + [[QXRoomMessageManager shared] sendChatEmoji:model isSuperRoom:self.isSuperRoom]; } -(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{ return self.dataArray.count; diff --git a/QXLive/Room(房间)/View/设置/QXRoomSettingView.h b/QXLive/Room(房间)/View/设置/QXRoomSettingView.h index fced214..dfa24f9 100644 --- a/QXLive/Room(房间)/View/设置/QXRoomSettingView.h +++ b/QXLive/Room(房间)/View/设置/QXRoomSettingView.h @@ -28,6 +28,8 @@ typedef NS_ENUM(NSInteger) { QXRoomSettingTypeRoomTypeSinger = 300, /// 签约房 QXRoomSettingTypeRoomTypeSign = 400, + /// 酒吧房 + QXRoomSettingTypeRoomTypeBar = 500, /// 常用工具 /// 房间补贴 diff --git a/QXLive/Room(房间)/View/设置/QXRoomSettingView.m b/QXLive/Room(房间)/View/设置/QXRoomSettingView.m index 8b778d3..99e5bed 100644 --- a/QXLive/Room(房间)/View/设置/QXRoomSettingView.m +++ b/QXLive/Room(房间)/View/设置/QXRoomSettingView.m @@ -49,6 +49,8 @@ @property (nonatomic,strong)QXRoomSettingModel *roomTypeSinger; /// 签约房 @property (nonatomic,strong)QXRoomSettingModel *roomTypeSign; +/// 酒吧房 +@property (nonatomic,strong)QXRoomSettingModel *roomTypeBar; @@ -188,7 +190,7 @@ NSArray *toolsArr; NSArray *moreArr; // roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFriend,self.roomTypeKSing,self.roomTypeSinger,self.roomTypeSign]; - roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFriend,self.roomTypeSinger,self.roomTypeSign]; + roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFriend,self.roomTypeSinger,self.roomTypeSign,self.roomTypeBar]; switch (roleType) { // 主持 case QXRoomRoleTypeCompere:{ @@ -372,7 +374,8 @@ || model.type == QXRoomSettingTypeRoomTypeFunny || model.type == QXRoomSettingTypeRoomTypeKSing || model.type == QXRoomSettingTypeRoomTypeSinger - || model.type == QXRoomSettingTypeRoomTypeSign) { + || model.type == QXRoomSettingTypeRoomTypeSign + || model.type == QXRoomSettingTypeRoomTypeBar) { self.alertView.message = [NSString stringWithFormat:@"您确定要修改为%@房吗?",model.name]; [[QXGlobal shareGlobal] showView:self.alertView controller:self.viewController popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{ @@ -415,6 +418,8 @@ type = @"9"; }else if (roomType == QXRoomSettingTypeRoomTypeSign) { type = @"10"; + }else if (roomType == QXRoomSettingTypeRoomTypeBar) { + type = @"11"; } [QXMineNetwork changeRoomTypeWithRoomId:self.roomModel.room_info.room_id type:type successBlock:^(NSDictionary * _Nonnull dict) { @@ -524,6 +529,16 @@ return _roomTypeSign; } +-(QXRoomSettingModel *)roomTypeBar{ + if (!_roomTypeBar) { + _roomTypeBar = [[QXRoomSettingModel alloc] init]; + _roomTypeBar.name = @"酒吧"; + _roomTypeBar.type = QXRoomSettingTypeRoomTypeBar; + _roomTypeBar.icon = @"room_set_room_type_bar"; + } + return _roomTypeBar; +} + -(QXRoomSettingModel *)roomSubsidy{ if (!_roomSubsidy) { _roomSubsidy = [[QXRoomSettingModel alloc] init]; diff --git a/QXLive/Room(房间)/View/酒吧房/QXBarAskAlertView.h b/QXLive/Room(房间)/View/酒吧房/QXBarAskAlertView.h new file mode 100644 index 0000000..e915e90 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXBarAskAlertView.h @@ -0,0 +1,29 @@ +// +// QXBarAskAlertView.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class QXBarAskAlertView; +@protocol QXBarAskAlertViewDelegate + +@optional +-(void)askViewDidRecharge:(QXBarAskAlertView*)alertView; + +-(void)askViewDidSend:(QXBarAskAlertView*)alertView pitModel:(QXRoomPitModel*)pitModel giftInfo:(QXGiftModel*)giftInfo; + +@end +@interface QXBarAskAlertView : UIView +@property (nonatomic,strong)NSString *roomId; +@property (nonatomic,strong)QXRoomPitModel *pitModel; +@property (nonatomic,weak)iddelegate; +-(void)showInView:(UIView *)view; + +-(void)hide; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXBarAskAlertView.m b/QXLive/Room(房间)/View/酒吧房/QXBarAskAlertView.m new file mode 100644 index 0000000..01d3d7f --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXBarAskAlertView.m @@ -0,0 +1,272 @@ +// +// QXBarAskAlertView.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "QXBarAskAlertView.h" +#import "QXMineNetwork.h" +@interface QXBarAskAlertView() +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UIImageView *bgImageView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UIImageView *headerImageView; +@property (nonatomic,strong)UILabel *nameLabel; +@property (nonatomic,strong)UIButton *closeBtn; + + +@property (nonatomic,strong)UIView *contentView; +@property (nonatomic,strong)UIImageView *contentBgImageView; +@property (nonatomic,strong)UILabel *contentTitleLabel; +@property (nonatomic,strong)UIView *giftBgView; +@property (nonatomic,strong)UIImageView *giftImageView; +@property (nonatomic,strong)UILabel *giftNameLabel; +@property (nonatomic,strong)UIButton *giftCoinBtn; + +@property (nonatomic,strong)UIButton *sendBtn; + +@property (nonatomic,strong)UIButton *myCoinBtn; +@property (nonatomic,strong)UIButton *rechargeBtn; + +@property (nonatomic,strong)QXGiftModel *giftModel; +@end +@implementation QXBarAskAlertView +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = UIScreen.mainScreen.bounds; + [self initSubviews]; + } + return self; +} + +-(void)initSubviews{ +// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]; + self.backgroundColor = RGB16A(0x000000, 0.3); +// tap.delegate = self; +// [self addGestureRecognizer:tap]; + + self.bgView = [[UIView alloc] initWithFrame:CGRectMake((self.width-ScaleWidth(275))/2, 0, ScaleWidth(275), ScaleWidth(275))]; + self.bgView.backgroundColor = RGB16(0xffffff); + [self.bgView addRoundedCornersWithRadius:16]; + [self addSubview:self.bgView]; + + self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, self.bgView.height)]; + self.bgImageView.backgroundColor = RGB16(0x9722D6); + [self.bgView addSubview:self.bgImageView]; + + + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:13]; + self.titleLabel.textColor = RGB16A(0xFFFFFF,0.65); + self.titleLabel.text = @"送给"; + [self.bgView addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(16); + make.height.mas_equalTo(17); + make.top.mas_equalTo(ScaleWidth(19)); + }]; + + self.headerImageView = [[UIImageView alloc] init]; + [self.bgView addSubview:self.headerImageView]; + self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; + [self.headerImageView addRoundedCornersWithRadius:ScaleWidth(16)]; + [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.titleLabel.mas_right).offset(2); + make.height.width.mas_equalTo(ScaleWidth(32)); + make.centerY.equalTo(self.titleLabel); + }]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.font = [UIFont boldSystemFontOfSize:13]; + self.nameLabel.textColor = RGB16(0xFFFFFF); + self.nameLabel.text = @"羽声语音"; + [self.bgView addSubview:self.nameLabel]; + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.headerImageView.mas_right).offset(2); + make.height.mas_equalTo(17); + make.centerY.equalTo(self.titleLabel); + }]; + + self.closeBtn = [[UIButton alloc] init]; + [self.closeBtn setImage:[[UIImage imageNamed:@"wallet_close"] imageByTintColor:RGB16(0xffffff)] forState:(UIControlStateNormal)]; + [self.closeBtn addTarget:self action:@selector(hide) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.closeBtn]; + [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(30); + make.right.mas_equalTo(-5); + make.centerY.equalTo(self.titleLabel); + }]; + + self.myCoinBtn = [[UIButton alloc] init]; + [self.myCoinBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)]; + [self.myCoinBtn setTitleColor:RGB16(0xF5F24F) forState:(UIControlStateNormal)]; + [self.myCoinBtn setTitle:@"0" forState:(UIControlStateNormal)]; + self.myCoinBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.bgView addSubview:self.myCoinBtn]; + [self.myCoinBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.titleLabel); + make.bottom.equalTo(self.bgView).offset(-8); + make.height.mas_equalTo(20); + }]; + + self.rechargeBtn = [[UIButton alloc] init]; + [self.rechargeBtn setTitleColor:RGB16(0xF5F24F) forState:(UIControlStateNormal)]; + [self.rechargeBtn setTitle:@"去充值>" forState:(UIControlStateNormal)]; + self.rechargeBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.rechargeBtn addTarget:self action:@selector(rechargeAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.rechargeBtn]; + [self.rechargeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-16); + make.height.mas_equalTo(30); + make.centerY.equalTo(self.myCoinBtn); + }]; + + self.sendBtn = [[UIButton alloc] init]; + [self.sendBtn setTitle:@"赠送并开房" forState:(UIControlStateNormal)]; + [self.sendBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; + self.sendBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + self.sendBtn.backgroundColor = QXConfig.themeColor; + [self.sendBtn addRoundedCornersWithRadius:ScaleWidth(16)]; + [self.sendBtn addTarget:self action:@selector(sendAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.sendBtn]; + [self.sendBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.myCoinBtn.mas_top).offset(-5); + make.width.mas_equalTo(ScaleWidth(104)); + make.height.mas_equalTo(ScaleWidth(32)); + make.centerX.equalTo(self.bgView); + }]; + + self.contentView = [[UIView alloc] init]; + [self.bgView addRoundedCornersWithRadius:8]; + [self.bgView addSubview:self.contentView];; + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.headerImageView.mas_bottom).offset(10); + make.bottom.equalTo(self.sendBtn.mas_top).offset(-12); + make.left.mas_equalTo(self.titleLabel); + make.right.mas_equalTo(-16); + }]; + + self.contentBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_bar_ask_bg"]]; + self.contentBgImageView.contentMode = UIViewContentModeScaleToFill; + [self.contentView addSubview:self.contentBgImageView]; + [self.contentBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.titleLabel); + make.top.equalTo(self.headerImageView.mas_bottom).offset(ScaleWidth(10)); + make.bottom.equalTo(self.sendBtn.mas_top).offset(ScaleWidth(-12)); + make.right.mas_equalTo(-16); + }]; + + self.contentTitleLabel = [[UILabel alloc] init]; + self.contentTitleLabel.text = @"开启私密房间,一起甜蜜约会吧!"; + self.contentTitleLabel.textColor = RGB16(0xFFD7FE); + self.contentTitleLabel.textAlignment = NSTextAlignmentCenter; + self.contentTitleLabel.font = [UIFont systemFontOfSize:ScaleWidth(12)]; + [self.contentView addSubview:self.contentTitleLabel]; + [self.contentTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.contentView); + make.top.mas_equalTo(9); + make.height.mas_equalTo(18); + }]; + + self.giftBgView = [[UIView alloc] init]; + [self.giftBgView setBackgroundColor:RGB16A(0x000000, 0.65)]; + [self.giftBgView addRoundedCornersWithRadius:12]; + [self.contentView addSubview:self.giftBgView]; + [self.giftBgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.contentTitleLabel.mas_bottom).offset(8); + make.height.width.mas_equalTo(ScaleWidth(72)); + make.centerX.equalTo(self.contentView); + }]; + + self.giftImageView = [[UIImageView alloc] init]; + [self.giftBgView addSubview:self.giftImageView]; + self.giftImageView.contentMode = UIViewContentModeScaleAspectFit; + [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.giftBgView); + }]; + + + self.giftNameLabel = [[UILabel alloc] init]; + self.giftNameLabel.text = @"礼物名称"; + self.giftNameLabel.textColor = RGB16(0xFFD7FE); + self.giftNameLabel.font = [UIFont systemFontOfSize:ScaleWidth(12)]; + self.giftNameLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.giftNameLabel]; + [self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.contentView); + make.top.equalTo(self.giftImageView.mas_bottom).offset(4); + make.height.mas_equalTo(17); + }]; + + self.giftCoinBtn = [[UIButton alloc] init]; + [self.giftCoinBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)]; + [self.giftCoinBtn setTitleColor:RGB16A(0xFFFFFF,0.85) forState:(UIControlStateNormal)]; + [self.giftCoinBtn setTitle:@"0" forState:(UIControlStateNormal)]; + self.giftCoinBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.bgView addSubview:self.giftCoinBtn]; + [self.giftCoinBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.giftNameLabel.mas_bottom); + make.height.mas_equalTo(20); + make.centerX.equalTo(self.contentView); + }]; + +} + +-(void)setRoomId:(NSString *)roomId{ + _roomId = roomId; +} +-(void)setPitModel:(QXRoomPitModel *)pitModel{ + _pitModel = pitModel; + [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:pitModel.avatar]]; + self.nameLabel.text = pitModel.nickname; + [self getGiftInfo]; +} +-(void)getGiftInfo{ + MJWeakSelf + [QXMineNetwork roomAskUserGiftWithRoomId:self.roomId toUserId:self.pitModel.user_id successBlock:^(QXGiftModel * _Nonnull model) { + [weakSelf.giftCoinBtn setTitle:model.gift_price forState:(UIControlStateNormal)]; + weakSelf.giftNameLabel.text = model.gift_name; + [weakSelf.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]]; + [weakSelf.myCoinBtn setTitle:model.user_wallet_coin forState:(UIControlStateNormal)]; + weakSelf.giftModel = model; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} + +-(void)rechargeAction{ + if (self.delegate && [self.delegate respondsToSelector:@selector(askViewDidRecharge:)]) { + [self.delegate askViewDidRecharge:self]; + } +} +-(void)sendAction{ + if (!self.giftModel) { + return; + } + if (self.delegate && [self.delegate respondsToSelector:@selector(askViewDidSend:pitModel:giftInfo:)]) { + [self.delegate askViewDidSend:self pitModel:self.pitModel giftInfo:self.giftModel]; + } +} + +-(void)showInView:(UIView *)view{ + self.bgView.y = -view.height; + [view addSubview:self]; + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = (view.height-self.bgView.height)/2.0; + } completion:^(BOOL finished) { + + }]; +} + +-(void)hide{ + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = SCREEN_HEIGHT; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} + +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.h b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.h new file mode 100644 index 0000000..a52708c --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.h @@ -0,0 +1,17 @@ +// +// QXRoomBarCabinListCell.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomBarCabinListCell : UICollectionViewCell +@property (weak, nonatomic) IBOutlet UIImageView *roomCoverView; + +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.m b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.m new file mode 100644 index 0000000..1b2820a --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.m @@ -0,0 +1,17 @@ +// +// QXRoomBarCabinListCell.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "QXRoomBarCabinListCell.h" + +@implementation QXRoomBarCabinListCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.xib b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.xib new file mode 100644 index 0000000..356938e --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListCell.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListView.h b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListView.h new file mode 100644 index 0000000..061307d --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListView.h @@ -0,0 +1,18 @@ +// +// QXRoomBarCabinListView.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomBarCabinListView : UIView +@property (nonatomic,strong)NSString *roomId; +-(void)showInView:(UIView *)view; +-(void)hide; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListView.m b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListView.m new file mode 100644 index 0000000..5bdafda --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarCabinListView.m @@ -0,0 +1,134 @@ +// +// QXRoomBarCabinListView.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "QXRoomBarCabinListView.h" +#import "QXRoomBarCabinListCell.h" +#import "QXMineNetwork.h" +@interface QXRoomBarCabinListView() +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UICollectionView *collectionView; +@property (nonatomic,strong)NSMutableArray *dataArray; +@end + +@implementation QXRoomBarCabinListView +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = UIScreen.mainScreen.bounds; + [self initSubviews]; + } + return self; +} + +-(void)initSubviews{ + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]; + self.backgroundColor = RGB16A(0x000000, 0.3); + tap.delegate = self; + [self addGestureRecognizer:tap]; + + self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)]; + self.bgView.backgroundColor = RGB16(0x103E30); + [self.bgView addRoundedCornersWithRadius:14 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; + [self addSubview:self.bgView]; + + // self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, self.bgView.height)]; + // self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"]; + // [self.bgView addSubview:self.bgImageView]; + + + self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 24)]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:18]; + self.titleLabel.textColor = RGB16(0xffffff); + self.titleLabel.textAlignment = NSTextAlignmentCenter; + self.titleLabel.text = @"交友小屋"; + [self.bgView addSubview:self.titleLabel]; + + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.minimumLineSpacing = 20; + layout.minimumInteritemSpacing = 20; + layout.sectionInset = UIEdgeInsetsMake(0, 50, 0, 50); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+10, self.bgView.width, self.bgView.height-self.titleLabel.bottom-20) collectionViewLayout:layout]; + [self.collectionView registerNib:[UINib nibWithNibName:@"QXRoomBarCabinListCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXRoomBarCabinListCell"]; + self.collectionView.delegate = self; + self.collectionView.dataSource = self; + self.collectionView.showsHorizontalScrollIndicator = NO; + self.collectionView.showsVerticalScrollIndicator = NO; + self.collectionView.bounces = NO; + self.collectionView.backgroundColor = [UIColor clearColor]; + [self.bgView addSubview:self.collectionView]; + +} + + +-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ + return touch.view == self; +} +-(void)getGiftList{ + MJWeakSelf + [QXMineNetwork giftListWithLabel:@"99" roomId:self.roomId successBlock:^(NSArray * _Nonnull list) { + [weakSelf.dataArray removeAllObjects]; + [weakSelf.dataArray addObjectsFromArray:list]; + [weakSelf.collectionView reloadData]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + + + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + return self.dataArray.count; +} + +-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + QXRoomBarCabinListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRoomBarCabinListCell" forIndexPath:indexPath]; + // cell.model = self.dataArray[indexPath.row]; + return cell; +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ + NSInteger itemWidth = (NSInteger)(SCREEN_WIDTH-50*2-20)/4; + return CGSizeMake(itemWidth, itemWidth); +} + +-(NSMutableArray *)dataArray{ + if (!_dataArray) { + _dataArray = [NSMutableArray array]; + } + return _dataArray; +} + +-(void)showInView:(UIView *)view{ + [self getGiftList]; + self.bgView.y = SCREEN_HEIGHT; + [view addSubview:self]; + [UIView animateWithDuration:0.3 animations:^{ + self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom; + }]; +} +-(void)hide{ + if (!self.superview) { + NSLog(@"⚠️ View already removed from superview"); + return; + } + [UIView animateWithDuration:0.3 animations:^{ + if (self.bgView) { + self.bgView.y = SCREEN_HEIGHT; + } + } completion:^(BOOL finished) { + // 检查是否已经被移除 + if (self.superview) { + [self removeFromSuperview]; + } + // 避免在 dealloc 过程中访问其他属性 + // 不要在 completion block 中访问或设置其他属性 + }]; +} +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSendCustomGiftView.h b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSendCustomGiftView.h new file mode 100644 index 0000000..ba0b1ec --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSendCustomGiftView.h @@ -0,0 +1,19 @@ +// +// QXRoomBarSendCustomGiftView.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomBarSendCustomGiftView : UIView +@property (nonatomic,strong)NSString *roomId; +@property (nonatomic,strong)QXRoomPitModel *pitModel; +-(void)showInView:(UIView *)view; +-(void)hide; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSendCustomGiftView.m b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSendCustomGiftView.m new file mode 100644 index 0000000..e26fbf3 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSendCustomGiftView.m @@ -0,0 +1,178 @@ +// +// QXRoomBarSendCustomGiftView.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "QXRoomBarSendCustomGiftView.h" +#import "QXRoomBarSetGiftCell.h" +#import "QXMineNetwork.h" +@interface QXRoomBarSendCustomGiftView () +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UIImageView *bgImageView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UIImageView *headerImageView; +@property (nonatomic,strong)UILabel *nameLabel; +@property (nonatomic,strong)UIButton *closeBtn; +@property (nonatomic,strong)UICollectionView *collectionView; +@property (nonatomic,strong)NSMutableArray *dataArray; +@end + +@implementation QXRoomBarSendCustomGiftView + +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = UIScreen.mainScreen.bounds; + [self initSubviews]; + } + return self; +} + +-(void)initSubviews{ + // UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]; + self.backgroundColor = RGB16A(0x000000, 0.3); + // tap.delegate = self; + // [self addGestureRecognizer:tap]; + + self.bgView = [[UIView alloc] initWithFrame:CGRectMake((self.width-ScaleWidth(287))/2, 0, ScaleWidth(287), ScaleWidth(300))]; + self.bgView.backgroundColor = RGB16(0xffffff); + [self.bgView addRoundedCornersWithRadius:16]; + [self addSubview:self.bgView]; + + self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, self.bgView.height)]; + self.bgImageView.backgroundColor = RGB16(0x9722D6); + [self.bgView addSubview:self.bgImageView]; + + + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:13]; + self.titleLabel.textColor = RGB16A(0xFFFFFF,0.65); + self.titleLabel.text = @"送给"; + [self.bgView addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(16); + make.height.mas_equalTo(17); + make.top.mas_equalTo(ScaleWidth(19)); + }]; + + self.headerImageView = [[UIImageView alloc] init]; + [self.bgView addSubview:self.headerImageView]; + [self.headerImageView addRoundedCornersWithRadius:ScaleWidth(16)]; + self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; + [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.titleLabel.mas_right).offset(2); + make.height.width.mas_equalTo(ScaleWidth(32)); + make.centerY.equalTo(self.titleLabel); + }]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.font = [UIFont boldSystemFontOfSize:13]; + self.nameLabel.textColor = RGB16(0xFFFFFF); + self.nameLabel.text = @"羽声语音"; + [self.bgView addSubview:self.nameLabel]; + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.headerImageView.mas_right).offset(2); + make.height.mas_equalTo(17); + make.centerY.equalTo(self.titleLabel); + }]; + + self.closeBtn = [[UIButton alloc] init]; + [self.closeBtn setImage:[[UIImage imageNamed:@"wallet_close"] imageByTintColor:RGB16(0xffffff)] forState:(UIControlStateNormal)]; + [self.closeBtn addTarget:self action:@selector(hide) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.closeBtn]; + [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(30); + make.right.mas_equalTo(-5); + make.centerY.equalTo(self.titleLabel); + }]; + + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.minimumLineSpacing = 12; + layout.minimumInteritemSpacing = 12; + layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + [self.collectionView registerNib:[UINib nibWithNibName:@"QXRoomBarSetGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXRoomBarSetGiftCell"]; + self.collectionView.delegate = self; + self.collectionView.dataSource = self; + self.collectionView.showsHorizontalScrollIndicator = NO; + self.collectionView.showsVerticalScrollIndicator = NO; + self.collectionView.bounces = NO; + self.collectionView.backgroundColor = [UIColor clearColor]; + [self.bgView addSubview:self.collectionView]; + + [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.bgView); + make.top.equalTo(self.headerImageView.mas_bottom).offset(10); + make.bottom.mas_equalTo(-15); + }]; +} +-(void)setPitModel:(QXRoomPitModel *)pitModel{ + _pitModel = pitModel; + [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:pitModel.avatar]]; + self.nameLabel.text = pitModel.nickname; +} +-(void)getGiftList{ + MJWeakSelf + [QXMineNetwork getRoomCustomGiftWithUserId:self.pitModel.user_id successBlock:^(NSArray * _Nonnull list) { + [weakSelf.dataArray removeAllObjects]; + [weakSelf.dataArray addObjectsFromArray:list]; + [weakSelf.collectionView reloadData]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + +-(void)setShowTimeGiftModel:(QXGiftModel *)giftModel{ + QXLOG(@"送自定义礼物%@",giftModel.gift_name); + [QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:giftModel.gift_id gift_num:@"1" to_uid:self.pitModel.user_id heart_id:@"" type:@"1" pit_number:@"" gift_bag_id:giftModel.gift_bag successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + return self.dataArray.count; +} + +-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + QXRoomBarSetGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRoomBarSetGiftCell" forIndexPath:indexPath]; + cell.cellType = QXRoomBarSetGiftCellTypeSend; + cell.model = self.dataArray[indexPath.row]; + cell.delegate = self; + return cell; +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ + CGFloat itemWidth = (SCREEN_WIDTH-16*2-12*3)/4; + return CGSizeMake(itemWidth, itemWidth+82+30); +} +-(void)showInView:(UIView *)view{ + [self getGiftList]; + self.bgView.y = -view.height; + [view addSubview:self]; + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = (view.height-self.bgView.height)/2.0; + } completion:^(BOOL finished) { + + }]; +} +-(void)hide{ + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = SCREEN_HEIGHT; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} +-(NSMutableArray *)dataArray{ + if (!_dataArray) { + _dataArray = [NSMutableArray array]; + } + return _dataArray; +} + +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.h b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.h new file mode 100644 index 0000000..bad2c9b --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.h @@ -0,0 +1,40 @@ +// +// QXRoomBarSetGiftCell.h +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +typedef NS_ENUM(NSInteger) { + /// 设置礼物 + QXRoomBarSetGiftCellTypeSet = 0, + /// 赠送 + QXRoomBarSetGiftCellTypeSend = 1, + /// 没有底部操作 + QXRoomBarSetGiftCellTypeNoOption = 2, +}QXRoomBarSetGiftCellType; +@protocol QXRoomBarSetGiftCellDelegate + +@optional +-(void)setShowTimeGiftModel:(QXGiftModel*)giftModel; + +@end +@interface QXRoomBarSetGiftCell : UICollectionViewCell +@property (weak, nonatomic) IBOutlet UIView *bgView; +@property (weak, nonatomic) IBOutlet UIButton *bgBtn; +@property (weak, nonatomic) IBOutlet UIImageView *giftImageView; +@property (weak, nonatomic) IBOutlet UILabel *giftNameLabel; +@property (weak, nonatomic) IBOutlet UIButton *coinBtn; +@property (weak, nonatomic) IBOutlet UILabel *remarkLabel; +@property (weak, nonatomic) IBOutlet UIButton *setBtn; +/// 是否为心愿礼物 +@property (nonatomic,assign)QXRoomBarSetGiftCellType cellType; +@property (nonatomic,strong)QXGiftModel *model; + +@property (nonatomic,weak)iddelegate; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.m b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.m new file mode 100644 index 0000000..7381dbf --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.m @@ -0,0 +1,85 @@ +// +// QXRoomBarSetGiftCell.m +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import "QXRoomBarSetGiftCell.h" + +@implementation QXRoomBarSetGiftCell +- (instancetype)initWithCoder:(NSCoder *)coder +{ + self = [super initWithCoder:coder]; + if (self) { + + } + return self; +} + + +-(void)setCellType:(QXRoomBarSetGiftCellType)cellType{ + _cellType = cellType; + /** + /// 设置礼物 + QXRoomBarSetGiftCellTypeSet = 0, + /// 赠送 + QXRoomBarSetGiftCellTypeSend = 1, + /// 没有底部操作 + QXRoomBarSetGiftCellTypeNoOption = 2, + */ + switch (cellType) { + case QXRoomBarSetGiftCellTypeSet:{ + self.setBtn.hidden = NO; + self.remarkLabel.hidden = NO; + [self.setBtn setTitle:@"设置" forState:(UIControlStateNormal)]; + } + break; + case QXRoomBarSetGiftCellTypeSend:{ + self.setBtn.hidden = NO; + self.remarkLabel.hidden = NO; + [self.setBtn setTitle:@"赠送" forState:(UIControlStateNormal)]; + } + break; + case QXRoomBarSetGiftCellTypeNoOption:{ + self.setBtn.hidden = YES; + self.remarkLabel.hidden = YES; + } + break; + default: + break; + } +} +- (IBAction)setAction:(id)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(setShowTimeGiftModel:)]) { + [self.delegate setShowTimeGiftModel:self.model]; + } +} + +-(void)setModel:(QXGiftModel *)model{ + _model = model; + [self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]]; + self.giftNameLabel.text = model.gift_name; + self.remarkLabel.text = [model.gift_remark_name isExist]?model.gift_remark_name:@"待设置"; + [self.coinBtn setTitle:model.gift_price forState:(UIControlStateNormal)]; + if (model.isSelected) { + self.bgBtn.selected = YES; + self.giftNameLabel.textColor = RGB16(0x333333); + [self.coinBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)]; + }else{ + self.bgBtn.selected = NO; + self.giftNameLabel.textColor = RGB16(0xffffff); + [self.coinBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; + } +} + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +// self.bgView.backgroundColor = RGB16A(0xE9E9E9, 0.2); + [self.bgBtn setBackgroundImage:[UIImage imageWithColor:RGB16A(0xE9E9E9, 0.2)] forState:(UIControlStateNormal)]; + [self.bgBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_sel"] forState:(UIControlStateSelected)]; + [self.setBtn setBackgroundColor:QXConfig.themeColor]; +} + +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.xib b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.xib new file mode 100644 index 0000000..ae4071e --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftCell.xib @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftView.h b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftView.h new file mode 100644 index 0000000..8dbd8c7 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftView.h @@ -0,0 +1,30 @@ +// +// QXRoomBarSetGiftView.h +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class QXRoomBarSetGiftView; +@protocol QXRoomBarSetGiftViewDelegate + +@optional +-(void)setGiftModelIsLikeGift:(BOOL)isLikeGift giftModel:(QXGiftModel*)giftModel pitNumber:(NSString*)pitNumber setGiftView:(QXRoomBarSetGiftView*)setGiftView; + +@end +@interface QXRoomBarSetGiftView : UIView +@property (nonatomic,strong)NSString *roomId; + +@property (nonatomic,strong)NSString *pitNumber; +/// 是否为心愿礼物 +@property (nonatomic,assign)BOOL isLikeGift; + +@property (nonatomic,weak)iddelegate; +-(void)showInView:(UIView *)view; +-(void)hide; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftView.m b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftView.m new file mode 100644 index 0000000..dc72f20 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetGiftView.m @@ -0,0 +1,229 @@ +// +// QXRoomBarSetGiftView.m +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import "QXRoomBarSetGiftView.h" +#import "QXRoomBarSetGiftCell.h" +#import "QXMineNetwork.h" +#import "QXRoomBarSetShowTimeView.h" + +@interface QXRoomBarSetGiftView() +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UILabel *subTitleLabel; +@property (nonatomic,strong)UICollectionView *collectionView; +@property (nonatomic,strong)QXGiftModel *selectedModel; +@property (nonatomic,strong)NSMutableArray *dataArray; + +@property (nonatomic,strong)UIButton *cancelBtn; +@property (nonatomic,strong)UIButton *commitBtn; +@end + +@implementation QXRoomBarSetGiftView +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = UIScreen.mainScreen.bounds; + [self initSubviews]; + } + return self; +} + +-(void)initSubviews{ + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]; + self.backgroundColor = RGB16A(0x000000, 0.3); + tap.delegate = self; + [self addGestureRecognizer:tap]; + + self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom)]; + self.bgView.backgroundColor = RGB16(0x103E30); + [self.bgView addRoundedCornersWithRadius:14 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; + [self addSubview:self.bgView]; + + // self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, self.bgView.height)]; + // self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"]; + // [self.bgView addSubview:self.bgImageView]; + + + self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 24)]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:18]; + self.titleLabel.textColor = RGB16(0xffffff); + self.titleLabel.textAlignment = NSTextAlignmentCenter; + self.titleLabel.text = @"设置你的自定义礼物"; + [self.bgView addSubview:self.titleLabel]; + + self.subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+10, self.bgView.width-32, 24)]; + self.subTitleLabel.font = [UIFont systemFontOfSize:13]; + self.subTitleLabel.textColor = RGB16(0x999999); + self.subTitleLabel.textAlignment = NSTextAlignmentLeft; + self.subTitleLabel.text = @"设置每个礼物对应的表演内容,上麦位后其他人可见"; + [self.bgView addSubview:self.subTitleLabel]; + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.minimumLineSpacing = 12; + layout.minimumInteritemSpacing = 12; + layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.subTitleLabel.bottom+10, self.bgView.width, self.bgView.height-self.subTitleLabel.bottom-20) collectionViewLayout:layout]; + [self.collectionView registerNib:[UINib nibWithNibName:@"QXRoomBarSetGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXRoomBarSetGiftCell"]; + self.collectionView.delegate = self; + self.collectionView.dataSource = self; + self.collectionView.showsHorizontalScrollIndicator = NO; + self.collectionView.showsVerticalScrollIndicator = NO; + self.collectionView.bounces = NO; + self.collectionView.backgroundColor = [UIColor clearColor]; + [self.bgView addSubview:self.collectionView]; + + + self.cancelBtn = [[UIButton alloc] init]; + [self.cancelBtn setTitle:@"取消" forState:(UIControlStateNormal)]; + [self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)]; + [self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.cancelBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15]; + [self.bgView addSubview:self.cancelBtn]; + [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(16); + make.height.mas_equalTo(30); + make.width.mas_equalTo(50); + make.centerY.equalTo(self.titleLabel); + }]; + + self.commitBtn = [[UIButton alloc] init]; + [self.commitBtn setTitle:@"确定" forState:(UIControlStateNormal)]; + [self.commitBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)]; + [self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.commitBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; + self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:15]; + [self.bgView addSubview:self.commitBtn]; + [self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-16); + make.height.mas_equalTo(30); + make.width.mas_equalTo(50); + make.centerY.equalTo(self.titleLabel); + }]; +} +-(void)setIsLikeGift:(BOOL)isLikeGift{ + _isLikeGift = isLikeGift; + self.cancelBtn.hidden = !isLikeGift; + self.commitBtn.hidden = !isLikeGift; + self.titleLabel.text = isLikeGift?@"选择你的心愿礼物":@"设置你的自定义礼物"; + self.subTitleLabel.text = isLikeGift?@"其他人赠送你心愿礼物,则能邀请你进入私密房间":@"设置每个礼物对应的表演内容,上麦位后其他人可见"; +} + +-(void)setPitNumber:(NSString *)pitNumber{ + _pitNumber = pitNumber; +} +-(void)cancelAction{ + [self hide]; +} + +-(void)commitAction{ + if (!self.selectedModel) { + showToast(@"请选择礼物"); + return; + } + if (self.delegate && [self.delegate respondsToSelector:@selector(setGiftModelIsLikeGift:giftModel:pitNumber:setGiftView:)]) { + [self.delegate setGiftModelIsLikeGift:self.isLikeGift giftModel:self.selectedModel pitNumber:self.pitNumber setGiftView:self]; + } +} +-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ + return touch.view == self; +} +-(void)getGiftList{ + MJWeakSelf + [QXMineNetwork getRoomNewGiftListWithLabel:self.isLikeGift?@"15":@"14" type:@"6" successBlock:^(NSArray * _Nonnull list) { + [weakSelf.dataArray removeAllObjects]; + [weakSelf.dataArray addObjectsFromArray:list]; + [weakSelf.collectionView reloadData]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + +-(void)setShowTimeGiftModel:(QXGiftModel *)giftModel{ + QXRoomBarSetShowTimeView *view = [[QXRoomBarSetShowTimeView alloc] init]; + view.roomId = self.roomId; + view.giftModel = giftModel; + MJWeakSelf + view.commitBlock = ^{ + [weakSelf getGiftList]; + }; + [view showInView:self.superview]; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + return self.dataArray.count; +} + +-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + QXRoomBarSetGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRoomBarSetGiftCell" forIndexPath:indexPath]; + cell.cellType = self.isLikeGift?QXRoomBarSetGiftCellTypeNoOption:QXRoomBarSetGiftCellTypeSet; + cell.model = self.dataArray[indexPath.row]; + cell.delegate = self; + return cell; +} +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ + CGFloat itemWidth = (SCREEN_WIDTH-16*2-12*3)/4; + if (self.isLikeGift) { + return CGSizeMake(itemWidth, itemWidth+50); + }else{ + return CGSizeMake(itemWidth, itemWidth+82+30); + } +} +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ + if (!self.isLikeGift) { + return; + } + + QXGiftModel *model = self.dataArray[indexPath.row]; + if (model.isSelected) { + return; + } + if (self.selectedModel) { + self.selectedModel.isSelected = NO; + } + model.isSelected = YES; + self.selectedModel = model; + [collectionView reloadData]; +} +-(NSMutableArray *)dataArray{ + if (!_dataArray) { + _dataArray = [NSMutableArray array]; + } + return _dataArray; +} + +-(void)showInView:(UIView *)view{ + self.selectedModel = nil; + [self.collectionView reloadData]; + [self getGiftList]; + self.bgView.y = SCREEN_HEIGHT; + [view addSubview:self]; + [UIView animateWithDuration:0.3 animations:^{ + self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom; + }]; +} +-(void)hide{ + if (!self.superview) { + NSLog(@"⚠️ View already removed from superview"); + return; + } + [UIView animateWithDuration:0.3 animations:^{ + if (self.bgView) { + self.bgView.y = SCREEN_HEIGHT; + } + } completion:^(BOOL finished) { + // 检查是否已经被移除 + if (self.superview) { + [self removeFromSuperview]; + } + // 避免在 dealloc 过程中访问其他属性 + // 不要在 completion block 中访问或设置其他属性 + }]; +} +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetShowTimeView.h b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetShowTimeView.h new file mode 100644 index 0000000..4fdb370 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetShowTimeView.h @@ -0,0 +1,19 @@ +// +// QXRoomBarSetShowTimeView.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@interface QXRoomBarSetShowTimeView : UIView +@property (nonatomic,strong)NSString *roomId; +@property (nonatomic,strong)QXGiftModel *giftModel; +@property (nonatomic,copy)void(^commitBlock)(void); +-(void)showInView:(UIView *)view; +-(void)hide; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetShowTimeView.m b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetShowTimeView.m new file mode 100644 index 0000000..d95a7c6 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetShowTimeView.m @@ -0,0 +1,180 @@ +// +// QXRoomBarSetShowTimeView.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "QXRoomBarSetShowTimeView.h" +#import "QXMineNetwork.h" +@interface QXRoomBarSetShowTimeView() +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UIButton *closeBtn; +@property (nonatomic,strong)UIView *scaleBGView; +@property (nonatomic,strong)UITextField *textField; +@property (nonatomic,strong)UILabel *messageLabel; + +@property (nonatomic,strong)UIButton *cancelBtn; +@property (nonatomic,strong)UIButton *commitBtn; + + +@end + +@implementation QXRoomBarSetShowTimeView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + [self createViews]; + } + return self; +} +-(void)createViews{ + self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5]; +// self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-AUTO_CEIL_WIETH(275))/2.0, (SCREEN_HEIGHT-AUTO_CEIL_WIETH(300))/2.0, AUTO_CEIL_WIETH(275), AUTO_CEIL_WIETH(300))]; + self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(300))]; + self.bgView.backgroundColor = [UIColor whiteColor]; + self.bgView.layer.masksToBounds = YES; + self.bgView.layer.cornerRadius = 16; + [self addSubview:self.bgView]; + + self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 12, self.bgView.width, 24)]; + self.titleLabel.text = @"表演内容"; + self.titleLabel.textAlignment = NSTextAlignmentCenter; + self.titleLabel.font = [UIFont boldSystemFontOfSize:16]; + self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"]; + [self.bgView addSubview:self.titleLabel]; + + self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50, 0, 50, 50)]; + [self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)]; + [self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside]; + [self.bgView addSubview:self.closeBtn]; + + self.scaleBGView = [[UIView alloc] initWithFrame:CGRectMake(12, self.titleLabel.bottom+35, self.bgView.width-12*2, 44)]; + self.scaleBGView.backgroundColor = [UIColor colorWithHexString:@"#EFF2F8"]; + self.scaleBGView.layer.masksToBounds = YES; + self.scaleBGView.layer.cornerRadius = 11; + [self.bgView addSubview:self.scaleBGView]; + + + self.textField = [[UITextField alloc] initWithFrame:CGRectMake(12, 0, self.scaleBGView.width-24, 44)]; + self.textField.placeholder = @"请输入表演内容(最多四个字)"; + self.textField.returnKeyType = UIReturnKeyDone; + self.textField.delegate = self; + self.textField.font = [UIFont boldSystemFontOfSize:16]; + [self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventValueChanged)]; + self.textField.textColor = [UIColor colorWithHexString:@"#333333"]; + [self.scaleBGView addSubview:self.textField]; + + self.messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(18, self.scaleBGView.bottom+35, self.bgView.width-36, 90)]; + self.messageLabel.numberOfLines = 0; + self.messageLabel.textColor = [UIColor colorWithHexString:@"#333333"]; + self.messageLabel.text = @"请表演内容(例:喊一声 啊)"; + self.messageLabel.font = [UIFont systemFontOfSize:13]; + [self.bgView addSubview:self.messageLabel]; + + + + + + self.commitBtn = [[UIButton alloc] init]; + [self.commitBtn addRoundedCornersWithRadius:21]; + self.commitBtn.backgroundColor = QXConfig.themeColor; + [self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)]; + [self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.commitBtn]; + [self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bgView).offset(-12); + make.height.mas_equalTo(42); + make.width.mas_equalTo(ScaleWidth(110)); + make.right.mas_equalTo(-20); + }]; + + + self.cancelBtn = [[UIButton alloc] init]; + [self.cancelBtn addRoundedCornersWithRadius:21]; + self.cancelBtn.backgroundColor = RGB16(0xF3F3F3); + [self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)]; + [self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)]; + self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.cancelBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.cancelBtn]; + [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bgView).offset(-12); + make.height.mas_equalTo(42); + make.width.mas_equalTo(ScaleWidth(110)); + make.left.mas_equalTo(20); + }]; + +} + +-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + [self endEditing:YES]; +} +-(BOOL)textFieldShouldReturn:(UITextField *)textField{ + [textField resignFirstResponder]; + return YES; +} +-(void)textFieldDidBeginEditing:(UITextField *)textField{ + [UIView animateWithDuration:0.15 animations:^{ + self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(300))/2.0-100; + }]; +} +-(void)textFieldDidEndEditing:(UITextField *)textField{ + [UIView animateWithDuration:0.15 animations:^{ + self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(300))/2.0; + }]; +} + +-(void)setGiftModel:(QXGiftModel *)giftModel{ + _giftModel = giftModel; +} +-(void)setRoomId:(NSString *)roomId{ + _roomId = roomId; +} +-(void)commitAction{ +// if (![self.textField.text isExist]) { +// showToast(@"请输入表演内容(最多四个字)"); +// return; +// } + MJWeakSelf + [QXMineNetwork setRoomCustomGiftWithGiftId:self.giftModel.gift_id roomId:self.roomId newGiftName:self.textField.text successBlock:^(NSDictionary * _Nonnull dict) { + if (weakSelf.commitBlock) { + weakSelf.commitBlock(); + } + [weakSelf hide]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + + + +-(void)closeAction{ + [self hide]; +} + +-(void)showInView:(UIView *)view{ + self.textField.text = @""; + [view addSubview:self]; + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(300))/2.0; + } completion:^(BOOL finished) { + + }]; +} + +-(void)hide{ + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = SCREEN_HEIGHT; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} + +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetTimeView.h b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetTimeView.h new file mode 100644 index 0000000..0e774da --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetTimeView.h @@ -0,0 +1,18 @@ +// +// QXRoomBarSetTimeView.h +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomBarSetTimeView : UIView +@property (nonatomic,strong)NSString *roomId; +-(void)showInView:(UIView *)view; +-(void)hide; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetTimeView.m b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetTimeView.m new file mode 100644 index 0000000..4c9a139 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXRoomBarSetTimeView.m @@ -0,0 +1,204 @@ +// +// QXRoomBarSetTimeView.m +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import "QXRoomBarSetTimeView.h" +#import "QXSelectAuctionInfoView.h" +#import "QXMineNetwork.h" +@interface QXRoomBarSetTimeView() +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UICollectionView *collectionView; +@property (nonatomic,strong)UIButton *commitBtn; +@property (nonatomic,strong)UIButton *cancelBtn; +@property (nonatomic,strong)NSMutableArray *dataArray; +@property (nonatomic,strong)QXRoomSeatTimeModel *selectedModel; +@end +@implementation QXRoomBarSetTimeView + +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = UIScreen.mainScreen.bounds; + [self initSubviews]; + } + return self; +} + +-(void)initSubviews{ + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]; + self.backgroundColor = RGB16A(0x000000, 0.3); + tap.delegate = self; + [self addGestureRecognizer:tap]; + + self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(310)+kSafeAreaBottom)]; + self.bgView.backgroundColor = RGB16(0x103E30); + [self.bgView addRoundedCornersWithRadius:14 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; + [self addSubview:self.bgView]; + + // self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bgView.width, self.bgView.height)]; + // self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"]; + // [self.bgView addSubview:self.bgImageView]; + + + self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 24)]; + self.titleLabel.font = [UIFont systemFontOfSize:16]; + self.titleLabel.textColor = RGB16(0xffffff); + self.titleLabel.textAlignment = NSTextAlignmentCenter; + self.titleLabel.text = @"设置麦位时长"; + [self.bgView addSubview:self.titleLabel]; + + self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.bgView.height-kSafeAreaBottom-12-42, 95, 42)]; + [self.cancelBtn setTitle:@"取消" forState:(UIControlStateNormal)]; + self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.cancelBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + self.cancelBtn.backgroundColor = RGB16(0x333333); + [self.cancelBtn addRoundedCornersWithRadius:21]; + [self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.cancelBtn]; + + self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.cancelBtn.right+16, self.bgView.height-kSafeAreaBottom-12-42, self.bgView.width-self.cancelBtn.right-16-38, 42)]; + [self.commitBtn setTitle:@"确定" forState:(UIControlStateNormal)]; + self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + self.commitBtn.backgroundColor = QXConfig.themeColor; + [self.commitBtn addRoundedCornersWithRadius:21]; + [self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.commitBtn]; + + + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.minimumLineSpacing = 12; + layout.minimumInteritemSpacing = 12; + layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16); + NSInteger itemWidth = (SCREEN_WIDTH-16*2-12*3)/4; + layout.itemSize = CGSizeMake(itemWidth, 44); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+10, self.bgView.width, self.commitBtn.top-self.titleLabel.bottom-20) collectionViewLayout:layout]; + [self.collectionView registerClass:[QXSelectAuctionInfoCell class] forCellWithReuseIdentifier:@"QXSelectAuctionInfoCell"]; + self.collectionView.delegate = self; + self.collectionView.dataSource = self; + self.collectionView.showsHorizontalScrollIndicator = NO; + self.collectionView.showsVerticalScrollIndicator = NO; + self.collectionView.bounces = NO; + self.collectionView.backgroundColor = [UIColor clearColor]; + [self.bgView addSubview:self.collectionView]; +} +-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ + return touch.view == self; +} +-(void)setRoomId:(NSString *)roomId{ + _roomId = roomId; +} +-(void)commitAction{ + if (self.selectedModel == nil) { + showToast(@"请选择设置麦位时长"); + return; + } + [QXMineNetwork setRoomSeatTimeWithRoomId:self.roomId time:self.selectedModel.time successBlock:^(NSDictionary * _Nonnull dict) { + showToast(@"设置成功"); + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + + [self hide]; +} + +-(void)getPlayList{ +// QXRoomRelationModel *md1 = [[QXRoomRelationModel alloc] init]; +// md1.name = @"5分钟"; +// [self.dataArray addObject:md1]; +// +// QXRoomRelationModel *md2 = [[QXRoomRelationModel alloc] init]; +// md2.name = @"10分钟"; +// [self.dataArray addObject:md2]; +// +// QXRoomRelationModel *md3 = [[QXRoomRelationModel alloc] init]; +// md3.name = @"15分钟"; +// [self.dataArray addObject:md3]; +// +// QXRoomRelationModel *md4 = [[QXRoomRelationModel alloc] init]; +// md4.name = @"20分钟"; +// [self.dataArray addObject:md4]; +// +// QXRoomRelationModel *md5 = [[QXRoomRelationModel alloc] init]; +// md5.name = @"25分钟"; +// [self.dataArray addObject:md5]; +// +// QXRoomRelationModel *md6 = [[QXRoomRelationModel alloc] init]; +// md6.name = @"30分钟"; +// [self.dataArray addObject:md6]; +// +// [self.collectionView reloadData]; + MJWeakSelf + [QXMineNetwork getRoomSeatTimeListSuccessBlock:^(NSArray * _Nonnull list) { + [weakSelf.dataArray removeAllObjects]; + [weakSelf.dataArray addObjectsFromArray:list]; + [weakSelf.collectionView reloadData]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} + +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + return self.dataArray.count; +} +-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + QXSelectAuctionInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXSelectAuctionInfoCell" forIndexPath:indexPath]; + cell.seatTimeModel = self.dataArray[indexPath.row]; + return cell; +} +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ + QXRoomSeatTimeModel *model = self.dataArray[indexPath.row]; + if (model.isSelected) { + return; + } + self.selectedModel.isSelected = NO; + model.isSelected = YES; + self.selectedModel = model; + [collectionView reloadData]; +} +-(void)cancelAction{ + [self hide]; +} +-(void)showInView:(UIView *)view{ + self.selectedModel = nil; + [self.collectionView reloadData]; + [self getPlayList]; + self.bgView.y = SCREEN_HEIGHT; + [view addSubview:self]; + [UIView animateWithDuration:0.3 animations:^{ + self.bgView.y = SCREEN_HEIGHT-ScaleWidth(310)-kSafeAreaBottom; + }]; +} +-(void)hide{ + if (!self.superview) { + NSLog(@"⚠️ View already removed from superview"); + return; + } + [UIView animateWithDuration:0.3 animations:^{ + if (self.bgView) { + self.bgView.y = SCREEN_HEIGHT; + } + } completion:^(BOOL finished) { + // 检查是否已经被移除 + if (self.superview) { + [self removeFromSuperview]; + } + // 避免在 dealloc 过程中访问其他属性 + // 不要在 completion block 中访问或设置其他属性 + }]; +} +-(NSMutableArray *)dataArray{ + if (!_dataArray) { + _dataArray = [NSMutableArray array]; + } + return _dataArray; +} + +@end diff --git a/QXLive/Room(房间)/View/酒吧房/QXSeductionAlertView.h b/QXLive/Room(房间)/View/酒吧房/QXSeductionAlertView.h new file mode 100644 index 0000000..17a0d8a --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXSeductionAlertView.h @@ -0,0 +1,23 @@ +// +// QXSeductionAlertView.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXSeductionAlertView : UIView +@property (nonatomic,copy)void(^commitBlock)(void); +@property (nonatomic,copy)void(^cancelBlock)(void); +@property (nonatomic,strong)QXRoomPitModel *pitModel; +@property (nonatomic,strong)NSString *sexy_coin; +@property (nonatomic,strong)NSString *roomId; +-(void)showInView:(UIView *)view; + +-(void)hide; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/酒吧房/QXSeductionAlertView.m b/QXLive/Room(房间)/View/酒吧房/QXSeductionAlertView.m new file mode 100644 index 0000000..0715923 --- /dev/null +++ b/QXLive/Room(房间)/View/酒吧房/QXSeductionAlertView.m @@ -0,0 +1,170 @@ +// +// QXSeductionAlertView.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "QXSeductionAlertView.h" +#import "QXMineNetwork.h" + +@interface QXSeductionAlertView() +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UILabel *messageLabel; +@property (nonatomic,strong)UIButton *noShowBtn; +@property (nonatomic,strong)UIButton *cancelBtn; +@property (nonatomic,strong)UIButton *commitBtn; +@end + +@implementation QXSeductionAlertView +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + [self initSubviews]; + } + return self; +} + +-(void)initSubviews{ + self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5]; + self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, 0, ScaleWidth(275), ScaleWidth(202))]; + self.bgView.backgroundColor = [UIColor whiteColor]; + self.bgView.layer.masksToBounds = YES; + self.bgView.layer.cornerRadius = 16; + [self addSubview:self.bgView]; + + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:16]; + self.titleLabel.text = QXText(@"温馨提示"); + self.titleLabel.textColor = RGB16(0x333333); + [self.bgView addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.bgView); + make.top.equalTo(self.bgView).offset(16); + make.height.mas_equalTo(24); + }]; + + self.commitBtn = [[UIButton alloc] init]; + [self.commitBtn addRoundedCornersWithRadius:21]; + self.commitBtn.backgroundColor = QXConfig.themeColor; + [self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)]; + [self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.commitBtn]; + [self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bgView).offset(-12); + make.height.mas_equalTo(42); + make.width.mas_equalTo(ScaleWidth(110)); + make.right.mas_equalTo(-20); + }]; + + + self.cancelBtn = [[UIButton alloc] init]; + [self.cancelBtn addRoundedCornersWithRadius:21]; + self.cancelBtn.backgroundColor = RGB16(0xF3F3F3); + [self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)]; + [self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)]; + self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.cancelBtn]; + [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bgView).offset(-12); + make.height.mas_equalTo(42); + make.width.mas_equalTo(ScaleWidth(110)); + make.left.mas_equalTo(20); + }]; + + self.noShowBtn = [[UIButton alloc] init]; + [self.noShowBtn setTitle:@" 以后不再提示" forState:(UIControlStateNormal)]; + [self.noShowBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)]; + self.noShowBtn.titleLabel.font = [UIFont systemFontOfSize:12]; + self.noShowBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + [self.noShowBtn setImage:[[UIImage imageNamed:@"login_agreement_nor"] imageByTintColor:RGB16(0x999999)] forState:(UIControlStateNormal)]; + [self.noShowBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)]; + [self.noShowBtn addTarget:self action:@selector(noShowAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:self.noShowBtn]; + [self.noShowBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.bgView).offset(16); + make.right.equalTo(self.bgView).offset(-16); + make.height.mas_equalTo(25); + make.bottom.equalTo(self.commitBtn.mas_top).offset(-10); + }]; + + + self.messageLabel = [[UILabel alloc] init]; + self.messageLabel.font = [UIFont systemFontOfSize:13]; + self.messageLabel.text = @"确定要撩一撩台上的 夏沫002 吗?共计需要 10个 金币。"; + self.messageLabel.textColor = RGB16(0x000000); + self.messageLabel.textAlignment = NSTextAlignmentCenter; + self.messageLabel.numberOfLines = 0; + [self.bgView addSubview:self.messageLabel]; + [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.bgView).offset(16); + make.right.equalTo(self.bgView).offset(-16); + make.top.equalTo(self.titleLabel.mas_bottom).offset(13); + make.bottom.equalTo(self.noShowBtn.mas_top).offset(-14); + }]; +} +-(void)setRoomId:(NSString *)roomId{ + _roomId = roomId; +} +-(void)setSexy_coin:(NSString *)sexy_coin{ + _sexy_coin = sexy_coin; +} +-(void)setPitModel:(QXRoomPitModel *)pitModel{ + _pitModel = pitModel; + NSString *str = [NSString stringWithFormat:@"确定要撩一撩台上的 %@ 吗?共计需要 %@个 金币。",pitModel.nickname,self.sexy_coin]; + NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str]; + [attr yy_setColor:QXConfig.themeColor range:[str rangeOfString:pitModel.nickname]]; + [attr yy_setColor:QXConfig.themeColor range:[str rangeOfString:self.sexy_coin]]; + self.messageLabel.attributedText = attr; +} + +-(void)noShowAction{ + self.noShowBtn.selected = !self.noShowBtn.selected; + [[NSUserDefaults standardUserDefaults] setBool:self.noShowBtn.isSelected forKey:kIsCloseSeductionAlert]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + + + +-(void)cancelAction{ + if (self.cancelBlock) { + self.cancelBlock(); + } + [self hide]; +} +-(void)commitAction{ + if (self.commitBlock) { + self.commitBlock(); + } + [self hide]; + [QXMineNetwork roomSeductionWithRoomId:self.roomId to_user_id:self.pitModel.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} + +-(void)showInView:(UIView *)view{ + self.bgView.y = -view.height; + [view addSubview:self]; + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = (view.height-self.bgView.height)/2.0; + } completion:^(BOOL finished) { + + }]; +} + +-(void)hide{ + [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.bgView.y = SCREEN_HEIGHT; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} +@end diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarCabinView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarCabinView.h new file mode 100644 index 0000000..f34bda5 --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarCabinView.h @@ -0,0 +1,41 @@ +// +// QXRoomSeatBarCabinView.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class QXRoomSeatBarCabinGiftView; +@protocol QXRoomSeatBarCabinGiftViewDelegate + +@optional + +-(void)didSendGiftWithGiftModel:(QXGiftModel *)giftModel giftView:(QXRoomSeatBarCabinGiftView*)giftView; + +@end +@interface QXRoomSeatBarCabinView : UIView +@property (nonatomic,weak)iddelegate; +@property (nonatomic,strong)QXRoomModel *roomModel; + +-(void)cabinRoomHotValueDidChanged:(NSString*)hot_value; +-(void)friendCabinRoomTimeDelayWithTime:(NSString*)end_time; +-(void)friendCabinRoomIsQuit; +-(void)stopHWDMP4; +-(void)playHWDMP4; +-(void)destroyViews; +@end + +@interface QXRoomSeatBarCabinGiftView : UIView +@property (nonatomic,strong)UIImageView *giftBgImageView; +@property (nonatomic,strong)UIImageView *giftImageView; +@property (nonatomic,strong)UIButton *giftCoinBtn; + +@property (nonatomic,strong)UIButton *button; +@property (nonatomic,strong)QXGiftModel *giftModel; +@property (nonatomic,weak)iddelegate; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarCabinView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarCabinView.m new file mode 100644 index 0000000..252e3fa --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarCabinView.m @@ -0,0 +1,537 @@ +// +// QXRoomSeatBarCabinView.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "QXRoomSeatBarCabinView.h" +#import "QXMineNetwork.h" +#import "UIView+FloatingAnimation.h" +#import "QXAgoraEngine.h" +@class QXRoomSeatBarCabinGiftView; +@interface QXRoomSeatBarCabinView() +//倒计时 +@property (nonatomic,strong)UIImageView *timeDownBgView; +@property (nonatomic,strong)UILabel *timeDownLabel; + +@property (nonatomic,strong)QXRoomSeatContentView *leftSeatView; + +//@property (nonatomic,strong)UIImageView *bgImageView; + +@property (nonatomic,strong)UIImageView *heartCenterImageView; +@property (nonatomic,strong)UILabel *numberLabel; + +@property (nonatomic,strong)QXRoomSeatContentView *rightSeatView; + +/// 退出房间按钮 +@property (nonatomic,strong) UIButton *closeBtn; +/// +@property (nonatomic,strong) UILabel *titleLabel; + +@property (nonatomic,strong) UIView *giftContentView; + +@property (nonatomic,strong) QXRoomSeatBarCabinGiftView *giftView1; +@property (nonatomic,strong) QXRoomSeatBarCabinGiftView *giftView2; +@property (nonatomic,strong) QXRoomSeatBarCabinGiftView *giftView3; +@property (nonatomic,strong) QXRoomSeatBarCabinGiftView *giftView4; +@property (nonatomic,strong) QXRoomSeatBarCabinGiftView *giftView5; +@property (nonatomic,strong) QXRoomSeatBarCabinGiftView *giftView6; +@property (nonatomic,strong) NSMutableArray *dataArray; +@property (nonatomic,strong) NSMutableArray *giftViewArray; + +@property (nonatomic,strong)UIButton *micBtn; +@property (nonatomic,strong)UIButton *voiceBtn; +@property (nonatomic,strong)UIButton *openCabinBtn; + +@property (nonatomic,strong)QXTimer *timer; +@property (nonatomic,assign)long startTime; +@end +@implementation QXRoomSeatBarCabinView + +- (instancetype)init +{ + self = [super init]; + if (self) { + [self initSubviews]; + } + return self; +} +-(void)initSubviews{ + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.text = @"房间名称"; + self.titleLabel.font = [UIFont systemFontOfSize:14]; + self.titleLabel.textColor = [UIColor whiteColor]; + [self addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(2); + make.left.mas_equalTo(16); + make.height.mas_equalTo(ScaleWidth(30)); + }]; + + self.closeBtn = [[UIButton alloc] init]; + [self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.closeBtn setImage:[UIImage imageNamed:@"room_close"] forState:(UIControlStateNormal)]; + [self addSubview:self.closeBtn]; + [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(ScaleWidth(40)); + make.right.mas_equalTo(-5); + make.centerY.equalTo(self.titleLabel); + }]; + +// self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_friend_cabin_bg"]]; +// self.bgImageView.contentMode = UIViewContentModeScaleToFill; +// [self addSubview:self.bgImageView]; +// [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.left.right.top.equalTo(self); +// make.height.mas_equalTo(ScaleWidth(330)); +// }]; + + self.timeDownLabel = [[UILabel alloc] initWithFrame:self.timeDownBgView.frame]; + self.timeDownLabel.textColor = [UIColor colorWithHexString:@"#ffffff"]; + self.timeDownLabel.font = [UIFont systemFontOfSize:12]; + self.timeDownLabel.text = @"倒计时:00:00:00"; + self.timeDownLabel.textAlignment = NSTextAlignmentCenter; + [self addSubview:self.timeDownLabel]; + [self.timeDownLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self); + make.top.equalTo(self.titleLabel.mas_bottom).offset(16); + make.height.mas_equalTo(24); + }]; + + self.timeDownBgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_cabin_timedown_bg"]]; + self.timeDownBgView.contentMode = UIViewContentModeScaleToFill; + [self insertSubview:self.timeDownBgView belowSubview:self.timeDownLabel]; + [self.timeDownBgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.timeDownLabel); + }]; + + + self.heartCenterImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bar_room_cabin_heart"]]; + [self addSubview:self.heartCenterImageView]; + [self.heartCenterImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self); + make.top.equalTo(self.timeDownBgView).offset(38); + make.height.mas_equalTo(ScaleWidth(120)); + make.width.mas_equalTo(ScaleWidth(128)); + }]; + + self.numberLabel = [[UILabel alloc] init]; + self.numberLabel.text = @"0"; + self.numberLabel.textAlignment = NSTextAlignmentCenter; + self.numberLabel.textColor = [UIColor colorWithHexString:@"#FF07C5"]; + self.numberLabel.font = [UIFont fontWithName:@"DIN Alternate" size:24]; + [self addSubview:self.numberLabel]; + [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(self.heartCenterImageView).offset(-5); + make.centerX.equalTo(self.heartCenterImageView); + }]; + + self.leftSeatView = [[QXRoomSeatContentView alloc] init]; + [self addSubview:self.leftSeatView]; + [self.leftSeatView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.heartCenterImageView.mas_left); + make.width.mas_equalTo(ScaleWidth(75)); + make.height.mas_equalTo(ScaleWidth(75)+25); + make.top.equalTo(self.heartCenterImageView).offset(-7); + }]; + + self.rightSeatView = [[QXRoomSeatContentView alloc] init]; + [self addSubview:self.rightSeatView]; + [self.rightSeatView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.heartCenterImageView.mas_right); + make.width.mas_equalTo(ScaleWidth(75)); + make.height.mas_equalTo(ScaleWidth(75)+25); + make.top.equalTo(self.leftSeatView); + }]; + + + CGFloat giftConetntHeight = 180; + CGFloat giftWidth = 72; + CGFloat giftHeight = 85; + CGFloat giftWidthSpace = (SCREEN_WIDTH-32-giftWidth*4)/3; + CGFloat giftHeightSpace = 10; + self.giftContentView = [[UIView alloc] init]; + [self addSubview:self.giftContentView]; + [self.giftContentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.heartCenterImageView.mas_bottom).offset(-15); + make.left.mas_equalTo(16); + make.right.mas_equalTo(-16); + make.height.mas_equalTo(giftConetntHeight); + }]; + + self.giftView1 = [[QXRoomSeatBarCabinGiftView alloc] initWithFrame:CGRectMake(0, (giftConetntHeight-85)/2, giftWidth, giftHeight)]; + self.giftView1.delegate = self; + [self.giftContentView addSubview:self.giftView1]; + + self.giftView2 = [[QXRoomSeatBarCabinGiftView alloc] initWithFrame:CGRectMake(self.giftView1.right+giftWidthSpace, 0, giftWidth, giftHeight)]; + self.giftView2.delegate = self; + [self.giftContentView addSubview:self.giftView2]; + + self.giftView3 = [[QXRoomSeatBarCabinGiftView alloc] initWithFrame:CGRectMake(self.giftView2.right+giftWidthSpace, 0, giftWidth, giftHeight)]; + self.giftView3.delegate = self; + [self.giftContentView addSubview:self.giftView3]; + + self.giftView4 = [[QXRoomSeatBarCabinGiftView alloc] initWithFrame:CGRectMake(self.giftView3.right+giftWidthSpace, (giftConetntHeight-85)/2, giftWidth, giftHeight)]; + self.giftView4.delegate = self; + [self.giftContentView addSubview:self.giftView4]; + + self.giftView5 = [[QXRoomSeatBarCabinGiftView alloc] initWithFrame:CGRectMake(self.giftView1.right+giftWidthSpace, self.giftView2.bottom+giftHeightSpace, giftWidth, giftHeight)]; + self.giftView5.delegate = self; + [self.giftContentView addSubview:self.giftView5]; + + self.giftView6 = [[QXRoomSeatBarCabinGiftView alloc] initWithFrame:CGRectMake(self.giftView5.right+giftWidthSpace, self.giftView5.top, giftWidth, giftHeight)]; + self.giftView6.delegate = self; + [self.giftContentView addSubview:self.giftView6]; + + [self.giftViewArray addObject:self.giftView1]; + [self.giftViewArray addObject:self.giftView2]; + [self.giftViewArray addObject:self.giftView3]; + [self.giftViewArray addObject:self.giftView4]; + [self.giftViewArray addObject:self.giftView5]; + [self.giftViewArray addObject:self.giftView6]; + + +// self.playAudioBtn = [[QXBadgeButton alloc] init]; +// self.playAudioBtn.tag = 20; +// [self.playAudioBtn setImage:[UIImage imageNamed:@"room_event_play_audio_nor"] forState:(UIControlStateNormal)]; +// [self.playAudioBtn setImage:[UIImage imageNamed:@"room_event_play_audio_sel"] forState:(UIControlStateSelected)]; +// [self.playAudioBtn addTarget:self action:@selector(eventAction:) forControlEvents:(UIControlEventTouchUpInside)]; +// self.playAudioBtn.hidden = YES; +// [self addSubview:self.playAudioBtn]; +// +// +// self.audioBtn = [[QXBadgeButton alloc] init]; +// self.audioBtn.tag = 21; +// [self.audioBtn setImage:[UIImage imageNamed:@"room_event_mute_audio_nor"] forState:(UIControlStateNormal)]; +// [self.audioBtn setImage:[UIImage imageNamed:@"room_event_mute_audio_sel"] forState:(UIControlStateSelected)]; +} + +-(void)setRoomModel:(QXRoomModel *)roomModel{ + _roomModel = roomModel; + QXRoomPitModel *pit1 = [[QXRoomPitModel alloc] init]; + QXRoomPitModel *pit2 = [[QXRoomPitModel alloc] init];; + if ([roomModel.cp_user.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + pit1.user_id = roomModel.cp_user.user_id; + pit1.nickname = roomModel.cp_user.nickname; + pit1.dress = roomModel.cp_user.dress; + pit1.avatar = roomModel.cp_user.avatar; + + pit2.user_id = roomModel.cp_user.user_id1; + pit2.nickname = roomModel.cp_user.nickname1; + pit2.dress = roomModel.cp_user.dress1; + pit2.avatar = roomModel.cp_user.avatar1; + }else{ + pit2.user_id = roomModel.cp_user.user_id; + pit2.nickname = roomModel.cp_user.nickname; + pit2.dress = roomModel.cp_user.dress; + pit2.avatar = roomModel.cp_user.avatar; + + pit1.user_id = roomModel.cp_user.user_id1; + pit1.nickname = roomModel.cp_user.nickname1; + pit1.dress = roomModel.cp_user.dress1; + pit1.avatar = roomModel.cp_user.avatar1; + } + self.leftSeatView.pitModel = pit1; + self.rightSeatView.pitModel = pit2; + + [self.leftSeatView hideCharm]; + [self.rightSeatView hideCharm]; + self.titleLabel.text = self.roomModel.room_info.room_name; + self.numberLabel.text = self.roomModel.room_info.hot_value; + [self startTimer]; + + [self getGiftList]; +} +-(void)getGiftList{ +// MJWeakSelf +// [QXMineNetwork giftListWithLabel:@"99" roomId:self.roomModel.room_info.room_id successBlock:^(NSArray * _Nonnull list) { +// [weakSelf.dataArray removeAllObjects]; +// [weakSelf.dataArray addObjectsFromArray:list]; +// for (int i = 0; i < list.count; i++) { +// if (i < 6) { +// QXRoomSeatBarCabinGiftView *giftView = self.giftViewArray[i]; +// QXGiftModel *gift = list[i]; +// giftView.giftModel = gift; +// [giftView startFloating]; +// } +// } +// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { +// +// }]; + MJWeakSelf + [QXMineNetwork getRoomNewGiftListWithLabel:@"16" type:@"6" successBlock:^(NSArray * _Nonnull list) { + [weakSelf.dataArray removeAllObjects]; + [weakSelf.dataArray addObjectsFromArray:list]; + for (int i = 0; i < list.count; i++) { + if (i < 6) { + QXRoomSeatBarCabinGiftView *giftView = self.giftViewArray[i]; + QXGiftModel *gift = list[i]; + giftView.giftModel = gift; + [giftView startFloating]; + } + } + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + +-(void)didSendGiftWithGiftModel:(QXGiftModel *)giftModel giftView:(QXRoomSeatBarCabinGiftView *)giftView{ + [giftView stopFloatingAnimation]; + [UIView animateWithDuration:0.3 animations:^{ + giftView.alpha = 0; + } completion:^(BOOL finished) { + [self giftViewShow:giftView]; + }]; +} + +-(void)giftViewShow:(QXRoomSeatBarCabinGiftView*)giftView{ + QXGiftModel *gift = [self randomResultGift]; + giftView.giftModel = gift; + [UIView animateWithDuration:0.3 animations:^{ + giftView.alpha = 1; + } completion:^(BOOL finished) { + [giftView startFloating]; + }]; +} + +-(QXGiftModel*)randomResultGift{ + NSUInteger randomIndex = arc4random() % self.dataArray.count; + QXGiftModel *result = self.dataArray[randomIndex]; + return result; +} +-(void)cabinRoomHotValueDidChanged:(NSString *)hot_value{ + self.roomModel.room_info.hot_value = hot_value; + self.numberLabel.text = self.roomModel.room_info.hot_value; +} +-(void)friendCabinRoomTimeDelayWithTime:(NSString*)end_time{ + self.roomModel.cp_user.time_day = end_time; + [self startTimer]; +} + +-(void)friendCabinRoomIsQuit{ + +} + +-(void)startTimer{ + MJWeakSelf + NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970]; + // 将秒转换为毫秒 + long long milliseconds = (long long)(timeInterval); + self.startTime = self.roomModel.cp_user.time_day.longLongValue - milliseconds; + if (self.startTime <= 0) { + //时间错误不进行倒计时 + self.timeDownLabel.text = @"倒计时:00:00:00"; + return; + } + [self stopTimer]; + _timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + weakSelf.startTime--; + NSInteger hour = self.startTime/60/60; + NSInteger min = (self.startTime % 3600) / 60; + NSInteger second = self.startTime % 60; + weakSelf.timeDownLabel.text = [NSString stringWithFormat:@"倒计时:%02ld:%02ld:%02ld",hour,min,(long)second]; + if (weakSelf.startTime<=0) { + [weakSelf stopTimer]; + weakSelf.timeDownLabel.text = @"00:00:00"; + } + }); + }]; +} +-(void)stopTimer{ + if (_timer) { + [self->_timer invalidate]; + self->_timer= nil; + } +} + +-(void)closeAction{ + MJWeakSelf + UIAlertController *al = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)]; +// [al addAction:[UIAlertAction actionWithTitle:@"最小化房间" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { +// [weakSelf miniRoom]; +// [[QXGlobal shareGlobal] miniRoomWithRoomId:weakSelf.roomModel.room_info.room_id roomCover:weakSelf.roomModel.room_info.room_cover]; +// }]]; + [al addAction:[UIAlertAction actionWithTitle:@"退出房间" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { + [weakSelf leaveRoom]; + }]]; + [al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { + + }]]; + [self.viewController presentViewController:al animated:YES completion:nil]; + +} + +-(void)leaveRoom{ + UINavigationController *na = (UINavigationController *)KEYWINDOW.rootViewController; + if ([self.roomModel.room_info.type_id isEqualToString:@"6"] && [self.roomModel.room_info.label_id isEqualToString:@"11"]) { + [[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomModel.room_info.room_id removeListener:YES]; + NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:na.viewControllers]; + for (int i = 0; i < viewControllers.count; i++) { + UIViewController *vc = [viewControllers objectAtIndex:i]; + if ([vc isEqual:self.viewController]) { + QXRoomViewController *roomVc = [[QXRoomViewController alloc] init]; + roomVc.roomId = QXGlobal.shareGlobal.superRoomId; + [viewControllers insertObject:roomVc atIndex:i]; + QXGlobal.shareGlobal.roomVC = roomVc; + QXGlobal.shareGlobal.roomId = roomVc.roomId; + break; + } + } + [UIApplication sharedApplication].idleTimerDisabled = YES; + na.viewControllers = viewControllers; + [na popViewControllerAnimated:YES]; + QXGlobal.shareGlobal.superRoomId = @""; + [[QXRoomMessageManager shared] quitExGroup]; + }else{ + [[QXGlobal shareGlobal]quitRoomWithRoomId:self.roomModel.room_info.room_id removeListener:YES]; + // self.navigationController.interactivePopGestureRecognizer.enabled = YES; + [na popViewControllerAnimated:YES]; + } +} +-(void)stopHWDMP4{ + [self.leftSeatView stopHWDMP4]; + [self.rightSeatView stopHWDMP4]; +} +-(void)playHWDMP4{ + [self.leftSeatView playHWDMP4]; + [self.rightSeatView playHWDMP4]; +} +-(void)destroyViews{ + if (_leftSeatView) { + [_leftSeatView destroyViews]; + _leftSeatView = nil; + } + if (_rightSeatView) { + [_rightSeatView destroyViews]; + _rightSeatView = nil; + } + [self stopTimer]; +} +-(NSMutableArray *)dataArray{ + if (!_dataArray) { + _dataArray = [NSMutableArray array]; + } + return _dataArray; +} +-(NSMutableArray *)giftViewArray{ + if (!_giftViewArray) { + _giftViewArray = [NSMutableArray array]; + } + return _giftViewArray; +} +@end + + +@implementation QXRoomSeatBarCabinGiftView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self initSubviews]; + } + return self; +} +-(void)setGiftModel:(QXGiftModel *)giftModel{ + _giftModel = giftModel; + [self.giftCoinBtn setTitle:giftModel.gift_price forState:(UIControlStateNormal)]; + [self.giftImageView sd_setImageWithURL:[NSURL URLWithString:giftModel.base_image]]; + if (giftModel.gift_price.intValue<101) { + [self.giftBgImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(45); + make.centerX.equalTo(self); + make.top.equalTo(self); + }]; + [self.giftImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.top.equalTo(self.giftBgImageView).offset(11); + make.right.equalTo(self.giftBgImageView).offset(-11); + make.height.equalTo(self.giftImageView.mas_width); + }]; + [self.giftCoinBtn mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self); + make.top.equalTo(self.giftBgImageView.mas_bottom); + make.height.mas_equalTo(16); + }]; + return; + }else if (giftModel.gift_price.intValue > 100 && giftModel.gift_price.intValue < 501){ + [self.giftBgImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(60); + make.centerX.equalTo(self); + make.top.equalTo(self); + }]; + [self.giftImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.top.equalTo(self.giftBgImageView).offset(11); + make.right.equalTo(self.giftBgImageView).offset(-11); + make.height.equalTo(self.giftImageView.mas_width); + }]; + [self.giftCoinBtn mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self); + make.top.equalTo(self.giftBgImageView.mas_bottom); + make.height.mas_equalTo(16); + }]; + return; + }else{ + [self.giftBgImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.equalTo(self); + make.height.equalTo(self.giftBgImageView.mas_width); + }]; + [self.giftImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.top.equalTo(self.giftBgImageView).offset(11); + make.right.equalTo(self.giftBgImageView).offset(-11); + make.height.equalTo(self.giftImageView.mas_width); + }]; + [self.giftCoinBtn mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self); + make.top.equalTo(self.giftBgImageView.mas_bottom); + make.height.mas_equalTo(16); + }]; + } +} + +-(void)giftAction:(UIButton*)sender{ + if (self.delegate && [self.delegate respondsToSelector:@selector(didSendGiftWithGiftModel:giftView:)]) { + [self.delegate didSendGiftWithGiftModel:self.giftModel giftView:self]; + } +} +-(void)initSubviews{ + self.giftBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bar_room_cabin_gift_bg"]]; + self.giftBgImageView.contentMode = UIViewContentModeScaleToFill; + [self addSubview:self.giftBgImageView]; + [self.giftBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.equalTo(self); + make.height.equalTo(self.giftBgImageView.mas_width); + }]; + + self.giftImageView = [[UIImageView alloc] init]; + self.giftImageView.contentMode = UIViewContentModeScaleToFill; + [self addSubview:self.giftImageView]; + [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.equalTo(self.giftBgImageView).offset(11); + make.right.mas_equalTo(-11); + make.height.equalTo(self.giftImageView.mas_width); + }]; + + self.giftCoinBtn = [[UIButton alloc] init]; + self.giftCoinBtn.userInteractionEnabled = NO; + [self.giftCoinBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)]; + [self.giftCoinBtn setTitleColor:RGB16(0xDBEB23) forState:(UIControlStateNormal)]; + [self.giftCoinBtn setTitle:@"0" forState:(UIControlStateNormal)]; + self.giftCoinBtn.titleLabel.font = [UIFont systemFontOfSize:12]; + [self addSubview:self.giftCoinBtn]; + [self.giftCoinBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self); + make.top.equalTo(self.giftBgImageView.mas_bottom); + make.height.mas_equalTo(16); + }]; + + self.button = [[UIButton alloc] init]; + [self.button addTarget:self action:@selector(giftAction:) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.button]; + [self.button mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.bottom.top.equalTo(self); + }]; +} + +@end diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarView.h new file mode 100644 index 0000000..63edb73 --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarView.h @@ -0,0 +1,73 @@ +// +// QXRoomSeatBarView.h +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import +#import "UIView+VAP.h" +NS_ASSUME_NONNULL_BEGIN +@protocol QXRoomSeatBarViewDelagate + +@optional +-(void)askUserWithPitModel:(QXRoomPitModel*)pitModel; + +-(void)seductionUserWithPitModel:(QXRoomPitModel*)pitModel; + +-(void)sendGiftWithPitModel:(QXRoomPitModel*)pitModel; + +@end +@interface QXRoomSeatBarView : UIView +@property (nonatomic,weak)iddelegate; +@property (nonatomic,strong)QXRoomModel *roomModel; +@property (nonatomic,assign)NSInteger myPitNumber; + +@property (nonatomic,copy)void(^finishBlock)(void); +/// 上下麦 +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; +-(void)clearCharm; +-(void)roomClearUserCharmWithUserId:(NSString *)userId; +-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK; +-(void)setSeatCharmWithUser:(QXUserHomeModel *)model; +-(void)setSeatCharmWithUsers:(NSArray *)users; +-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user; + +/// 上麦 +-(void)barRoomUpseatActionWithPitNumber:(NSString*)pit_number; + + + /// 收到撩他特效 +-(void)barRoomSeductionEffectWithModel:(QXRoomChatListModel*)model; +/// 需要进入小黑屋 +-(void)barRoomJoinCabinRoomWithRoomId:(NSString*)room_id user_id:(NSString*)user_id meet_user_id:(NSString*)meet_user_id; +/// 设置自定义礼物 +-(void)barRoomSetCustomGiftWithUserId:(NSString *)userId had_custom_gift:(BOOL)had_custom_gift; + +-(void)stopHWDMP4; +-(void)playHWDMP4; +-(void)destroyViews; +@end + +@interface QXRoomSeatBarSeatView : UIView +@property (nonatomic,strong)QXRoomSeatContentView *contentView; +@property (nonatomic,strong)UIView *timeView; +@property (nonatomic,strong)UIImageView *timeBgImageView; +@property (nonatomic,strong)UIImageView *timeImageView; +@property (nonatomic,strong)UIImageView *sexImageView; +@property (nonatomic,strong)UILabel *timeLabel; + +@property (nonatomic,strong)UIView *optionView; +@property (nonatomic,strong)UIButton *askBtn; +@property (nonatomic,strong)UIButton *seductionBtn; +@property (nonatomic,strong)UIButton *giftBtn; +@property (nonatomic,strong)QXRoomPitModel *pitModel; +@property (nonatomic,weak)id delegate; +@property (nonatomic,strong) VAPView *mp4View; + +-(void)playSeductionEffectWithPlayImage:(NSString*)playImage isMute:(BOOL)isMute; + +-(void)updateUserCharm:(NSString *)charm; +-(void)destroyViews; +@end +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarView.m new file mode 100644 index 0000000..3135bfa --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatBarView.m @@ -0,0 +1,1065 @@ +// +// QXRoomSeatBarView.m +// QXLive +// +// Created by 启星 on 2026/1/4. +// + +#import "QXRoomSeatBarView.h" +#import "QXMineNetwork.h" +#import "QXRoomBarSetTimeView.h" +#import "QXRoomBarSetGiftView.h" +#import "QXBarAskAlertView.h" +#import "QXSeductionAlertView.h" +#import "QXRoomBarSendCustomGiftView.h" +#import "QXCustomAlertView.h" +#import "QXFileManager.h" +#import "QXRechargeViewcController.h" + +@interface QXRoomSeatBarView() +/// 主持 +@property (nonatomic,strong)QXRoomSeatContentView *compereView; +/// 嘉宾 +@property (nonatomic,strong)QXRoomSeatContentView *guestView; + +/// 嘉宾 +@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView1; +/// 嘉宾 +@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView2; +/// 嘉宾 +@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView3; +/// 嘉宾 +@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView4; +/// 嘉宾 +@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView5; +/// 嘉宾 +@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView6; + +@property (nonatomic,strong)UIButton *ruleBtn; +@property (nonatomic,strong)UIView *leftSettingView; +@property (nonatomic,strong)UIButton *timeBtn; +@property (nonatomic,strong)UIView *rightSettingView; +@property (nonatomic,strong)UIButton *giftBtn; + +/// seatArray +@property (nonatomic,strong)NSMutableArray *seatArray; +@property (nonatomic, strong) NSTimer *checkTimer; + +@property (nonatomic, strong) UIButton *seaKingBtn; +@end +@implementation QXRoomSeatBarView + +- (instancetype)init +{ + self = [super init]; + if (self) { + [self initSubviews]; + } + return self; +} +-(void)initSubviews{ + self.leftSettingView = [[UIView alloc] init]; + self.leftSettingView.hidden = YES; + [self addSubview:self.leftSettingView]; + + self.rightSettingView = [[UIView alloc] init]; + [self addSubview:self.rightSettingView]; + + self.timeBtn = [[UIButton alloc] init]; +// [self.timeBtn setTitle:@"设置时长" forState:(UIControlStateNormal)]; +// [self.timeBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; +// self.timeBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.timeBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_set_seat_time"] forState:(UIControlStateNormal)]; + [self.timeBtn addTarget:self action:@selector(timeAction) forControlEvents:(UIControlEventTouchUpInside)]; +// [self.timeBtn addRoundedCornersWithRadius:ScaleWidth(30)]; +// self.timeBtn.backgroundColor = QXConfig.themeColor; + [self.leftSettingView addSubview:self.timeBtn]; + + self.ruleBtn = [[UIButton alloc] init]; + [self.rightSettingView addSubview:self.ruleBtn]; + [self.ruleBtn setBackgroundImage:[UIImage imageNamed:@"nobility_help_icon"] forState:(UIControlStateNormal)]; + + self.giftBtn = [[UIButton alloc] init]; +// [self.giftBtn setTitle:@"自定义礼物" forState:(UIControlStateNormal)]; +// [self.giftBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; +// self.giftBtn.titleLabel.font = [UIFont systemFontOfSize:14]; +// [self.giftBtn addRoundedCornersWithRadius:ScaleWidth(30)]; +// self.giftBtn.backgroundColor = QXConfig.themeColor; + [self.giftBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_set_custom_gift"] forState:(UIControlStateNormal)]; + [self.giftBtn addTarget:self action:@selector(giftAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.rightSettingView addSubview:self.giftBtn]; + + + [self.leftSettingView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self); + make.height.mas_equalTo(ScaleWidth(36)); + make.width.mas_equalTo(ScaleWidth(53)); + make.top.mas_equalTo(20); + }]; + + [self.rightSettingView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self); + make.height.mas_equalTo(ScaleWidth(57)); + make.width.mas_equalTo(ScaleWidth(69)); + make.top.equalTo(self); + }]; + + [self.ruleBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-5); + make.width.height.mas_equalTo(ScaleWidth(24)); + make.top.equalTo(self.rightSettingView); + }]; + + [self.timeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.leftSettingView); + make.right.equalTo(self.leftSettingView); + make.top.equalTo(self.leftSettingView); + make.bottom.equalTo(self.leftSettingView); + }]; + + [self.giftBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.rightSettingView); + make.right.equalTo(self.rightSettingView); + make.bottom.equalTo(self.rightSettingView); + make.height.mas_equalTo(ScaleWidth(23)); + }]; + + + self.compereView = [[QXRoomSeatContentView alloc] init]; + self.compereView.delegate = self; + self.compereView.tagString = QXText(@"主持"); + self.compereView.number = 9; + [self addSubview:self.compereView]; + CGFloat margin = (SCREEN_WIDTH/2-ScaleWidth(60))/2; + [self.compereView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self).offset(12); + make.width.mas_equalTo(ScaleWidth(65)); + make.height.mas_equalTo(ScaleWidth(65-10)+51-ScaleWidth(15)-5); + make.centerX.equalTo(self).offset(ScaleWidth(-65)); + }]; + + + self.guestView = [[QXRoomSeatContentView alloc] init]; + self.guestView.tagString = QXText(@"嘉宾"); + self.guestView.number = 10; +// [self.guestView addTapBlock:^(id _Nonnull obj) { +// [weakSelf didClickSeatView:obj]; +// }]; + self.guestView.delegate = self; + [self addSubview:self.guestView]; + [self.guestView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self).offset(12); + make.width.mas_equalTo(ScaleWidth(65)); + make.height.mas_equalTo(ScaleWidth(65-10)+51-ScaleWidth(15)-5); + make.centerX.equalTo(self).offset(ScaleWidth(65)); + }]; + + CGFloat seatHeight = ScaleWidth(60-10)+51-ScaleWidth(15)-5 + ScaleWidth(12+14)-5; + CGFloat seatSpace = (SCREEN_WIDTH - ScaleWidth(100)*3)/4; + + self.seatView2 = [[QXRoomSeatBarSeatView alloc] init]; + self.seatView2.contentView.number = 2; + self.seatView2.delegate = self; + [self addSubview:self.seatView2]; + [self.seatView2 mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(ScaleWidth(100)); + make.centerX.equalTo(self); + make.top.equalTo(self.compereView.mas_bottom); + make.height.mas_equalTo(seatHeight); + }]; + + + self.seatView1 = [[QXRoomSeatBarSeatView alloc] init]; + self.seatView1.contentView.number = 1; + self.seatView1.delegate = self; + [self addSubview:self.seatView1]; + [self.seatView1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.seatView2.mas_left).offset(-seatSpace); + make.top.width.height.equalTo(self.seatView2); + }]; + + self.seatView3 = [[QXRoomSeatBarSeatView alloc] init]; + self.seatView3.contentView.number = 3; + self.seatView3.delegate = self; + [self addSubview:self.seatView3]; + + [self.seatView3 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.seatView2.mas_right).offset(seatSpace); + make.top.width.height.equalTo(self.seatView2); + }]; + + self.seatView5 = [[QXRoomSeatBarSeatView alloc] init]; + self.seatView5.contentView.number = 5; + self.seatView5.delegate = self; + [self addSubview:self.seatView5]; + [self.seatView5 mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.seatView2.mas_bottom); + make.centerX.width.height.equalTo(self.seatView2); + }]; + + + self.seatView4 = [[QXRoomSeatBarSeatView alloc] init]; + self.seatView4.contentView.number = 4; + self.seatView4.delegate = self; + [self addSubview:self.seatView4]; + [self.seatView4 mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.seatView5); + make.width.height.equalTo(self.seatView2); + make.centerX.equalTo(self.seatView1); + }]; + + self.seatView6 = [[QXRoomSeatBarSeatView alloc] init]; + self.seatView6.contentView.number = 6; + self.seatView6.delegate = self; + [self addSubview:self.seatView6]; + + [self.seatView6 mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.seatView5); + make.width.height.equalTo(self.seatView2); + make.centerX.equalTo(self.seatView3); + }]; + + [self.seatArray addObject:self.seatView1]; + [self.seatArray addObject:self.seatView2]; + [self.seatArray addObject:self.seatView3]; + [self.seatArray addObject:self.seatView4]; + [self.seatArray addObject:self.seatView5]; + [self.seatArray addObject:self.seatView6]; + ///7 号麦 (占位) + [self.seatArray addObject:[QXRoomSeatContentView new]]; + ///8 号麦 (占位) + [self.seatArray addObject:[QXRoomSeatContentView new]]; + ///9 号麦 (占位) + [self.seatArray addObject:self.compereView]; + + [self.seatArray addObject:self.guestView]; + + + self.seaKingBtn = [[UIButton alloc] init]; + [self.seaKingBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_sea_king"] forState:(UIControlStateNormal)]; + [self.seaKingBtn addTarget:self action:@selector(everyOneFollowMe) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.seaKingBtn]; + [self.seaKingBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.seatView6.mas_bottom).offset(10); + make.centerX.equalTo(self); + make.width.mas_equalTo(ScaleWidth(128)); + make.height.mas_equalTo(ScaleWidth(32)); + }]; +} +- (void)startCheckTimer { + self.checkTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 + target:self + selector:@selector(checkAllSeatTime) + userInfo:nil + repeats:YES]; +} + +-(void)checkAllSeatTime{ + for (int i = 0; i < 6;i++ ) { + QXRoomSeatBarSeatView *seatView = self.seatArray[i]; + QXRoomPitModel *model = seatView.pitModel; + if (model.user_id.longLongValue > 0) { + NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970]; + // 将秒转换为毫秒 + long long milliseconds = (long long)(timeInterval); + NSInteger timeDown = model.end_time.longLongValue - milliseconds; + if (timeDown <= 0) { + seatView.timeLabel.text = @"00:00"; + }else{ + seatView.timeLabel.text = [NSString stringWithFormat:@"%02ld:%02ld",timeDown/60,timeDown%60]; + } + } + } +} + +-(void)timeAction{ + QXRoomBarSetTimeView *setTimeView = [[QXRoomBarSetTimeView alloc] init]; + setTimeView.roomId = self.roomModel.room_info.room_id; + [setTimeView showInView:self.viewController.view]; +} + +-(void)giftAction{ + QXRoomBarSetGiftView *giftView = [[QXRoomBarSetGiftView alloc] init]; + giftView.roomId = self.roomModel.room_info.room_id; + giftView.isLikeGift = NO; + [giftView showInView:self.viewController.view]; +} + +-(void)everyOneFollowMe{ + NSInteger count = 0; + for (int i = 0 ; i < self.seatArray.count;i++) { + id object = self.seatArray[i]; + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + if (contentView.pitModel.user_id.longLongValue > 0 && ![contentView.pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + count++; + } + continue; + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + if (contentView.pitModel.user_id.longLongValue > 0 && ![contentView.pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + count++; + } + continue; + } + } + if (count == 0) { + showToast(@"请等待用户上麦"); + return; + } + + QXCustomAlertView *alert = [[QXCustomAlertView alloc] init]; + __weak typeof(self) weakSelf = self; + alert.commitBlock = ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) return; + [strongSelf everyOneComeOn]; + }; + [alert showInView:self.viewController.view title:@"温馨提示" message:[NSString stringWithFormat:@"确定要撩一撩台上全部嘉宾吗? 共计需要 %ld个 金币",self.roomModel.room_info.sexy_coin.integerValue*count] cancleTitle:@"取消" commitTitle:@"确定"]; +} + +-(void)everyOneComeOn{ + [QXMineNetwork roomSeductionWithRoomId:self.roomModel.room_info.room_id to_user_id:@"" type:@"2" successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} + +-(void)setRoomModel:(QXRoomModel *)roomModel{ + _roomModel = roomModel; + for (int i = 0 ; i < roomModel.room_info.pit_list.count;i++) { + QXRoomPitModel *pitModel = roomModel.room_info.pit_list[i]; + id object = self.seatArray[i]; + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + contentView.pitModel = pitModel; + [contentView hideCharm]; + continue; + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + contentView.pitModel = pitModel; + [contentView.contentView hideCharm]; + continue; + } + } + self.myPitNumber = roomModel.user_info.pit_number.integerValue; + [self startCheckTimer]; +} + +-(void)seductionUserWithPitModel:(QXRoomPitModel *)pitModel{ + BOOL closeAlert = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseSeductionAlert]; + if (closeAlert) { + [QXMineNetwork roomSeductionWithRoomId:self.roomModel.room_info.room_id to_user_id:pitModel.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + }else{ + QXSeductionAlertView *seductionView = [[QXSeductionAlertView alloc] init]; + seductionView.roomId = self.roomModel.room_info.room_id; + seductionView.sexy_coin = self.roomModel.room_info.sexy_coin; + seductionView.pitModel = pitModel; + [seductionView showInView:self.viewController.view]; + } + +} + +-(void)askUserWithPitModel:(QXRoomPitModel *)pitModel{ + QXBarAskAlertView *askView = [[QXBarAskAlertView alloc] init]; + askView.roomId = self.roomModel.room_info.room_id; + askView.pitModel = pitModel; + askView.delegate = self; + [askView showInView:self.viewController.view]; +} + +-(void)sendGiftWithPitModel:(QXRoomPitModel *)pitModel{ + QXRoomBarSendCustomGiftView *giftView = [[QXRoomBarSendCustomGiftView alloc] init]; + giftView.roomId = self.roomModel.room_info.room_id; + giftView.pitModel = pitModel; + [giftView showInView:self.viewController.view]; +} +#pragma mark - QXBarAskAlertViewDelegate +-(void)askViewDidRecharge:(QXBarAskAlertView *)alertView{ + [alertView hide]; + QXRechargeViewcController *vc = [[QXRechargeViewcController alloc] init]; + [self.viewController.navigationController pushViewController:vc animated:YES]; +} + +-(void)askViewDidSend:(QXBarAskAlertView *)alertView pitModel:(nonnull QXRoomPitModel *)pitModel giftInfo:(nonnull QXGiftModel *)giftInfo{ + [alertView hide]; + [QXMineNetwork roomBarAskWithRoomId:self.roomModel.room_info.room_id user_id:pitModel.user_id gift_id:giftInfo.gift_id successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +#pragma mark - QXRoomBarSetGiftViewDelegate +-(void)setGiftModelIsLikeGift:(BOOL)isLikeGift giftModel:(QXGiftModel *)giftModel pitNumber:(nonnull NSString *)pitNumber setGiftView:(nonnull QXRoomBarSetGiftView *)setGiftView{ + /// 自由麦请求 + [setGiftView hide]; + __weak typeof(self) weakSelf = self; + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pitNumber gift_id:giftModel.gift_id isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) return; + if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(upSeatFinish)]) { + [strongSelf.delegate upSeatFinish]; + } + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +#pragma mark - QXRoomSeatBarViewDelagate +-(void)barRoomSeductionEffectWithModel:(QXRoomChatListModel *)model{ + int count = 0; + for (int i = 0;i < 6 ; i++) { + QXRoomSeatBarSeatView *seatView = self.seatArray[i]; + for (QXUserHomeModel*user in model.ToUserInfos) { + if ([user.user_id isEqualToString:seatView.pitModel.user_id]) { + count++; + if (count == 1) { + [seatView playSeductionEffectWithPlayImage:model.GiftInfo.play_image isMute:NO]; + }else{ + [seatView playSeductionEffectWithPlayImage:model.GiftInfo.play_image isMute:YES]; + } + } + } + } +} +-(void)barRoomSetCustomGiftWithUserId:(NSString *)userId had_custom_gift:(BOOL)had_custom_gift{ + for (int i = 0;i < 6 ; i++) { + QXRoomSeatBarSeatView *seatView = self.seatArray[i]; + if ([seatView.pitModel.user_id isEqualToString:userId]) { + seatView.pitModel.had_custom_gift = had_custom_gift?1:0; + seatView.giftBtn.hidden = !had_custom_gift; + } + } +} + +-(void)barRoomJoinCabinRoomWithRoomId:(NSString *)room_id user_id:(NSString *)user_id meet_user_id:(NSString *)meet_user_id{ + if ([QXGlobal.shareGlobal.loginModel.user_id isEqualToString:user_id] || [QXGlobal.shareGlobal.loginModel.user_id isEqualToString:meet_user_id]) { + QXGlobal.shareGlobal.superRoomId = self.roomModel.room_info.room_id; + [[QXGlobal shareGlobal] joinRoomWithRoomId:room_id isRejoin:NO navagationController:self.viewController.navigationController]; + } +} + +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ + if (pit_number > 10) { + return; + } + UIView *objectV = self.seatArray[pit_number-1]; + QXRoomPitModel *model; + if ([objectV isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)objectV; + model = contentView.pitModel; + }else{ + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)objectV; + model = contentView.pitModel; + } + if (isUpSeat) { + model.user_id = user.user_id; + model.avatar = user.avatar; + model.dress = user.dress; + model.sex = user.sex; + model.nickname = user.nickname; + model.user_code = user.user_code; + model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; + model.had_custom_gift = user.had_custom_gift; + model.end_time = end_time; + }else{ + model.user_id = @"0"; + model.avatar = @""; + model.dress = @""; + model.sex = @""; + model.nickname = @""; + model.user_code = @""; + model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; + model.had_custom_gift = 0; + model.end_time = @"0"; + if ([objectV isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)objectV; + [contentView stopHWDMP4]; + [contentView stopAudioAnimation]; + }else{ + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)objectV; + [contentView stopHWDMP4]; + [contentView.contentView stopAudioAnimation]; + } + } + if ([user.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { + if (isUpSeat) { + self.myPitNumber = pit_number; + }else{ + self.myPitNumber = -1; + } + if (self.myPitNumber == 9) { + self.leftSettingView.hidden = NO; + }else{ + self.leftSettingView.hidden = YES; + } + } + + if ([objectV isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)objectV; + contentView.pitModel = model; + [contentView hideCharm]; + }else{ + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)objectV; + contentView.pitModel = model; + [contentView.contentView hideCharm]; + } +} +-(void)didClickUserHeaderWithPitModel:(QXRoomPitModel *)pitModel seatView:(QXRoomSeatContentView *)seatView{ + NSString *pit_number = [NSString stringWithFormat:@"%ld",seatView.number] ; + QXLOG(@"点击了%ld麦位",seatView.number); + if (seatView.pitModel.user_id.longLongValue > 0) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUserHeaderWithPitModel:userModel:isPkRoom:pkRoomId:isNoTakeOff:)]) { + [self.delegate didClickUserHeaderWithPitModel:seatView.pitModel userModel:nil isPkRoom:NO pkRoomId:@"" isNoTakeOff:NO]; + } + }else{ + if (seatView.number == 9) { + /// 麦位没人时点9号麦直接请求上麦 + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + return; + }else if (seatView.number == 10) { + if (self.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) { + [self.delegate didHugSeatWithPitNumber:@"10"]; + } + }else{ + showToast(@"请等待主持抱麦"); + } + return; + }else{ + if (self.myPitNumber == 9) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) { + [self.delegate didHugSeatWithPitNumber:pitModel.pit_number]; + } + }else{ + if (self.roomModel.room_info.room_up_pit_type.intValue == 2) { + if (self.myPitNumber > 0) { + if (self.myPitNumber == 10) { +// [self barRoomUpseatActionWithPitNumber:pit_number]; + QXLOG(@"嘉宾不允许换麦"); + }else{ + id object = self.seatArray[seatView.number]; + QXRoomPitModel *pitModel; + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + pitModel = contentView.pitModel; + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + pitModel = contentView.pitModel; + } + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + } + }else{ + [self barRoomUpseatActionWithPitNumber:pit_number]; + } + }else{ + // 排麦模式 弹出上麦 + if (self.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1 || self.roomModel.user_info.is_host.intValue == 1) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) { + [self.delegate didHugSeatWithPitNumber:pitModel.pit_number]; + } + } + } + } + } + } + +} + +-(void)barRoomUpseatActionWithPitNumber:(NSString*)pit_number{ + QXRoomBarSetGiftView *giftView = [[QXRoomBarSetGiftView alloc] init]; + giftView.roomId = self.roomModel.room_info.room_id; + giftView.pitNumber = pit_number; + giftView.isLikeGift = YES; + giftView.delegate = self; + [giftView showInView:self.viewController.view]; +} +-(void)previewRoomUserCharmListWithUserId:(NSString *)userId{ + if (self.delegate && [self.delegate respondsToSelector:@selector(previewRoomUserCharmListWithUserId:)]) { + [self.delegate previewRoomUserCharmListWithUserId:userId]; + } +} +-(void)clearCharm{ + for (id object in self.seatArray) { + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + QXRoomPitModel *model = contentView.pitModel; + if (model) { + model.charm = @"0"; + [contentView updateUserCharm:model.charm]; + } + continue; + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + [contentView updateUserCharm:contentView.pitModel.charm]; + continue; + } + } +} +-(void)roomClearUserCharmWithUserId:(NSString *)userId{ + for (id object in self.seatArray) { + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + QXRoomPitModel *model = contentView.pitModel; + if ([model.user_id isEqualToString:userId]) { + model.charm = @"0"; + [contentView updateUserCharm:model.charm]; + break; + } + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + QXRoomPitModel *model = contentView.pitModel; + if ([model.user_id isEqualToString:userId]) { + [contentView updateUserCharm:model.charm]; + break; + } + } + } +} +-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK{ + if (fromPitNumber == 0 || toPitNumber == 0) { + return; + } + if (toPitNumber > 10 || toPitNumber == 7 || toPitNumber == 8) { + return; + } + + UIView *fromSeatView = self.seatArray[fromPitNumber-1]; + UIView *toSeatView = self.seatArray[toPitNumber-1]; + QXRoomPitModel *fromPitModel; + QXRoomPitModel *totModel; + if (fromPitNumber>6) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)fromSeatView; + fromPitModel = contentView.pitModel; + }else{ + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)fromSeatView; + fromPitModel = contentView.pitModel; + } + if (toPitNumber>6) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)toSeatView; + totModel = contentView.pitModel; + }else{ + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)toSeatView; + totModel = contentView.pitModel; + } + + NSString* tmpPitNum = [NSString stringWithFormat:@"%@",fromPitModel.pit_number]; + fromPitModel.pit_number = totModel.pit_number; + totModel.pit_number = tmpPitNum; + NSMutableArray*arr = [NSMutableArray arrayWithArray:self.roomModel.room_info.pit_list]; + if (toPitNumber <= arr.count) { + [arr exchangeObjectAtIndex:fromPitNumber-1 withObjectAtIndex:toPitNumber-1]; + } + self.roomModel.room_info.pit_list = arr; + if (fromPitNumber>6) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)fromSeatView; + contentView.pitModel = totModel; + [contentView hideCharm]; + }else{ + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)fromSeatView; + contentView.pitModel = totModel; + [contentView.contentView hideCharm]; + } + if (toPitNumber>6) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)toSeatView; + contentView.pitModel = fromPitModel; + [contentView hideCharm]; + }else{ + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)toSeatView; + contentView.pitModel = fromPitModel; + [contentView.contentView hideCharm]; + } + if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + self.myPitNumber = toPitNumber; + if (self.myPitNumber == 9) { + self.leftSettingView.hidden = NO; + }else{ + self.leftSettingView.hidden = YES; + } + } +} + +-(void)setSeatCharmWithUser:(QXUserHomeModel *)model{ + for (id object in self.seatArray) { + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + QXRoomPitModel *md = contentView.pitModel; + if ([model.user_id isEqualToString:md.user_id]) { + model.charm = @"0"; + [contentView updateUserCharm:model.charm]; + break; + } + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + QXRoomPitModel *md = contentView.pitModel; + if ([model.user_id isEqualToString:md.user_id]) { + [contentView updateUserCharm:model.charm]; + break; + } + } + } +} +-(void)setSeatCharmWithUsers:(NSArray *)users{ + for (QXUserHomeModel*model in users) { + [self setSeatCharmWithUser:model]; + } +} +-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user{ + for (id object in self.seatArray) { + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + QXRoomPitModel *md = contentView.pitModel; + if ([user.user_id isEqualToString:md.user_id]) { + md.dress = user.dress; + md.nickname = user.nickname; + md.sex = user.sex; + md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; + contentView.pitModel = md; + [contentView hideCharm]; + break; + } + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + QXRoomPitModel *md = contentView.pitModel; + if ([user.user_id isEqualToString:md.user_id]) { + md.dress = user.dress; + md.nickname = user.nickname; + md.sex = user.sex; + md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; + contentView.pitModel = md; + [contentView.contentView hideCharm]; + break; + } + } + } +} +-(void)stopHWDMP4{ + for (id object in self.seatArray) { + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + QXRoomPitModel *md = contentView.pitModel; + if (md) { + [contentView stopHWDMP4]; + } + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + QXRoomPitModel *md = contentView.pitModel; + if (md) { + [contentView.contentView stopHWDMP4]; + } + } + } +} +-(void)playHWDMP4{ + for (id object in self.seatArray) { + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + QXRoomPitModel *md = contentView.pitModel; + if (md) { + [contentView playHWDMP4]; + } + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + QXRoomPitModel *md = contentView.pitModel; + if (md) { + [contentView.contentView playHWDMP4]; + } + } + } +} + +-(void)destroyViews{ + [self.compereView destroyViews]; + [self.compereView destroyViews]; + for (id object in self.seatArray) { + if ([object isKindOfClass:[QXRoomSeatContentView class] ]) { + QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object; + [contentView destroyViews]; + } + if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) { + QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object; + QXRoomPitModel *md = contentView.pitModel; + if (md) { + [contentView destroyViews]; + } + } + } + [self.checkTimer invalidate]; + self.checkTimer = nil; +} +-(NSMutableArray *)seatArray{ + if (!_seatArray) { + _seatArray = [NSMutableArray array]; + } + return _seatArray; +} +@end + + +@implementation QXRoomSeatBarSeatView + +- (instancetype)init +{ + self = [super init]; + if (self) { + [self initSubviews]; + } + return self; +} +-(void)didClickUserHeaderWithPitModel:(QXRoomPitModel *)pitModel seatView:(QXRoomSeatContentView *)seatView{ + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUserHeaderWithPitModel:seatView:)]) { + [self.delegate didClickUserHeaderWithPitModel:pitModel seatView:seatView]; + } +} +-(void)previewRoomUserCharmListWithUserId:(NSString *)userId{ + if (self.delegate && [self.delegate respondsToSelector:@selector(previewRoomUserCharmListWithUserId:)]) { + [self.delegate previewRoomUserCharmListWithUserId:userId]; + } +} +-(void)setPitModel:(QXRoomPitModel *)pitModel{ + _pitModel = pitModel; + + if (pitModel.user_id.longLongValue>0) { + self.timeView.hidden = NO; + self.optionView.hidden = NO; + self.sexImageView.hidden = NO; + if (pitModel.had_custom_gift == 1) { + self.giftBtn.hidden = NO; + }else{ + self.giftBtn.hidden = YES; + } + if ([pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + self.optionView.hidden = YES; + self.giftBtn.hidden = YES; + } + }else{ + self.timeView.hidden = YES; + self.optionView.hidden = YES; + self.sexImageView.hidden = YES; + self.giftBtn.hidden = YES; + } + + self.sexImageView.image = [UIImage imageNamed:pitModel.sex.intValue == 1?@"user_sex_boy":@"user_sex_girl"]; + self.contentView.pitModel = pitModel; +} +-(void)updateUserCharm:(NSString *)charm{ + [self.contentView updateUserCharm:charm]; +} +-(void)giftAction{ + if (self.delegate && [self.delegate respondsToSelector:@selector(sendGiftWithPitModel:)]) { + [self.delegate sendGiftWithPitModel:self.pitModel]; + } +} +-(void)seductionAction{ + if (self.delegate && [self.delegate respondsToSelector:@selector(seductionUserWithPitModel:)]) { + [self.delegate seductionUserWithPitModel:self.pitModel]; + } +} + + +-(void)askAction{ + if (self.delegate && [self.delegate respondsToSelector:@selector(askUserWithPitModel:)]) { + [self.delegate askUserWithPitModel:self.pitModel]; + } +} +-(void)initSubviews{ + self.timeView = [[UIView alloc] init]; + [self addSubview:self.timeView]; + [self.timeView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self); + make.width.mas_equalTo(ScaleWidth(55)); + make.centerX.equalTo(self); + make.height.mas_equalTo(ScaleWidth(16)); + }]; + + self.timeBgImageView = [[UIImageView alloc] init]; + self.timeBgImageView.backgroundColor = RGB16(0x000000); + [self.timeBgImageView addRoundedCornersWithRadius:ScaleWidth(8)]; + self.timeBgImageView.layer.borderWidth = 1; + self.timeBgImageView.layer.borderColor = RGB16A(0xffffff, 0.2).CGColor; + self.timeBgImageView.contentMode = UIViewContentModeScaleToFill; + [self.timeView addSubview:self.timeBgImageView]; + [self.timeBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.timeView); + }]; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.font = [UIFont systemFontOfSize:10]; + self.timeLabel.textColor = RGB16(0xffffff); + self.timeLabel.text = @"00:00"; + [self.timeView addSubview:self.timeLabel]; + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self).offset(ScaleWidth(8)); + make.top.bottom.equalTo(self.timeView); + }]; + + self.timeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bar_room_time_icon"]]; + [self.timeView addSubview:self.timeImageView]; + [self.timeImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.timeLabel.mas_left).offset(-3); + make.height.width.mas_equalTo(12); + make.centerY.equalTo(self.timeView); + }]; + + + + + self.contentView = [[QXRoomSeatContentView alloc] init]; + self.contentView.delegate = self; + [self addSubview:self.contentView]; + + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.timeView.mas_bottom).offset(-10); + make.width.mas_equalTo(ScaleWidth(60)); + make.height.mas_equalTo(ScaleWidth(60-10)+51-ScaleWidth(15)-5); + make.centerX.mas_equalTo(self); + }]; + + self.optionView = [[UIView alloc] init]; + [self addSubview:self.optionView]; + + [self.optionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self); + make.centerX.equalTo(self); + make.height.mas_equalTo(ScaleWidth(14)); + make.width.mas_equalTo(100); + }]; + + self.askBtn = [[UIButton alloc] init]; +// self.askBtn.titleLabel.font = [UIFont systemFontOfSize:12]; +// [self.askBtn setTitle:@"约TA" forState:(UIControlStateNormal)]; +// [self.askBtn addRoundedCornersWithRadius:12.5]; +// [self.askBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; +// self.askBtn.backgroundColor = QXConfig.themeColor; + [self.askBtn addTarget:self action:@selector(askAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.askBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_ask_ta"] forState:(UIControlStateNormal)]; + [self.optionView addSubview:self.askBtn]; + [self.askBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.optionView).offset(ScaleWidth(-21.5)); + make.width.mas_equalTo(ScaleWidth(38)); + make.top.bottom.equalTo(self.optionView); + }]; + + self.seductionBtn = [[UIButton alloc] init]; +// [self.seductionBtn setTitle:@"撩TA" forState:(UIControlStateNormal)]; +// self.seductionBtn.titleLabel.font = [UIFont systemFontOfSize:12]; +// [self.seductionBtn addRoundedCornersWithRadius:12.5]; +// [self.seductionBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; +// self.seductionBtn.backgroundColor = QXConfig.themeColor; + [self.seductionBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_seduction_ta"] forState:(UIControlStateNormal)]; + [self.seductionBtn addTarget:self action:@selector(seductionAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.optionView addSubview:self.seductionBtn]; + [self.seductionBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.askBtn.mas_right).offset(5); + make.width.mas_equalTo(ScaleWidth(38)); + make.top.bottom.equalTo(self.optionView); + + }]; + [self bringSubviewToFront:self.timeView]; + + self.sexImageView = [[UIImageView alloc] init]; + [self addSubview:self.sexImageView]; + [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(15); + make.right.equalTo(self.contentView).offset(-5); + make.top.equalTo(self.contentView).offset(ScaleWidth(40)); + }]; + + self.giftBtn = [[UIButton alloc] init]; + [self.giftBtn setImage:[UIImage imageNamed:@"bar_room_custom_gift"] forState:(UIControlStateNormal)]; + [self.giftBtn addTarget:self action:@selector(giftAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.giftBtn]; + [self.giftBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self); + make.right.equalTo(self.contentView.mas_left); + make.height.mas_equalTo(30); + make.top.equalTo(self.contentView).offset(12); + }]; + + [self addSubview:self.mp4View]; + [self.mp4View mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self).offset(ScaleWidth(30)); + make.width.mas_equalTo(ScaleWidth(100)); + make.height.mas_equalTo(ScaleWidth(100/9*16)); + make.top.equalTo(self.contentView).offset(-ScaleWidth((100/9*16)/2)+ScaleWidth(40)); + }]; +} +-(void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container{ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_mp4View.hidden = YES; + [self->_mp4View stopHWDMP4]; + }); +} + +-(void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container{ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_mp4View.hidden = YES; + }); +} + +-(void)playSeductionEffectWithPlayImage:(NSString *)playImage isMute:(BOOL)isMute{ + MJWeakSelf + if ([playImage hasPrefix:@"http"] || [playImage hasPrefix:@"https"]) { +// [[QXRequset shareInstance] downloadVideoPlayerWithUrl:playImage completion:^(BOOL result, NSString * _Nonnull fileName) { +// NSString *videoPath = [QXFileManager getGiftVideoPath:playImage.lastPathComponent]; +// weakSelf.mp4View.hidden = NO; +// [weakSelf.mp4View playHWDMP4:videoPath repeatCount:1 delegate:self]; +// }]; + self.mp4View.hidden = NO; + NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"zizi" ofType:@"mp4"]; + [self.mp4View setMute:isMute]; + [self.mp4View playHWDMP4:videoPath repeatCount:1 delegate:self]; + + } +} + +- (VAPView *)mp4View { + if (!_mp4View) { + _mp4View = [[VAPView alloc] initWithFrame:CGRectZero]; + _mp4View.hwd_enterBackgroundOP = HWDMP4EBOperationTypePauseAndResume; + _mp4View.contentMode = UIViewContentModeScaleAspectFit; + _mp4View.userInteractionEnabled = NO; + _mp4View.backgroundColor = [UIColor clearColor]; + _mp4View.hidden = YES; + _mp4View.hwd_Delegate = self; + } + return _mp4View; +} +-(void)destroyViews{ + [self.mp4View stopHWDMP4]; + [self.contentView destroyViews]; +} +@end diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatDelegate.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatDelegate.h index b0c5366..99ec33b 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatDelegate.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatDelegate.h @@ -37,4 +37,7 @@ /// 查看房间内用户魅力 -(void)previewRoomUserCharmListWithUserId:(NSString *)userId; +/// 酒吧房排麦模式下申请上麦完成 +-(void)upSeatFinish; + @end diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.h index 49e6634..ace5b60 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXRoomModel *roomModel; @property (nonatomic,strong)QXRoomModel *pkRoomModel; @property (nonatomic,assign)NSInteger myPitNumber; --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 清除魅力 -(void)clearCharm; /// 清除个人魅力 diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.m index 5ef7de0..27aa6ee 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatPKView.m @@ -289,7 +289,7 @@ _myPitNumber = myPitNumber; self.leftSeatView.myPitNumber = myPitNumber; } --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ if ([user.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { if (isUpSeat) { self.myPitNumber = pit_number; @@ -302,9 +302,9 @@ } } if (isPK) { - [self.rightSeatView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.rightSeatView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; }else{ - [self.leftSeatView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.leftSeatView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; } } -(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK{ diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.h index fceac75..17866cc 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXSelectAuctionInfoView *auctionInfoView; --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 拍卖者上麦 -(void)didAuctiontUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat; /// 开始 diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m index e84dae2..add88f2 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m @@ -652,7 +652,7 @@ [self.delegate didClickUserHeaderWithPitModel:self.compereView.pitModel userModel:nil isPkRoom:NO pkRoomId:@"" isNoTakeOff:NO]; } }else{ - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"9" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"9" gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -684,7 +684,7 @@ } } --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ QXRoomSeatContentView *contentView; if (pit_number == 9) { contentView = self.compereView; diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.h index 3048c08..caae387 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.h @@ -29,7 +29,7 @@ typedef NS_ENUM(NSInteger) { @property (nonatomic,weak)iddelegate; /// 上下麦 --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 交友房阶段发生变化 step 阶段 1等待 2心动 3牵手 friend_id 场次id -(void)friendPartDidChangedWithType:(NSString*)step friend_id:(NSString*)friend_id end_time:(NSString*)end_time relationModel:(QXRoomFriendRelationModel*)relationModel; /// 交友房时间发生延时 end_time 截止时间 diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m index 0284328..9f44083 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m @@ -819,7 +819,7 @@ } } --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ if (pit_number > 10) { return; } @@ -923,7 +923,7 @@ if (seatView.number == 9) { /// 麦位没人时点9号麦直接请求上麦 - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -968,7 +968,7 @@ }else{ if (self.roomModel.room_info.room_up_pit_type.intValue == 2) { /// 自由麦请求 - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.h index ed32e3a..3f93d54 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,assign)NSInteger myPitNumber; @property (nonatomic,strong)QXRoomSeatContentView* mySeatView; /// 上下麦 --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 清除魅力 -(void)clearCharm; /// 清除个人魅力 diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m index ff018c0..2dec3aa 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m @@ -113,7 +113,7 @@ static NSInteger maxSeat = 8; } if (seatView.number == 9) { /// 麦位没人时点9号麦直接请求上麦 - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -153,7 +153,7 @@ static NSInteger maxSeat = 8; }else{ if (self.roomModel.room_info.room_up_pit_type.intValue == 2) { /// 自由麦请求 - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -195,7 +195,7 @@ static NSInteger maxSeat = 8; } } --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ if (pit_number > 10) { return; } diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.h index bf281f4..aa7588b 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXRoomSeatContentView* mySeatView; /// 上下麦 --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 清除魅力 -(void)clearCharm; /// 清除个人魅力 diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.m index b64c34f..20e9f99 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.m @@ -547,7 +547,7 @@ }]; } -(void)applyAction{ - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"" gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -591,7 +591,7 @@ }else{ if (seatView.number == 9) { /// 麦位没人时点9号麦直接请求上麦 - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -617,7 +617,7 @@ [self.delegate previewRoomUserCharmListWithUserId:userId]; } } --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ if (pit_number > 10 || pit_number == 6 || pit_number == 7 || pit_number == 8) { return; } diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.h index 362de83..7fddea3 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXRoomModel *roomModel; /// 上下麦 --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 清除魅力 -(void)clearCharm; /// 清除个人魅力 diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.m index c36a64d..cfa07cb 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.m @@ -246,7 +246,7 @@ } -(void)upseatCompere{ - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"9" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"9" gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -300,7 +300,7 @@ }else{ if (self.roomModel.room_info.room_up_pit_type.intValue == 2) { /// 自由麦请求 - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -552,7 +552,7 @@ } } /// 上下麦 --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ if (pit_number > 10) { return; } diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.h index 239ebaf..af04c36 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.h @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN /// 设置多人魅力 -(void)setSeatCharmWithUsers:(NSArray*)users; --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 榜单发生变化 -(void)songRoomCharmRankListDidChanged:(NSArray*)list; /// 房间内用户信息发生变化 diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m index 47ec70d..a9f1c9b 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m @@ -240,7 +240,7 @@ QXRoomSeatDelegate } }else{ if (seatView.number == 9) { - [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); @@ -272,7 +272,7 @@ QXRoomSeatDelegate [self.delegate previewRoomUserCharmListWithUserId:userId]; } } --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ // if (pit_number==9999) { // for (<#type *object#> in <#collection#>) { // <#statements#> diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h index 14b9e2a..8476e96 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h @@ -11,6 +11,7 @@ #import "QXRoomSeatDelegate.h" #import "QXRoomFriendRelationModel.h" #import "QXUserSongListModel.h" +#import "QXRoomChatListView.h" NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger) { @@ -30,7 +31,12 @@ typedef NS_ENUM(NSInteger) { /// 点唱 QXRoomSeatViewTypeSinger, /// 签约房 - QXRoomSeatViewTypeSign + QXRoomSeatViewTypeSign, + /// 酒吧房 + QXRoomSeatViewTypeBar, + /// 酒吧房私密小屋 + QXRoomSeatViewTypeBarCabin +// }QXRoomSeatViewType; @@ -66,7 +72,7 @@ typedef NS_ENUM(NSInteger) { /// 设置麦位锁麦状态 -(void)setSeatIsLock:(NSString*)isLock pitNumber:(NSString*)pitNumber; --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time; /// 房间内用户信息发生变化 -(void)roomUserInfoDidChanged:(QXUserHomeModel *)user; /// 房间内换麦 @@ -139,6 +145,16 @@ typedef NS_ENUM(NSInteger) { -(void)signValueDidChangedWithSignUserInfo:(QXUserHomeModel*)signUserInfo sign_value:(NSString*)sign_value signId:(NSString*)signId sign_coin_list:(NSArray*)sign_coin_list; /// 签约身价变化 -(void)signTimeDelayWithEndTime:(NSString*)endTime; + + +/// 酒吧房点击上麦 +-(void)barRoomUpseatActionWithPitNumber:(NSString*)pit_number; +/// 收到撩他特效 +-(void)barRoomSeductionEffectWithModel:(QXRoomChatListModel*)model; +/// 需要进入小黑屋 +-(void)barRoomJoinCabinRoomWithRoomId:(NSString*)room_id user_id:(NSString*)user_id meet_user_id:(NSString*)meet_user_id; +/// 设置了自定义礼物 +-(void)barRoomSetCustomGiftWithUserId:(NSString *)userId had_custom_gift:(BOOL)had_custom_gift; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m index 9f297b6..341690f 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m @@ -16,6 +16,8 @@ #import "QXRoomUserCharmView.h" #import "QXRoomSeatTypeSingerView.h" #import "QXRoomSeatTypeSignView.h" +#import "QXRoomSeatBarView.h" +#import "QXRoomSeatBarCabinView.h" @interface QXRoomSeatView() /// 二卡八 @@ -37,6 +39,11 @@ @property (nonatomic,strong)QXRoomSeatTypeSingerView *singerView; /// 签约房 @property (nonatomic,strong)QXRoomSeatTypeSignView *signView; +/// 酒吧房 +@property (nonatomic,strong)QXRoomSeatBarView *barView; +/// 酒吧房私密小屋 +@property (nonatomic,strong)QXRoomSeatBarCabinView *barCabinView; + @property (nonatomic,strong)QXRoomUserCharmView *charmListView; @end @@ -80,6 +87,12 @@ }]; return; } + if (_barView) { + [self hideBarViewBlock:^{ + [self showNormalView]; + }]; + return; + } if (_roomPkView) { _roomPkView.transform = CGAffineTransformIdentity; // 弹性动画 @@ -179,6 +192,12 @@ }]; return; } + if (_barView) { + [self hideBarViewBlock:^{ + [self showAuctionView]; + }]; + return; + } [self addSubview:self.auctionView]; [self.auctionView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.equalTo(self); @@ -257,6 +276,12 @@ }]; return; } + if (_barView) { + [self hideBarViewBlock:^{ + [self showSongView]; + }]; + return; + } [self addSubview:self.songView]; [self.songView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.equalTo(self); @@ -373,6 +398,12 @@ }]; return; } + if (_barView) { + [self hideBarViewBlock:^{ + [self showRoomFriendView]; + }]; + return; + } [self addSubview:self.roomFriendView]; [self.roomFriendView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.equalTo(self); @@ -448,6 +479,12 @@ }]; return; } + if (_barView) { + [self hideBarViewBlock:^{ + [self showSingerView]; + }]; + return; + } [self addSubview:self.singerView]; [self.singerView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.equalTo(self); @@ -531,6 +568,12 @@ }]; return; } + if (_barView) { + [self hideBarViewBlock:^{ + [self showSignView]; + }]; + return; + } [self addSubview:self.signView]; [self.signView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.equalTo(self); @@ -575,6 +618,94 @@ }]; } +-(void)initBarView{ + if (_roomFriendView) { + [self hideRoomFriendBlock:^{ + [self showBarView]; + }]; + return; + } + if (_normalSeatView) { + [self hideNormalViewBlock:^{ + [self showBarView]; + }]; + return; + } + if (_auctionView) { + [self hideAuctionViewBlock:^{ + [self showBarView]; + }]; + return; + } + if (_songView) { + [self hideSongViewBlock:^{ + [self showBarView]; + }]; + return; + } + if (_singerView) { + [self hideSinggerViewBlock:^{ + [self showBarView]; + }]; + return; + } + if (_signView) { + [self hideSignViewBlock:^{ + [self showBarView]; + }]; + return; + } + [self addSubview:self.barView]; + [self.barView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; +} +-(void)showBarView{ + [self addSubview:self.barView]; + [self.barView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; + self.barView.transform = CGAffineTransformMakeScale(0.01, 0.01); + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.barView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + + }]; +} +-(void)hideBarViewBlock:(void(^)(void))completion{ + _barView.transform = CGAffineTransformIdentity; + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self->_barView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + [self->_barView destroyViews]; + [self->_barView removeFromSuperview]; + self->_barView = nil; + if (completion) { + completion(); + } + }]; +} +- (void)initBarCabinView{ + self.barCabinView = [[QXRoomSeatBarCabinView alloc] init]; + self.barCabinView.delegate = self; + [self addSubview:self.barCabinView]; + [self.barCabinView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; +} + -(void)setMyPitNumber:(NSInteger)myPitNumber{ _myPitNumber = myPitNumber; switch (self.type) { @@ -599,6 +730,9 @@ case QXRoomSeatViewTypeSign: self.signView.myPitNumber = myPitNumber; break; + case QXRoomSeatViewTypeBar: + self.barView.myPitNumber = myPitNumber; + break; default: break; } @@ -646,6 +780,14 @@ [self initSignView]; } break; + case QXRoomSeatViewTypeBar:{ + [self initBarView]; + } + break; + case QXRoomSeatViewTypeBarCabin:{ + [self initBarCabinView]; + } + break; default: break; } @@ -713,6 +855,14 @@ self.signView.roomModel = roomModel; } break; + case QXRoomSeatViewTypeBar:{ + self.barView.roomModel = roomModel; + } + break; + case QXRoomSeatViewTypeBarCabin:{ + self.barCabinView.roomModel = roomModel; + } + break; default: break; } @@ -766,8 +916,14 @@ } } -(void)cabinRoomHotValueDidChanged:(NSString *)hot_value{ - if (_cabinView) { - [self.cabinView cabinRoomHotValueDidChanged:hot_value]; + if ([self.roomModel.room_info.label_id isEqualToString:@"11"]) { + if (_barCabinView) { + [self.barCabinView cabinRoomHotValueDidChanged:hot_value]; + } + }else{ + if (_cabinView) { + [self.cabinView cabinRoomHotValueDidChanged:hot_value]; + } } } -(void)clearCharm{ @@ -798,6 +954,9 @@ case QXRoomSeatViewTypeSign: [self.signView clearCharm]; break; + case QXRoomSeatViewTypeBar: + [self.barView clearCharm]; + break; default: break; } @@ -831,6 +990,9 @@ case QXRoomSeatViewTypeSign: [self.signView roomClearUserCharmWithUserId:userId]; break; + case QXRoomSeatViewTypeBar: + [self.barView roomClearUserCharmWithUserId:userId]; + break; default: break; } @@ -863,6 +1025,9 @@ case QXRoomSeatViewTypeSign: [self.signView roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:userInfo isPK:isPK]; break; + case QXRoomSeatViewTypeBar: + [self.barView roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:userInfo isPK:isPK]; + break; default: break; } @@ -896,6 +1061,9 @@ case QXRoomSeatViewTypeSign: [self.signView setSeatCharmWithUser:model]; break; + case QXRoomSeatViewTypeBar: + [self.barView setSeatCharmWithUser:model]; + break; default: break; } @@ -930,6 +1098,9 @@ case QXRoomSeatViewTypeSign: [self.signView setSeatCharmWithUsers:users]; break; + case QXRoomSeatViewTypeBar: + [self.barView setSeatCharmWithUsers:users]; + break; default: break; } @@ -1070,6 +1241,10 @@ [self.cabinView friendCabinRoomIsQuit]; } break; + case QXRoomSeatViewTypeBarCabin:{ + [self.barCabinView friendCabinRoomIsQuit]; + } + break; default: break; } @@ -1081,6 +1256,10 @@ [self.cabinView friendCabinRoomTimeDelayWithTime:end_time]; } break; + case QXRoomSeatViewTypeBarCabin:{ + [self.barCabinView friendCabinRoomTimeDelayWithTime:end_time]; + } + break; default: break; } @@ -1116,7 +1295,7 @@ -(void)didHugSeatWithPitNumber:(NSString *)pitNumber{ [self showOnlineListWithPitNumber:pitNumber]; } --(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{ if (self.roomModel == nil) { return; } @@ -1125,28 +1304,31 @@ } switch (self.type) { case QXRoomSeatViewTypeNormal: - [self.normalSeatView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.normalSeatView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; break; case QXRoomSeatViewTypeSing: - [self.songView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.songView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; break; case QXRoomSeatViewTypeAuction: - [self.auctionView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.auctionView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; break; case QXRoomSeatViewTypeCabin: // self.cabinView.roomModel = roomModel; break; case QXRoomSeatViewTypePK: - [self.roomPkView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.roomPkView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; break; case QXRoomSeatViewTypeFriend: - [self.roomFriendView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.roomFriendView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; break; case QXRoomSeatViewTypeSinger: - [self.singerView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.singerView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; break; case QXRoomSeatViewTypeSign: - [self.signView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + [self.signView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; + break; + case QXRoomSeatViewTypeBar: + [self.barView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK end_time:end_time]; break; default: break; @@ -1239,6 +1421,36 @@ } } +/// 酒吧房点击上麦 +-(void)barRoomUpseatActionWithPitNumber:(NSString*)pit_number;{ + if (_barView) { + [self.barView barRoomUpseatActionWithPitNumber:pit_number]; + } +} +-(void)barRoomSetCustomGiftWithUserId:(NSString *)userId had_custom_gift:(BOOL)had_custom_gift{ + if (_barView) { + [self.barView barRoomSetCustomGiftWithUserId:userId had_custom_gift:had_custom_gift]; + } +} +-(void)upSeatFinish{ + if (self.delegate && [self.delegate respondsToSelector:@selector(upSeatFinish)]) { + [self.delegate upSeatFinish]; + } +} + +/// 收到撩他特效 +-(void)barRoomSeductionEffectWithModel:(QXRoomChatListModel*)model{ + if (_barView) { + [_barView barRoomSeductionEffectWithModel:model]; + } +} +/// 需要进入小黑屋 +-(void)barRoomJoinCabinRoomWithRoomId:(NSString*)room_id user_id:(NSString*)user_id meet_user_id:(NSString*)meet_user_id{ + if (_barView) { + [_barView barRoomJoinCabinRoomWithRoomId:room_id user_id:user_id meet_user_id:meet_user_id]; + } +} + -(void)roomUserInfoDidChanged:(QXUserHomeModel *)user{ switch (self.type) { case QXRoomSeatViewTypeNormal: @@ -1265,6 +1477,9 @@ case QXRoomSeatViewTypeSign: [self.signView roomUserInfoDidChanged:user]; break; + case QXRoomSeatViewTypeBar: + [self.barView roomUserInfoDidChanged:user]; + break; default: break; } @@ -1295,6 +1510,13 @@ case QXRoomSeatViewTypeSign: [self.signView stopHWDMP4]; break; + case QXRoomSeatViewTypeBar: + [self.barView stopHWDMP4]; + break; + case QXRoomSeatViewTypeBarCabin:{ + [self.barCabinView stopHWDMP4]; + } + break; default: break; } @@ -1325,6 +1547,13 @@ case QXRoomSeatViewTypeSign: [self.signView playHWDMP4]; break; + case QXRoomSeatViewTypeBar: + [self.barView playHWDMP4]; + break; + case QXRoomSeatViewTypeBarCabin:{ + [self.barCabinView playHWDMP4]; + } + break; default: break; } @@ -1359,6 +1588,11 @@ } if (_signView) { [_singerView destroyViews]; + _singerView = nil; + } + if (_barView) { + [_barView destroyViews]; + _barView = nil; } } @@ -1404,6 +1638,20 @@ } return _signView; } +-(QXRoomSeatBarView *)barView{ + if (!_barView) { + _barView = [[QXRoomSeatBarView alloc] init]; + _barView.delegate = self; + } + return _barView; +} +-(QXRoomSeatBarCabinView *)barCabinView{ + if (!_barCabinView) { + _barCabinView = [[QXRoomSeatBarCabinView alloc] init]; + _barCabinView.delegate = self; + } + return _barCabinView; +} -(QXRoomUserCharmView *)charmListView{ if (!_charmListView) { _charmListView = [[QXRoomUserCharmView alloc] initWithFrame:[UIScreen mainScreen].bounds]; diff --git a/QXLive/Tools/Category/UIView+FloatingAnimation.h b/QXLive/Tools/Category/UIView+FloatingAnimation.h new file mode 100644 index 0000000..69c7154 --- /dev/null +++ b/QXLive/Tools/Category/UIView+FloatingAnimation.h @@ -0,0 +1,45 @@ +// +// UIView+FloatingAnimation.h +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import + +typedef NS_ENUM(NSInteger, FloatingDirection) { + FloatingDirectionUpDown, // 上下漂浮 + FloatingDirectionLeftRight // 左右漂浮 +}; + +@interface UIView (FloatingAnimation) + +/// 开始无限漂浮动画 +/// @param distance 漂浮距离(单位:点) +/// @param duration 单次动画持续时间(秒) +/// @param direction 漂浮方向 +/// @param autoStart 是否自动开始(YES:立即开始,NO:需要手动调用startFloating) +- (void)startInfiniteFloatingAnimationWithDistance:(CGFloat)distance + duration:(NSTimeInterval)duration + direction:(FloatingDirection)direction + autoStart:(BOOL)autoStart; + +/// 开始上下漂浮动画(默认自动开始) +- (void)startUpDownFloatingWithDistance:(CGFloat)distance duration:(NSTimeInterval)duration; + +/// 手动开始漂浮动画(如果设置了autoStart为NO,需要调用此方法) +- (void)startFloating; + +/// 停止漂浮动画 +- (void)stopFloatingAnimation; + +/// 暂停漂浮动画 +- (void)pauseFloatingAnimation; + +/// 恢复漂浮动画 +- (void)resumeFloatingAnimation; + +/// 检查是否正在漂浮 +- (BOOL)isFloatingAnimating; + +@end diff --git a/QXLive/Tools/Category/UIView+FloatingAnimation.m b/QXLive/Tools/Category/UIView+FloatingAnimation.m new file mode 100644 index 0000000..395b477 --- /dev/null +++ b/QXLive/Tools/Category/UIView+FloatingAnimation.m @@ -0,0 +1,240 @@ +// +// UIView+FloatingAnimation.m +// QXLive +// +// Created by 启星 on 2026/1/5. +// + +#import "UIView+FloatingAnimation.h" +#import + +// 关联对象键 +static char kFloatingAnimationKey; +static char kFloatingDistanceKey; +static char kFloatingDurationKey; +static char kFloatingDirectionKey; +static char kOriginalCenterKey; +static char kFloatingStateKey; + +@interface UIView () +// 内部属性 +@property (nonatomic, assign) BOOL isFloating; +@property (nonatomic, assign) CGPoint originalCenter; +@property (nonatomic, assign) CGFloat floatingDistance; +@property (nonatomic, assign) NSTimeInterval floatingDuration; +@property (nonatomic, assign) FloatingDirection floatingDirection; +@end + +@implementation UIView (FloatingAnimation) + +#pragma mark - 公共方法 + +- (void)startInfiniteFloatingAnimationWithDistance:(CGFloat)distance + duration:(NSTimeInterval)duration + direction:(FloatingDirection)direction + autoStart:(BOOL)autoStart { + // 保存原始位置 + self.originalCenter = self.center; + + // 保存参数 + self.floatingDistance = distance; + self.floatingDuration = duration; + self.floatingDirection = direction; + + if (autoStart) { + [self startFloating]; + } +} + +- (void)startUpDownFloatingWithDistance:(CGFloat)distance duration:(NSTimeInterval)duration { + [self startInfiniteFloatingAnimationWithDistance:distance + duration:duration + direction:FloatingDirectionUpDown + autoStart:YES]; +} + +- (void)startFloating { + if (self.isFloating) { + return; + } + + self.isFloating = YES; + + // 根据方向选择动画方法 + switch (self.floatingDirection) { + case FloatingDirectionUpDown: + [self startUpDownAnimation]; + break; + case FloatingDirectionLeftRight: + [self startLeftRightAnimation]; + break; + } +} + +- (void)stopFloatingAnimation { + if (!self.isFloating) { + return; + } + + self.isFloating = NO; + + // 移除所有动画 + [self.layer removeAllAnimations]; + + // 平滑回到原始位置 + [UIView animateWithDuration:0.3 + delay:0 + usingSpringWithDamping:0.7 + initialSpringVelocity:0.5 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.center = self.originalCenter; + } completion:nil]; +} + +- (void)pauseFloatingAnimation { + if (!self.isFloating) { + return; + } + + // 暂停图层动画 + CFTimeInterval pausedTime = [self.layer convertTime:CACurrentMediaTime() fromLayer:nil]; + self.layer.speed = 0.0; + self.layer.timeOffset = pausedTime; +} + +- (void)resumeFloatingAnimation { + if (!self.isFloating) { + return; + } + + // 恢复图层动画 + CFTimeInterval pausedTime = [self.layer timeOffset]; + self.layer.speed = 1.0; + self.layer.timeOffset = 0.0; + self.layer.beginTime = 0.0; + CFTimeInterval timeSincePause = [self.layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime; + self.layer.beginTime = timeSincePause; +} + +- (BOOL)isFloating { + return [objc_getAssociatedObject(self, &kFloatingStateKey) boolValue]; +} + +#pragma mark - 私有动画方法 + +- (void)startUpDownAnimation { + // 计算目标位置 + CGPoint upPoint = CGPointMake(self.center.x, self.center.y - self.floatingDistance); + CGPoint downPoint = CGPointMake(self.center.x, self.center.y + self.floatingDistance); + + // 创建关键帧动画 + CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.y"]; + + // 设置动画路径 + NSArray *values = @[ + @(self.center.y), + @(upPoint.y), + @(self.center.y), + @(downPoint.y), + @(self.center.y) + ]; + animation.values = values; + + // 设置时间点 + animation.keyTimes = @[@0, @0.25, @0.5, @0.75, @1]; + + // 配置动画属性 + animation.duration = self.floatingDuration * 4; // 完整上下循环 + animation.repeatCount = HUGE_VALF; // 无限循环 + animation.autoreverses = NO; + animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + + // 保存动画引用 + objc_setAssociatedObject(self, &kFloatingAnimationKey, animation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + // 添加动画 + [self.layer addAnimation:animation forKey:@"floatingAnimation"]; +} + +- (void)startLeftRightAnimation { + // 计算目标位置 + CGPoint leftPoint = CGPointMake(self.center.x - self.floatingDistance, self.center.y); + CGPoint rightPoint = CGPointMake(self.center.x + self.floatingDistance, self.center.y); + + // 创建关键帧动画 + CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.x"]; + + // 设置动画路径 + NSArray *values = @[ + @(self.center.x), + @(leftPoint.x), + @(self.center.x), + @(rightPoint.x), + @(self.center.x) + ]; + animation.values = values; + + // 设置时间点 + animation.keyTimes = @[@0, @0.25, @0.5, @0.75, @1]; + + // 配置动画属性 + animation.duration = self.floatingDuration * 2; + animation.repeatCount = HUGE_VALF; + animation.autoreverses = NO; + animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + + // 保存动画引用 + objc_setAssociatedObject(self, &kFloatingAnimationKey, animation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + // 添加动画 + [self.layer addAnimation:animation forKey:@"floatingAnimation"]; +} + +#pragma mark - 关联属性 + +- (void)setIsFloating:(BOOL)isFloating { + objc_setAssociatedObject(self, &kFloatingStateKey, @(isFloating), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL)isFloatingAnimating { + return [objc_getAssociatedObject(self, &kFloatingStateKey) boolValue]; +} + +- (void)setOriginalCenter:(CGPoint)originalCenter { + objc_setAssociatedObject(self, &kOriginalCenterKey, [NSValue valueWithCGPoint:originalCenter], OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (CGPoint)originalCenter { + NSValue *value = objc_getAssociatedObject(self, &kOriginalCenterKey); + return value ? [value CGPointValue] : self.center; +} + +- (void)setFloatingDistance:(CGFloat)floatingDistance { + objc_setAssociatedObject(self, &kFloatingDistanceKey, @(floatingDistance), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (CGFloat)floatingDistance { + NSNumber *number = objc_getAssociatedObject(self, &kFloatingDistanceKey); + return number ? [number floatValue] : 10.0; +} + +- (void)setFloatingDuration:(NSTimeInterval)floatingDuration { + objc_setAssociatedObject(self, &kFloatingDurationKey, @(floatingDuration), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (NSTimeInterval)floatingDuration { + NSNumber *number = objc_getAssociatedObject(self, &kFloatingDurationKey); + return number ? [number doubleValue] : 1.0; +} + +- (void)setFloatingDirection:(FloatingDirection)floatingDirection { + objc_setAssociatedObject(self, &kFloatingDirectionKey, @(floatingDirection), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (FloatingDirection)floatingDirection { + NSNumber *number = objc_getAssociatedObject(self, &kFloatingDirectionKey); + return number ? [number integerValue] : FloatingDirectionUpDown; +} + +@end