diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index f626cecf..5ab1537e 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -303,6 +303,7 @@ 23942E912A86424500D0ECC2 /* XPLoginAuthCodeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23942E902A86424500D0ECC2 /* XPLoginAuthCodeVC.m */; }; 2396FCE42B22BE5D0014021D /* pi_area_info.json in Resources */ = {isa = PBXBuildFile; fileRef = 2396FCE32B22BE5D0014021D /* pi_area_info.json */; }; 239BEEDB2AA1E058005CDA94 /* PIHoemCategoryTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 239BEEDA2AA1E058005CDA94 /* PIHoemCategoryTitleView.m */; }; + 23A03F2D2B4408CD0094227A /* pi_room_lucky_gift.svga in Resources */ = {isa = PBXBuildFile; fileRef = 23A03F2C2B4408CD0094227A /* pi_room_lucky_gift.svga */; }; 23A439742AA1CF7C002E6039 /* XPNewHomeHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23A439732AA1CF7C002E6039 /* XPNewHomeHeadView.m */; }; 23B2AEC12A64E9C200543D17 /* LoginForgetEditView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2AEC02A64E9C200543D17 /* LoginForgetEditView.m */; }; 23B2AEC42A6516C200543D17 /* LoginForgetPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2AEC22A6516C200543D17 /* LoginForgetPasswordViewController.m */; }; @@ -2069,6 +2070,7 @@ 2396FCE32B22BE5D0014021D /* pi_area_info.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = pi_area_info.json; sourceTree = ""; }; 239BEED92AA1E058005CDA94 /* PIHoemCategoryTitleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIHoemCategoryTitleView.h; sourceTree = ""; }; 239BEEDA2AA1E058005CDA94 /* PIHoemCategoryTitleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIHoemCategoryTitleView.m; sourceTree = ""; }; + 23A03F2C2B4408CD0094227A /* pi_room_lucky_gift.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_room_lucky_gift.svga; sourceTree = ""; }; 23A439722AA1CF7C002E6039 /* XPNewHomeHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNewHomeHeadView.h; sourceTree = ""; }; 23A439732AA1CF7C002E6039 /* XPNewHomeHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNewHomeHeadView.m; sourceTree = ""; }; 23B2AEBF2A64E9C200543D17 /* LoginForgetEditView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginForgetEditView.h; sourceTree = ""; }; @@ -9376,6 +9378,7 @@ E8A1E45C276220B100B294CA /* Resources */ = { isa = PBXGroup; children = ( + 23A03F2C2B4408CD0094227A /* pi_room_lucky_gift.svga */, 23FF256F2ABD456C0064E904 /* pi_home_new_play.svga */, 23FF25612ABAE6310064E904 /* pi_room_game_fine_love.svga */, 232C444A2AB4363200D4B2ED /* pi_room_tarrow_h5_banner.svga */, @@ -10656,6 +10659,7 @@ E80EC87128ACD84000D133C5 /* emoji_160@2x.png in Resources */, 23E9EB252A84E98300B792F2 /* pi_new_mine_info_online.svga in Resources */, 23FF42652AA5AC040055733C /* home_heat.gif in Resources */, + 23A03F2D2B4408CD0094227A /* pi_room_lucky_gift.svga in Resources */, E80EC86D28ACD84000D133C5 /* emoji_35@2x.png in Resources */, E80EC86528ACD84000D133C5 /* emoji_03@2x.png in Resources */, E80EC85B28ACD84000D133C5 /* emoji_69@2x.png in Resources */, diff --git a/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_assist.imageset/Contents.json b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_assist.imageset/Contents.json new file mode 100644 index 00000000..952c6ca7 --- /dev/null +++ b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_assist.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "room_across_pk_assist.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_assist.imageset/room_across_pk_assist.png b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_assist.imageset/room_across_pk_assist.png new file mode 100644 index 00000000..164b9488 Binary files /dev/null and b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_assist.imageset/room_across_pk_assist.png differ diff --git a/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_onlookers.imageset/Contents.json b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_onlookers.imageset/Contents.json new file mode 100644 index 00000000..498338c0 --- /dev/null +++ b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_onlookers.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "room_across_pk_onlookers.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_onlookers.imageset/room_across_pk_onlookers.png b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_onlookers.imageset/room_across_pk_onlookers.png new file mode 100644 index 00000000..48c9bd98 Binary files /dev/null and b/YuMi/Assets.xcassets/yna/AcrossRoomPK/room_across_pk_onlookers.imageset/room_across_pk_onlookers.png differ diff --git a/YuMi/Global/YUMIConstant.m b/YuMi/Global/YUMIConstant.m index 93d88c1c..914b5806 100644 --- a/YuMi/Global/YUMIConstant.m +++ b/YuMi/Global/YUMIConstant.m @@ -65,7 +65,7 @@ NSString * const KeyWithType(Pi_KeyType type) { NSDictionary * dic = @{ @(KeyType_PasswordEncode) : @"1ea53d260ecf11e7b56e00163e046a26", @(KeyType_NTESQuickLoginBusinessId) : @"09c1214706c34f4798d3f05d86148608", - @(KeyType_Agora) : @"7ae1a8dabe7a44a9a67c829faa409e70", + @(KeyType_Agora) : @"f8713b6ec98c4c01adaf34cb4fa091b1", @(KeyType_TRTC) : @"1400741885", @(KeyType_NetEase) : @"1c3b8c6bf8467d8e4c33a004dbec5c94", @(keyType_YiDunBussinessId) : @"yinyouApnsDebug", diff --git a/YuMi/Modules/YMMine/View/Guild/View/XPMineClanViewController.m b/YuMi/Modules/YMMine/View/Guild/View/XPMineClanViewController.m index ba5dc053..4eb7b7f2 100644 --- a/YuMi/Modules/YMMine/View/Guild/View/XPMineClanViewController.m +++ b/YuMi/Modules/YMMine/View/Guild/View/XPMineClanViewController.m @@ -57,6 +57,8 @@ @property (nonatomic,strong) XPClanSectionView *sectionView; ///是否请求了数据 @property (nonatomic,assign) BOOL isRequest; +///公会成员 +@property(nonatomic,assign) NSInteger memberNum; @end @implementation XPMineClanViewController @@ -161,7 +163,7 @@ if (cell == nil) { cell = [[XPClanMemberTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPClanMemberTableViewCell class])]; } - self.sectionView.title = [NSString stringWithFormat:YMLocalizedString(@"XPMineClanViewController1"), self.datasource.count]; + self.sectionView.title = [NSString stringWithFormat:YMLocalizedString(@"XPMineClanViewController1"), self.memberNum]; cell.cellType = ClanMemberTableViewCellType_Normal; ClanMemberInfoModel * memberInfo = [self.datasource safeObjectAtIndex1:indexPath.row-1]; cell.isLast = (self.datasource.count -1) == indexPath.row-1; @@ -241,6 +243,7 @@ } else { self.hasNoMoreData = YES; } + self.memberNum = memberInfo.count; [self.tableView reloadData]; } diff --git a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m index aface76e..c3609f85 100644 --- a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m +++ b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrpssRoomPKPanelView.m @@ -820,7 +820,7 @@ - (UIButton *)assistButton { if (!_assistButton) { _assistButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_assistButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + [_assistButton setBackgroundImage:kImage(@"room_across_pk_assist") forState:UIControlStateNormal]; [_assistButton setTitle:YMLocalizedString(@"XPAcrpssRoomPKPanelView2") forState:UIControlStateNormal]; _assistButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; [_assistButton setTitleColor:[DJDKMIMOMColor confirmButtonTextColor] forState:UIControlStateNormal]; @@ -836,7 +836,7 @@ - (UIButton *)onlookButton { if (!_onlookButton) { _onlookButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_onlookButton setBackgroundImage:[UIImage imageWithColor:[DJDKMIMOMColor disableButtonColor]] forState:UIControlStateNormal]; + [_onlookButton setBackgroundImage:kImage(@"room_across_pk_onlookers") forState:UIControlStateNormal]; [_onlookButton setTitle:YMLocalizedString(@"XPAcrpssRoomPKPanelView3") forState:UIControlStateNormal]; _onlookButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; [_onlookButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; diff --git a/YuMi/Modules/YMRoom/View/AnimationView/Model/PIBaseAnimationViewModel.h b/YuMi/Modules/YMRoom/View/AnimationView/Model/PIBaseAnimationViewModel.h index 0726c6f6..d1032e4d 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/Model/PIBaseAnimationViewModel.h +++ b/YuMi/Modules/YMRoom/View/AnimationView/Model/PIBaseAnimationViewModel.h @@ -16,6 +16,7 @@ typedef enum : NSUInteger { GiftBannerType_Fairy,///夺宝精灵 GiftBannerType_Tarrow,//塔罗 GiftBannerType_Common_H5,//通用h5 + GiftBannerType_Magic_House,//魔法屋 } GiftBannerType; NS_ASSUME_NONNULL_BEGIN @@ -25,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, copy)NSString *nick; @property(nonatomic, copy)NSString *giftName; +@property(nonatomic, copy) NSString *giftNum; @property (nonatomic,copy) NSString *luckyBagName; @property (nonatomic,copy) NSString *roomTitle; @property (nonatomic,assign) NSInteger uid; @@ -41,6 +43,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,copy) NSString * bannerId; @property(nonatomic,copy) NSString *drawGoldNum; @property(nonatomic,copy) NSString *content; +///福袋图片 +@property(nonatomic,copy) NSString *luckyBagGiftPic; +///礼物图片 +@property(nonatomic,copy) NSString *giftPic; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.h b/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.h index d7fb9681..35d56963 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.h +++ b/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.h @@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface PIRoomGiftBroadcastWindow : UIView +@property(nonatomic,assign) BOOL isLuck;///是否是福袋 @property(nonatomic,copy) NSString *roomName; @property(nonatomic,copy) NSString *roodUid; @property(nonatomic,weak) iddelegate; diff --git a/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.m b/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.m index e94af891..cbc49c93 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/PIRoomGiftBroadcastWindow.m @@ -96,6 +96,16 @@ } -(void)selectAction:(UIButton *)sender{ sender.selected = !sender.selected; + + if(self.isLuck == YES){ + if(sender.selected == YES){ + [[NSUserDefaults standardUserDefaults]setValue:@(YES) forKey:@"kSaveLuckSelectState"]; + [[NSUserDefaults standardUserDefaults]synchronize]; + }else{ + [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"kSaveLuckSelectState"]; + } + return; + } if(sender.selected == YES){ [[NSUserDefaults standardUserDefaults]setValue:@(YES) forKey:@"kSaveBrooadcastSelectState"]; [[NSUserDefaults standardUserDefaults]synchronize]; diff --git a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m index 59f1fe21..57b32012 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m @@ -111,8 +111,7 @@ @property (nonatomic,strong) NSMutableSet * giftVisibleArray; -///魔法小屋合成礼物的队列 -@property (nonatomic,strong) NSMutableArray *compoundGiftQueue; + ///大礼物是否正在播放 @property (nonatomic,assign) BOOL isLargeGiftAnimating; @@ -183,6 +182,8 @@ self.delegate = delegate; [self initSubViews]; [self initSubViewConstraints]; + + } return self; } @@ -1178,16 +1179,18 @@ #pragma mark - 魔法小屋礼物合成 - (void)receiveGiftCompound:(AttachmentModel *)attachment { if ([self isInSudGame]) {return;} - if (self.compoundGiftQueue.count == 0) { - [self createGiftCompoundBannerAnimation:attachment]; + PIBaseAnimationViewModel *magicModel =[PIBaseAnimationViewModel new]; + magicModel.data = attachment.data; + magicModel.type = GiftBannerType_Magic_House; + if(self.animationListB.count == 0 && self.isPlayOfB == NO){ + [self createGiftCompoundBannerAnimation:magicModel]; } - [self.compoundGiftQueue addObject:attachment]; + [self.animationListB addObject:magicModel]; + } -- (void)createGiftCompoundBannerAnimation:(AttachmentModel *)attachment { - - - +- (void)createGiftCompoundBannerAnimation:(PIBaseAnimationViewModel *)attachment { + self.isPlayOfB = YES; XPRoomGiftCompoundView *compoundGiftView = [[XPRoomGiftCompoundView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 45)]; compoundGiftView.compoundGiftInfo = attachment.data; [self.middleLevelView addSubview:compoundGiftView]; @@ -1210,13 +1213,16 @@ @kStrongify(self); if (finished) { [compoundGiftView removeFromSuperview]; - if (self.compoundGiftQueue.count > 0) { - [self.compoundGiftQueue removeObjectAtIndex:0]; - } - - if (self.compoundGiftQueue.count > 0) { - [self createGiftCompoundBannerAnimation:self.compoundGiftQueue.firstObject]; + self.isPlayOfB = NO; + if(self.animationListB.count > 0){ + [self.animationListB removeObjectAtIndex:0]; } + // if(self.isAnimationListAFinish == YES){ + // self.isAnimationListAFinish = NO; + // [self playAnimationWithModel]; + // return; + // } + [self playAnimationWithModel]; } }]; [compoundGiftView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; @@ -1619,7 +1625,7 @@ self.isLuckyGiftAnimation = YES; - XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 60)]; + XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 71)]; luckyGiftEffectView.delegate = self; [self.highLevleView addSubview:luckyGiftEffectView]; luckyGiftEffectView.giftInfo = prizeModel; @@ -1629,19 +1635,35 @@ springAnimation.springBounciness = 10.f; springAnimation.fromValue = [NSValue valueWithCGPoint:luckyGiftEffectView.center]; springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, luckyGiftEffectView.center.y)]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 6 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [luckyGiftEffectView removeFromSuperview]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 7 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; + moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, luckyGiftEffectView.center.y)]; + moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, luckyGiftEffectView.center.y)]; + moveAnimation.beginTime = CACurrentMediaTime(); + moveAnimation.duration = 0.5; + moveAnimation.repeatCount = 1; + moveAnimation.removedOnCompletion = YES; + @kWeakify(self); + [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { + @kStrongify(self); + if (finished) { + [luckyGiftEffectView removeFromSuperview]; + + if (self.animationListB.count > 0) { + [self.animationListB removeObjectAtIndex:0]; + } + self.isPlayOfB = NO; + // if(self.isAnimationListAFinish == YES){ + // self.isAnimationListAFinish = NO; + // [self playAnimationWithModel]; + // return; + // } + [self playAnimationWithModel]; + } + }]; + [luckyGiftEffectView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; + - if (self.animationListB.count > 0) { - [self.animationListB removeObjectAtIndex:0]; - } - self.isPlayOfB = NO; - // if(self.isAnimationListAFinish == YES){ - // self.isAnimationListAFinish = NO; - // [self playAnimationWithModel]; - // return; - // } - [self playAnimationWithModel]; }); [luckyGiftEffectView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"]; } @@ -1665,6 +1687,8 @@ [self createTarotBannerAnimation:model]; }else if(model.type == GiftBannerType_Common_H5){ [self createCommonH5BannerAnimation:model]; + }else if(model.type == GiftBannerType_Magic_House){ + [self createGiftCompoundBannerAnimation:model]; } } @@ -1699,18 +1723,35 @@ [self createTarotBannerAnimation:model]; }else if(model.type == GiftBannerType_Common_H5){ [self createCommonH5BannerAnimation:model]; + }else if(model.type == GiftBannerType_Magic_House){ + [self createGiftCompoundBannerAnimation:model]; } } #pragma mark - XPRoomLuckyBigPrizeViewDelegate - (void)xPRoomLuckyBigPrizeView:(XPRoomLuckyBigPrizeView *)view luckyGiftInfo:(PIBaseAnimationViewModel *)giftInfo { - if (!giftInfo.isInRoomVisiable && giftInfo.roomUid.length > 0 && giftInfo.roomUid.integerValue != self.delegate.getRoomInfo.uid) { - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:giftInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - } + id isShowBroadcastView = [[NSUserDefaults standardUserDefaults]valueForKey:@"kSaveLuckSelectState"]; + if(isShowBroadcastView == nil){ + PIRoomGiftBroadcastWindow *broadcastView = [[PIRoomGiftBroadcastWindow alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; + broadcastView.isLuck = YES; + broadcastView.roodUid = giftInfo.roomUid; + broadcastView.roomName = giftInfo.roomTitle; + broadcastView.delegate = self; + [kWindow addSubview:broadcastView]; + return; + } + if (!giftInfo.isInRoomVisiable && giftInfo.roomUid.length > 0 && giftInfo.roomUid.integerValue != self.delegate.getRoomInfo.uid) { + [self.delegate exitRoom]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [XPRoomViewController openRoom:giftInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; + }); + } + + + + + } #pragma mark - 普通礼物 @@ -2590,13 +2631,6 @@ -- (NSMutableArray *)compoundGiftQueue { - if (!_compoundGiftQueue) { - _compoundGiftQueue = [NSMutableArray array]; - } - return _compoundGiftQueue; -} - - (NSMutableArray *)carEffectQueue { diff --git a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomLuckyBigPrizeView.m b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomLuckyBigPrizeView.m index 4d149d4c..e5183287 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomLuckyBigPrizeView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomLuckyBigPrizeView.m @@ -22,7 +22,10 @@ @interface XPRoomLuckyBigPrizeView () ///动画管理类 @property (strong, nonatomic) SVGAParser *parser; -@property (nonatomic, strong) XPSVGAPlayer *giftImageView; +@property (nonatomic, strong) XPSVGAPlayer *giftSvgaView; +@property(nonatomic,strong) NetImageView *chestImageView; +@property(nonatomic,strong) NetImageView *giftImageView; +@property(nonatomic,strong) UILabel *contentView; @end @implementation XPRoomLuckyBigPrizeView @@ -38,15 +41,31 @@ #pragma mark - Private Method - (void)initSubViews { - [self addSubview:self.giftImageView]; - UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)]; - [self addGestureRecognizer:tap]; + [self addSubview:self.giftSvgaView]; + [self addSubview:self.chestImageView]; + [self addSubview:self.giftImageView]; + [self addSubview:self.contentView]; + } - (void)initSubViewConstraints { - [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + [self.giftSvgaView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(self); }]; + [self.chestImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(9); + make.centerY.equalTo(self); + make.height.width.mas_equalTo(60); + }]; + [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(-9); + make.centerY.equalTo(self); + make.height.width.mas_equalTo(60); + }]; + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.equalTo(self).inset(69); + make.top.mas_equalTo(19); + }]; } #pragma mark - Event Response @@ -55,72 +74,71 @@ [self.delegate xPRoomLuckyBigPrizeView:self luckyGiftInfo:self.giftInfo]; } } - +- (void)chestImageViewTapRecognizer:(UITapGestureRecognizer *)tap{ + [self tapRecognizer:tap]; +} +- (void)giftImageViewTapRecognizer:(UITapGestureRecognizer *)tap{ + [self tapRecognizer:tap]; +} #pragma mark - Getters And Setters - (void)setGiftInfo:(PIBaseAnimationViewModel*)giftInfo { _giftInfo = giftInfo; - if (_giftInfo) { + if (_giftInfo) { NSString * nick = _giftInfo.nick ?: @""; - if (nick.length > 6) { - nick = [nick substringToIndex:6]; - } - NSString *goldPrice = _giftInfo.goldPrice ?: @""; + if (nick.length > 5) { + nick = [nick substringToIndex:5]; + } + NSString *goldPrice = _giftInfo.goldPrice ?: @"0"; NSString *giftName = _giftInfo.giftName ?: @""; NSString *luckyBagName = _giftInfo.luckyBagName ?: @""; - CGFloat fontSize = 22; - NSDictionary * dic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize], NSForegroundColorAttributeName:[UIColor whiteColor]}; - NSDictionary * mainDic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize], NSForegroundColorAttributeName:[DJDKMIMOMColor appMainColor]}; + NSString *giftNum = _giftInfo.giftNum ?: @"0"; + NSString *mainText = [NSString stringWithFormat:YMLocalizedString(@"XPRoomLuckyBigPrizeView0"),nick,luckyBagName,goldPrice,giftName]; + if([giftNum integerValue] > 1){ + mainText = [NSString stringWithFormat:@"%@ X%@",mainText,giftNum]; + } + CGFloat fontSize = 12; + NSDictionary * dic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize weight:UIFontWeightMedium], NSForegroundColorAttributeName:UIColorFromRGB(0xFFF45E)}; + NSDictionary * mainDic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize weight:UIFontWeightMedium], NSForegroundColorAttributeName:[UIColor whiteColor]}; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init]; - [attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPGiftLuckyGiftBroadcastCell0") attributes:dic]]; + [attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:mainText attributes:mainDic]]; - [attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:nick attributes:mainDic]]; - - - [attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:YMLocalizedString(@"XPRoomLuckyBigPrizeView1"),luckyBagName] attributes:dic]]; - - [attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:goldPrice attributes:mainDic]]; - - [attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:giftName attributes:mainDic]]; - NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; - paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping; - paragraphStyle.alignment = NSTextAlignmentLeft; - paragraphStyle.lineSpacing = 4.0f;//行间距 - // 强制排版(从左到右) - paragraphStyle.alignment = NSTextAlignmentLeft; - paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight; - [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedString.length)]; - if (_giftInfo.isInRoomVisiable) { - [self.giftImageView setHidden:YES forKey:@"img_206"]; - } else { - [self.giftImageView setHidden:NO forKey:@"img_206"]; - } + [attributedString addAttributes:dic range:[mainText rangeOfString:nick]]; + [attributedString addAttributes:dic range:[mainText rangeOfString:luckyBagName]]; + [attributedString addAttributes:dic range:[mainText rangeOfString:goldPrice]]; + [attributedString addAttributes:dic range:[mainText rangeOfString:giftName]]; + if([giftNum integerValue] > 1){ + [attributedString addAttributes:dic range:[mainText rangeOfString:giftNum]]; + } + _contentView.attributedText = attributedString; + _chestImageView.imageUrl = _giftInfo.luckyBagGiftPic; + _giftImageView.imageUrl = _giftInfo.giftPic; @kWeakify(self); - [self.giftImageView setAttributedText:attributedString forKey:@"fdpp_copywriting"]; - NSString * anatomiser1Name = [NSString stringWithFormat:@"%@/lucky_gift_streamer.svga", API_Image_URL]; - [self.parser parseWithURL:[NSURL URLWithString:anatomiser1Name] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { - @kStrongify(self); - self.hidden = NO; - self.giftImageView.hidden = NO; - self.giftImageView.videoItem = videoItem; - self.giftImageView.loops = 1; - self.giftImageView.clearsAfterStop = YES; - [self.giftImageView startAnimation]; - } failureBlock:^(NSError * _Nonnull error) { - - }]; + + [self.parser parseWithNamed:@"pi_room_lucky_gift" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + @kStrongify(self); + self.hidden = NO; + self.giftSvgaView.hidden = NO; + self.giftSvgaView.videoItem = videoItem; + self.giftSvgaView.loops = 10000; + self.giftSvgaView.clearsAfterStop = YES; + [self.giftSvgaView startAnimation]; + } failureBlock:^(NSError * _Nullable error) { + }]; + + } } - (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player{ NSLog(@"11111"); } -- (XPSVGAPlayer *)giftImageView { - if (!_giftImageView) { - _giftImageView = [[XPSVGAPlayer alloc]init]; - _giftImageView.backgroundColor = [UIColor clearColor]; - _giftImageView.userInteractionEnabled = NO; - _giftImageView.delegate = self; +- (XPSVGAPlayer *)giftSvgaView { + if (!_giftSvgaView) { + _giftSvgaView = [[XPSVGAPlayer alloc]init]; + _giftSvgaView.backgroundColor = [UIColor clearColor]; + _giftSvgaView.userInteractionEnabled = NO; + _giftSvgaView.delegate = self; } - return _giftImageView; + return _giftSvgaView; } - (SVGAParser *)parser { @@ -129,4 +147,30 @@ } return _parser; } +- (NetImageView *)chestImageView{ + if(!_chestImageView){ + _chestImageView = [NetImageView new]; + UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(chestImageViewTapRecognizer:)]; + _chestImageView.userInteractionEnabled = YES; + [_chestImageView addGestureRecognizer:tap]; + } + return _chestImageView; +} +- (NetImageView *)giftImageView{ + if(!_giftImageView){ + _giftImageView = [NetImageView new]; + UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(giftImageViewTapRecognizer:)]; + _giftImageView.userInteractionEnabled = YES; + [_giftImageView addGestureRecognizer:tap]; + } + return _giftImageView; +} +- (UILabel *)contentView{ + if(!_contentView){ + _contentView = [UILabel labelInitWithText:@"" font:kFontMedium(10) textColor:[UIColor whiteColor]]; + _contentView.textAlignment = NSTextAlignmentCenter; + _contentView.numberOfLines = 2; + } + return _contentView; +} @end diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.h b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.h index 400919f2..4f645b45 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.h @@ -23,6 +23,9 @@ NS_ASSUME_NONNULL_BEGIN - (void)configGiftUsers:(NSArray *)users; ///代理 @property (nonatomic,weak) id delegate; + +-(NSMutableArray*)getSelectUserList; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.m index c162830b..5126252c 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftUsersView.m @@ -175,7 +175,9 @@ [self.collectionView reloadData]; NSString * selectUid = [NSString stringWithFormat:@"%ld", queue.uid]; if (queue.isSelect) { - [self.selectUserArray addObject:selectUid]; + if (![self.selectUserArray containsObject:selectUid]) { + [self.selectUserArray addObject:selectUid]; + } } else { if ([self.selectUserArray containsObject:selectUid]) { [self.selectUserArray removeObject:selectUid]; @@ -193,6 +195,19 @@ [self.delegate xPGiftUsersView:self didSelectUsers:self.selectUserArray]; } } +-(NSMutableArray*)getSelectUserList{ + NSMutableArray *userList = [NSMutableArray array]; + for (XPGiftUserInfoModel * queue in self.userArray) { + if(queue.isSelect == YES){ + NSString * selectUid = [NSString stringWithFormat:@"%ld", queue.uid]; + if(![userList containsObject:selectUid]){ + [userList addObject:selectUid]; + } + + } + } + return userList; +} #pragma mark - Getters And Setters - (UIStackView *)stackView { if (!_stackView) { diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m index 72db2aff..8d6ed40f 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m @@ -360,7 +360,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; } - (RoomSendGiftType)dealRoomSendGiftType:(GiftInfoModel *)giftInfo giftCount:(XPGiftCountModel *)giftCount { - NSArray * uids = self.userView.selectUserArray; + NSArray * uids = [self.userView getSelectUserList]; RoomSendGiftType roomSendGiftType; if (self.userView.isSelectAll) { if (giftInfo.sourceType == GiftSourceType_Pack && giftCount.isTotal && giftInfo && uids.count > 1) { @@ -368,13 +368,13 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; return -1; } roomSendGiftType = RoomSendGiftType_AllMic; - } else if(self.userView.selectUserArray.count > 1) { + } else if(uids.count > 1) { if (giftInfo.sourceType == GiftSourceType_Pack && giftCount.isTotal) { [self showErrorToast:YMLocalizedString(@"XPSendGiftView1")]; return -1; } roomSendGiftType = RoomSendGiftType_MutableOnMic; - } else if(self.userView.selectUserArray.count == 1) { + } else if(uids.count == 1) { roomSendGiftType = RoomSendGiftType_ToOne; } else { roomSendGiftType = -1; @@ -395,7 +395,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; #pragma mark - XPGiftBarViewDelegate - (void)xPGiftBarView:(XPGiftBarView *)view didClickSendGift:(XPGiftCountModel *)giftCount { ///总礼物 三要素 送礼物的人 送的什么礼物 送多少个礼物 - NSArray * uids = self.userView.selectUserArray; + NSArray * uids = [self.userView getSelectUserList]; GiftInfoModel * giftInfo = self.giftInfoView.lastSelectGift; if (self.usingplaceType == SendGiftType_Room) { if (uids.count > 0) { @@ -561,7 +561,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; self.graffitiView.hidden = NO; self.graffitiView.price = info.goldPrice; self.giftBarView.drawGiftCount = 0; - self.graffitiView.selectUidNumber = self.userView.selectUserArray.count; + self.graffitiView.selectUidNumber = [self.userView getSelectUserList].count; [[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { if (error == nil && image) { self.graffitiView.image = image; diff --git a/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m b/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m index 3fe21662..7d2b9abf 100644 --- a/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m +++ b/YuMi/Modules/YMTabbar/View/PIFullScreenBannerAnimation.m @@ -433,7 +433,7 @@ - (void)createBigPrizeAnimation:(PIBaseAnimationViewModel *)prizeModel { self.isPlayOfB = YES; CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 60)]; + XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 71)]; luckyGiftEffectView.delegate = self; [kWindow addSubview:luckyGiftEffectView]; @@ -444,36 +444,51 @@ springAnimation.springBounciness = 10.f; springAnimation.fromValue = [NSValue valueWithCGPoint:luckyGiftEffectView.center]; springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, luckyGiftEffectView.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, luckyGiftEffectView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth, luckyGiftEffectView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 7 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; + moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, luckyGiftEffectView.center.y)]; + moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, luckyGiftEffectView.center.y)]; + moveAnimation.beginTime = CACurrentMediaTime(); + moveAnimation.duration = 0.5; + moveAnimation.repeatCount = 1; + moveAnimation.removedOnCompletion = YES; + @kWeakify(self); + [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { + @kStrongify(self); + if (finished) { [luckyGiftEffectView removeFromSuperview]; + if (self.animationListB.count > 0) { [self.animationListB removeObjectAtIndex:0]; } self.isPlayOfB = NO; -// if(self.isAnimationListAFinish == YES){ -// self.isAnimationListAFinish = NO; -// [self playAnimationWithModel]; -// return; -// } + // if(self.isAnimationListAFinish == YES){ + // self.isAnimationListAFinish = NO; + // [self playAnimationWithModel]; + // return; + // } [self playAnimationWithModel]; - - }]; - [luckyGiftEffectView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; + } + }]; + [luckyGiftEffectView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; + + + }); [luckyGiftEffectView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"]; } #pragma mark - XPRoomLuckyBigPrizeViewDelegate - (void)xPRoomLuckyBigPrizeView:(XPRoomLuckyBigPrizeView *)view luckyGiftInfo:(PIBaseAnimationViewModel *)giftInfo { + + id isShowBroadcastView = [[NSUserDefaults standardUserDefaults]valueForKey:@"kSaveLuckSelectState"]; + if(isShowBroadcastView == nil){ + PIRoomGiftBroadcastWindow *broadcastView = [[PIRoomGiftBroadcastWindow alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; + broadcastView.isLuck = YES; + broadcastView.roodUid = giftInfo.roomUid; + broadcastView.roomName = giftInfo.roomTitle; + broadcastView.delegate = self; + [kWindow addSubview:broadcastView]; + return; + } if (!giftInfo.isInRoomVisiable && giftInfo.roomUid.length > 0 ) { [XPRoomViewController openRoom:giftInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; } diff --git a/YuMi/Modules/YMTabbar/View/TabbarViewController.m b/YuMi/Modules/YMTabbar/View/TabbarViewController.m index 4e2ea3a9..9504638f 100644 --- a/YuMi/Modules/YMTabbar/View/TabbarViewController.m +++ b/YuMi/Modules/YMTabbar/View/TabbarViewController.m @@ -171,9 +171,10 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showNewUserRecharge) name:kNewUserRechargeKey object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showAnchorCardKey:) name:kTabShowAnchorCardKey object:nil]; - + + } diff --git a/YuMi/Resources/pi_room_lucky_gift.svga b/YuMi/Resources/pi_room_lucky_gift.svga new file mode 100644 index 00000000..7fb25561 Binary files /dev/null and b/YuMi/Resources/pi_room_lucky_gift.svga differ diff --git a/YuMi/zh-Hans.lproj/Localizable.strings b/YuMi/zh-Hans.lproj/Localizable.strings index 5ec38ba4..f63ef7be 100644 --- a/YuMi/zh-Hans.lproj/Localizable.strings +++ b/YuMi/zh-Hans.lproj/Localizable.strings @@ -1476,6 +1476,8 @@ "XPGiftLuckyGiftBroadcastCell1" = "开出%@获得 "; "XPGiftLuckyGiftBroadcastView0" = "玩法说明"; + + "XPSendGiftView0" = "只能全部赠送给一人"; "XPSendGiftView1" = "只能全部赠送给一人"; "XPSendGiftView2" = "请选择至少一个人"; @@ -1623,8 +1625,8 @@ "XPRoomAnchorRankBannerView0" = "恭喜 %@ 成为上时段 小时榜TOP1"; "XPRoomAnchorRankBannerView1" = "小时榜TOP1"; -"XPRoomLuckyBigPrizeView0" = "恭喜"; -"XPRoomLuckyBigPrizeView1" = "在%@幸运礼物中欧气爆棚开出了价值"; + +"XPRoomLuckyBigPrizeView0" = "恭喜!%@ 在 %@ 中欧气爆棚开出了价值 %@钻 的 %@"; "XPRoomActivityPlayView0" = "更多玩法"; diff --git a/YuMi/zh-Hant.lproj/Localizable.strings b/YuMi/zh-Hant.lproj/Localizable.strings index 300d312c..3fbfa855 100644 --- a/YuMi/zh-Hant.lproj/Localizable.strings +++ b/YuMi/zh-Hant.lproj/Localizable.strings @@ -1625,8 +1625,8 @@ "XPRoomAnchorRankBannerView0" = "恭喜 %@ 成為上時段 小時榜TOP1"; "XPRoomAnchorRankBannerView1" = "小時榜TOP1"; -"XPRoomLuckyBigPrizeView0" = "恭喜"; -"XPRoomLuckyBigPrizeView1" = "在%@幸運禮物中歐氣爆棚開出了價值"; +"XPRoomLuckyBigPrizeView0" = "恭喜!%@ 在 %@ 中歐氣爆棚開出了價值 %@鉆 的 %@"; + "XPRoomActivityPlayView0" = "更多玩法";