From ca7051f34ecc109c0489ca47d4ec687beda7e81d Mon Sep 17 00:00:00 2001 From: eggmanQQQ <3671373519@qq.com> Date: Wed, 19 Jun 2024 00:00:11 +0800 Subject: [PATCH] =?UTF-8?q?#761=20=E4=BF=AE=E5=A4=8D=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E5=B8=83=E5=B1=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi/CustomUI/MSRTL/UILabel+MSRTL.m | 6 - .../View/Setting/XPMineSwitchLanguageVC.m | 8 +- .../XPAcrossRoomPKForceEndResultView.m | 11 +- .../View/SubViews/XPAcrossRoomPKPanelView.h | 1 + .../View/SubViews/XPAcrossRoomPKPanelView.m | 126 ++++++++++-------- .../XPRoomFunctionContainerView.m | 31 ++--- .../View/RoomPK/View/XPRoomPKPanelView.h | 4 + .../View/RoomPK/View/XPRoomPKPanelView.m | 39 +++--- 8 files changed, 119 insertions(+), 107 deletions(-) diff --git a/YuMi/CustomUI/MSRTL/UILabel+MSRTL.m b/YuMi/CustomUI/MSRTL/UILabel+MSRTL.m index f2a46f8b..2df6bf57 100644 --- a/YuMi/CustomUI/MSRTL/UILabel+MSRTL.m +++ b/YuMi/CustomUI/MSRTL/UILabel+MSRTL.m @@ -8,8 +8,6 @@ #import "UILabel+MSRTL.h" #import "NSMutableAttributedString+MSRTL.h" - - BOOL isMSRTLString(NSString *string) { if ([string hasPrefix:@"\u202B"] || [string hasPrefix:@"\u202A"]) { return YES; @@ -45,10 +43,6 @@ NSString * MSRTLString(NSString *string) { Method oldTextMethod1 = class_getInstanceMethod(self,@selector(setAttributedText:)); Method newTextMethod1 = class_getInstanceMethod(self, @selector(msrtl_setAttributedText:)); method_exchangeImplementations(oldTextMethod1, newTextMethod1); - - - - } -(void)msrtl_setAttributedText:(NSAttributedString *)attributedText{ diff --git a/YuMi/Modules/YMMine/View/Setting/XPMineSwitchLanguageVC.m b/YuMi/Modules/YMMine/View/Setting/XPMineSwitchLanguageVC.m index d770ad44..c2c7e380 100644 --- a/YuMi/Modules/YMMine/View/Setting/XPMineSwitchLanguageVC.m +++ b/YuMi/Modules/YMMine/View/Setting/XPMineSwitchLanguageVC.m @@ -48,20 +48,14 @@ language = @"ar"; } if ([language isEqualToString:@"ar"]) { - [UIView appearance].semanticContentAttribute = UISemanticContentAttributeForceRightToLeft; [UISearchBar appearance].semanticContentAttribute = UISemanticContentAttributeForceRightToLeft; - - } else { - [UIView appearance].semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; [UISearchBar appearance].semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; - - } [NSBundle setLanguageText:language]; - [[NSNotificationCenter defaultCenter]postNotificationName:@"kSwitchLanguage" object:language]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"kSwitchLanguage" object:language]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter]postNotificationName:@"kChanecNavView" object:language]; diff --git a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKForceEndResultView.m b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKForceEndResultView.m index a1c8f182..747cf04d 100644 --- a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKForceEndResultView.m +++ b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKForceEndResultView.m @@ -75,8 +75,8 @@ make.height.mas_equalTo(18); }]; [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.trailing.mas_equalTo(-22); - make.top.mas_equalTo(22); + make.trailing.mas_equalTo(-12); + make.top.mas_equalTo(12); make.width.height.mas_equalTo(33); }]; @@ -97,7 +97,7 @@ [self.redRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.redHeadImageView.mas_bottom).mas_offset(8); make.left.mas_equalTo(self); - make.right.mas_equalTo(self.redHeadImageView.mas_right); + make.width.mas_equalTo(70); make.height.mas_equalTo(14); }]; [self.redValueLabel mas_makeConstraints:^(MASConstraintMaker *make) { @@ -106,7 +106,6 @@ make.height.mas_equalTo(14); }]; - [self.blueHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(70); make.trailing.mas_equalTo(-12.5); @@ -114,9 +113,9 @@ }]; [self.blueRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.blueHeadImageView.mas_bottom).mas_offset(8); - make.right.mas_equalTo(self); + make.width.mas_equalTo(70); make.height.mas_equalTo(14); - make.left.mas_equalTo(self.blueHeadImageView.mas_left); + make.right.mas_equalTo(self); }]; [self.blueValueLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.blueRoomTitleLabel); diff --git a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.h b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.h index 1a5337d4..dfa7c796 100644 --- a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.h +++ b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.h @@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN @end @interface XPAcrossRoomPKPanelView : UIView +- (void)startInitUI; ///开启pk - (void)openCountdownWithTime:(long)time; ///pk 信息 diff --git a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.m b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.m index 2a2a9bf4..491d7ac5 100644 --- a/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.m +++ b/YuMi/Modules/YMRoom/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKPanelView.m @@ -29,6 +29,7 @@ static CGFloat MiniHeight = 130.5; @interface XPAcrossRoomPKPanelView () ///背景 @property (nonatomic, strong) UIImageView *backgroundImageView; +@property (nonatomic, strong) UIImageView *backgroundImageView_small; #pragma mark - 规则的view ///帮助按钮 @property (nonatomic, strong) UIButton *helpButton; @@ -54,7 +55,7 @@ static CGFloat MiniHeight = 130.5; /// 蓝队头像 @property (nonatomic, strong) NetImageView *blueAvatarImageView; /// 去围观 -@property (nonatomic, strong) UIButton *onlookButton; +@property (nonatomic, strong) UIButton *onLookButton; #pragma mark -进度条内容 ///PK最外面的容器 @property (nonatomic, strong) UIView *progressView; @@ -95,7 +96,7 @@ static CGFloat MiniHeight = 130.5; ///倒计时 @property (strong, nonatomic) dispatch_source_t timer; -@property (nonatomic, strong) MASConstraint *centerXConstraint; +@property (nonatomic, assign) CGPoint centerCenter; @end @implementation XPAcrossRoomPKPanelView @@ -107,28 +108,30 @@ static CGFloat MiniHeight = 130.5; } - (instancetype)initWithFrame:(CGRect)frame { - if (self = [super initWithFrame:frame]) { + if (self = [super initWithFrame:CGRectMake(0, 0, kGetScaleWidth(310), kGetScaleWidth(MaxHeight))]) { UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(changeLocation:)]; // 这里的delaysTouchesBegan属性很明显就是对touchBegin方法是否进行延迟, // YES表示延迟,即在系统未识别出来手势为什么手势时先不要调用touchesBegan 方法; // NO表示不延迟,即在系统未识别出来手势为什么手势时会先调用touchesBegan 方法; pan.delaysTouchesBegan = YES; [self addGestureRecognizer:pan]; - - [self initSubViews]; - [self initSubViewConstraints]; - - for (id view in self.ruleTextView.subviews) { - if ([view isKindOfClass:[UITextView class]]){ - UITextView *textView = view; - textView.textAlignment = NSTextAlignmentLeft; - break; - } - } } return self; } +- (void)startInitUI { + [self initSubViews]; + [self initSubViewConstraints]; + + for (id view in self.ruleTextView.subviews) { + if ([view isKindOfClass:[UITextView class]]){ + UITextView *textView = view; + textView.textAlignment = NSTextAlignmentLeft; + break; + } + } +} + #pragma mark - Public Method - (void)resetAcrossPKViewData { if (self.timer) { @@ -140,12 +143,9 @@ static CGFloat MiniHeight = 130.5; #pragma mark - Private Method - (void)setupBackground { - [self mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(kGetScaleWidth(310)); - make.height.mas_equalTo(kGetScaleWidth(MaxHeight)); - }]; [self addSubview:self.backgroundImageView]; + [self addSubview:self.backgroundImageView_small]; UIImageView *topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pk_background_top"]]; topImageView.contentMode = UIViewContentModeScaleAspectFill; @@ -155,6 +155,11 @@ static CGFloat MiniHeight = 130.5; make.edges.equalTo(self); }]; + [self.backgroundImageView_small mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.left.right.mas_equalTo(self); + make.height.mas_equalTo(kGetScaleWidth(MiniHeight)); + }]; + [topImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self); make.centerY.mas_equalTo(self.mas_top).offset(7); @@ -245,7 +250,7 @@ static CGFloat MiniHeight = 130.5; }]; [self.teamContainerView insertSubview:self.assistButton belowSubview:self.redAvatarImageView]; - [self.teamContainerView insertSubview:self.onlookButton belowSubview:self.blueAvatarImageView]; + [self.teamContainerView insertSubview:self.onLookButton belowSubview:self.blueAvatarImageView]; [self.assistButton mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(self.redAvatarImageView.mas_trailing).offset(-16); make.bottom.mas_equalTo(self.progressView.mas_top); @@ -253,7 +258,7 @@ static CGFloat MiniHeight = 130.5; make.height.mas_equalTo(14); }]; - [self.onlookButton mas_makeConstraints:^(MASConstraintMaker *make) { + [self.onLookButton mas_makeConstraints:^(MASConstraintMaker *make) { make.trailing.mas_equalTo(self.blueAvatarImageView.mas_leading).offset(16); make.bottom.mas_equalTo(self.progressView.mas_top); make.width.mas_equalTo(70); @@ -283,12 +288,12 @@ static CGFloat MiniHeight = 130.5; }]; [self.redCountLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(self.redAvatarImageView.mas_trailing); + make.left.mas_equalTo(self.progressView).offset(2); make.bottom.mas_equalTo(self.redAvatarImageView); }]; [self.blueCountLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.mas_equalTo(self.blueAvatarImageView.mas_left); + make.right.mas_equalTo(self.progressView).offset(-2); make.bottom.mas_equalTo(self.blueAvatarImageView); }]; @@ -361,7 +366,6 @@ static CGFloat MiniHeight = 130.5; make.width.equalTo(self.ruleTextView.mas_width).offset(20).priorityLow(); make.height.equalTo(self.ruleTextView.mas_height).offset(20); }]; - } - (void)initSubViews { @@ -475,25 +479,23 @@ static CGFloat MiniHeight = 130.5; #pragma mark - Event Response - (void)foldButtonAction:(UIButton *)sender { sender.selected = !sender.selected; + CGRect newFrame = self.frame; + if (sender.isSelected) { self.userStackView.hidden = NO; - [self mas_updateConstraints:^(MASConstraintMaker *make) { - make.height.mas_equalTo(kGetScaleWidth(MaxHeight)); - }]; - self.backgroundImageView.image = [UIImage imageNamed:@"room_across_pk_panel_bg"]; - [UIView animateWithDuration:0.5 animations:^{ - self.foldButton.transform = CGAffineTransformIdentity; - }]; + self.backgroundImageView.hidden = NO; + self.backgroundImageView_small.hidden = YES; + newFrame.size.height = kGetScaleWidth(MaxHeight); + self.foldButton.transform = CGAffineTransformIdentity; } else { self.userStackView.hidden = YES; - self.backgroundImageView.image = [UIImage imageNamed:@"room_across_pk_panel_small_bg"]; - [self mas_updateConstraints:^(MASConstraintMaker *make) { - make.height.mas_equalTo(kGetScaleWidth(MiniHeight)); - }]; - [UIView animateWithDuration:0.5 animations:^{ - self.foldButton.transform = CGAffineTransformMakeRotation(M_PI); - }]; + self.backgroundImageView.hidden = YES; + self.backgroundImageView_small.hidden = NO; + newFrame.size.height = kGetScaleWidth(MiniHeight); + self.foldButton.transform = CGAffineTransformMakeRotation(M_PI); } + self.frame = newFrame; + [self layoutIfNeeded]; } - (void)helpButtonAction:(UIButton *)sender { @@ -503,25 +505,29 @@ static CGFloat MiniHeight = 130.5; - (void)tapRedAvatarRecognizer:(UITapGestureRecognizer *)ges { if (self.delegate && [self.delegate respondsToSelector:@selector(XPAcrossRoomPKPanelView:showUserCard:)]) { - [self.delegate XPAcrossRoomPKPanelView:self showUserCard:self.pkPanelInfo.cUid]; + [self.delegate XPAcrossRoomPKPanelView:self + showUserCard:self.pkPanelInfo.cUid]; } } - (void)tapBlueAvatarRecognizer:(UITapGestureRecognizer *)ges { if (self.delegate && [self.delegate respondsToSelector:@selector(XPAcrossRoomPKPanelView:showUserCard:)]) { - [self.delegate XPAcrossRoomPKPanelView:self showUserCard:self.pkPanelInfo.aUid]; + [self.delegate XPAcrossRoomPKPanelView:self + showUserCard:self.pkPanelInfo.aUid]; } } - (void)assistButtonAction:(UIButton *)sender { if (self.delegate && [self.delegate respondsToSelector:@selector(XPAcrossRoomPKPanelView:sendGiftToUser:)]) { - [self.delegate XPAcrossRoomPKPanelView:self sendGiftToUser:self.pkPanelInfo.cUid]; + [self.delegate XPAcrossRoomPKPanelView:self + sendGiftToUser:self.pkPanelInfo.cUid]; } } - (void)onlookButtonAction:(UIButton *)sender { - if (self.delegate && [self.delegate respondsToSelector:@selector(XPAcrossRoomPKPanelView:onLookRoomonLookRoom:)]) { - [self.delegate XPAcrossRoomPKPanelView:self onLookRoom:self.pkPanelInfo.aUid]; + if (self.delegate && [self.delegate respondsToSelector:@selector(XPAcrossRoomPKPanelView:onLookRoom:)]) { + [self.delegate XPAcrossRoomPKPanelView:self + onLookRoom:self.pkPanelInfo.aUid]; } } @@ -539,12 +545,12 @@ static CGFloat MiniHeight = 130.5; CGPoint panPoint = [p locationInView:appWindow]; if (p.state == UIGestureRecognizerStateBegan) { - self.alpha = 1; +// self.alpha = 1; } else if(p.state == UIGestureRecognizerStateChanged) { self.center = CGPointMake(panPoint.x, panPoint.y); } else if(p.state == UIGestureRecognizerStateEnded || p.state == UIGestureRecognizerStateCancelled) { - self.alpha = 1; +// self.alpha = 1; CGFloat touchWidth = self.frame.size.width; CGFloat touchHeight = self.frame.size.height; CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width; @@ -576,6 +582,7 @@ static CGFloat MiniHeight = 130.5; }else { newCenter = CGPointMake(panPoint.x, screenHeight - touchWidth / 3); } + self.centerCenter = newCenter; [UIView animateWithDuration:0.25 animations:^{ if ((newCenter.y + self.frame.size.height / 2) > (KScreenHeight - kSafeAreaBottomHeight - 44)) { self.center = CGPointMake(newCenter.x, KScreenHeight - self.frame.size.height / 2 - kSafeAreaBottomHeight - 44); @@ -703,11 +710,22 @@ static CGFloat MiniHeight = 130.5; _backgroundImageView = [[UIImageView alloc] init]; _backgroundImageView.image = [UIImage imageNamed:@"room_across_pk_panel_bg"]; _backgroundImageView.userInteractionEnabled = YES; - _backgroundImageView.contentMode = UIViewContentModeScaleAspectFill; + _backgroundImageView.contentMode = UIViewContentModeScaleAspectFit; } return _backgroundImageView; } +- (UIImageView *)backgroundImageView_small { + if (!_backgroundImageView_small) { + _backgroundImageView_small = [[UIImageView alloc] init]; + _backgroundImageView_small.image = [UIImage imageNamed:@"room_across_pk_panel_small_bg"]; + _backgroundImageView_small.userInteractionEnabled = YES; + _backgroundImageView_small.contentMode = UIViewContentModeScaleAspectFit; + _backgroundImageView_small.hidden = YES; + } + return _backgroundImageView_small; +} + - (UIButton *)helpButton { if (!_helpButton) { _helpButton = [[UIButton alloc] init]; @@ -889,16 +907,16 @@ static CGFloat MiniHeight = 130.5; return _assistButton; } -- (UIButton *)onlookButton { - if (!_onlookButton) { - _onlookButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_onlookButton setBackgroundImage:kImage(@"pk_name_bg_blue") forState:UIControlStateNormal]; - [_onlookButton setTitle:YMLocalizedString(@"XPAcrossRoomPKPanelView3") forState:UIControlStateNormal]; - _onlookButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; - [_onlookButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [_onlookButton addTarget:self action:@selector(onlookButtonAction:) forControlEvents:UIControlEventTouchUpInside]; +- (UIButton *)onLookButton { + if (!_onLookButton) { + _onLookButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_onLookButton setBackgroundImage:kImage(@"pk_name_bg_blue") forState:UIControlStateNormal]; + [_onLookButton setTitle:YMLocalizedString(@"XPAcrossRoomPKPanelView3") forState:UIControlStateNormal]; + _onLookButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; + [_onLookButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [_onLookButton addTarget:self action:@selector(onlookButtonAction:) forControlEvents:UIControlEventTouchUpInside]; } - return _onlookButton; + return _onLookButton; } - (UIButton *)foldButton { diff --git a/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m index 00153b82..6dc816f5 100644 --- a/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -253,7 +253,6 @@ ///房间内PK是否正在进行 - (BOOL)isRoomPKPlaying { return [self.pkPanelView isRoomPKPlaying]; -// return [self.roompkPanelView isRoomPKPlaying]; } #pragma mark - Private Method @@ -460,12 +459,14 @@ } } // MARK: ----- 修改结束 -- (void)configRoomPKPanelView:(BOOL)isEnter { +- (void)configRoomPKPanelView:(BOOL)isEnter{ RoomInfoModel * roomInfo = self.delegate.getRoomInfo; if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) { self.pkPanelView.roomInfo = roomInfo; - [self showPKPanel_]; + if (self.pkPanelView.isPanelMinion == NO) { + [self showPKPanel_]; + } NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; NSString * uid = [AccountInfoStorage instance].getUid; @@ -643,10 +644,8 @@ if (acrossPKPanelInfo.aUid.integerValue > 0) { if (!self.acrossPKPanelView.superview) { [self addSubview:self.acrossPKPanelView]; - [self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.mas_equalTo(self); - make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight); - }]; + [self.acrossPKPanelView startInitUI]; + self.acrossPKPanelView.center = self.center; } self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo; } @@ -744,16 +743,16 @@ if (error == nil) { NIMChatroomMember * member = [members firstObject]; if (member.type == NIMChatroomMemberTypeCreator || meIsSuperAdmin) { - XPAcrossRoomPKInviteResultView * inviteResutView = [[XPAcrossRoomPKInviteResultView alloc] init]; - inviteResutView.is_XP_Accept = YES; - [self addSubview:inviteResutView]; - [inviteResutView mas_makeConstraints:^(MASConstraintMaker *make) { + XPAcrossRoomPKInviteResultView * inviteResultView = [[XPAcrossRoomPKInviteResultView alloc] init]; + inviteResultView.is_XP_Accept = YES; + [self addSubview:inviteResultView]; + [inviteResultView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self).offset(114 + kSafeAreaTopHeight); make.centerX.mas_equalTo(self); - make.size.mas_equalTo(CGSizeMake(281, 42)); + make.size.mas_equalTo(CGSizeMake(KScreenWidth - 40, 42)); }]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [inviteResutView removeFromSuperview]; + [inviteResultView removeFromSuperview]; }); } } @@ -793,10 +792,8 @@ self.acrossPKCountView = nil; if (!self.acrossPKPanelView.superview) { [self addSubview:self.acrossPKPanelView]; - [self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight); - make.centerX.mas_equalTo(self); - }]; + [self.acrossPKPanelView startInitUI]; + self.acrossPKPanelView.center = self.center; } AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data]; if (attachment.data[@"amicStatus"] != nil){ diff --git a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.h b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.h index 6037a753..d793434f 100644 --- a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.h +++ b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.h @@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN @class MicroQueueModel, AttachmentModel, RoomInfoModel, RoomPKChooseUserModel; @interface XPRoomPKPanelView : UIView +@property (nonatomic, strong) UIView *pkPanelContentView; + @property (nonatomic, strong) NSMutableDictionary *micQueue; ///房间信息 @property (nonatomic, strong) RoomInfoModel *roomInfo; @@ -29,6 +31,8 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)isRoomPKPlaying; +- (BOOL)isPanelMinion; + ///收到礼物 - (void)roomPKReceiveGift:(AttachmentModel *)attachment; diff --git a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.m b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.m index 29ff24df..eae9ebc3 100644 --- a/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.m +++ b/YuMi/Modules/YMRoom/View/RoomPK/View/XPRoomPKPanelView.m @@ -53,7 +53,7 @@ ///蓝队收到礼物个数(按照收礼个数) @property (nonatomic, strong) NSMutableDictionary * blueTeamGiftPersonDic; -@property (nonatomic, strong) UIView *pkPanelContentView; + @property (nonatomic, strong) UIImageView *backgroundImageView; @property (nonatomic, strong) UIImageView *topImageView; @@ -88,6 +88,8 @@ @property (nonatomic, strong) UILabel *blueCountLabel; @property (nonatomic, strong) UIImageView *fireImageView; +@property (nonatomic, assign) BOOL isMinion; + @end @implementation XPRoomPKPanelView @@ -106,7 +108,7 @@ - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { - [self setupUI]; +// [self setupUI]; } return self; } @@ -306,8 +308,9 @@ } break; case Custom_Message_Sub_Room_PK_Result:{ - [TTPopup dismiss]; +// [TTPopup dismiss]; [self didTapMinion]; + RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:attachment.data]; self.isReceivePKResult = YES; [self stopRoomPKCountDown]; @@ -528,6 +531,10 @@ return self.isPlaying; } +- (BOOL)isPanelMinion { + return self.isMinion; +} + ///收到礼物 - (void)roomPKReceiveGift:(AttachmentModel *)attachment { if (self.pkInfo.pkStatus != RoomPKStatusType_Playing) { @@ -849,7 +856,7 @@ #pragma mark - - (void)didTapMinion { - // TODO: 最小化 + self.isMinion = true; [self removeFromSuperview]; } @@ -1251,7 +1258,6 @@ [transparentRoundedCornersBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.pkPanelContentView); make.top.mas_equalTo(self.redTeamStackView.mas_bottom).offset(8); -// make.size.mas_equalTo(CGSizeMake(122, 30)); make.width.mas_greaterThanOrEqualTo(120); make.height.mas_equalTo(30); }]; @@ -1264,6 +1270,13 @@ make.size.mas_equalTo(CGSizeMake(13, 13)); }]; + [transparentRoundedCornersBackgroundView addSubview:self.countDownLabel]; + [self.countDownLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(transparentRoundedCornersBackgroundView); + make.right.mas_equalTo(transparentRoundedCornersBackgroundView.mas_right).offset(-6); + make.width.mas_greaterThanOrEqualTo(40); + }]; + UILabel *titleLabel = [UILabel labelInitWithText:YMLocalizedString(@"XPRoomPKProgressView11") font:[UIFont systemFontOfSize:11 weight:UIFontWeightMedium] textColor:[UIColor colorWithWhite:1 alpha:0.7]]; @@ -1271,14 +1284,7 @@ [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(transparentRoundedCornersBackgroundView); make.left.mas_equalTo(clockImageView.mas_right).offset(6); - }]; - - [transparentRoundedCornersBackgroundView addSubview:self.countDownLabel]; - [self.countDownLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerY.mas_equalTo(transparentRoundedCornersBackgroundView); - make.left.mas_equalTo(titleLabel.mas_right).offset(6); - make.right.mas_equalTo(titleLabel.mas_right).offset(-6); - make.width.mas_equalTo(50); + make.right.mas_equalTo(self.countDownLabel.mas_left).offset(-6); }]; } @@ -1333,7 +1339,7 @@ [self.progressArea addSubview:self.fireImageView]; [self.fireImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerX.mas_equalTo(self.progressArea).offset(0); + make.centerX.mas_equalTo(self.progressArea); make.centerY.mas_equalTo(self.progressArea).mas_offset(2); make.height.mas_equalTo(35); make.width.mas_equalTo(24); @@ -1341,9 +1347,8 @@ [self.progressArea insertSubview:self.blueCountImageView aboveSubview:self.redCountImageView]; [self.blueCountImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.mas_equalTo(self.progressArea).offset(-47.5); - make.centerY.mas_equalTo(self.progressArea).mas_offset(4); - make.leading.mas_equalTo(self.fireImageView.mas_centerX); + make.right.top.mas_equalTo(self.redCountImageView); + make.left.mas_equalTo(self.fireImageView.mas_centerX); make.height.mas_equalTo(14); }];