1166 lines
40 KiB
Objective-C
1166 lines
40 KiB
Objective-C
//
|
||
// BoomInfoViewController.m
|
||
// YuMi
|
||
//
|
||
// Created by P on 2024/9/29.
|
||
//
|
||
|
||
#import "BoomInfoViewController.h"
|
||
|
||
#import "Api+Boom.h"
|
||
#import "BoomInfoModel.h"
|
||
#import "RoomBoomManager.h"
|
||
#import "XPRoomHalfWebView.h"
|
||
#import "RoomBoomExplosionView.h"
|
||
#import "XPRoomGiftAnimationParser.h"
|
||
|
||
#import <QGVAPWrapView.h>
|
||
|
||
@interface RocketBox : UIView
|
||
|
||
@property (nonatomic, strong) NetImageView *icon;
|
||
@property (nonatomic, strong) UILabel *levelLabel;
|
||
|
||
@property (nonatomic, assign) NSInteger level;
|
||
@property (nonatomic, assign) BOOL isSelected;
|
||
@property (nonatomic, copy) void(^didTapRocket)(NSInteger level);
|
||
|
||
@end
|
||
|
||
@implementation RocketBox
|
||
|
||
- (instancetype)init {
|
||
if (self = [super init]) {
|
||
[self setupUI];
|
||
[self setupTap];
|
||
}
|
||
return self;
|
||
}
|
||
|
||
- (void)setupUI {
|
||
[self addSubview:self.icon];
|
||
[self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerY.mas_equalTo(0);
|
||
make.leading.mas_equalTo(4.5);
|
||
make.width.mas_equalTo(23);
|
||
make.height.mas_equalTo(36);
|
||
}];
|
||
|
||
[self addSubview:self.levelLabel];
|
||
[self.levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerY.mas_equalTo(self);
|
||
make.leading.mas_equalTo(self.icon.mas_trailing).offset(7);
|
||
make.trailing.mas_equalTo(0);
|
||
}];
|
||
}
|
||
|
||
- (void)setupTap {
|
||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
|
||
[self addGestureRecognizer:tap];
|
||
}
|
||
|
||
- (void)handleTap {
|
||
if (_didTapRocket) {
|
||
self.didTapRocket(self.level);
|
||
}
|
||
}
|
||
|
||
- (void)setLevel:(NSInteger)level {
|
||
_level = level;
|
||
self.levelLabel.text = [NSString stringWithFormat:@"LV.%ld", (long)level];
|
||
}
|
||
|
||
- (void)setIsSelected:(BOOL)isSelected {
|
||
_isSelected = isSelected;
|
||
if (isSelected) {
|
||
self.backgroundColor = UIColorFromRGB(0x9739FF);
|
||
} else {
|
||
self.backgroundColor = [UIColor clearColor];
|
||
}
|
||
}
|
||
|
||
- (NetImageView *)icon {
|
||
if (!_icon) {
|
||
_icon = [[NetImageView alloc] init];
|
||
_icon.userInteractionEnabled = YES;
|
||
}
|
||
return _icon;
|
||
}
|
||
|
||
- (UILabel *)levelLabel {
|
||
if (!_levelLabel) {
|
||
_levelLabel = [UILabel labelInitWithText:@"" font:kFontMedium(12) textColor:UIColorFromRGB(0xF8F4C9)];
|
||
_levelLabel.textAlignment = NSTextAlignmentCenter;
|
||
_levelLabel.userInteractionEnabled = YES;
|
||
}
|
||
return _levelLabel;
|
||
}
|
||
|
||
@end
|
||
|
||
|
||
@interface BoomInfoViewController () <HWDMP4PlayDelegate>
|
||
|
||
@property (nonatomic, strong) UIView *giftsView;
|
||
@property (nonatomic, strong) NetImageView *giftBig;
|
||
@property (nonatomic, strong) NetImageView *giftSmall_1;
|
||
@property (nonatomic, strong) NetImageView *giftSmall_2;
|
||
@property (nonatomic, strong) NetImageView *giftSmall_3;
|
||
@property (nonatomic, strong) NetImageView *giftSmall_4;
|
||
|
||
@property (nonatomic, strong) RocketBox *rocket_lv_1;
|
||
@property (nonatomic, strong) RocketBox *rocket_lv_2;
|
||
@property (nonatomic, strong) RocketBox *rocket_lv_3;
|
||
@property (nonatomic, strong) RocketBox *rocket_lv_4;
|
||
@property (nonatomic, strong) RocketBox *rocket_lv_5;
|
||
|
||
@property (nonatomic, strong) UILabel *progressLabel;
|
||
|
||
@property (nonatomic, copy) NSArray <BoomDetailModel *> * boomInfoArray;
|
||
|
||
@property (nonatomic, strong) VAPView *vapView;
|
||
@property (nonatomic, strong) XPRoomGiftAnimationParser *vapParser;
|
||
|
||
@property (nonatomic, assign) NSInteger selectedIndex;
|
||
@property (nonatomic, strong) UIImageView *progressBar;
|
||
|
||
@property (nonatomic, strong) UIView *rankingView;
|
||
@property (nonatomic, strong) NetImageView *rankAvatar_1;
|
||
@property (nonatomic, strong) NetImageView *rankAvatar_2;
|
||
@property (nonatomic, strong) NetImageView *rankAvatar_3;
|
||
@property (nonatomic, strong) UILabel *rankName_1;
|
||
@property (nonatomic, strong) UILabel *rankName_2;
|
||
@property (nonatomic, strong) UILabel *rankName_3;
|
||
|
||
@property (nonatomic, strong) UILabel *rankTipsLabel;
|
||
@property (nonatomic, strong) UILabel *ratioLabel;
|
||
|
||
@end
|
||
|
||
@implementation BoomInfoViewController
|
||
|
||
|
||
- (instancetype)init {
|
||
if (self = [super init]) {
|
||
self.view.backgroundColor = [UIColor clearColor];
|
||
|
||
}
|
||
return self;
|
||
}
|
||
|
||
- (void)dealloc {
|
||
[self.vapView stopHWDMP4];
|
||
[self.vapView removeFromSuperview];
|
||
self.vapView = nil;
|
||
|
||
[[RoomBoomManager sharedManager] removeEventListenerForTarget:self];
|
||
}
|
||
|
||
- (void)viewDidLoad {
|
||
[super viewDidLoad];
|
||
|
||
[self setupUI];
|
||
[self setupNotification];
|
||
|
||
@kWeakify(self);
|
||
[[RoomBoomManager sharedManager] registerBoomProgressUpdate:^(id _Nonnull sth) {
|
||
@kStrongify(self);
|
||
if ([sth isKindOfClass:[BoomDetailModel class]]) {
|
||
self.boomInfoArray = [[RoomBoomManager sharedManager] loadBoomDetails];
|
||
}
|
||
} target:self];
|
||
|
||
self.selectedIndex = -1;
|
||
self.boomInfoArray = [[RoomBoomManager sharedManager] loadBoomDetails];
|
||
|
||
[self locateToRightLevel];
|
||
}
|
||
|
||
- (void)setPartitionId:(NSString *)partitionId {
|
||
_partitionId = partitionId;
|
||
self.rankTipsLabel.text = [self.partitionId isEqualToString:@"2"] ? YMLocalizedString(@"RoomBoom_6") : YMLocalizedString(@"RoomBoom_9");
|
||
}
|
||
|
||
- (void)setRoomUid:(NSInteger)roomUid {
|
||
_roomUid = roomUid;
|
||
[self loadDetailData];
|
||
}
|
||
|
||
- (void)setupNotification {
|
||
@kWeakify(self);
|
||
[[NSNotificationCenter defaultCenter] addObserverForName:@"UpdateWhenBoomExplosion"
|
||
object:nil
|
||
queue:[NSOperationQueue mainQueue]
|
||
usingBlock:^(NSNotification * _Nonnull notification) {
|
||
@kStrongify(self);
|
||
[self loadDetailData];
|
||
}];
|
||
}
|
||
|
||
- (void)loadDetailData {
|
||
// 确保进入时数据正确
|
||
@kWeakify(self);
|
||
[Api getBoomDetailInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||
@kStrongify(self);
|
||
if (code == 200) {
|
||
NSArray *array = [BoomDetailModel modelsWithArray:data.data];
|
||
self.boomInfoArray = array;
|
||
[self locateToRightLevel];
|
||
}
|
||
} roomUid:@(self.roomUid).stringValue];
|
||
}
|
||
|
||
- (void)locateToRightLevel {
|
||
for (BoomDetailModel *boom in self.boomInfoArray) {
|
||
if (boom.currLevel == 1 || boom.speed > 0) {
|
||
[self handleTapRocket:boom level:boom.level];
|
||
}
|
||
|
||
switch (boom.level) {
|
||
case 1:
|
||
self.rocket_lv_1.icon.imageUrl = boom.pic;
|
||
break;
|
||
case 2:
|
||
self.rocket_lv_2.icon.imageUrl = boom.pic;
|
||
break;
|
||
case 3:
|
||
self.rocket_lv_3.icon.imageUrl = boom.pic;
|
||
break;
|
||
case 4:
|
||
self.rocket_lv_4.icon.imageUrl = boom.pic;
|
||
break;
|
||
case 5:
|
||
self.rocket_lv_5.icon.imageUrl = boom.pic;
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (self.selectedIndex == -1) {
|
||
[self handleTapRocket:nil level:1];
|
||
}
|
||
}
|
||
|
||
- (void)setBoomInfoArray:(NSArray<BoomDetailModel *> *)boomInfoArray {
|
||
_boomInfoArray = boomInfoArray;
|
||
|
||
if (self.selectedIndex != -1) {
|
||
[self handleTapRocket:nil level:self.selectedIndex];
|
||
}
|
||
}
|
||
|
||
- (void)setupUI {
|
||
UIImageView *backgroundImageView = [self backgroundImageView];
|
||
[self.view addSubview:backgroundImageView];
|
||
[backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.leading.trailing.mas_equalTo(self.view);
|
||
make.top.mas_equalTo(self.view).offset(kGetScaleWidth(154));
|
||
}];
|
||
|
||
UIButton *leaveButton = [self leaveButton];
|
||
[self.view addSubview:leaveButton];
|
||
[leaveButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.leading.trailing.mas_equalTo(self.view);
|
||
make.height.mas_equalTo(kGetScaleWidth(188));
|
||
}];
|
||
|
||
_vapView = [[VAPView alloc] init];
|
||
_vapView.contentMode = UIViewContentModeScaleAspectFit;
|
||
[self.view addSubview:_vapView];
|
||
[_vapView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(self.view);
|
||
if (iPhoneXSeries) {
|
||
make.top.mas_equalTo(self.view).offset(kGetScaleWidth(170) - kSafeAreaBottomHeight);
|
||
} else {
|
||
make.top.mas_equalTo(self.view).offset(kGetScaleWidth(40) - kSafeAreaBottomHeight);
|
||
}
|
||
make.width.mas_equalTo(kGetScaleWidth(211));
|
||
make.height.mas_equalTo(kGetScaleWidth(489));
|
||
}];
|
||
|
||
[self.view addSubview:self.giftsView];
|
||
[self.giftsView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.leading.trailing.mas_equalTo(self.view);
|
||
make.height.mas_equalTo(kGetScaleWidth(230+65) + kSafeAreaBottomHeight);
|
||
}];
|
||
|
||
UIButton *bottomButton = [self bottomButton];
|
||
[self.giftsView addSubview:bottomButton];
|
||
[bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(self.giftsView);
|
||
make.bottom.mas_equalTo(self.view).offset(kGetScaleWidth(-11));
|
||
make.width.mas_equalTo(kGetScaleWidth(340));
|
||
make.height.mas_equalTo(kGetScaleWidth(44));
|
||
}];
|
||
|
||
UIImageView *jackpotBackgroundImageView = [self jackpotBackgroundImageView];
|
||
[self.giftsView addSubview:jackpotBackgroundImageView];
|
||
[jackpotBackgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.mas_equalTo(self.giftsView).offset(kGetScaleWidth(-65));
|
||
make.centerX.mas_equalTo(self.giftsView);
|
||
make.width.mas_equalTo(kGetScaleWidth(355));
|
||
make.height.mas_equalTo(kGetScaleWidth(230));
|
||
}];
|
||
|
||
UIButton *helpButton = [self helpButton];
|
||
[self.giftsView addSubview:helpButton];
|
||
[helpButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(jackpotBackgroundImageView).offset(-8);
|
||
make.trailing.mas_equalTo(jackpotBackgroundImageView).offset(-5);
|
||
make.width.height.mas_equalTo(43);
|
||
}];
|
||
|
||
UIImageView *jackpotTitleImageView = [self jackpotTitleBG];
|
||
[self.giftsView addSubview:jackpotTitleImageView];
|
||
|
||
UILabel *jackpotTitleLabel = [self jackpotTitleLabel];
|
||
[self.giftsView addSubview:jackpotTitleLabel];
|
||
|
||
[jackpotTitleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(jackpotBackgroundImageView);
|
||
make.centerY.mas_equalTo(helpButton);
|
||
make.height.mas_equalTo(kGetScaleWidth(52));
|
||
make.leading.mas_equalTo(jackpotTitleLabel).offset(-40);
|
||
make.trailing.mas_equalTo(jackpotTitleLabel).offset(40);
|
||
}];
|
||
|
||
[jackpotTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(jackpotTitleImageView);
|
||
}];
|
||
|
||
UILabel *tipsLabel = [self jackpotTipsLabel];
|
||
[self.giftsView addSubview:tipsLabel];
|
||
[tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(jackpotTitleImageView.mas_bottom).offset(4.5);
|
||
make.leading.mas_equalTo(jackpotBackgroundImageView).offset(28);
|
||
make.trailing.mas_equalTo(jackpotBackgroundImageView).offset(-28);
|
||
}];
|
||
|
||
UIImageView *giftBigBG = [self jackpotGiftBigBG];
|
||
[self.giftsView addSubview:giftBigBG];
|
||
[giftBigBG mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(tipsLabel.mas_bottom).offset(11.5);
|
||
make.bottom.mas_equalTo(jackpotBackgroundImageView).offset(-11);
|
||
make.leading.mas_equalTo(jackpotBackgroundImageView).offset(32);
|
||
make.width.mas_equalTo(kGetScaleWidth(120));
|
||
}];
|
||
|
||
[giftBigBG addSubview:self.giftBig];
|
||
[self.giftBig mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(giftBigBG);
|
||
make.size.mas_equalTo(giftBigBG).multipliedBy(0.8);
|
||
}];
|
||
|
||
UIImageView *giftSmall_1 = [self jackpotGiftSmallBG];
|
||
[self.giftsView addSubview:giftSmall_1];
|
||
[giftSmall_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(giftBigBG);
|
||
make.leading.mas_equalTo(giftBigBG.mas_trailing).offset(13);
|
||
make.width.height.mas_equalTo(kGetScaleWidth(73.5));
|
||
}];
|
||
|
||
[giftSmall_1 addSubview:self.giftSmall_1];
|
||
[self.giftSmall_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(giftSmall_1);
|
||
make.size.mas_equalTo(giftSmall_1).multipliedBy(0.8);
|
||
}];
|
||
|
||
UIImageView *giftSmall_2 = [self jackpotGiftSmallBG];
|
||
[self.giftsView addSubview:giftSmall_2];
|
||
[giftSmall_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(giftBigBG);
|
||
make.leading.mas_equalTo(giftSmall_1.mas_trailing).offset(13);
|
||
make.width.height.mas_equalTo(kGetScaleWidth(73.5));
|
||
}];
|
||
|
||
[giftSmall_2 addSubview:self.giftSmall_2];
|
||
[self.giftSmall_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(giftSmall_2);
|
||
make.size.mas_equalTo(giftSmall_2).multipliedBy(0.8);
|
||
}];
|
||
|
||
UIImageView *giftSmall_3 = [self jackpotGiftSmallBG];
|
||
[self.giftsView addSubview:giftSmall_3];
|
||
[giftSmall_3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(giftSmall_1.mas_bottom).offset(5.5);
|
||
make.leading.mas_equalTo(giftBigBG.mas_trailing).offset(13);
|
||
make.width.height.mas_equalTo(kGetScaleWidth(73.5));
|
||
}];
|
||
|
||
[giftSmall_3 addSubview:self.giftSmall_3];
|
||
[self.giftSmall_3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(giftSmall_3);
|
||
make.size.mas_equalTo(giftSmall_3).multipliedBy(0.8);
|
||
}];
|
||
|
||
UIImageView *giftSmall_4 = [self jackpotGiftSmallBG];
|
||
[self.giftsView addSubview:giftSmall_4];
|
||
[giftSmall_4 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(giftSmall_3);
|
||
make.leading.mas_equalTo(giftSmall_3.mas_trailing).offset(13);
|
||
make.width.height.mas_equalTo(kGetScaleWidth(73.5));
|
||
}];
|
||
|
||
[giftSmall_4 addSubview:self.giftSmall_4];
|
||
[self.giftSmall_4 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(giftSmall_4);
|
||
make.size.mas_equalTo(giftSmall_4).multipliedBy(0.8);
|
||
}];
|
||
|
||
UIImageView *progressBG = [self progressBarBG];
|
||
[self.view addSubview:progressBG];
|
||
[progressBG mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.mas_equalTo(helpButton.mas_top).offset(-13);
|
||
make.trailing.mas_equalTo(self.view).offset(-6);
|
||
make.width.mas_equalTo(57);
|
||
make.height.mas_equalTo(kGetScaleWidth(240));
|
||
}];
|
||
|
||
[progressBG addSubview:self.progressBar];
|
||
[self.progressBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.leading.mas_equalTo(progressBG).offset(isMSRTL() ? 18 : 21);
|
||
make.bottom.mas_equalTo(progressBG).offset(kGetScaleWidth(-35));
|
||
make.width.mas_equalTo(18);
|
||
make.height.mas_equalTo(kGetScaleWidth(180)).multipliedBy(1);
|
||
}];
|
||
|
||
UIImageView *progressNumberBG = [self progressBarNumberBG];
|
||
[self.view addSubview:progressNumberBG];
|
||
[progressNumberBG mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.mas_equalTo(progressBG).offset(kGetScaleWidth(-13));
|
||
make.centerX.mas_equalTo(self.progressBar);
|
||
make.width.height.mas_equalTo(43);
|
||
}];
|
||
|
||
[self.view addSubview:self.progressLabel];
|
||
[self.progressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(progressNumberBG);
|
||
}];
|
||
|
||
[progressBG addSubview:self.ratioLabel];
|
||
[self.ratioLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(progressBG).offset(2);
|
||
make.centerY.mas_equalTo(progressBG);
|
||
}];
|
||
|
||
UIImageView *rocketsBG = [self rocketsBG];
|
||
[self.view addSubview:rocketsBG];
|
||
[rocketsBG mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.leading.mas_equalTo(self.view);
|
||
make.bottom.mas_equalTo(jackpotBackgroundImageView.mas_top);
|
||
make.width.mas_equalTo(kGetScaleWidth(71));
|
||
make.height.mas_equalTo(kGetScaleWidth(247));
|
||
}];
|
||
|
||
[rocketsBG addSubview:self.rocket_lv_5];
|
||
[self.rocket_lv_5 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(rocketsBG).offset(kGetScaleWidth(11.5));
|
||
make.leading.mas_equalTo(rocketsBG);
|
||
make.width.mas_equalTo(rocketsBG.mas_width).offset(-7.5);
|
||
make.height.mas_equalTo(kGetScaleWidth(38.5));
|
||
}];
|
||
|
||
[rocketsBG addSubview:self.rocket_lv_4];
|
||
[self.rocket_lv_4 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(self.rocket_lv_5.mas_bottom).offset(kGetScaleWidth(7));
|
||
make.leading.mas_equalTo(rocketsBG);
|
||
make.width.mas_equalTo(self.rocket_lv_5);
|
||
make.height.mas_equalTo(self.rocket_lv_5);
|
||
}];
|
||
|
||
[rocketsBG addSubview:self.rocket_lv_3];
|
||
[self.rocket_lv_3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(self.rocket_lv_4.mas_bottom).offset(kGetScaleWidth(7));
|
||
make.leading.mas_equalTo(rocketsBG);
|
||
make.width.mas_equalTo(self.rocket_lv_5);
|
||
make.height.mas_equalTo(self.rocket_lv_5);
|
||
}];
|
||
|
||
[rocketsBG addSubview:self.rocket_lv_2];
|
||
[self.rocket_lv_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(self.rocket_lv_3.mas_bottom).offset(kGetScaleWidth(7));
|
||
make.leading.mas_equalTo(rocketsBG);
|
||
make.width.mas_equalTo(self.rocket_lv_5);
|
||
make.height.mas_equalTo(self.rocket_lv_5);
|
||
}];
|
||
|
||
[rocketsBG addSubview:self.rocket_lv_1];
|
||
[self.rocket_lv_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(self.rocket_lv_2.mas_bottom).offset(kGetScaleWidth(7));
|
||
make.leading.mas_equalTo(rocketsBG);
|
||
make.width.mas_equalTo(self.rocket_lv_5);
|
||
make.height.mas_equalTo(self.rocket_lv_5);
|
||
}];
|
||
|
||
[self.view addSubview:self.rankingView];
|
||
[self.rankingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.bottom.mas_equalTo(self.view).offset(-16);
|
||
make.leading.mas_equalTo(self.view).offset(10);
|
||
make.trailing.mas_equalTo(self.view).offset(-10);
|
||
make.height.mas_equalTo(kGetScaleWidth(288));
|
||
}];
|
||
|
||
UIImageView *rankingBG = [self rankingBG];
|
||
[self.rankingView addSubview:rankingBG];
|
||
[rankingBG mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.edges.mas_equalTo(self.rankingView);
|
||
}];
|
||
|
||
UIButton *helpButton_2 = [self helpButton];
|
||
[self.rankingView addSubview:helpButton_2];
|
||
[helpButton_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(rankingBG).offset(-8);
|
||
make.trailing.mas_equalTo(rankingBG).offset(-3);
|
||
make.width.height.mas_equalTo(43);
|
||
}];
|
||
|
||
UIImageView *rankingTitleBG = [self rankingTitleBG];
|
||
[self.rankingView addSubview:rankingTitleBG];
|
||
[rankingTitleBG mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.top.mas_equalTo(rankingBG.mas_top).offset(-14);
|
||
make.centerX.mas_equalTo(self.rankingView);
|
||
// make.width.mas_equalTo(kGetScaleWidth(215));
|
||
make.height.mas_equalTo(kGetScaleWidth(52));
|
||
}];
|
||
|
||
UILabel *rankingTitleLabel = [self rankingTitleLabel];
|
||
[self.rankingView addSubview:rankingTitleLabel];
|
||
[rankingTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerY.mas_equalTo(rankingTitleBG);
|
||
make.leading.mas_equalTo(rankingTitleBG).offset(40);
|
||
make.trailing.mas_equalTo(rankingTitleBG).offset(-40);
|
||
}];
|
||
|
||
[self.rankingView addSubview:self.rankAvatar_1];
|
||
[self.rankAvatar_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(self.rankingView);
|
||
make.top.mas_equalTo(rankingBG).offset(kGetScaleWidth(60));
|
||
make.width.height.mas_equalTo(kGetScaleWidth(86));
|
||
}];
|
||
UIImageView *wear_1 = [self rankingAvatarWear];
|
||
[self.rankingView addSubview:wear_1];
|
||
[wear_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(self.rankAvatar_1);
|
||
make.width.height.mas_equalTo(kGetScaleWidth(124));
|
||
}];
|
||
|
||
[self.rankingView addSubview:self.rankAvatar_2];
|
||
[self.rankAvatar_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.leading.mas_equalTo(rankingBG).offset(30);
|
||
make.top.mas_equalTo(rankingBG).offset(kGetScaleWidth(108));
|
||
make.width.height.mas_equalTo(kGetScaleWidth(66));
|
||
}];
|
||
UIImageView *wear_2 = [self rankingAvatarWear];
|
||
[self.rankingView addSubview:wear_2];
|
||
[wear_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(self.rankAvatar_2);
|
||
make.width.height.mas_equalTo(kGetScaleWidth(94));
|
||
}];
|
||
|
||
[self.rankingView addSubview:self.rankAvatar_3];
|
||
[self.rankAvatar_3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.trailing.mas_equalTo(rankingBG).offset(-30);
|
||
make.top.mas_equalTo(rankingBG).offset(kGetScaleWidth(108));
|
||
make.width.height.mas_equalTo(kGetScaleWidth(66));
|
||
}];
|
||
UIImageView *wear_3 = [self rankingAvatarWear];
|
||
[self.rankingView addSubview:wear_3];
|
||
[wear_3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(self.rankAvatar_3);
|
||
make.width.height.mas_equalTo(kGetScaleWidth(94));
|
||
}];
|
||
|
||
UIImageView *nameBG_1 = [self rankingNameBG];
|
||
[self.rankingView addSubview:nameBG_1];
|
||
[nameBG_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(wear_1);
|
||
make.top.mas_equalTo(wear_1.mas_bottom).offset(6);
|
||
make.width.mas_equalTo(kGetScaleWidth(98));
|
||
make.height.mas_equalTo(kGetScaleWidth(28));
|
||
}];
|
||
[self.rankingView addSubview:self.rankName_1];
|
||
[self.rankName_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(nameBG_1);
|
||
}];
|
||
|
||
UIImageView *nameBG_2 = [self rankingNameBG];
|
||
[self.rankingView addSubview:nameBG_2];
|
||
[nameBG_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(wear_2);
|
||
make.top.mas_equalTo(wear_2.mas_bottom).offset(6);
|
||
make.width.mas_equalTo(kGetScaleWidth(98));
|
||
make.height.mas_equalTo(kGetScaleWidth(28));
|
||
}];
|
||
[self.rankingView addSubview:self.rankName_2];
|
||
[self.rankName_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(nameBG_2);
|
||
}];
|
||
|
||
UIImageView *nameBG_3 = [self rankingNameBG];
|
||
[self.rankingView addSubview:nameBG_3];
|
||
[nameBG_3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(wear_3);
|
||
make.top.mas_equalTo(wear_3.mas_bottom).offset(6);
|
||
make.width.mas_equalTo(kGetScaleWidth(98));
|
||
make.height.mas_equalTo(kGetScaleWidth(28));
|
||
}];
|
||
[self.rankingView addSubview:self.rankName_3];
|
||
[self.rankName_3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.center.mas_equalTo(nameBG_3);
|
||
}];
|
||
|
||
[self.rankingView addSubview:self.rankTipsLabel];
|
||
[self.rankingView addSubview:self.rankTipsLabel];
|
||
[self.rankTipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
make.centerX.mas_equalTo(self.rankingView);
|
||
make.bottom.mas_equalTo(-15);
|
||
}];
|
||
}
|
||
|
||
- (void)handleTapBottomButton {
|
||
@kWeakify(self);
|
||
[self dismissViewControllerAnimated:YES completion:^{
|
||
@kStrongify(self);
|
||
if (self.showGiftPanel) {
|
||
self.showGiftPanel();
|
||
}
|
||
}];
|
||
}
|
||
|
||
- (void)handleTapHelpButton {
|
||
[self dismissViewControllerAnimated:YES completion:^{
|
||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomUid];
|
||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||
webView.roomUid = roomUid;
|
||
webView.url = [NSString stringWithFormat:@"%@%@", URLWithType(KBoomRule), self.partitionId];
|
||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||
}];
|
||
}
|
||
|
||
- (void)handleTapEmptySpace {
|
||
[self dismissViewControllerAnimated:YES completion:nil];
|
||
}
|
||
|
||
- (void)handleTapRocket:(BoomDetailModel * _Nullable )boom level:(NSInteger)level {
|
||
|
||
self.selectedIndex = level;
|
||
|
||
self.rocket_lv_1.isSelected = NO;
|
||
self.rocket_lv_2.isSelected = NO;
|
||
self.rocket_lv_3.isSelected = NO;
|
||
self.rocket_lv_4.isSelected = NO;
|
||
self.rocket_lv_5.isSelected = NO;
|
||
|
||
switch (level) {
|
||
case 1:
|
||
self.rocket_lv_1.isSelected = YES;
|
||
break;
|
||
case 2:
|
||
self.rocket_lv_2.isSelected = YES;
|
||
break;
|
||
case 3:
|
||
self.rocket_lv_3.isSelected = YES;
|
||
break;
|
||
case 4:
|
||
self.rocket_lv_4.isSelected = YES;
|
||
break;
|
||
case 5:
|
||
self.rocket_lv_5.isSelected = YES;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
if (boom == nil) {
|
||
for (BoomDetailModel *boomInfo in self.boomInfoArray) {
|
||
if (boomInfo.level == level) {
|
||
boom = boomInfo;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
self.progressLabel.text = @(boom.speed).stringValue;
|
||
CGFloat progress = boom.speed * 1.0 / 100.0;
|
||
if (progress == 0) {
|
||
progress = 0.1;
|
||
}
|
||
|
||
// 更新比值 label 并保持发光效果
|
||
NSString *ratioText = [NSString stringWithFormat:@"%@/%@",
|
||
@(floor(boom.exp * boom.speed / 100.0)).stringValue,
|
||
@(boom.exp).stringValue];
|
||
|
||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:ratioText];
|
||
[attributedString addAttribute:NSStrokeColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, attributedString.length)];
|
||
[attributedString addAttribute:NSStrokeWidthAttributeName value:@(-2.0) range:NSMakeRange(0, attributedString.length)];
|
||
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, attributedString.length)];
|
||
[attributedString addAttribute:NSFontAttributeName value:kFontMedium(14) range:NSMakeRange(0, attributedString.length)];
|
||
self.ratioLabel.attributedText = attributedString;
|
||
|
||
[UIView animateWithDuration:0.2 animations:^{
|
||
[self.progressBar mas_updateConstraints:^(MASConstraintMaker *make) {
|
||
make.height.mas_equalTo(kGetScaleWidth(180) * progress); // 动态调整高度
|
||
}];
|
||
[self.view layoutIfNeeded];
|
||
}];
|
||
|
||
[self playMP4:boom.vapUrl];
|
||
|
||
if (boom.roomBoomRankVos.count > 0) {
|
||
self.rankingView.hidden = NO;
|
||
self.giftsView.hidden = YES;
|
||
|
||
self.rankName_1.text = @"";
|
||
self.rankName_2.text = @"";
|
||
self.rankName_3.text = @"";
|
||
self.rankAvatar_1.imageUrl = @"";
|
||
self.rankAvatar_2.imageUrl = @"";
|
||
self.rankAvatar_3.imageUrl = @"";
|
||
|
||
for (roomBoomRankVo *rank in boom.roomBoomRankVos) {
|
||
switch (rank.position) {
|
||
case 1:
|
||
self.rankAvatar_1.imageUrl = rank.avatar;
|
||
self.rankName_1.text = rank.nick;
|
||
break;
|
||
case 2:
|
||
self.rankAvatar_2.imageUrl = rank.avatar;
|
||
self.rankName_2.text = rank.nick;
|
||
break;
|
||
case 3:
|
||
self.rankAvatar_3.imageUrl = rank.avatar;
|
||
self.rankName_3.text = rank.nick;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
} else {
|
||
self.rankingView.hidden = YES;
|
||
self.giftsView.hidden = NO;
|
||
|
||
self.giftBig.image = nil;
|
||
self.giftSmall_1.image = nil;
|
||
self.giftSmall_2.image = nil;
|
||
self.giftSmall_3.image = nil;
|
||
self.giftSmall_4.image = nil;
|
||
|
||
for (roomBoomLevelAwardVo *award in boom.roomBoomLevelAwardVos) {
|
||
if (award.isShow != 1) {
|
||
continue;
|
||
}
|
||
NSString *pic = [award.awardPic stringByRemovingPercentEncoding];
|
||
switch (award.seq) {
|
||
case 1:
|
||
self.giftBig.imageUrl = pic;
|
||
break;
|
||
case 2:
|
||
self.giftSmall_1.imageUrl = pic;
|
||
break;
|
||
case 3:
|
||
self.giftSmall_2.imageUrl = pic;
|
||
break;
|
||
case 4:
|
||
self.giftSmall_3.imageUrl = pic;
|
||
break;
|
||
case 5:
|
||
self.giftSmall_4.imageUrl = pic;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
- (void)playMP4:(NSString *)path {
|
||
NSString *mp4Path = [path pureURLString];
|
||
if (mp4Path.length == 0) {
|
||
return;
|
||
}
|
||
|
||
@kWeakify(self);
|
||
[self.vapParser parseWithURL:mp4Path completionBlock:^(NSString * _Nullable videoUrl) {
|
||
@kStrongify(self);
|
||
if (videoUrl.length) {
|
||
[self.vapView setMute:YES];
|
||
[self.vapView playHWDMP4:videoUrl repeatCount:-1 delegate:self];
|
||
}
|
||
} failureBlock:^(NSError * _Nullable error) {
|
||
// NSLog(@"%@", error);
|
||
}];
|
||
}
|
||
|
||
#pragma mark - HWDMP4PlayDelegate
|
||
//即将开始播放时询问,true马上开始播放,false放弃播放
|
||
- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config {
|
||
return YES;
|
||
}
|
||
|
||
- (void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container {
|
||
|
||
}
|
||
|
||
- (void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container {
|
||
|
||
}
|
||
|
||
- (void)viewDidFailPlayMP4:(NSError *)error{
|
||
|
||
}
|
||
|
||
#pragma mark -
|
||
- (UILabel *)progressLabel {
|
||
if (!_progressLabel) {
|
||
_progressLabel = [UILabel labelInitWithText:@""
|
||
font:kFontMedium(15)
|
||
textColor:UIColorFromRGB(0xF0E7BA)];
|
||
_progressLabel.textAlignment = NSTextAlignmentCenter;
|
||
}
|
||
return _progressLabel;
|
||
}
|
||
|
||
- (UIButton *)leaveButton {
|
||
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[b addTarget:self action:@selector(handleTapEmptySpace) forControlEvents:UIControlEventTouchUpInside];
|
||
return b;
|
||
}
|
||
|
||
- (UIImageView *)backgroundImageView {
|
||
UIImageView *bg = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_bg")];
|
||
bg.contentMode = UIViewContentModeScaleAspectFill;
|
||
bg.userInteractionEnabled = YES;
|
||
return bg;
|
||
}
|
||
|
||
- (UIView *)giftsView {
|
||
if (!_giftsView) {
|
||
_giftsView = [[UIView alloc] init];
|
||
_giftsView.hidden = YES;
|
||
}
|
||
return _giftsView;
|
||
}
|
||
|
||
- (UIButton *)bottomButton {
|
||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[button setTitle:YMLocalizedString(@"RoomBoom_2") forState:UIControlStateNormal];
|
||
[button setBackgroundImage:kImage(@"room_boom_progress_bottom_bg") forState:UIControlStateNormal];
|
||
[button addTarget:self action:@selector(handleTapBottomButton) forControlEvents:UIControlEventTouchUpInside];
|
||
return button;
|
||
}
|
||
|
||
- (UIImageView *)jackpotBackgroundImageView {
|
||
UIImageView *bg = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_jackpot_bg")];
|
||
bg.contentMode = UIViewContentModeScaleAspectFill;
|
||
return bg;
|
||
}
|
||
|
||
- (UIButton *)helpButton {
|
||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
[button setBackgroundImage:kImage(@"room_boom_progress_help") forState:UIControlStateNormal];
|
||
[button addTarget:self action:@selector(handleTapHelpButton) forControlEvents:UIControlEventTouchUpInside];
|
||
return button;
|
||
}
|
||
|
||
- (UIImageView *)jackpotTitleBG {
|
||
UIImage *image = [kImage(@"room_boom_result_top_bg") resizableImageWithCapInsets:UIEdgeInsetsMake(0, 40, 0, 40) resizingMode:UIImageResizingModeStretch];
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
|
||
return imageView;
|
||
}
|
||
|
||
- (UILabel *)jackpotTitleLabel {
|
||
UILabel *label = [UILabel labelInitWithText:YMLocalizedString(@"RoomBoom_8")
|
||
font:kFontMedium(17.5)
|
||
textColor:UIColorFromRGB(0xF0E7BA)];
|
||
label.textAlignment = NSTextAlignmentCenter;
|
||
return label;
|
||
}
|
||
|
||
|
||
- (UILabel *)jackpotTipsLabel {
|
||
UILabel *label = [UILabel labelInitWithText:YMLocalizedString(@"RoomBoom_10") font:kFontRegular(10) textColor:UIColorFromRGB(0xCBA1FF)];
|
||
label.textAlignment = NSTextAlignmentCenter;
|
||
label.numberOfLines = 2;
|
||
return label;
|
||
}
|
||
|
||
- (UIImageView *)jackpotGiftBigBG {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_gift_big_bg")];
|
||
return imageView;
|
||
}
|
||
|
||
- (UIImageView *)jackpotGiftSmallBG {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_gift_small_bg")];
|
||
return imageView;
|
||
}
|
||
|
||
- (UIView *)rankingView {
|
||
if (!_rankingView) {
|
||
_rankingView = [[UIView alloc] init];
|
||
_rankingView.hidden = YES;
|
||
}
|
||
return _rankingView;
|
||
}
|
||
|
||
- (UIImageView *)rankingBG {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_ranking_bg")];
|
||
return imageView;
|
||
}
|
||
|
||
- (UIImageView *)rankingTitleBG {
|
||
UIImage *image = [kImage(@"room_boom_result_top_bg") resizableImageWithCapInsets:UIEdgeInsetsMake(0, 40, 0, 40) resizingMode:UIImageResizingModeTile];
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
|
||
return imageView;
|
||
}
|
||
|
||
- (UILabel *)rankingTitleLabel {
|
||
UILabel *label = [UILabel labelInitWithText:YMLocalizedString(@"RoomBoom_7")
|
||
font:kFontMedium(17.5)
|
||
textColor:UIColorFromRGB(0xF0E7BA)];
|
||
label.textAlignment = NSTextAlignmentCenter;
|
||
return label;
|
||
}
|
||
|
||
- (UIImageView *)rankingAvatarWear {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_avatar")];
|
||
return imageView;
|
||
}
|
||
|
||
- (UIImageView *)rankingNameBG {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_ranking_name_bg")];
|
||
return imageView;
|
||
}
|
||
|
||
- (UILabel *)rankName_1 {
|
||
if (!_rankName_1) {
|
||
_rankName_1 = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:UIColorFromRGB(0xF0E7BA)];
|
||
}
|
||
return _rankName_1;
|
||
}
|
||
|
||
- (UILabel *)rankName_2 {
|
||
if (!_rankName_2) {
|
||
_rankName_2 = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:UIColorFromRGB(0xF0E7BA)];
|
||
}
|
||
return _rankName_2;
|
||
}
|
||
|
||
- (UILabel *)rankName_3 {
|
||
if (!_rankName_3) {
|
||
_rankName_3 = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:UIColorFromRGB(0xF0E7BA)];
|
||
}
|
||
return _rankName_3;
|
||
}
|
||
|
||
- (NetImageConfig *)avatarConfig {
|
||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||
config.imageType = ImageTypeUserIcon;
|
||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||
return config;
|
||
}
|
||
|
||
- (NetImageView *)rankAvatar_1 {
|
||
if (!_rankAvatar_1) {
|
||
_rankAvatar_1 = [[NetImageView alloc] initWithConfig:self.avatarConfig];
|
||
_rankAvatar_1.contentMode = UIViewContentModeScaleAspectFit;
|
||
_rankAvatar_1.layer.cornerRadius = 86/2;
|
||
_rankAvatar_1.layer.masksToBounds = YES;
|
||
}
|
||
return _rankAvatar_1;
|
||
}
|
||
|
||
- (NetImageView *)rankAvatar_2 {
|
||
if (!_rankAvatar_2) {
|
||
_rankAvatar_2 = [[NetImageView alloc] initWithConfig:self.avatarConfig];
|
||
_rankAvatar_2.contentMode = UIViewContentModeScaleAspectFit;
|
||
_rankAvatar_2.layer.cornerRadius = 66/2;
|
||
_rankAvatar_2.layer.masksToBounds = YES;
|
||
}
|
||
return _rankAvatar_2;
|
||
}
|
||
|
||
- (NetImageView *)rankAvatar_3 {
|
||
if (!_rankAvatar_3) {
|
||
_rankAvatar_3 = [[NetImageView alloc] initWithConfig:self.avatarConfig];
|
||
_rankAvatar_3.contentMode = UIViewContentModeScaleAspectFit;
|
||
_rankAvatar_3.layer.cornerRadius = 66/2;
|
||
_rankAvatar_3.layer.masksToBounds = YES;
|
||
}
|
||
return _rankAvatar_3;
|
||
}
|
||
|
||
- (UIImageView *)progressBarBG {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_bar_bg")];
|
||
return imageView;
|
||
}
|
||
|
||
- (UIImageView *)progressBarNumberBG {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_number_bg")];
|
||
return imageView;
|
||
}
|
||
|
||
- (UIImageView *)rocketsBG {
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:kImage(@"room_boom_progress_rockets_bg")];
|
||
imageView.userInteractionEnabled = YES;
|
||
return imageView;
|
||
}
|
||
|
||
- (NetImageView *)giftBig {
|
||
if (!_giftBig) {
|
||
_giftBig = [[NetImageView alloc] init];
|
||
_giftBig.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _giftBig;
|
||
}
|
||
|
||
- (NetImageView *)giftSmall_1 {
|
||
if (!_giftSmall_1) {
|
||
_giftSmall_1 = [[NetImageView alloc] init];
|
||
_giftSmall_1.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _giftSmall_1;
|
||
}
|
||
|
||
- (NetImageView *)giftSmall_2 {
|
||
if (!_giftSmall_2) {
|
||
_giftSmall_2 = [[NetImageView alloc] init];
|
||
_giftSmall_2.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _giftSmall_2;
|
||
}
|
||
|
||
- (NetImageView *)giftSmall_3 {
|
||
if (!_giftSmall_3) {
|
||
_giftSmall_3 = [[NetImageView alloc] init];
|
||
_giftSmall_3.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _giftSmall_3;
|
||
}
|
||
|
||
- (NetImageView *)giftSmall_4 {
|
||
if (!_giftSmall_4) {
|
||
_giftSmall_4 = [[NetImageView alloc] init];
|
||
_giftSmall_4.contentMode = UIViewContentModeScaleAspectFit;
|
||
}
|
||
return _giftSmall_4;
|
||
}
|
||
|
||
- (RocketBox *)rocket_lv_1 {
|
||
if (!_rocket_lv_1) {
|
||
_rocket_lv_1 = [[RocketBox alloc] init];
|
||
_rocket_lv_1.level = 1;
|
||
@kWeakify(self);
|
||
_rocket_lv_1.didTapRocket = ^(NSInteger level) {
|
||
@kStrongify(self);
|
||
[self handleTapRocket:nil level:level];
|
||
};
|
||
}
|
||
return _rocket_lv_1;
|
||
}
|
||
|
||
- (RocketBox *)rocket_lv_2 {
|
||
if (!_rocket_lv_2) {
|
||
_rocket_lv_2 = [[RocketBox alloc] init];
|
||
_rocket_lv_2.level = 2;
|
||
@kWeakify(self);
|
||
_rocket_lv_2.didTapRocket = ^(NSInteger level) {
|
||
@kStrongify(self);
|
||
[self handleTapRocket:nil level:level];
|
||
};
|
||
}
|
||
return _rocket_lv_2;
|
||
}
|
||
|
||
- (RocketBox *)rocket_lv_3 {
|
||
if (!_rocket_lv_3) {
|
||
_rocket_lv_3 = [[RocketBox alloc] init];
|
||
_rocket_lv_3.level = 3;
|
||
@kWeakify(self);
|
||
_rocket_lv_3.didTapRocket = ^(NSInteger level) {
|
||
@kStrongify(self);
|
||
[self handleTapRocket:nil level:level];
|
||
};
|
||
}
|
||
return _rocket_lv_3;
|
||
}
|
||
|
||
- (RocketBox *)rocket_lv_4 {
|
||
if (!_rocket_lv_4) {
|
||
_rocket_lv_4 = [[RocketBox alloc] init];
|
||
_rocket_lv_4.level = 4;
|
||
@kWeakify(self);
|
||
_rocket_lv_4.didTapRocket = ^(NSInteger level) {
|
||
@kStrongify(self);
|
||
[self handleTapRocket:nil level:level];
|
||
};
|
||
}
|
||
return _rocket_lv_4;
|
||
}
|
||
|
||
- (RocketBox *)rocket_lv_5 {
|
||
if (!_rocket_lv_5) {
|
||
_rocket_lv_5 = [[RocketBox alloc] init];
|
||
_rocket_lv_5.level = 5;
|
||
@kWeakify(self);
|
||
_rocket_lv_5.didTapRocket = ^(NSInteger level) {
|
||
@kStrongify(self);
|
||
[self handleTapRocket:nil level:level];
|
||
};
|
||
}
|
||
return _rocket_lv_5;
|
||
}
|
||
|
||
- (XPRoomGiftAnimationParser *)vapParser {
|
||
if (!_vapParser) {
|
||
_vapParser = [[XPRoomGiftAnimationParser alloc] init];
|
||
}
|
||
return _vapParser;
|
||
}
|
||
|
||
- (UIImageView *)progressBar {
|
||
if (!_progressBar) {
|
||
UIImage *progressImage = [kImage(@"room_boom_progress_bar") resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 20, 0) resizingMode:UIImageResizingModeTile];
|
||
_progressBar = [[UIImageView alloc] initWithImage:progressImage];
|
||
_progressBar.userInteractionEnabled = YES;
|
||
_progressBar.hidden = NO;
|
||
_progressBar.clipsToBounds = YES;
|
||
}
|
||
return _progressBar;
|
||
}
|
||
|
||
- (UILabel *)rankTipsLabel {
|
||
if (!_rankTipsLabel) {
|
||
_rankTipsLabel = [UILabel labelInitWithText:@"" font:kFontLight(12) textColor:[UIColor whiteColor]];
|
||
_rankTipsLabel.textAlignment = NSTextAlignmentCenter;
|
||
}
|
||
return _rankTipsLabel;
|
||
}
|
||
|
||
- (UILabel *)ratioLabel {
|
||
if (!_ratioLabel) {
|
||
_ratioLabel = [UILabel labelInitWithText:@"0/0" font:kFontMedium(14) textColor:[UIColor blackColor]];
|
||
_ratioLabel.textAlignment = NSTextAlignmentCenter;
|
||
_ratioLabel.transform = CGAffineTransformMakeRotation(M_PI_2); // 顺时针旋转90度
|
||
|
||
// 添加发光效果
|
||
_ratioLabel.layer.shadowColor = [UIColor whiteColor].CGColor;
|
||
_ratioLabel.layer.shadowOffset = CGSizeZero;
|
||
_ratioLabel.layer.shadowRadius = 3.0;
|
||
_ratioLabel.layer.shadowOpacity = 0.8;
|
||
_ratioLabel.layer.masksToBounds = NO;
|
||
|
||
// 添加文字描边效果
|
||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"0/0"];
|
||
[attributedString addAttribute:NSStrokeColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, attributedString.length)];
|
||
[attributedString addAttribute:NSStrokeWidthAttributeName value:@(-2.0) range:NSMakeRange(0, attributedString.length)];
|
||
_ratioLabel.attributedText = attributedString;
|
||
}
|
||
return _ratioLabel;
|
||
}
|
||
|
||
|
||
@end
|