diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 05e2cb79..ee48ecbf 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -115,6 +115,7 @@ 9B060B5827BCAEE20001B767 /* AnchorGiftValueView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B060B5727BCAEE20001B767 /* AnchorGiftValueView.m */; }; 9B0997A127F19D8A00EB8F14 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 9B0997A027F19D8900EB8F14 /* README.md */; }; 9B0997A327F19DE500EB8F14 /* QGHWDShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 9B0997A227F19DE500EB8F14 /* QGHWDShaders.metal */; }; + 9B0AABDE280D4CD20025269D /* anchorPK_vs.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B0AABDD280D4CD20025269D /* anchorPK_vs.svga */; }; 9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; }; 9B16A34827E17D9B00E13A98 /* XPRoomTrumpetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B16A34727E17D9B00E13A98 /* XPRoomTrumpetViewController.m */; }; 9B16A34B27E1915A00E13A98 /* XPTrumpetPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B16A34A27E1915A00E13A98 /* XPTrumpetPresenter.m */; }; @@ -845,6 +846,7 @@ 9B060B5727BCAEE20001B767 /* AnchorGiftValueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorGiftValueView.m; sourceTree = ""; }; 9B0997A027F19D8900EB8F14 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 9B0997A227F19DE500EB8F14 /* QGHWDShaders.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; name = QGHWDShaders.metal; path = Pods/QGVAPlayer/iOS/QGVAPlayer/QGVAPlayer/Shaders/QGHWDShaders.metal; sourceTree = SOURCE_ROOT; }; + 9B0AABDD280D4CD20025269D /* anchorPK_vs.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchorPK_vs.svga; sourceTree = ""; }; 9B0E1C5726E77022005D4442 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = ""; }; 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNavigationController.m; sourceTree = ""; }; 9B16A34627E17D9B00E13A98 /* XPRoomTrumpetViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetViewController.h; sourceTree = ""; }; @@ -4441,6 +4443,7 @@ E8A1E45C276220B100B294CA /* Sources */ = { isa = PBXGroup; children = ( + 9B0AABDD280D4CD20025269D /* anchorPK_vs.svga */, E88863C2278E7BCC004BCFAB /* crossRoomPk_progress.svga */, 9B85F34F2806A34B006EDF51 /* anchorPK_progress.svga */, E8937ABF276C3ECF00B2C7E1 /* enterroom */, @@ -5324,6 +5327,7 @@ 186A52E726FC559700D67B2C /* yw_1222_0769.jpg in Resources */, E8937ACB276C3EDE00B2C7E1 /* svga_member_in_lv60.svga in Resources */, 186A52E326FC559200D67B2C /* RPSDK.bundle in Resources */, + 9B0AABDE280D4CD20025269D /* anchorPK_vs.svga in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/xplan-ios/Main/Room/Model/RoomInfoModel.h b/xplan-ios/Main/Room/Model/RoomInfoModel.h index e7fefacf..e0f0f32b 100644 --- a/xplan-ios/Main/Room/Model/RoomInfoModel.h +++ b/xplan-ios/Main/Room/Model/RoomInfoModel.h @@ -7,6 +7,7 @@ #import "NSObject+MJExtension.h" #import "XPEnum.h" +#import "AcrossRoomPKPanelModel.h" NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, RoomType) { @@ -60,6 +61,8 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) { @property(nonatomic, copy) NSString *openBoxIcon; @end +@class AcrossRoomPKPanelModel; + @interface RoomInfoModel : NSObject @property (nonatomic , copy) NSString * nick; @property (nonatomic , assign) NSInteger uid; @@ -128,6 +131,10 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) { @property (nonatomic, copy) NSString *mgName; ///pk场次id(本地字段) @property (nonatomic, assign) NSInteger roundId; +//PK进行状态(1:pk中 2:惩罚中) +@property (nonatomic, assign) AcrossRoomPkStateType pkState; +///个播PK赢方uid +@property (nonatomic, copy) NSString *winUid; ///PK中的对方UID(本地字段) @property (nonatomic, copy) NSString *pkUid; ///PK中的对方房间roomId(本地字段) diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.h b/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.h index 5738d465..61ae1b9b 100644 --- a/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.h +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKPanelModel.h @@ -17,6 +17,7 @@ typedef NS_ENUM(NSUInteger, AcrossRoomPkType) { typedef NS_ENUM(NSUInteger, AcrossRoomPkStateType) { AcrossRoomPkStateTypePking = 1,//PK中 AcrossRoomPkStateTypePenalty, //惩罚阶段 + AcrossRoomPkStateTypePenaltyEnd,//惩罚结束 }; @class AcrossRoomPkRankModel; diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.h b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.h index c8c543fb..426bdf13 100644 --- a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.h +++ b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.h @@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)xPAnchorPKPanelView:(XPAnchorPkPanelView *)view onlookRoom:(NSString *)roomUid; ///关注房主成功 - (void)xPAnchorPKPanelViewAttentionSuccess; +///惩罚时间倒计时结束 +- (void)xPAnchorPKPanelViewPenaltyCountDownEnd; @end diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m index c8f4b351..bcbba770 100644 --- a/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m +++ b/xplan-ios/Main/Room/View/AnchorPK/View/SubViews/XPAnchorPkPanelView.m @@ -129,14 +129,14 @@ [self.progressView addSubview:self.progressContentView]; [self.progressContentView addSubview:self.redCountImageView]; [self.progressContentView addSubview:self.blueCountImageView]; + [self.progressContentView addSubview:self.redStarImageView]; + [self.progressContentView addSubview:self.blueStarImageView]; [self.progressContentView addSubview:self.svgDisplayView]; ///贡献榜 [self.backImageView addSubview:self.redContributeStackView]; [self.backImageView addSubview:self.blueContributeStackView]; [self.progressContentView addSubview:self.redCountLabel]; [self.progressContentView addSubview:self.blueCountLabel]; - [self.backImageView addSubview:self.redStarImageView]; - [self.backImageView addSubview:self.blueStarImageView]; [self addSubview:self.redResultImageView]; [self addSubview:self.otherAvatarImageView]; @@ -198,7 +198,7 @@ [self.redStarImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.backImageView).mas_offset(15); - make.left.mas_equalTo(-30); + make.left.mas_equalTo(self.backImageView.mas_left).mas_offset(-30); make.width.height.mas_equalTo(26); }]; [self.blueStarImageView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -317,6 +317,9 @@ self.timeLabel.text = @"结果计算中"; } else { self.timeLabel.text = @"00:00"; + if (self.delegate && [self.delegate respondsToSelector:@selector(xPAnchorPKPanelViewPenaltyCountDownEnd)]) { + [self.delegate xPAnchorPKPanelViewPenaltyCountDownEnd]; + } } }); } else { @@ -476,9 +479,14 @@ if (_pkPanelInfo.aPercent > 1) { _pkPanelInfo.aPercent = 1; } - CGFloat width = 305; + CGFloat width = 305 * _pkPanelInfo.aPercent; + if (width <= 6.5) { + width = 6.5; + } else if (width >= 305 - 5.5) { + width = 305 - 5.5; + } [self.blueCountImageView mas_updateConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(width * _pkPanelInfo.aPercent); + make.width.mas_equalTo(width); }]; self.otherAvatarImageView.imageUrl = pkPanelInfo.aAvatar; self.otherNickLabel.text = pkPanelInfo.aTitle; diff --git a/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationView.m b/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationView.m index 5c245959..7b499a47 100644 --- a/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationView.m +++ b/xplan-ios/Main/Room/View/AnimationView/XPRoomAnimationView.m @@ -179,8 +179,6 @@ [self receiveBroadcastGift:attachment]; } else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Noble_LevelUp_Suspend) {///贵族升级全服飘屏 [self receiveNobleLevelUp:attachment]; - } else if (attachment.first == CustomMessageType_Anchor_Hour_Rank && attachment.second == Custom_Message_Sub_Anchor_Hour_Rank) {///个播小时榜 - [self receiveAnchorHourRank:attachment]; } } } @@ -221,6 +219,8 @@ [self receiveGift:receiveInfo]; } else if (attachment.first == CustomMessageType_Across_Room_PK && attachment.second == Custom_Message_Sub_AnchorPK_Result) {//个播PK横幅 [self acrossRoomPKBannerAnimation:attachment]; + } else if (attachment.first == CustomMessageType_Anchor_Hour_Rank && attachment.second == Custom_Message_Sub_Anchor_Hour_Rank) {///个播小时榜 + [self receiveAnchorHourRank:attachment]; } } } diff --git a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m index b503433f..3c75aae0 100644 --- a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -329,9 +329,7 @@ [Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data]; - self.delegate.getRoomInfo.roundId = acrossPKPanelInfo.roundId; - self.delegate.getRoomInfo.pkUid = acrossPKPanelInfo.aUid; - self.delegate.getRoomInfo.pkRoomId = acrossPKPanelInfo.aRoomId; + [self updateAnchorPkInfo:acrossPKPanelInfo]; if (acrossPKPanelInfo.pkType == AcrossRoomPkTypeAnchor) { if (acrossPKPanelInfo.aUid.integerValue > 0) { if (!self.anchorPKPanelView.superview) { @@ -547,7 +545,7 @@ }); AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; [[RtcManager instance] connectOtherRoom:acrossPKPanelInfo.aRoomId userId:acrossPKPanelInfo.aUid]; - self.delegate.getRoomInfo.roundId = acrossPKPanelInfo.roundId; + [self updateAnchorPkInfo:acrossPKPanelInfo]; } } }]; @@ -589,7 +587,7 @@ } AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo; - self.delegate.getRoomInfo.roundId = acrossPKPanelInfo.roundId; + [self updateAnchorPkInfo:acrossPKPanelInfo]; } break; case Custom_Message_Sub_AnchorPK_End://个播PK结束,进入惩罚阶段 @@ -603,9 +601,16 @@ } AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo; - XPAnchorPKResultView *view = [[XPAnchorPKResultView alloc] initWithFrame:CGRectMake(0, 0, 300, 472)]; - view.data = acrossPKPanelInfo; - [TTPopup popupView:view style:TTPopupStyleAlert]; + [self updateAnchorPkInfo:acrossPKPanelInfo]; + if (acrossPKPanelInfo.isForce) { + XPAnchorPKFinishView *view = [[XPAnchorPKFinishView alloc] init]; + view.data = acrossPKPanelInfo; + [TTPopup popupView:view style:TTPopupStyleAlert]; + } else { + XPAnchorPKResultView *view = [[XPAnchorPKResultView alloc] initWithFrame:CGRectMake(0, 0, 300, 472)]; + view.data = acrossPKPanelInfo; + [TTPopup popupView:view style:TTPopupStyleAlert]; + } } break; case Custom_Message_Sub_AnchorPK_Finish://个播PK完成 @@ -613,11 +618,8 @@ [self.anchorPKPanelView resetAcrossPKViewData]; [self.anchorPKPanelView removeFromSuperview]; self.anchorPKPanelView = nil; + [self resetAnchorPkInfo]; [[RtcManager instance] disconnectOtherRoom]; - AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; - XPAnchorPKFinishView *view = [[XPAnchorPKFinishView alloc] init]; - view.data = acrossPKPanelInfo; - [TTPopup popupView:view style:TTPopupStyleAlert]; } break; default: @@ -766,6 +768,10 @@ } } +- (void)xPAnchorPKPanelViewPenaltyCountDownEnd { + self.delegate.getRoomInfo.pkState = AcrossRoomPkStateTypePenaltyEnd; +} + #pragma mark - Event Response - (void)contributionButtonAction:(UIButton *)sender { NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid]; @@ -1037,6 +1043,22 @@ } } +- (void)updateAnchorPkInfo:(AcrossRoomPKPanelModel *)acrossPKPanelInfo { + self.delegate.getRoomInfo.roundId = acrossPKPanelInfo.roundId; + self.delegate.getRoomInfo.pkUid = acrossPKPanelInfo.aUid; + self.delegate.getRoomInfo.pkRoomId = acrossPKPanelInfo.aRoomId; + self.delegate.getRoomInfo.pkState = acrossPKPanelInfo.pkState; + self.delegate.getRoomInfo.winUid = acrossPKPanelInfo.winUid; +} + +- (void)resetAnchorPkInfo { + self.delegate.getRoomInfo.roundId = nil; + self.delegate.getRoomInfo.pkUid = nil; + self.delegate.getRoomInfo.pkRoomId = nil; + self.delegate.getRoomInfo.pkState = nil; + self.delegate.getRoomInfo.winUid = nil; +} + #pragma mark - XPRoomLittleGameListViewDelegate - (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo { RoomInfoModel * roomInfo = self.delegate.getRoomInfo; diff --git a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m index 1b64794f..69a86437 100644 --- a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m +++ b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m @@ -52,6 +52,17 @@ anchorRoomPK.imageName = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? @"room_more_menu_anchorPK_close" : @"room_more_menu_anchorPK_open"; anchorRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Anchor_PK_Close : RoomMoreMenuType_Room_Anchor_PK_Open; anchorRoomPK.titleColor = roomInfo.isCloseScreen ? nil : [ThemeColor roomMoreMenuTextColor]; + if (roomInfo.pkState == AcrossRoomPkStateTypePenalty) { + if ([roomInfo.winUid isEqualToString:[AccountInfoStorage instance].getUid]) { + anchorRoomPK.title = @"结束PK"; + } else if ([roomInfo.winUid isEqualToString:roomInfo.pkUid]) { + anchorRoomPK.title = @"主播PK中"; + } else { + anchorRoomPK.title = @"结束PK"; + } + } else if (roomInfo.pkState == AcrossRoomPkStateTypePenaltyEnd) { + anchorRoomPK.title = @"结束PK"; + } XPRoomMoreItemModel * messageScreen = [[XPRoomMoreItemModel alloc] init]; messageScreen.title = roomInfo.isCloseScreen ? @"开启公屏" : @"关闭公屏"; diff --git a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m index 119981e2..c8bbd8db 100644 --- a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m +++ b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m @@ -12,6 +12,7 @@ #import "XPMacro.h" #import "TTPopup.h" #import "XPConstant.h" +#import "AccountInfoStorage.h" ///Model #import "XPRoomMoreItemModel.h" #import "RoomInfoModel.h" @@ -312,9 +313,24 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; break; case RoomMoreMenuType_Room_Anchor_PK_Close: { - if (self.roomInfo.roundId) { - [self.presenter requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", self.roomInfo.roundId]]; + if (self.roomInfo.pkState == AcrossRoomPkStateTypePenalty) { + if ([self.roomInfo.winUid isEqualToString:[AccountInfoStorage instance].getUid]) {//赢 + if (self.roomInfo.roundId) { + [self.presenter requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", self.roomInfo.roundId]]; + } + } else if ([self.roomInfo.winUid isEqualToString:self.roomInfo.pkUid]) {//输 + + } else {//平局 + if (self.roomInfo.roundId) { + [self.presenter requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", self.roomInfo.roundId]]; + } + } + } else { + if (self.roomInfo.roundId) { + [self.presenter requestFinishAnchorPK:[NSString stringWithFormat:@"%ld", self.roomInfo.roundId]]; + } } + } break; diff --git a/xplan-ios/Main/Room/View/StageView/AnchorPKStageView.m b/xplan-ios/Main/Room/View/StageView/AnchorPKStageView.m index 46dbbd4a..c560bf6a 100644 --- a/xplan-ios/Main/Room/View/StageView/AnchorPKStageView.m +++ b/xplan-ios/Main/Room/View/StageView/AnchorPKStageView.m @@ -9,6 +9,7 @@ ///Third #import #import +#import ///Tool #import "AccountInfoStorage.h" #import "XPMacro.h" @@ -52,20 +53,23 @@ @interface AnchorPKStageView() -///vs图片 -@property (nonatomic, strong) UIImageView *vsImageView; ///规则按钮 @property (nonatomic, strong) UIButton *ruleButton; +///动画管理类 +@property (strong, nonatomic) SVGAParser *parser; +///中间进度的动画 +@property (nonatomic, strong) SVGAImageView *svgDisplayView; + @end @implementation AnchorPKStageView - (instancetype)initWithDelegate:(id)delegate { if (self = [super initWithDelegate:delegate]) { - [self addSubview:self.vsImageView]; + [self addSubview:self.svgDisplayView]; [self addSubview:self.ruleButton]; - [self.vsImageView mas_makeConstraints:^(MASConstraintMaker *make) { + [self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(64); make.height.mas_equalTo(74); make.centerX.mas_equalTo(self); @@ -75,7 +79,16 @@ make.width.mas_equalTo(46); make.height.mas_equalTo(18); make.centerX.mas_equalTo(self); - make.top.mas_equalTo(self.vsImageView.mas_bottom).mas_offset(7); + make.top.mas_equalTo(self.svgDisplayView.mas_bottom).mas_offset(7); + }]; + + [self.parser parseWithNamed:@"anchorPK_vs" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + self.svgDisplayView.loops = INT_MAX; + self.svgDisplayView.clearsAfterStop = NO; + self.svgDisplayView.videoItem = videoItem; + [self.svgDisplayView startAnimation]; + } failureBlock:^(NSError * _Nonnull error) { + }]; } return self; @@ -258,37 +271,10 @@ #pragma mark - RtcDelegate - 讲话的波纹回调 - (void)usersSpeaking:(NSMutableArray *)uids { - if ([RtcManager instance].isRemoteMuted) { - return; - } - for (NSString* uid in uids) { - if ([RtcManager instance].isLocalMuted && uid.integerValue == self.hostDelegate.getUserInfo.uid) { - continue; - } - UIView* microView = [self findMicroViewByUid:uid]; - if (microView) { - [microView userSpeaking]; - } else { - RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo; - if ([uid isEqualToString:roomInfo.pkUid]) { - UIView* microView = [self findMicroViewByIndex:1]; - if (microView) { - [microView userSpeaking]; - } - } - } - } + return; } #pragma mark - getter -- (UIImageView *)vsImageView { - if (!_vsImageView) { - _vsImageView = [[UIImageView alloc] init]; - _vsImageView.image = [UIImage imageNamed:@"anchorPk_panel_vs"]; - } - return _vsImageView; -} - - (UIButton *)ruleButton { if (!_ruleButton) { _ruleButton = [[UIButton alloc] init]; @@ -301,4 +287,21 @@ return _ruleButton; } +- (SVGAImageView *)svgDisplayView { + if (_svgDisplayView == nil) { + _svgDisplayView = [[SVGAImageView alloc]init]; + _svgDisplayView.contentMode = UIViewContentModeScaleToFill; + _svgDisplayView.userInteractionEnabled = NO; + _svgDisplayView.backgroundColor = [UIColor clearColor]; + } + return _svgDisplayView; +} + +- (SVGAParser *)parser { + if (!_parser) { + _parser = [[SVGAParser alloc]init]; + } + return _parser; +} + @end diff --git a/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorPKMicroView.m b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorPKMicroView.m index 71d4abba..1f0dd8df 100644 --- a/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorPKMicroView.m +++ b/xplan-ios/Main/Room/View/StageView/MicroView/Anchor/AnchorPKMicroView.m @@ -6,12 +6,18 @@ // #import "AnchorPKMicroView.h" - ///Third #import +#import +#import "SVGAParserManager.h" +#import @interface AnchorPKMicroView () +///个播主播的动画 +@property (nonatomic, strong) SVGAImageView *svgDisplayView; +@property (nonatomic, strong) SVGAParserManager *parserManager; + ///当前坑位 @property (nonatomic, assign) NSInteger position; @@ -21,10 +27,15 @@ - (void)initSubViews { [super initSubViews]; + [self insertSubview:self.svgDisplayView belowSubview:self.avatarImageView]; } - (void)initSubViewConstraints { [super initSubViewConstraints]; + [self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(85 * 1.5); + make.center.equalTo(self.avatarImageView); + }]; } #pragma mark - MicroViewProtocol @@ -83,6 +94,21 @@ [self.stackView mas_updateConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.avatarImageView.mas_bottom).mas_offset(17); }]; + + ///主播添加光圈动画 + self.svgDisplayView.hidden = NO; + @weakify(self); + NSString *bgString = [[NSBundle mainBundle] pathForResource:@"anchor_room_speak" ofType:@"svga"]; + NSURL *bgUrl = [NSURL fileURLWithPath:bgString]; + [self.parserManager loadSvgaWithURL:bgUrl completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { + @strongify(self); + self.svgDisplayView.loops = INT_MAX; + self.svgDisplayView.clearsAfterStop = NO; + self.svgDisplayView.videoItem = videoItem; + [self.svgDisplayView startAnimation]; + } failureBlock:^(NSError * _Nullable error) { + }]; + } - (void)configUser:(UserInfoModel *)userInfo { @@ -90,4 +116,23 @@ self.sexImageView.hidden = YES; } +#pragma mark - getter +- (SVGAParserManager *)parserManager { + if (!_parserManager) { + _parserManager = [[SVGAParserManager alloc]init]; + } + return _parserManager; +} + +- (SVGAImageView *)svgDisplayView { + if (_svgDisplayView == nil) { + _svgDisplayView = [[SVGAImageView alloc]init]; + _svgDisplayView.contentMode = UIViewContentModeScaleToFill; + _svgDisplayView.userInteractionEnabled = NO; + _svgDisplayView.frame = CGRectMake(0, 0, 384, 384); + _svgDisplayView.hidden = YES; + _svgDisplayView.backgroundColor = [UIColor clearColor]; + } + return _svgDisplayView; +} @end diff --git a/xplan-ios/Sources/anchorPK_vs.svga b/xplan-ios/Sources/anchorPK_vs.svga new file mode 100644 index 00000000..ea9cb5bd Binary files /dev/null and b/xplan-ios/Sources/anchorPK_vs.svga differ