diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 73b824d2..e16782b2 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -155,6 +155,7 @@ 9B3353BB2881527A00AC2F24 /* XPHomeLivesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3353BA2881527A00AC2F24 /* XPHomeLivesViewController.m */; }; 9B3353BE288156DB00AC2F24 /* XPHomeLivePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3353BD288156DB00AC2F24 /* XPHomeLivePresenter.m */; }; 9B3353C228816E6F00AC2F24 /* HomeLiveTagModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3353C128816E6F00AC2F24 /* HomeLiveTagModel.m */; }; + 9B335B492925D8A00048A116 /* XPAnchorPKSelectTypeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B335B482925D8A00048A116 /* XPAnchorPKSelectTypeController.m */; }; 9B33E3CB27D85379003B0E62 /* UploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3C927D85379003B0E62 /* UploadFile.m */; }; 9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; }; 9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; }; @@ -1527,6 +1528,8 @@ 9B3353BF2881570400AC2F24 /* XPHomeLiveProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLiveProtocol.h; sourceTree = ""; }; 9B3353C028816E6F00AC2F24 /* HomeLiveTagModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeLiveTagModel.h; sourceTree = ""; }; 9B3353C128816E6F00AC2F24 /* HomeLiveTagModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeLiveTagModel.m; sourceTree = ""; }; + 9B335B472925D8A00048A116 /* XPAnchorPKSelectTypeController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKSelectTypeController.h; sourceTree = ""; }; + 9B335B482925D8A00048A116 /* XPAnchorPKSelectTypeController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKSelectTypeController.m; sourceTree = ""; }; 9B33E3C927D85379003B0E62 /* UploadFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UploadFile.m; sourceTree = ""; }; 9B33E3CA27D85379003B0E62 /* UploadFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UploadFile.h; sourceTree = ""; }; 9B33E3CC27D8540C003B0E62 /* XPVoiceCardViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPVoiceCardViewController.h; sourceTree = ""; }; @@ -4337,6 +4340,8 @@ 9B1B72AB280031DB003FACE9 /* XPAnchorPKViewController.m */, 9B1B72AD280031F8003FACE9 /* XPAnchorPKSelectRoomView.h */, 9B1B72AE280031F8003FACE9 /* XPAnchorPKSelectRoomView.m */, + 9B335B472925D8A00048A116 /* XPAnchorPKSelectTypeController.h */, + 9B335B482925D8A00048A116 /* XPAnchorPKSelectTypeController.m */, ); path = View; sourceTree = ""; @@ -9891,6 +9896,7 @@ 9BCF585C279909D7008401A4 /* XPSkillCardEditPropCell.m in Sources */, E88863C6278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m in Sources */, E8AC722C26F49580007D6E91 /* XPMineNotificaViewController.m in Sources */, + 9B335B492925D8A00048A116 /* XPAnchorPKSelectTypeController.m in Sources */, E8098CAE282E07C00090B9F0 /* XPMonentsEmptyTableViewCell.m in Sources */, 9B044DA0282D32F700DE4859 /* MicroInviteExtModel.m in Sources */, E8D7D74B282BA1EC0007D7BD /* XPMonentsTableViewCell.m in Sources */, diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/Contents.json new file mode 100644 index 00000000..9c481d9c --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "anchor_pk_invite_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "anchor_pk_invite_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/anchor_pk_invite_icon@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/anchor_pk_invite_icon@2x.png new file mode 100644 index 00000000..b01bdaf6 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/anchor_pk_invite_icon@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/anchor_pk_invite_icon@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/anchor_pk_invite_icon@3x.png new file mode 100644 index 00000000..75f167c5 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_invite_icon.imageset/anchor_pk_invite_icon@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/Contents.json new file mode 100644 index 00000000..cbaca198 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "anchor_pk_random_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "anchor_pk_random_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/anchor_pk_random_icon@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/anchor_pk_random_icon@2x.png new file mode 100644 index 00000000..b6eb2e67 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/anchor_pk_random_icon@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/anchor_pk_random_icon@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/anchor_pk_random_icon@3x.png new file mode 100644 index 00000000..c24d415f Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/anchor_pk_random_icon.imageset/anchor_pk_random_icon@3x.png differ diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectTypeController.h b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectTypeController.h new file mode 100644 index 00000000..1e512e52 --- /dev/null +++ b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectTypeController.h @@ -0,0 +1,18 @@ +// +// XPAnchorSelectTypeViewController.h +// xplan-ios +// +// Created by GreenLand on 2022/11/17. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPAnchorPKSelectTypeController : MvpViewController + +- (instancetype)initWithRoomUid:(NSString *)roomUid; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectTypeController.m b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectTypeController.m new file mode 100644 index 00000000..22fb2999 --- /dev/null +++ b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKSelectTypeController.m @@ -0,0 +1,193 @@ +// +// XPAnchorSelectTypeViewController.m +// xplan-ios +// +// Created by GreenLand on 2022/11/17. +// + +#import "XPAnchorPKSelectTypeController.h" +#import "ThemeColor.h" +#import +#import "XPMacro.h" +#import "TTPopup.h" +#import "XPAnchorPKRuleView.h" +#import "XPAnchorPKViewController.h" +#import "StatisticsServiceHelper.h" +#import "XCCurrentVCStackManager.h" +#import "Api+Room.h" + +@interface XPAnchorPKSelectTypeController () + +@property (nonatomic, copy) NSString *roomUid; + +@property (nonatomic, strong) UIView *gesView; +@property (nonatomic, strong) UIView *bgView; +@property (nonatomic, strong) UILabel *titleLabel; +@property (nonatomic, strong) UIButton *ruleButton; +@property (nonatomic, strong) UIView *lineView; +@property (nonatomic, strong) UIButton *randomPKButton; +@property (nonatomic, strong) UIButton *invitePKButton; + +@end + +@implementation XPAnchorPKSelectTypeController + +- (instancetype)initWithRoomUid:(NSString *)roomUid { + if (self = [super init]) { + self.roomUid = roomUid; + self.modalPresentationStyle = UIModalPresentationOverFullScreen; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self addSubView]; + [self setupContraints]; + self.view.backgroundColor = [UIColor clearColor]; +} + +- (void)addSubView { + [self.view addSubview:self.gesView]; + [self.view addSubview:self.bgView]; + [self.bgView addSubview:self.titleLabel]; + [self.bgView addSubview:self.ruleButton]; + [self.bgView addSubview:self.lineView]; + [self.bgView addSubview:self.randomPKButton]; + [self.bgView addSubview:self.invitePKButton]; +} + +- (void)setupContraints { + [self.gesView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.mas_equalTo(0); + make.bottom.mas_equalTo(self.bgView.mas_top); + }]; + [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.bottom.mas_equalTo(0); + make.height.mas_equalTo(250); + }]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(16); + make.centerX.mas_equalTo(self.bgView); + make.height.mas_equalTo(18); + }]; + [self.ruleButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-16); + make.centerY.mas_equalTo(self.titleLabel); + make.width.height.mas_equalTo(21); + }]; + [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(8); + make.left.right.mas_equalTo(0); + make.height.mas_equalTo(0.5); + }]; + [self.randomPKButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(self.bgView.mas_centerX).mas_offset(-22); + make.size.mas_equalTo(CGSizeMake(100, 135)); + make.top.mas_equalTo(self.lineView.mas_bottom).mas_offset(16); + }]; + [self.invitePKButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.randomPKButton.mas_right).mas_offset(44); + make.size.mas_equalTo(CGSizeMake(100, 135)); + make.top.mas_equalTo(self.randomPKButton); + }]; +} + +- (void)ruleButtonAction:(UIButton *)sender { +// XPAnchorPKRuleView *view = [[XPAnchorPKRuleView alloc] init]; +// [TTPopup popupView:view style:TTPopupStyleAlert]; + + [Api requestAnchorPkRule:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + XPAnchorPKRuleView *view = [[XPAnchorPKRuleView alloc] init]; + view.ruleString = data.data; + [TTPopup popupView:view style:TTPopupStyleAlert]; + } + }]; + +} + +- (void)randomButtonAction:(UIButton *)sender { + +} + +- (void)inviteButtonAction:(UIButton *)sender { + [self dismissViewControllerAnimated:YES completion:^{ + XPAnchorPKViewController * acrossRoomPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:self.roomUid]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController presentViewController:acrossRoomPKVC animated:YES completion:nil]; + [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openAnchorPk"}]; + + }]; +} + +- (void)dismiss:(UITapGestureRecognizer *)ges { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +#pragma mark - getter +- (UIView *)gesView { + if (!_gesView) { + _gesView = [[UIView alloc] init]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss:)]; + [_gesView addGestureRecognizer:tap]; + } + return _gesView; +} + +- (UIView *)bgView { + if (!_bgView) { + _bgView = [[UIView alloc] init]; + _bgView.backgroundColor = UIColorFromRGB(0x0D0E2C); + CAShapeLayer * layer = [CAShapeLayer layer]; + layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 250) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)].CGPath; + _bgView.layer.mask = layer; + } + return _bgView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.text = @"选择PK方式"; + _titleLabel.textColor = [UIColor whiteColor]; + _titleLabel.font = [UIFont systemFontOfSize:14]; + } + return _titleLabel; +} + +- (UIButton *)ruleButton { + if (!_ruleButton) { + _ruleButton = [[UIButton alloc] init]; + [_ruleButton setImage:[UIImage imageNamed:@"room_across_pk_help"] forState:UIControlStateNormal]; + [_ruleButton addTarget:self action:@selector(ruleButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _ruleButton; +} + +- (UIView *)lineView { + if (!_lineView) { + _lineView = [[UIView alloc] init]; + _lineView.backgroundColor = UIColorRGBAlpha(0xffffff, 0.1); + } + return _lineView; +} + +- (UIButton *)randomPKButton { + if (!_randomPKButton) { + _randomPKButton = [[UIButton alloc] init]; + [_randomPKButton setImage:[UIImage imageNamed:@"anchor_pk_random_icon"] forState:UIControlStateNormal]; + [_randomPKButton addTarget:self action:@selector(randomButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _randomPKButton; +} + +- (UIButton *)invitePKButton { + if (!_invitePKButton) { + _invitePKButton = [[UIButton alloc] init]; + [_invitePKButton setImage:[UIImage imageNamed:@"anchor_pk_invite_icon"] forState:UIControlStateNormal]; + [_invitePKButton addTarget:self action:@selector(inviteButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _invitePKButton; +} + +@end diff --git a/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKViewController.m b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKViewController.m index 4a8b14db..6768429a 100644 --- a/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKViewController.m +++ b/xplan-ios/Main/Room/View/AnchorPK/View/XPAnchorPKViewController.m @@ -19,7 +19,6 @@ #import "AcrossRoomPKInfoModel.h" ///View #import "XPAnchorPKSelectRoomView.h" -#import "XPAnchorPKRuleView.h" ///P #import "XPAnchorPKPresenter.h" #import "XPAnchorPKProtocol.h" @@ -33,8 +32,6 @@ @property (nonatomic, strong) UIView *contentView; ///标题 @property (nonatomic, strong) UILabel *titleLabel; -///帮助 -@property (nonatomic, strong) UIButton *helpButton; ///PK对象的容器 @property (nonatomic,strong) UIStackView *userStackView; ///选择PK对象title @@ -117,7 +114,6 @@ [self.view addSubview:self.contentView]; [self.contentView addSubview:self.titleLabel]; - [self.contentView addSubview:self.helpButton]; [self.contentView addSubview:self.userStackView]; [self.contentView addSubview:self.timeStackView]; [self.contentView addSubview:self.playStackView]; @@ -160,13 +156,6 @@ make.centerX.mas_equalTo(self.contentView); make.top.mas_equalTo(18); }]; - - [self.helpButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.mas_equalTo(-12); - make.width.height.mas_equalTo(22); - make.centerY.mas_equalTo(self.titleLabel); - }]; - [self.userStackView mas_makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(32); make.left.mas_equalTo(self.contentView).offset(22); @@ -321,13 +310,6 @@ } #pragma mark - Event Response -- (void)helpButtonAction:(UIButton *)sender { - [self.customTimeTextField resignFirstResponder]; - [self.pkPlayModeTextField resignFirstResponder]; - XPAnchorPKRuleView *view = [[XPAnchorPKRuleView alloc] init]; - [TTPopup popupView:view style:TTPopupStyleAlert]; -} - - (void)selectPKButtonAction:(UIButton *)sender { [self.customTimeTextField resignFirstResponder]; [self.pkPlayModeTextField resignFirstResponder]; @@ -399,15 +381,6 @@ return _titleLabel; } -- (UIButton *)helpButton { - if (!_helpButton) { - _helpButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_helpButton setImage:[UIImage imageNamed:@"room_across_pk_help"] forState:UIControlStateNormal]; - [_helpButton addTarget:self action:@selector(helpButtonAction:) forControlEvents:UIControlEventTouchUpInside]; - } - return _helpButton; -} - - (UIStackView *)userStackView { if (!_userStackView) { _userStackView = [[UIStackView alloc] init]; diff --git a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m index 590a8613..a5946fd4 100644 --- a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m +++ b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m @@ -35,6 +35,7 @@ #import "XPRoomSendRedPacketViewController.h" #import "BaseNavigationController.h" #import "XPWishGiftCreateViewController.h" +#import "XPAnchorPKSelectTypeController.h" ///P #import "XPMoreMenuPresenter.h" #import "XPMoreMenuProtocol.h" @@ -372,9 +373,8 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; case RoomMoreMenuType_Room_Anchor_PK_Open: { [self dismissViewControllerAnimated:NO completion:nil]; - XPAnchorPKViewController * acrossRoomPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:roomUid]; - [self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil]; - [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"openAnchorPk"}]; + XPAnchorPKSelectTypeController *selectVc = [[XPAnchorPKSelectTypeController alloc] initWithRoomUid:roomUid]; + [self.hostDelegate.getCurrentNav presentViewController:selectVc animated:YES completion:nil]; } break; case RoomMoreMenuType_Room_Anchor_PK_Close: