PK预约倒计时
This commit is contained in:
@@ -262,6 +262,7 @@
|
||||
9BEE3D11278584FE00C83219 /* XPNobleCenterEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BEE3D10278584FE00C83219 /* XPNobleCenterEmptyView.m */; };
|
||||
9BEE3D142785884A00C83219 /* XPNobleCenterResidueView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BEE3D132785884A00C83219 /* XPNobleCenterResidueView.m */; };
|
||||
9BEE3D1727858E5700C83219 /* XPNobleAuthorityDescView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BEE3D1627858E5700C83219 /* XPNobleAuthorityDescView.m */; };
|
||||
9BF5192628801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BF5192528801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m */; };
|
||||
E80016232803CA5D00D6D17A /* XPMineGuildIncomeRecordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E80016222803CA5D00D6D17A /* XPMineGuildIncomeRecordViewController.m */; };
|
||||
E80016262803CB2800D6D17A /* XPGuildIncomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80016252803CB2800D6D17A /* XPGuildIncomeHeaderView.m */; };
|
||||
E80016292803D5C500D6D17A /* XPGuildIncomeRecordTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E80016282803D5C500D6D17A /* XPGuildIncomeRecordTableViewCell.m */; };
|
||||
@@ -1371,6 +1372,8 @@
|
||||
9BEE3D132785884A00C83219 /* XPNobleCenterResidueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNobleCenterResidueView.m; sourceTree = "<group>"; };
|
||||
9BEE3D1527858E5700C83219 /* XPNobleAuthorityDescView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNobleAuthorityDescView.h; sourceTree = "<group>"; };
|
||||
9BEE3D1627858E5700C83219 /* XPNobleAuthorityDescView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNobleAuthorityDescView.m; sourceTree = "<group>"; };
|
||||
9BF5192428801D4700B6BE92 /* XPAcrossRoomPKCountDownView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKCountDownView.h; sourceTree = "<group>"; };
|
||||
9BF5192528801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKCountDownView.m; sourceTree = "<group>"; };
|
||||
B66633E061B1B34177CD011C /* Pods-xplan-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.release.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.release.xcconfig"; sourceTree = "<group>"; };
|
||||
CACF623970097D653132D69A /* Pods_xplan_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_xplan_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E80016212803CA5D00D6D17A /* XPMineGuildIncomeRecordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineGuildIncomeRecordViewController.h; sourceTree = "<group>"; };
|
||||
@@ -5295,6 +5298,8 @@
|
||||
E88863C8278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m */,
|
||||
E88863CD278EC393004BCFAB /* XPAcrossRoomPKPrizeView.h */,
|
||||
E88863CE278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m */,
|
||||
9BF5192428801D4700B6BE92 /* XPAcrossRoomPKCountDownView.h */,
|
||||
9BF5192528801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m */,
|
||||
);
|
||||
path = SubViews;
|
||||
sourceTree = "<group>";
|
||||
@@ -7382,6 +7387,7 @@
|
||||
E855515E28056F88005F293F /* XPMineHallAnchorIncomeStatisViewController.m in Sources */,
|
||||
189DD6FF26E20E5900AB55B1 /* HttpRequestHelper.m in Sources */,
|
||||
E8788945273A55C200BF1D57 /* XPGiftInfoView.m in Sources */,
|
||||
9BF5192628801D4700B6BE92 /* XPAcrossRoomPKCountDownView.m in Sources */,
|
||||
9BD63FAB277EE885006EB744 /* Api+RoomRadio.m in Sources */,
|
||||
E8A30BF328534B17003B4873 /* Api+FindNew.m in Sources */,
|
||||
9BA8A48327C726E8000365A3 /* ThemeColor+SkillCard.m in Sources */,
|
||||
|
22
xplan-ios/Assets.xcassets/Room/AcrossRoomPK/acrossPK_countDown_bg.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/AcrossRoomPK/acrossPK_countDown_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "acrossPK_countDown_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "acrossPK_countDown_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
@@ -368,6 +368,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubAcrossRoomPK) {
|
||||
Custom_Message_Sub_AnchorPK_Result = 8312,
|
||||
///个播PK完成
|
||||
Custom_Message_Sub_AnchorPK_Finish = 8313,
|
||||
///收到预约PK倒计时
|
||||
Custom_Message_Sub_PK_BeginTime = 8314,
|
||||
};
|
||||
|
||||
///first = CustomMessageType_Noble_VIP
|
||||
|
@@ -143,6 +143,11 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) {
|
||||
@property (nonatomic , assign) double clearScreenTime;
|
||||
///小游戏房麦位数量
|
||||
@property (nonatomic, assign) NSInteger mgMicNum;
|
||||
///是否显示跨房PK预约倒计时
|
||||
@property (nonatomic, assign) BOOL showPkBeginTime;
|
||||
///跨房PK开始时间
|
||||
@property (nonatomic, assign) long long pkBeginTime;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPAcrossRoomPKCountDownView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/14.
|
||||
// 跨房PK预约倒计时
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPAcrossRoomPKCountDownView : UIView
|
||||
|
||||
@property (nonatomic, assign) long long startTime;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// XPAcrossRoomPKCountDownView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/7/14.
|
||||
//
|
||||
|
||||
#import "XPAcrossRoomPKCountDownView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
|
||||
@interface XPAcrossRoomPKCountDownView()
|
||||
|
||||
///背景
|
||||
@property (nonatomic, strong) UIImageView *backImageView;
|
||||
///标题
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
///显示倒计时
|
||||
@property (nonatomic, strong) UILabel *timeLabel;
|
||||
///倒计时
|
||||
@property (strong, nonatomic) dispatch_source_t timer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPAcrossRoomPKCountDownView
|
||||
|
||||
- (void)dealloc {
|
||||
if (self.timer) {
|
||||
dispatch_source_cancel(self.timer);
|
||||
self.timer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backImageView];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.timeLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(130);
|
||||
make.height.mas_equalTo(34);
|
||||
}];
|
||||
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(0);
|
||||
}];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(4);
|
||||
make.top.mas_equalTo(9);
|
||||
make.height.mas_equalTo(10);
|
||||
}];
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.titleLabel);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(2);
|
||||
make.height.mas_equalTo(10);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 倒计时
|
||||
- (void)openCountdownWithTime:(long)time {
|
||||
__block long tempTime = time; //倒计时时间
|
||||
if (self.timer == nil) {
|
||||
@kWeakify(self);
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
||||
dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行
|
||||
dispatch_source_set_event_handler(self.timer, ^{
|
||||
@kStrongify(self);
|
||||
if(tempTime <= 0){ //倒计时结束,关闭
|
||||
dispatch_source_cancel(self.timer);
|
||||
self.timer = nil;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self removeFromSuperview];
|
||||
});
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
//设置按钮显示读秒效果
|
||||
[self acrossRoomPKCutdownOpen:tempTime];
|
||||
});
|
||||
tempTime--;
|
||||
}
|
||||
});
|
||||
dispatch_resume(self.timer);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)acrossRoomPKCutdownOpen:(NSInteger)time {
|
||||
NSInteger minute = time / 60;
|
||||
NSInteger second = (time % 60);
|
||||
NSInteger hour = time/3600;
|
||||
NSString *timeStr;
|
||||
if (hour > 0) {
|
||||
minute = minute % 60;
|
||||
timeStr = [NSString stringWithFormat:@"%02zd:%02zd:%02zd", hour, minute, second];
|
||||
} else {
|
||||
timeStr = [NSString stringWithFormat:@"%02zd:%02zd", minute, second];
|
||||
}
|
||||
self.timeLabel.text = timeStr;
|
||||
if (time <= 30) {
|
||||
self.timeLabel.textColor = UIColorFromRGB(0xFF87A1);
|
||||
} else {
|
||||
self.timeLabel.textColor = UIColorFromRGB(0xFFF600);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setStartTime:(long long)startTime {
|
||||
long long time2 = (long long)([[NSDate date] timeIntervalSince1970]*1000);
|
||||
long aTime = (long)(startTime - time2) / 1000;
|
||||
[self openCountdownWithTime:aTime];
|
||||
}
|
||||
|
||||
- (UIImageView *)backImageView {
|
||||
if (!_backImageView) {
|
||||
_backImageView = [[UIImageView alloc] init];
|
||||
_backImageView.image = [UIImage imageNamed:@"acrossPK_countDown_bg"];
|
||||
}
|
||||
return _backImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:10];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.text = @"距离下一场PK开始";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)timeLabel {
|
||||
if (!_timeLabel) {
|
||||
_timeLabel = [[UILabel alloc] init];
|
||||
_timeLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
|
||||
_timeLabel.textColor = UIColorFromRGB(0xFFF333);
|
||||
_timeLabel.text = @"00:00";
|
||||
}
|
||||
return _timeLabel;
|
||||
}
|
||||
|
||||
@end
|
@@ -74,6 +74,7 @@
|
||||
#import "XPRoomBackMusicPlayerView.h"
|
||||
#import "XPRoomNewUserGreetView.h"
|
||||
#import "XPRoomHalfMessageView.h"
|
||||
#import "XPAcrossRoomPKCountDownView.h"
|
||||
///个播PK
|
||||
#import "XPAnchorFansTeamEntranceView.h"
|
||||
#import "XPAnchorFansTeamViewController.h"
|
||||
@@ -103,6 +104,8 @@
|
||||
@property (nonatomic,strong) UIButton *editButton;
|
||||
///跨房pk的面板
|
||||
@property (nonatomic,strong) XPAcrpssRoomPKPanelView *acrossPKPanelView;
|
||||
///跨房PK预约倒计时
|
||||
@property (nonatomic, strong) XPAcrossRoomPKCountDownView *acrossPKCountView;
|
||||
///小游戏 最小化的坑位
|
||||
@property (nonatomic,strong) XPLittleGameMiniStageView *littleGameMiniView;
|
||||
///显示游戏的切换
|
||||
@@ -509,7 +512,22 @@
|
||||
}
|
||||
} roomUid:roomUid];
|
||||
}
|
||||
|
||||
if (roomInfo.showPkBeginTime && roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode) {//显示PK倒计时
|
||||
if (!self.acrossPKCountView.superview) {
|
||||
[self addSubview:self.acrossPKCountView];
|
||||
self.acrossPKCountView.startTime = roomInfo.pkBeginTime;
|
||||
[self.acrossPKCountView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(0);
|
||||
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(4);
|
||||
make.size.mas_equalTo(CGSizeMake(130, 34));
|
||||
}];
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
CGRect frame = self.acrossPKCountView.frame;
|
||||
frame.origin.x = 0;
|
||||
self.acrossPKCountView.frame = frame;
|
||||
}];
|
||||
}
|
||||
}
|
||||
[self updateRoomTopic];
|
||||
[self showLittleGameMiniView:roomInfo.type micCount:roomInfo.mgMicNum];
|
||||
[self configLittleGameState];
|
||||
@@ -557,6 +575,8 @@
|
||||
switch (attachment.second) {
|
||||
case Custom_Message_Sub_AcrossRoomPK_Invite:
|
||||
{
|
||||
[self.acrossPKCountView removeFromSuperview];
|
||||
self.acrossPKCountView = nil;
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
request.userIds = @[[AccountInfoStorage instance].getUid];
|
||||
@@ -579,6 +599,8 @@
|
||||
break;
|
||||
case Custom_Message_Sub_AcrossRoomPK_Accept:
|
||||
{
|
||||
[self.acrossPKCountView removeFromSuperview];
|
||||
self.acrossPKCountView = nil;
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
request.userIds = @[[AccountInfoStorage instance].getUid];
|
||||
@@ -604,6 +626,8 @@
|
||||
break;
|
||||
case Custom_Message_Sub_AcrossRoomPK_Reject:
|
||||
{
|
||||
[self.acrossPKCountView removeFromSuperview];
|
||||
self.acrossPKCountView = nil;
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
request.userIds = @[[AccountInfoStorage instance].getUid];
|
||||
@@ -629,6 +653,8 @@
|
||||
break;
|
||||
case Custom_Message_Sub_AcrossRoomPK_Panel:
|
||||
{
|
||||
[self.acrossPKCountView removeFromSuperview];
|
||||
self.acrossPKCountView = nil;
|
||||
if (!self.acrossPKPanelView.superview) {
|
||||
[self addSubview:self.acrossPKPanelView];
|
||||
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -642,6 +668,8 @@
|
||||
break;
|
||||
case Custom_Message_Sub_AcrossRoomPK_End:
|
||||
{
|
||||
[self.acrossPKCountView removeFromSuperview];
|
||||
self.acrossPKCountView = nil;
|
||||
[self.acrossPKPanelView resetAcrossPKViewData];
|
||||
[self.acrossPKPanelView removeFromSuperview];
|
||||
AcrossRoomPKPanelModel * model = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
||||
@@ -772,6 +800,11 @@
|
||||
self.anchorPKPanelView = nil;
|
||||
[self resetAnchorPkInfo];
|
||||
[[RtcManager instance] disconnectOtherRoom];
|
||||
}
|
||||
break;
|
||||
case Custom_Message_Sub_PK_BeginTime:{
|
||||
long long time = [attachment.data[@"beginTime"] longLongValue];
|
||||
[self showAcrossPkCountDownViewWithTime:time];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1478,6 +1511,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
///跨房PK预约倒计时
|
||||
- (void)showAcrossPkCountDownViewWithTime:(long long)time {
|
||||
if (self.acrossPKCountView.superview) {
|
||||
return;
|
||||
}
|
||||
if (self.acrossPKPanelView.superview) {//正在PK中
|
||||
return;
|
||||
}
|
||||
if ([self.delegate getRoomInfo].roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||||
return;
|
||||
}
|
||||
[self addSubview:self.acrossPKCountView];
|
||||
self.acrossPKCountView.startTime = time;
|
||||
[self.acrossPKCountView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(0);
|
||||
make.height.mas_equalTo(34);
|
||||
make.width.mas_equalTo(130);
|
||||
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(4);
|
||||
}];
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
CGRect frame = self.acrossPKCountView.frame;
|
||||
frame.origin.x = 0;
|
||||
self.acrossPKCountView.frame = frame;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (XPRoomRankEntranceView *)contributeEnterView {
|
||||
if (!_contributeEnterView) {
|
||||
@@ -1637,5 +1696,11 @@
|
||||
return _roompkPanelView;
|
||||
}
|
||||
|
||||
- (XPAcrossRoomPKCountDownView *)acrossPKCountView {
|
||||
if (!_acrossPKCountView) {
|
||||
_acrossPKCountView = [[XPAcrossRoomPKCountDownView alloc] initWithFrame:CGRectMake(-130, kNavigationHeight+4+22+4, 130, 34)];
|
||||
}
|
||||
return _acrossPKCountView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user