diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.h b/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.h index 10adb44f..163bff30 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.h @@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)registerActions:(void(^ _Nullable)(ComboActionType type))action; +- (void)enableToCombo:(BOOL)enable; + - (void)saveSendGiftTo:(NSArray *)UIDs; - (void)saveGiftSourceType:(GiftSourceType)type; - (void)saveSendGiftInfo:(GiftInfoModel *)model; @@ -48,6 +50,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)resetCombo; - (void)sendGift; - (void)forceRemove; +- (BOOL)loadEnable; // 第一个 combo 由 send gift view 发起,需要手动 combo + 1 - (NSInteger)loadComboCountFromSendGiftView; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.m b/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.m index e2c812cf..b6490dd0 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/GiftComboManager.m @@ -20,6 +20,8 @@ @interface GiftComboManager () +@property (nonatomic, assign) BOOL enableCombo; + // 用来存储 GiftReceiveInfoModel 和 NSDictionary 的元数据队列 @property (nonatomic, strong) NSMutableArray *giftComboQueue; @@ -96,11 +98,10 @@ - (void)resetCombo { _combo = 1; _errorMessage = @""; - if (self.actionCallback) { + if (self.actionCallback && self.enableCombo) { self.actionCallback(ComboAction_ShowPanel); + self.isCombing = YES; } - - self.isCombing = YES; } - (void)registerActions:(void (^)(ComboActionType))action { @@ -117,6 +118,11 @@ } - (NSInteger)loadComboCountFromSendGiftView { + + if (!self.enableCombo) { + return 0; + } + NSInteger temp = self.combo; self.combo += 1; return temp; @@ -324,6 +330,15 @@ } #pragma mark - Gift meta data + +- (void)enableToCombo:(BOOL)enable { + self.enableCombo = enable; +} + +- (BOOL)loadEnable { + return self.enableCombo; +} + - (void)saveSendGiftTo:(NSArray *)UIDs { _sendGiftToUIDs = UIDs; @@ -437,9 +452,12 @@ attachment.first = CustomMessageType_Gift; attachment.second = Custom_Message_Sub_Gift_Send; NSDictionary *targetUsers = ((NSArray *)[data objectForKey:@"targetUsers"]).firstObject; + NSString *avatar = [targetUsers valueForKeyPath:@"avatar"]; [data setObject:[targetUsers valueForKeyPath:@"uid"] forKey:@"targetUid"]; [data setObject:[targetUsers valueForKeyPath:@"nick"] forKey:@"targetNick"]; - [data setObject:[targetUsers valueForKeyPath:@"avatar"] forKey:@"targetAvatar"]; + if (avatar.length > 0) { + [data setObject:avatar forKey:@"targetAvatar"]; + } attachment.data = data; } break; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h b/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h index ce0744ac..8a21c4fb 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h @@ -22,8 +22,9 @@ typedef NS_ENUM(NSUInteger, GiftType) { GiftType_Anchor = 11, //个播礼物 GiftType_Punish = 12, //惩罚礼物 GiftType_Twelve_Star = 13, //星座礼物 - GiftType_super = 16, //超级礼物 + GiftType_super = 16, //幸运礼物 GiftType_Country = 17, //国家礼物 + GiftType_Lucky24 = 18, //幸运24 }; //礼物类型 diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m index 050818b7..1ea4643e 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m @@ -188,7 +188,8 @@ } } break; - case GiftType_super:{ + case GiftType_super: + case GiftType_Lucky24:{ return self.superLuckyVC; } break; @@ -211,7 +212,7 @@ return i; } else if (tabGiftType == GiftType_Lucky && self.segmentType == GiftSegmentType_Lucky) { return i; - } else if (tabGiftType == GiftType_super && self.segmentType == GiftSegmentType_SuperLucky) { + } else if ((tabGiftType == GiftType_super || tabGiftType == GiftType_Lucky24) && self.segmentType == GiftSegmentType_SuperLucky) { return i; } else if (tabGiftType == GiftType_WeekStar && self.segmentType == GiftSegmentType_WeekStar) { return i; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m index 42b72b97..b9c45484 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m @@ -469,15 +469,21 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; } /// 初始化/重置 连击礼物功能状态 -- (void)readyForCombo:(XPGiftCountModel *)giftCount { - if (self.segmentType == GiftSegmentType_Pack || - self.segmentType == GiftSegmentType_Lucky) { +- (void)readyForCombo:(XPGiftCountModel *)giftCount + gift:(GiftInfoModel *)giftInfo { + if (self.segmentType == GiftSegmentType_Pack) { + [[GiftComboManager sharedManager] enableToCombo:NO]; return; } - NSString *sessionID = self.usingplaceType == SendGiftType_User ? [NSString stringWithFormat:@"%ld", self.userArray.firstObject.uid] : [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]; + if (giftInfo.giftType != GiftType_Game && giftInfo.giftType != GiftType_super && giftInfo.giftType != GiftType_Lucky24) { + [[GiftComboManager sharedManager] enableToCombo:NO]; + return; + } - GiftInfoModel *giftInfo = self.giftInfoView.lastSelectGift; + [[GiftComboManager sharedManager] enableToCombo:YES]; + + NSString *sessionID = self.usingplaceType == SendGiftType_User ? [NSString stringWithFormat:@"%ld", self.userArray.firstObject.uid] : [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]; [[GiftComboManager sharedManager] saveSendGiftTo:[self.userView getSelectUserList]]; [[GiftComboManager sharedManager] saveGiftSourceType:giftInfo.sourceType]; [[GiftComboManager sharedManager] saveSendGiftInfo:giftInfo]; @@ -493,11 +499,13 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; - (void)xPGiftBarView:(XPGiftBarView *)view didClickSendGift:(XPGiftCountModel *)giftCount { ///总礼物 三要素 送礼物的人 送的什么礼物 送多少个礼物 NSArray * uids = [self.userView getSelectUserList]; - GiftInfoModel * giftInfo = self.giftInfoView.lastSelectGift; + GiftInfoModel *giftInfo = self.giftInfoView.lastSelectGift; if (self.usingplaceType == SendGiftType_Room) { if (uids.count > 0) { - [self readyForCombo:giftCount]; + + [self readyForCombo:giftCount + gift:giftInfo]; ///送礼物的人 NSString * uidString = [self dealSendGiftUids:uids];