diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftInfoModel.h b/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftInfoModel.h index 7e2bad2f..eab987a0 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftInfoModel.h +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftInfoModel.h @@ -18,6 +18,7 @@ typedef NS_ENUM(NSUInteger, GiftType) { GiftType_Noble = 7, // 贵族礼物 GiftType_WeekStar = 8, //周星礼物 GiftType_Graffiti = 10, //涂鸦礼物 + GiftType_Anchor = 11, //个播礼物 }; //礼物类型 diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m index 3935a15e..ed79edc0 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m @@ -64,6 +64,7 @@ NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; // 普通面板礼物 NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; // 周星礼物 NSArray *drawGift = [GiftInfoModel modelsWithArray:data.data[@"drawGift"]]; // 涂鸦礼物 + NSArray *anchorGift = [GiftInfoModel modelsWithArray:data.data[@"singlePopularGift"]]; // 个播礼物 NSMutableArray *info = [NSMutableArray array]; NSMutableArray *totalInfo = [NSMutableArray array]; [info addObjectsFromArray:luckyBagGift]; @@ -71,6 +72,7 @@ [info addObjectsFromArray:normalGift]; [info addObjectsFromArray:weekStarGift]; [info addObjectsFromArray:drawGift]; + [info addObjectsFromArray:anchorGift]; [totalInfo addObjectsFromArray:info]; [totalInfo addObjectsFromArray:luckyPoolGift]; ///把礼物信息保存一下 diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.h b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.h index c5a8510c..52750cc7 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.h +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.h @@ -7,6 +7,8 @@ #import #import "XPSendGiftView.h" +///Model +#import "RoomInfoModel.h" NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, GiftSegmentType) { @@ -16,6 +18,7 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) { GiftSegmentType_WeekStar, ///周星礼物 GiftSegmentType_Pack,///背包礼物 GiftSegmentType_Graffiti,///涂鸦礼物 + GiftSegmentType_Anchor,///个播 }; @@ -51,7 +54,8 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) { @property (nonatomic, assign) NSInteger curUserNobleLevel; @property (nonatomic, copy) NSString *defaultSelectGiftId; - +///房间类型 +@property (nonatomic,assign) RoomType roomType; ///头部礼物类型变更 /// - Parameter headType: 1:礼物 2:互动 - (void)giftHeadTypeHadChange:(NSInteger)headType; diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m index cc7f2fbd..b4a55ce0 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftInfoView.m @@ -15,6 +15,7 @@ ///Model #import "GiftInfoModel.h" #import "GiftReceiveInfoModel.h" +#import "RoomInfoModel.h" ///View #import "XPGiftItemCollectionViewCell.h" #import "XPGiftEmptyCollectionViewCell.h" @@ -37,6 +38,8 @@ @property (nonatomic, strong) UIButton *weekStarButton; ///涂鸦礼物 @property (nonatomic,strong) UIButton *graffitiButton; +///个播礼物 +@property (nonatomic,strong) UIButton *anchorButton; ///背包总价值 @property (nonatomic,strong) UILabel *totalValueLabel; /// @@ -59,6 +62,8 @@ @property (nonatomic,strong) NSArray *giftPackArray; ///涂鸦礼物数据源 @property (nonatomic,strong) NSArray *giftGraffitiArray; +///个播礼物数据源 +@property (nonatomic,strong) NSArray *anchorArray; ///总的价值 @property (nonatomic,strong) NSAttributedString *totalAttribute; ///当前展示的数据的类型 @@ -91,6 +96,7 @@ self.packGiftButton.selected = NO; self.weekStarButton.selected = NO; self.graffitiButton.selected = NO; + self.anchorButton.selected = NO; sender.selected = !sender.selected; self.segmentType = sender.tag; } @@ -112,6 +118,9 @@ [self.segmentStackView addArrangedSubview:self.nobleGiftButton]; [self.segmentStackView addArrangedSubview:self.luckyGiftButton]; [self.segmentStackView addArrangedSubview:self.weekStarButton]; + if(self.roomType == RoomType_Anchor) { + [self didClickGiftSegmentAction:self.anchorButton]; + } if(self.segmentType != GiftSegmentType_Pack) { [self didClickGiftSegmentAction:self.normalGiftButton]; } @@ -120,6 +129,7 @@ [self.luckyGiftButton removeFromSuperview]; [self.nobleGiftButton removeFromSuperview]; [self.weekStarButton removeFromSuperview]; + [self.anchorButton removeFromSuperview]; [self.segmentStackView addArrangedSubview:self.graffitiButton]; if(self.segmentType != GiftSegmentType_Pack) { [self didClickGiftSegmentAction:self.graffitiButton]; @@ -141,6 +151,7 @@ [self.segmentStackView addArrangedSubview:self.nobleGiftButton]; [self.segmentStackView addArrangedSubview:self.luckyGiftButton]; [self.segmentStackView addArrangedSubview:self.weekStarButton]; + [self.segmentStackView addArrangedSubview:self.anchorButton]; ///礼物 [self.giftStackView addArrangedSubview:self.giftcollectionView]; [self.giftStackView addArrangedSubview:self.pageController]; @@ -327,6 +338,14 @@ } #pragma mark - Getters And Setters +- (void)setRoomType:(RoomType)roomType { + _roomType = roomType; + if (_roomType == RoomType_Anchor) { + self.anchorButton.hidden = NO; + } +} + + - (void)setSegmentType:(GiftSegmentType)segmentType { if (segmentType == _segmentType) { return; @@ -339,6 +358,7 @@ [self resetSelectGift:self.giftNobleArray]; [self resetSelectGift:self.giftWeekStarArray]; [self resetSelectGift:self.giftGraffitiArray]; + [self resetSelectGift:self.anchorArray]; self.totalValueLabel.hidden = YES; switch (_segmentType) { case GiftSegmentType_Normal: @@ -365,13 +385,16 @@ case GiftSegmentType_Graffiti: [self.datasource addObjectsFromArray:self.giftGraffitiArray]; break; + case GiftSegmentType_Anchor: + [self.datasource addObjectsFromArray:self.anchorArray]; + break; default: [self.datasource addObjectsFromArray:self.giftArray]; break; } NSInteger currentPage = 0; if (self.datasource.count > 0) { - if (self.defaultSelectGiftId.length) { + if (self.defaultSelectGiftId.length && (self.segmentType == GiftSegmentType_Normal | self.segmentType == GiftSegmentType_Pack)) { for (int i = 0 ; i )delegate { + _delegate = delegate; + if (_delegate) { + self.giftInfoView.roomType = _delegate.getRoomInfo.type; + } +} + - (UIView *)topView { if (!_topView) { _topView = [[UIView alloc] init]; diff --git a/xplan-ios/Main/Room/Presenter/XPRoomPresenter.m b/xplan-ios/Main/Room/Presenter/XPRoomPresenter.m index c35240a7..193fb31a 100644 --- a/xplan-ios/Main/Room/Presenter/XPRoomPresenter.m +++ b/xplan-ios/Main/Room/Presenter/XPRoomPresenter.m @@ -160,6 +160,7 @@ NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; // 普通面板礼物 NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; // 周星礼物 NSArray *drawGift = [GiftInfoModel modelsWithArray:data.data[@"drawGift"]]; // 涂鸦礼物 + NSArray *anchorGift = [GiftInfoModel modelsWithArray:data.data[@"singlePopularGift"]]; // 个播礼物 //TODO: luckyPoolGift 这个就是福袋礼物的所有的数据 只要保存这个就行了吧 以后需要改 NSMutableArray *info = [NSMutableArray array]; NSMutableArray *totalInfo = [NSMutableArray array]; diff --git a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m index 235a0efa..a97328dc 100644 --- a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -1008,12 +1008,16 @@ UserInfoModel * userInfo = microModel.userInfo; XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init]; userModel.avatar = userInfo.avatar; + userModel.vipMic = userInfo.vipMic; userModel.position = [NSString stringWithFormat:@"%d", microModel.microState.position]; userModel.uid = userInfo.uid; + if (self.delegate.getRoomInfo.type == RoomType_Anchor && microModel.microState.position == -1) {///个播房一直为离开模式,不需要添加房主位 + continue; + } [array addObject:userModel]; } } - + if (self.delegate.getRoomInfo.leaveMode) { RoomInfoModel * roomInfo= self.delegate.getRoomInfo; XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init]; @@ -1021,6 +1025,22 @@ userModel.position = @"-1"; userModel.uid = roomInfo.uid; [array addObject:userModel]; + } else if (self.delegate.getRoomInfo.type == RoomType_Anchor) { + RoomInfoModel * roomInfo= self.delegate.getRoomInfo; + BOOL hadContainerOwner = NO; + for (UserInfoModel *userModel in array) { + if (userModel.uid == roomInfo.uid) { + hadContainerOwner = YES; + break; + } + } + if (!hadContainerOwner) { + XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init]; + userModel.avatar = roomInfo.avatar; + userModel.position = @"-1"; + userModel.uid = roomInfo.uid; + [array addObject:userModel]; + } } return array; }