diff --git a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/UserInterfaceState.xcuserstate b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/UserInterfaceState.xcuserstate index d794cf7..7738b60 100644 Binary files a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/UserInterfaceState.xcuserstate and b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index bec0772..70fa8eb 100644 --- a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -20,7 +20,7 @@ BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> @property (nonatomic, strong) JXPagerView *pagingView; @@ -177,7 +178,9 @@ -(void)firstAction{ - [self popFirstRechargeView]; +// [self popFirstRechargeView]; + QXSkyPraizeView *v = [[QXSkyPraizeView alloc] init]; + [v showInView:self.view]; } -(void)popFirstRechargeView{ MJWeakSelf diff --git a/QXLive/HomePage(声播)/View/房间/QXRoomChatListView.m b/QXLive/HomePage(声播)/View/房间/QXRoomChatListView.m index ec53b11..4c23817 100644 --- a/QXLive/HomePage(声播)/View/房间/QXRoomChatListView.m +++ b/QXLive/HomePage(声播)/View/房间/QXRoomChatListView.m @@ -102,17 +102,17 @@ NSInteger maxMessageCount = 20; make.width.mas_equalTo(75); }]; -// self.messageLabel = [[UILabel alloc] init]; -// self.messageLabel.textColor = [UIColor whiteColor]; -// self.messageLabel.text = @"张三进入了房间"; -// self.messageLabel.font = [UIFont systemFontOfSize:12]; -// [self addSubview:self.messageLabel]; -// [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { -// make.left.mas_equalTo(16); -// make.bottom.equalTo(self).offset(-5); -// make.height.mas_equalTo(20); -// make.right.equalTo(self); -// }]; + // self.messageLabel = [[UILabel alloc] init]; + // self.messageLabel.textColor = [UIColor whiteColor]; + // self.messageLabel.text = @"张三进入了房间"; + // self.messageLabel.font = [UIFont systemFontOfSize:12]; + // [self addSubview:self.messageLabel]; + // [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + // make.left.mas_equalTo(16); + // make.bottom.equalTo(self).offset(-5); + // make.height.mas_equalTo(20); + // make.right.equalTo(self); + // }]; } -(void)typeAction:(UIButton*)sender{ self.selectedBtn.selected = !self.selectedBtn.selected; @@ -202,7 +202,7 @@ NSInteger maxMessageCount = 20; }else{ model = self.dataArray[indexPath.row]; } -// model.havBubble = indexPath.row%2; + // model.havBubble = indexPath.row%2; if (model.messageType == QXRoomChatMessageTypeChat) { QXRoomChatListCell *cell = [QXRoomChatListCell cellWithTableView:tableView]; cell.delegate = self; @@ -244,7 +244,7 @@ NSInteger maxMessageCount = 20; CGFloat height = 0; if (model.messageType == QXRoomChatMessageTypeChat) { height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8]; - + if (model.havBubble) { /// 有气泡 height = 30+14+6+30 + height; @@ -406,29 +406,29 @@ NSInteger maxMessageCount = 20; self.nameLabel.text = @"张三站撒旦撒大萨达撒"; self.bubbleImageView = [[UIImageView alloc] init]; -// UIImage * image = [UIImage imageWithColor:RGB16A(0xffffff, 0.2)]; + // UIImage * image = [UIImage imageWithColor:RGB16A(0x000000, 0.4)]; [self.bubbleImageView addRoundedCornersWithRadius:6]; -// UIImage *image = [UIImage imageWithContentsOfFile:path]; -// image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)]; -// self.bubbleImageView.image = image; - self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2); + // UIImage *image = [UIImage imageWithContentsOfFile:path]; + // image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)]; + // self.bubbleImageView.image = image; + self.bubbleImageView.backgroundColor = RGB16A(0x000000, 0.4); + + + - - - [self.contentView addSubview:self.bubbleImageView]; [self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel).offset(-8); make.top.equalTo(self.titleLabel).offset(-6); make.bottom.equalTo(self.titleLabel).offset(6); make.right.equalTo(self.titleLabel).offset(8); -// make.left.equalTo(self.titleLabel).offset(-55); -// make.top.equalTo(self.titleLabel).offset(0); -// make.bottom.equalTo(self.titleLabel).offset(0); -// make.right.equalTo(self.titleLabel).offset(55); + // make.left.equalTo(self.titleLabel).offset(-55); + // make.top.equalTo(self.titleLabel).offset(0); + // make.bottom.equalTo(self.titleLabel).offset(0); + // make.right.equalTo(self.titleLabel).offset(55); }]; [self.contentView bringSubviewToFront:self.titleLabel]; @@ -462,31 +462,31 @@ NSInteger maxMessageCount = 20; if (!self.message.havBubble) { [self.bubbleImageView sd_cancelLatestImageLoad]; self.bubbleImageView.image = nil; - self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2); + self.bubbleImageView.backgroundColor = RGB16A(0x000000, 0.4); [self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel).offset(-8); make.top.equalTo(self.titleLabel).offset(-6); make.bottom.equalTo(self.titleLabel).offset(6); make.right.equalTo(self.titleLabel).offset(8); - // make.left.equalTo(self.titleLabel).offset(-55); - // make.top.equalTo(self.titleLabel).offset(0); - // make.bottom.equalTo(self.titleLabel).offset(0); - // make.right.equalTo(self.titleLabel).offset(55); + // make.left.equalTo(self.titleLabel).offset(-55); + // make.top.equalTo(self.titleLabel).offset(0); + // make.bottom.equalTo(self.titleLabel).offset(0); + // make.right.equalTo(self.titleLabel).offset(55); }]; }else{ NSString *path = [[NSBundle mainBundle] pathForResource:@"气泡" ofType:@"webp"]; [self.bubbleImageView sd_setImageWithURL:[NSURL fileURLWithPath:path] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 30, 20 , 30) resizingMode:(UIImageResizingModeStretch)]; self.bubbleImageView.image = image; - + }]; CGFloat height = [self.message.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8]; self.bubbleImageView.backgroundColor = [UIColor clearColor]; [self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel).offset(-48); - // make.height.mas_equalTo(height+12); + // make.height.mas_equalTo(height+12); make.height.mas_equalTo(height+60); - // make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8); + // make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8); make.centerY.equalTo(self.titleLabel); make.right.equalTo(self.titleLabel).offset(48); }]; @@ -594,29 +594,29 @@ NSInteger maxMessageCount = 20; self.nameLabel.text = @"张三站撒旦撒大萨达撒"; self.bubbleImageView = [[UIImageView alloc] init]; -// UIImage * image = [UIImage imageWithColor:RGB16A(0xffffff, 0.2)]; + // UIImage * image = [UIImage imageWithColor:RGB16A(0x000000, 0.4)]; [self.bubbleImageView addRoundedCornersWithRadius:6]; -// UIImage *image = [UIImage imageWithContentsOfFile:path]; -// image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)]; -// self.bubbleImageView.image = image; - self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2); + // UIImage *image = [UIImage imageWithContentsOfFile:path]; + // image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 40, 20 , 40) resizingMode:(UIImageResizingModeStretch)]; + // self.bubbleImageView.image = image; + self.bubbleImageView.backgroundColor = RGB16A(0x000000, 0.4); + + + - - - [self.contentView addSubview:self.bubbleImageView]; [self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel).offset(-8); make.top.equalTo(self.titleLabel).offset(-6); make.bottom.equalTo(self.titleLabel).offset(6); make.right.equalTo(self.titleLabel).offset(8); -// make.left.equalTo(self.titleLabel).offset(-55); -// make.top.equalTo(self.titleLabel).offset(0); -// make.bottom.equalTo(self.titleLabel).offset(0); -// make.right.equalTo(self.titleLabel).offset(55); + // make.left.equalTo(self.titleLabel).offset(-55); + // make.top.equalTo(self.titleLabel).offset(0); + // make.bottom.equalTo(self.titleLabel).offset(0); + // make.right.equalTo(self.titleLabel).offset(55); }]; [self.contentView bringSubviewToFront:self.titleLabel]; @@ -650,31 +650,31 @@ NSInteger maxMessageCount = 20; if (!self.message.havBubble) { [self.bubbleImageView sd_cancelLatestImageLoad]; self.bubbleImageView.image = nil; - self.bubbleImageView.backgroundColor = RGB16A(0xffffff, 0.2); + self.bubbleImageView.backgroundColor = RGB16A(0x000000, 0.4); [self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel).offset(-8); make.top.equalTo(self.titleLabel).offset(-6); make.bottom.equalTo(self.titleLabel).offset(6); make.right.equalTo(self.titleLabel).offset(8); - // make.left.equalTo(self.titleLabel).offset(-55); - // make.top.equalTo(self.titleLabel).offset(0); - // make.bottom.equalTo(self.titleLabel).offset(0); - // make.right.equalTo(self.titleLabel).offset(55); + // make.left.equalTo(self.titleLabel).offset(-55); + // make.top.equalTo(self.titleLabel).offset(0); + // make.bottom.equalTo(self.titleLabel).offset(0); + // make.right.equalTo(self.titleLabel).offset(55); }]; }else{ NSString *path = [[NSBundle mainBundle] pathForResource:@"气泡" ofType:@"webp"]; [self.bubbleImageView sd_setImageWithURL:[NSURL fileURLWithPath:path] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(20, 30, 20 , 30) resizingMode:(UIImageResizingModeStretch)]; self.bubbleImageView.image = image; - + }]; CGFloat height = [self.message.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-28-6-8-8]; self.bubbleImageView.backgroundColor = [UIColor clearColor]; [self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel).offset(-48); - // make.height.mas_equalTo(height+12); + // make.height.mas_equalTo(height+12); make.height.mas_equalTo(height+60); - // make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8); + // make.width.mas_equalTo(ScaleWidth(280)-16-28-6-8-8); make.centerY.equalTo(self.titleLabel); make.right.equalTo(self.titleLabel).offset(48); }]; @@ -719,7 +719,7 @@ NSInteger maxMessageCount = 20; -(void)initSubviews{ self.bgView = [[UIView alloc] init]; - self.bgView.backgroundColor = RGB16A(0xffffff, 0.2); + self.bgView.backgroundColor = RGB16A(0x000000, 0.4); [self.bgView addRoundedCornersWithRadius:6]; [self.contentView addSubview:self.bgView]; [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -730,7 +730,8 @@ NSInteger maxMessageCount = 20; }]; self.titleLabel = [[UILabel alloc] init]; - self.titleLabel.textColor = QXConfig.themeColor; + self.titleLabel.textColor = RGB16(0XD1A9FE); + // self.titleLabel.textColor = QXConfig.themeColor; self.titleLabel.font = [UIFont systemFontOfSize:14]; self.titleLabel.numberOfLines = 0; [self.bgView addSubview:self.titleLabel]; diff --git a/QXLive/HomePage(声播)/View/房间/麦位视图/QXRoomSeatContentView.m b/QXLive/HomePage(声播)/View/房间/麦位视图/QXRoomSeatContentView.m index 16bc1de..234edd2 100644 --- a/QXLive/HomePage(声播)/View/房间/麦位视图/QXRoomSeatContentView.m +++ b/QXLive/HomePage(声播)/View/房间/麦位视图/QXRoomSeatContentView.m @@ -183,6 +183,7 @@ self.offlineImageView.hidden = YES; }else{ self.offlineImageView.hidden = NO; + [self stopAudioAnimation]; } } } diff --git a/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m b/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m index 433f65d..a4110d8 100644 --- a/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m +++ b/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m @@ -134,7 +134,7 @@ return self.headerView; } - (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView { - return 215; + return 215+26; } - (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView { @@ -178,7 +178,7 @@ } -(QXUserHomeHeaderView *)headerView{ if (!_headerView) { - _headerView = [[QXUserHomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 215)]; + _headerView = [[QXUserHomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 215+26)]; } return _headerView; } diff --git a/QXLive/Mine(音域)/Model/QXUserModel.h b/QXLive/Mine(音域)/Model/QXUserModel.h index 0b16842..2f704ed 100644 --- a/QXLive/Mine(音域)/Model/QXUserModel.h +++ b/QXLive/Mine(音域)/Model/QXUserModel.h @@ -92,6 +92,9 @@ NS_ASSUME_NONNULL_BEGIN /// 打赏价值 @property (nonatomic,strong)NSString *total_price; +/// 公会 +@property (nonatomic,strong)NSString *guild; + /// 是否使用靓号 0未使用 1 已使用 @property (nonatomic,strong)NSString *is_use_code; @end diff --git a/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m b/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m index 3c8f0bf..d129ad9 100644 --- a/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m +++ b/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m @@ -20,6 +20,7 @@ @property (nonatomic,strong) UILabel * nameLabel; @property (nonatomic,strong) UILabel * idLabel; @property (nonatomic,strong) UILabel * ageLabel; +@property (nonatomic,strong) UILabel * guildLabel; @property (nonatomic,strong) UICollectionView * collectionView; @property (nonatomic,strong) NSMutableArray * tagArray; @property (nonatomic,strong) UILabel *introduceLabel; @@ -119,6 +120,18 @@ }]; + self.guildLabel = [[UILabel alloc] init]; + self.guildLabel.textColor = RGB16(0x999999); + self.guildLabel.text = @"所属公会"; + self.guildLabel.font = [UIFont boldSystemFontOfSize:12]; + [self addSubview:self.guildLabel]; + [self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.headerView); + make.height.mas_equalTo(18); + make.top.equalTo(self.ageLabel.mas_bottom).offset(8); + make.width.mas_greaterThanOrEqualTo(35); + }]; + self.introduceLabel = [[UILabel alloc] init]; self.introduceLabel.textColor = QXConfig.textColor; self.introduceLabel.font = [UIFont systemFontOfSize:14]; @@ -126,7 +139,7 @@ [self addSubview:self.introduceLabel]; [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.headerView); - make.top.equalTo(self.ageLabel.mas_bottom).offset(4); + make.top.equalTo(self.guildLabel.mas_bottom).offset(4); make.width.mas_equalTo(SCREEN_WIDTH-64); make.height.mas_greaterThanOrEqualTo(22); }]; @@ -266,12 +279,18 @@ self.playBtn.hidden = NO; self.followBtn.selected = model.is_follow==0?NO:YES; if (model.room_id.intValue > 0) { - [self.playBtn setTitle:QXText(@"跟随") forState:(UIControlStateNormal)]; +// [self.playBtn setTitle:QXText(@"跟随") forState:(UIControlStateNormal)]; + [self.playBtn setBackgroundImage:[UIImage imageNamed:@"room_user_follow"] forState:(UIControlStateNormal)]; }else{ - [self.playBtn setTitle:QXText(@"私信") forState:(UIControlStateNormal)]; +// [self.playBtn setTitle:QXText(@"私信") forState:(UIControlStateNormal)]; + [self.playBtn setBackgroundImage:[UIImage imageNamed:@"expansion_call"] forState:(UIControlStateNormal)]; } } - + if ([model.guild isExist]) { + self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",model.guild]; + }else{ + self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",@"无"]; + } if (model.is_use_code.intValue == 1) { self.useCodeImageView.hidden = NO; }else{ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Contents.json deleted file mode 100644 index 5f4ea61..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 1381@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 1381@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Frame 1381@2x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Frame 1381@2x.png deleted file mode 100644 index e6d2cab..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Frame 1381@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Frame 1381@3x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Frame 1381@3x.png deleted file mode 100644 index 23959aa..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1381.imageset/Frame 1381@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Contents.json deleted file mode 100644 index 2222159..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 1403@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 1403@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Frame 1403@2x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Frame 1403@2x.png deleted file mode 100644 index 519ce31..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Frame 1403@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Frame 1403@3x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Frame 1403@3x.png deleted file mode 100644 index 0bb7aea..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1403.imageset/Frame 1403@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Contents.json deleted file mode 100644 index ac092bd..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 1427@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 1427@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Frame 1427@2x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Frame 1427@2x.png deleted file mode 100644 index 9fad70e..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Frame 1427@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Frame 1427@3x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Frame 1427@3x.png deleted file mode 100644 index 58c2c6e..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1427.imageset/Frame 1427@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Contents.json deleted file mode 100644 index 177d7ab..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 1428@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 1428@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Frame 1428@2x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Frame 1428@2x.png deleted file mode 100644 index a8d1249..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Frame 1428@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Frame 1428@3x.png b/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Frame 1428@3x.png deleted file mode 100644 index 99cf5de..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 1428.imageset/Frame 1428@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Contents.json deleted file mode 100644 index f8bcbfa..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 8@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 8@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Frame 8@2x.png b/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Frame 8@2x.png deleted file mode 100644 index 87fa5ac..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Frame 8@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Frame 8@3x.png b/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Frame 8@3x.png deleted file mode 100644 index d999164..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 8.imageset/Frame 8@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Contents.json deleted file mode 100644 index a2f179e..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame 895@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame 895@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Frame 895@2x.png b/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Frame 895@2x.png deleted file mode 100644 index 66cd324..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Frame 895@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Frame 895@3x.png b/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Frame 895@3x.png deleted file mode 100644 index a78b581..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame 895.imageset/Frame 895@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Contents.json deleted file mode 100644 index 780851a..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame@2x(4).png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame@3x(4).png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Frame@2x(4).png b/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Frame@2x(4).png deleted file mode 100644 index 45cb280..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Frame@2x(4).png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Frame@3x(4).png b/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Frame@3x(4).png deleted file mode 100644 index 3cf5dd8..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame(4).imageset/Frame@3x(4).png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Contents.json deleted file mode 100644 index ef558de..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame@2x(7).png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame@3x(7).png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Frame@2x(7).png b/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Frame@2x(7).png deleted file mode 100644 index 2c91275..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Frame@2x(7).png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Frame@3x(7).png b/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Frame@3x(7).png deleted file mode 100644 index c465a1c..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame(7).imageset/Frame@3x(7).png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Contents.json deleted file mode 100644 index 5c4d3b1..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Frame@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Frame@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Frame@2x.png b/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Frame@2x.png deleted file mode 100644 index 9baaa75..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Frame@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Frame@3x.png b/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Frame@3x.png deleted file mode 100644 index 219dbd5..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Frame.imageset/Frame@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Contents.json deleted file mode 100644 index 4463f76..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 25@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 25@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Group 25@2x.png b/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Group 25@2x.png deleted file mode 100644 index 890b200..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Group 25@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Group 25@3x.png b/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Group 25@3x.png deleted file mode 100644 index 93a81af..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 25.imageset/Group 25@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Contents.json deleted file mode 100644 index 61ef4a3..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 7053@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 7053@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Group 7053@2x.png b/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Group 7053@2x.png deleted file mode 100644 index 3a591a0..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Group 7053@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Group 7053@3x.png b/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Group 7053@3x.png deleted file mode 100644 index e27638c..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7053.imageset/Group 7053@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Contents.json deleted file mode 100644 index e063cf7..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 7055@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 7055@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Group 7055@2x.png b/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Group 7055@2x.png deleted file mode 100644 index 086d10f..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Group 7055@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Group 7055@3x.png b/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Group 7055@3x.png deleted file mode 100644 index a0bdaac..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7055.imageset/Group 7055@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Contents.json deleted file mode 100644 index f4fd752..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 7056@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 7056@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Group 7056@2x.png b/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Group 7056@2x.png deleted file mode 100644 index 23c15d0..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Group 7056@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Group 7056@3x.png b/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Group 7056@3x.png deleted file mode 100644 index 3a2dd2b..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7056.imageset/Group 7056@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Contents.json deleted file mode 100644 index 62a7cb8..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 7072@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 7072@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Group 7072@2x.png b/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Group 7072@2x.png deleted file mode 100644 index ee238b6..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Group 7072@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Group 7072@3x.png b/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Group 7072@3x.png deleted file mode 100644 index bf35484..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7072.imageset/Group 7072@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Contents.json deleted file mode 100644 index b144cae..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 7074@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 7074@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Group 7074@2x.png b/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Group 7074@2x.png deleted file mode 100644 index 1f41711..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Group 7074@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Group 7074@3x.png b/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Group 7074@3x.png deleted file mode 100644 index 150bcd7..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7074.imageset/Group 7074@3x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Contents.json b/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Contents.json deleted file mode 100644 index ac55063..0000000 --- a/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "Group 7075@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "Group 7075@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Group 7075@2x.png b/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Group 7075@2x.png deleted file mode 100644 index c657371..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Group 7075@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Group 7075@3x.png b/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Group 7075@3x.png deleted file mode 100644 index a8ed082..0000000 Binary files a/QXLive/Other/Assets.xcassets/mine/Group 7075.imageset/Group 7075@3x.png and /dev/null differ diff --git a/QXLive/活动/QXSkyPraizeView.h b/QXLive/活动/QXSkyPraizeView.h new file mode 100644 index 0000000..1bb2a41 --- /dev/null +++ b/QXLive/活动/QXSkyPraizeView.h @@ -0,0 +1,30 @@ +// +// QXSkyPraizeView.h +// QXLive +// +// Created by 启星 on 2025/8/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXSkyPraizeView : UIView +-(void)showInView:(UIView *)view; +@end + + +@interface QXSkyPraizeSubView :UIView +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)UIImageView *bgImageView; +@property (nonatomic,strong)UIImageView *giftImageView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UIButton *giftCoin; + +@property (nonatomic,assign)BOOL isSelected; + +- (void)startPulseAnimationWithLayer; +// 停止动画 +- (void)stopPulseAnimationWithLayer; +@end +NS_ASSUME_NONNULL_END diff --git a/QXLive/活动/QXSkyPraizeView.m b/QXLive/活动/QXSkyPraizeView.m new file mode 100644 index 0000000..c408111 --- /dev/null +++ b/QXLive/活动/QXSkyPraizeView.m @@ -0,0 +1,459 @@ +// +// QXSkyPraizeView.m +// QXLive +// +// Created by 启星 on 2025/8/16. +// + +#import "QXSkyPraizeView.h" +/// 共有12个礼物 +static NSInteger giftMaxCount = 12; +/// 最少转2圈 +static NSInteger minRoundCount = 2; +/// 距离4个的时候放慢 +static NSInteger toSlowCount = 4; + +@interface QXSkyPraizeView() +/// 目标下标 +@property (nonatomic,assign)NSInteger targetIndex; + +@property (nonatomic,strong)NSMutableArray* targetArrayIndex; +@property (nonatomic,strong)NSMutableArray* finishTargetArrayIndex; +/// 当前转动到第几个下标 +@property (nonatomic,assign)NSInteger currentIndex; +/// 转动了多少次 +@property (nonatomic,assign)NSInteger roundCount; +/// 延时 +@property (nonatomic,assign)double delayTime; +/// 22 抽一次 33 抽十次 44 抽 100次 +@property (nonatomic,assign)NSInteger startType; + +@property (nonatomic,strong)QXSkyPraizeSubView *currentGiftView; + +@property (nonatomic,strong)UIView *bgView; +@property (nonatomic,strong)NSMutableArray *allViewsArray; + +@property (nonatomic,strong)dispatch_source_t fastTimer; +@property (nonatomic,strong)dispatch_source_t slowTimer; +@end + +@implementation QXSkyPraizeView + +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + [self initSubviews]; + } + return self; +} +-(void)initSubviews{ + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]; + tap.delegate = self; + [self addGestureRecognizer:tap]; + self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3]; + + self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(520)+kSafeAreaBottom)]; + self.bgView.backgroundColor = UIColor.whiteColor; + [self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; + [self addSubview:self.bgView]; + + + CGFloat topMargin = 60; + CGFloat margin = 16; + CGFloat space = 10; + CGFloat itemWidth = (SCREEN_WIDTH - margin*2 - space*3) / 4; + CGFloat itemHeight = itemWidth/7*8;; + for (int i = 0; i < giftMaxCount; i++) { + QXSkyPraizeSubView *giftView; + if (i < 4) { + /// 第一行4个 + giftView = [[QXSkyPraizeSubView alloc] initWithFrame:CGRectMake(margin+(itemWidth+space)*i, topMargin, itemWidth, itemHeight)]; + giftView.titleLabel.text = [NSString stringWithFormat:@"%d",i]; + [self.allViewsArray replaceObjectAtIndex:i withObject:giftView]; + }else if (i > 3 && i < 6){ + /// 第二行两个 + if (i == 4) { + giftView = [[QXSkyPraizeSubView alloc] initWithFrame:CGRectMake(margin, topMargin+itemHeight+space, itemWidth, itemHeight)]; + giftView.titleLabel.text = [NSString stringWithFormat:@"%d",11]; + [self.allViewsArray replaceObjectAtIndex:11 withObject:giftView]; + }else{ + giftView = [[QXSkyPraizeSubView alloc] initWithFrame:CGRectMake(margin+(itemWidth+space)*3, topMargin+itemHeight+space, itemWidth, itemHeight)]; + [self.allViewsArray replaceObjectAtIndex:4 withObject:giftView]; + giftView.titleLabel.text = [NSString stringWithFormat:@"%d",4]; + } + }else if (i > 5 && i < 8){ + /// 第三行两个 + if (i == 6) { + giftView = [[QXSkyPraizeSubView alloc] initWithFrame:CGRectMake(margin, topMargin+(itemHeight+space)*2, itemWidth, itemHeight)]; + [self.allViewsArray replaceObjectAtIndex:10 withObject:giftView]; + giftView.titleLabel.text = [NSString stringWithFormat:@"%d",10]; + }else{ + giftView = [[QXSkyPraizeSubView alloc] initWithFrame:CGRectMake(margin+(itemWidth+space)*3, topMargin+(itemHeight+space)*2, itemWidth, itemHeight)]; + [self.allViewsArray replaceObjectAtIndex:5 withObject:giftView]; + giftView.titleLabel.text = [NSString stringWithFormat:@"%d",5]; + } + }else{ + giftView = [[QXSkyPraizeSubView alloc] initWithFrame:CGRectMake(margin+(itemWidth+space)*(i%4), topMargin+(itemHeight+space)*3, itemWidth, itemHeight)]; + [self.allViewsArray replaceObjectAtIndex:11-(i-6) withObject:giftView]; + giftView.titleLabel.text = [NSString stringWithFormat:@"%d",11-(i-6)]; + } + + [self.bgView addSubview:giftView]; + } + [self resetViews]; + + + + UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(16, 20, 100, 40)]; + [btn setTitle:@"抽1次" forState:(UIControlStateNormal)]; + [btn setTitleColor:UIColor.blueColor forState:(UIControlStateNormal)]; + btn.tag = 22; + [btn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:btn]; + + UIButton *tenBtn = [[UIButton alloc] initWithFrame:CGRectMake(116, 20, 100, 40)]; + [tenBtn setTitle:@"抽10次" forState:(UIControlStateNormal)]; + tenBtn.tag = 33; + [tenBtn setTitleColor:UIColor.blueColor forState:(UIControlStateNormal)]; + [tenBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:tenBtn]; + + + UIButton *hundredBtn = [[UIButton alloc] initWithFrame:CGRectMake(216, 20, 100, 40)]; + [hundredBtn setTitle:@"抽100次" forState:(UIControlStateNormal)]; + hundredBtn.tag = 44; + [hundredBtn setTitleColor:UIColor.blueColor forState:(UIControlStateNormal)]; + [hundredBtn addTarget:self action:@selector(startAction:) forControlEvents:(UIControlEventTouchUpInside)]; + [self.bgView addSubview:hundredBtn]; +} +-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ + return touch.view == self; +} +-(void)startAction:(UIButton*)sender{ + + self.startType = sender.tag; + /// 获取目标礼物 + [self resetViews]; + [self getTargetGift]; + [self startFastAnimate]; +} + + + +-(void)resetViews{ + self.targetIndex = -1; + self.currentIndex = -1; + self.roundCount = 0; + self.delayTime = 0.3; + [self.targetArrayIndex removeAllObjects]; + [self.finishTargetArrayIndex removeAllObjects]; + if (self.currentGiftView != nil) { + self.currentGiftView.isSelected = NO; + [self.currentGiftView stopPulseAnimationWithLayer]; + } + for (QXSkyPraizeSubView *giftView in self.allViewsArray) { + giftView.isSelected = NO; + [giftView stopPulseAnimationWithLayer]; + } +} + +-(void)startFastAnimate{ + self.currentGiftView = self.allViewsArray.firstObject; + self.currentGiftView.isSelected = YES; + [self stopFastAnimate]; + if (_fastTimer == nil) { + _fastTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)); + } +// dispatch_source_set_timer(_fastTimer, +// dispatch_time(DISPATCH_TIME_NOW, 0), +// NSEC_PER_SEC * 0.06, // 间隔0.1秒 +// NSEC_PER_SEC * 0.01); // 允许误差0.01秒 + + dispatch_source_set_timer(_fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 0.06 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, // 使用一次性模式 + 0.01 * NSEC_PER_SEC); + __weak typeof(self) weakSelf = self; + dispatch_source_set_event_handler(_fastTimer, ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) return; + // 如果需要更新UI,切换到主线程 + dispatch_async(dispatch_get_main_queue(), ^{ + strongSelf.roundCount++; + + if ((strongSelf.roundCount / giftMaxCount == minRoundCount) && strongSelf.startType != 22) { + BOOL has = NO; + for (NSNumber *index in self.finishTargetArrayIndex) { + if (index.integerValue == self.currentIndex) { + has = YES; + break; + } + } + self.currentGiftView.isSelected = NO; + if (has) { + QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; + giftView.isSelected = YES; + }else{ + QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; + giftView.isSelected = NO; + } + }else{ + /// 把上一个选中状态置为未选中 + strongSelf.currentGiftView.isSelected = NO; + } + /// 计算当前下标 + strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount; + /// 获取当前选中的view 并设置为选中状态 + QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; + giftView.isSelected = YES; + + /// 重新赋值给选中view + strongSelf.currentGiftView = giftView; + + if (strongSelf.roundCount / giftMaxCount == minRoundCount) { + + /// 已经转了2圈 + if (strongSelf.startType == 22) { + + NSInteger index = strongSelf.targetIndex; + // 0 - > 11 + // 1 - > 12 + // 2->13 + // 3->14 + // 4->15 + // 处理0-4数据无法匹配问题 + if (index < 5) { + index = (giftMaxCount-1) + index; + } + if ((strongSelf.currentIndex + toSlowCount) == index) { + //距离目标差4 + QXLOG(@"当前下标为%ld---目标为%ld",strongSelf.currentIndex,strongSelf.targetIndex); + [self stopFastAnimate]; + [self startSlowAnimate]; + }else{ + dispatch_source_set_timer(strongSelf.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 0.06 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + } + + }else{ +// for (QXSkyPraizeSubView *giftView in strongSelf.allViewsArray) { +// giftView.isSelected = NO; +// } + BOOL has = NO; + for (NSNumber *index in strongSelf.targetArrayIndex) { + if (strongSelf.currentIndex == index.integerValue) { + QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[index.integerValue]; + giftView.isSelected = YES; + [giftView startPulseAnimationWithLayer]; +// [strongSelf pauseGCDTimer]; + [strongSelf.targetArrayIndex removeObject:index]; + [strongSelf.finishTargetArrayIndex addObject:index]; + has = YES; + break; + } + } +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// [strongSelf resumeGCDTimer]; +// }); + if (has) { + dispatch_source_set_timer(strongSelf.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + }else{ + dispatch_source_set_timer(strongSelf.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 0.06 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + } + if (strongSelf.targetArrayIndex.count == 0) { + [strongSelf stopFastAnimate]; + } + } + }else{ + dispatch_source_set_timer(strongSelf.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 0.06 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + } + + + }); + }); + dispatch_resume(_fastTimer); +} + +-(void)startSlowAnimate{ + + if (_slowTimer == nil) { + _slowTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)); + } + // 立即开始,初始间隔0.1秒 + dispatch_source_set_timer(_slowTimer, + dispatch_time(DISPATCH_TIME_NOW, self.delayTime * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, // 使用一次性模式 + 0.01 * NSEC_PER_SEC); + __weak typeof(self) weakSelf = self; + dispatch_source_set_event_handler(_slowTimer, ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) return; + // 如果需要更新UI,切换到主线程 + dispatch_async(dispatch_get_main_queue(), ^{ + + /// 把上一个选中状态置为未选中 + strongSelf.currentGiftView.isSelected = NO; + + strongSelf.roundCount++; + /// 计算当前下标 + strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount; + /// 获取当前选中的view 并设置为选中状态 + QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; + giftView.isSelected = YES; + + /// 重新赋值给选中view + strongSelf.currentGiftView = giftView; + + if (strongSelf.currentIndex == strongSelf.targetIndex) { + //距离目标差4 + QXLOG(@"礼物结束====当前下标为%ld---目标为%ld",strongSelf.currentIndex,strongSelf.targetIndex); + [strongSelf stopSlowAnimate]; + [strongSelf.currentGiftView startPulseAnimationWithLayer]; + } + }); + strongSelf.delayTime = strongSelf.delayTime+0.1; + dispatch_source_set_timer(strongSelf.slowTimer, + dispatch_time(DISPATCH_TIME_NOW, strongSelf.delayTime * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + }); + dispatch_resume(_slowTimer); +} + + + +-(void)stopFastAnimate{ + if (_fastTimer != nil) { + dispatch_source_cancel(_fastTimer); + _fastTimer = nil; + } +} + +- (void)pauseGCDTimer { + if (_fastTimer) { + dispatch_suspend(_fastTimer); + NSLog(@"GCD定时器已暂停"); + } +} +- (void)resumeGCDTimer { + if (_fastTimer) { + dispatch_resume(_fastTimer); + NSLog(@"GCD定时器已恢复"); + } +} + +-(void)stopSlowAnimate{ + if (_slowTimer != nil) { + dispatch_source_cancel(_slowTimer); + _slowTimer = nil; + } +} + +-(void)getTargetGift{ + self.targetArrayIndex = [NSMutableArray arrayWithArray:@[@3,@5,@8,@10]]; + if (self.startType == 22) { + self.targetIndex = arc4random() % 12; + }else{ +// NSNumber *number = self.targetArrayIndex.firstObject; +// self.targetIndex = number.integerValue; + } +} + +-(void)getTenTargetGift{ + +} + +-(NSMutableArray *)allViewsArray{ + if (!_allViewsArray) { + _allViewsArray = [NSMutableArray arrayWithArray:@[@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@""]]; + } + return _allViewsArray; +} + + + + + + + +-(NSMutableArray *)finishTargetArrayIndex{ + if (!_finishTargetArrayIndex) { + _finishTargetArrayIndex = [NSMutableArray array]; + } + return _finishTargetArrayIndex; +} +-(void)showInView:(UIView *)view{ + self.bgView.y = SCREEN_HEIGHT; + [view addSubview:self]; + [UIView animateWithDuration:0.3 animations:^{ + self.bgView.y = SCREEN_HEIGHT-ScaleWidth(520)-kSafeAreaBottom; + }]; +} +-(void)hide{ + [self stopFastAnimate]; + [self stopSlowAnimate]; + [UIView animateWithDuration:0.3 animations:^{ + self.bgView.y = SCREEN_HEIGHT; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} +@end + + +@implementation QXSkyPraizeSubView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.backgroundColor = [UIColor cyanColor]; + [self initSubviews]; + } + return self; +} +-(void)initSubviews{ + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:22]; + self.titleLabel.textColor = UIColor.blackColor; + self.titleLabel.textAlignment = NSTextAlignmentCenter; + [self addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self); + }]; +} +-(void)setIsSelected:(BOOL)isSelected{ + _isSelected = isSelected; + self.backgroundColor = isSelected?[UIColor blueColor]:[UIColor cyanColor]; +} +- (void)startPulseAnimationWithLayer { + CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; + pulseAnimation.duration = 0.5; + pulseAnimation.fromValue = @0.9; + pulseAnimation.toValue = @1.1; + pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + pulseAnimation.autoreverses = YES; + pulseAnimation.repeatCount = HUGE_VALF; // 无限循环 + + [self.layer addAnimation:pulseAnimation forKey:@"pulse"]; + +} + +// 停止动画 +- (void)stopPulseAnimationWithLayer { + [self.layer removeAnimationForKey:@"pulse"]; +} +@end