1.0.19 feat:基本完成所有需求 & bug fix

This commit is contained in:
eggmanQQQ
2024-11-11 19:35:21 +08:00
parent efefa94d3c
commit 00014f0327
63 changed files with 1239 additions and 367 deletions

View File

@@ -7,6 +7,13 @@
#import "RoomHighValueGiftBannerAnimation.h"
#import "SVGA.h"
#import "AttachmentModel.h"
#import "GiftReceiveInfoModel.h"
#import "XCCurrentVCStackManager.h"
#import "XPRoomViewController.h"
#import "RoomHostDelegate.h"
#import "RoomInfoModel.h"
#import "XPSkillCardPlayerManager.h"
@interface RoomHighValueGiftBannerAnimation ()
@@ -26,6 +33,8 @@
@property (nonatomic,strong) UILabel *giftCountLabel;
///
@property(nonatomic,strong) UIButton *goButton;
@property (nonatomic, assign) NSInteger roomUid;
@property (nonatomic, copy) NSString *bgSourceName;
@property (nonatomic, copy) void(^animationComplete)(void);
@@ -34,20 +43,48 @@
@implementation RoomHighValueGiftBannerAnimation
+ (void)display:(UIView *)superView
with:(id)attachment
tapToRoom:(BOOL)handleTapToRoom
with:(AttachmentModel *)attachment
complete:(void(^)(void))complete {
NSInteger height = kGetScaleWidth(110);
NSInteger y = kStatusBarHeight;
GiftReceiveInfoModel *giftNotifyInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
__block RoomHighValueGiftBannerAnimation *banner = [[RoomHighValueGiftBannerAnimation alloc] initWithFrame:CGRectMake(KScreenWidth, y, KScreenWidth, height)];
banner.animationComplete = complete;
banner.senderAvatarView.imageUrl = giftNotifyInfo.sendUserAvatar;
banner.giftImageView.imageUrl = giftNotifyInfo.giftUrl;
banner.roomNameScrollLabel.text = giftNotifyInfo.roomTitle;
banner.senderScrollLabel.text = [NSString stringWithFormat:@"%@ %@ %@", giftNotifyInfo.sendUserNick, YMLocalizedString(@"XPSessionFindNewGreetListView3"), giftNotifyInfo.recvUserNick];
banner.giftNameLabel.text = giftNotifyInfo.giftName;
banner.giftCountLabel.text = [NSString stringWithFormat:@"x %ld", (long)giftNotifyInfo.giftNum];
banner.roomUid = giftNotifyInfo.roomUid;
banner.senderScrollLabel.text = @"roomUidinteger($int64) (query)";
banner.roomNameScrollLabel.text = @"roomUidinteger($int64) (query)";
banner.giftNameLabel.text = @"yijgish";
banner.giftCountLabel.text = @"x!0";
switch (giftNotifyInfo.bgLevel) {
case 1:
banner.bgSourceName = @"gift_normal_1";
break;
case 2:
banner.bgSourceName = @"gift_normal_2";
break;
case 3:
banner.bgSourceName = @"gift_normal_3";
break;
case 4:
banner.bgSourceName = @"gift_vip_1";
break;
case 5:
banner.bgSourceName = @"gift_vip_2";
break;
case 6:
banner.bgSourceName = @"gift_vip_3";
break;
default:
banner.bgSourceName = @"gift_normal_1";
break;
}
[superView addSubview:banner];
@@ -55,7 +92,7 @@
[UIView animateWithDuration:0.25 animations:^{
banner.frame = CGRectMake(0, y, KScreenWidth, height);
} completion:^(BOOL finished) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(112.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
banner.frame = CGRectMake(-KScreenWidth, y, KScreenWidth, height);
} completion:^(BOOL finished) {
@@ -69,23 +106,61 @@
}];
}
- (void)handleTapGo {
//
UIViewController * controllerView = [XCCurrentVCStackManager shareManager].getCurrentVC;
__block XPRoomViewController<RoomHostDelegate> *roomVC = nil;
[controllerView.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[XPRoomViewController class]]) {
[controllerView.navigationController popToRootViewControllerAnimated:NO];
roomVC = obj;
*stop = YES;
}
}];
if (roomVC) {
//
if ([roomVC getRoomInfo].uid == self.roomUid) {
return;
}
__block NSString *targetRoomUid = @(self.roomUid).stringValue;
[TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{
[roomVC exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:targetRoomUid
viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
} cancelHandler:^{}];
} else {
[XPRoomViewController openRoom:@(self.roomUid).stringValue
viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
}
}
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self setupUI];
@kWeakify(self);
SVGAParser *parser = [[SVGAParser alloc] init];
[parser parseWithNamed:@"gift_VIP_1" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.svgaImageView.videoItem = videoItem;
[self.svgaImageView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
// TODO:
}];
}
return self;
}
- (void)setBgSourceName:(NSString *)bgSourceName {
_bgSourceName = bgSourceName;
@kWeakify(self);
SVGAParser *parser = [[SVGAParser alloc] init];
[parser parseWithNamed:self.bgSourceName
inBundle:[NSBundle mainBundle]
completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.svgaImageView.videoItem = videoItem;
[self.svgaImageView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
// TODO:
}];
}
- (void)setupUI {
[self addSubview:self.backImageView];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -113,7 +188,7 @@
[self addSubview:self.senderScrollLabel];
[self.senderScrollLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(38);
make.top.mas_equalTo(40);
make.leading.mas_equalTo(self.senderAvatarView.mas_trailing).offset(4);
make.trailing.mas_equalTo(self.giftImageView.mas_leading).offset(-4);
make.height.mas_equalTo(16);
@@ -121,7 +196,7 @@
[self addSubview:self.giftNameLabel];
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.senderScrollLabel.mas_bottom).offset(4);
make.top.mas_equalTo(self.senderScrollLabel.mas_bottom).offset(8);
make.leading.mas_equalTo(self.senderAvatarView.mas_trailing).offset(4);
make.height.mas_equalTo(16);
}];
@@ -138,7 +213,7 @@
[room mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.giftImageView.mas_trailing).offset(2);
make.top.mas_equalTo(self.giftImageView);
make.width.height.mas_equalTo(11);
make.width.height.mas_equalTo(16);
}];
[self addSubview:self.roomNameScrollLabel];
@@ -191,7 +266,8 @@
_senderScrollLabel.scrollDuration = 6.0;
_senderScrollLabel.textColor = [UIColor whiteColor];
_senderScrollLabel.fadeLength = 8.0f;
_senderScrollLabel.textAlignment = NSTextAlignmentCenter;
_senderScrollLabel.font = kFontMedium(11);
_senderScrollLabel.textAlignment = NSTextAlignmentLeft;
}
return _senderScrollLabel;
}
@@ -202,7 +278,8 @@
_roomNameScrollLabel.textColor = [UIColor whiteColor];
_roomNameScrollLabel.scrollDuration = 6.0;
_roomNameScrollLabel.fadeLength = 8.0f;
_roomNameScrollLabel.textAlignment = NSTextAlignmentCenter;
_roomNameScrollLabel.font = kFontMedium(11);
_roomNameScrollLabel.textAlignment = NSTextAlignmentLeft;
}
return _roomNameScrollLabel;
}
@@ -242,10 +319,23 @@
if(!_goButton){
_goButton = [UIButton new];
[_goButton setTitle:YMLocalizedString(@"XPAcrossRoomPKPanelView3") forState:UIControlStateNormal];
[_goButton setTitleColor:UIColorFromRGB(0x442a00) forState:UIControlStateNormal];
_goButton.titleLabel.font = kFontRegular(10);
_goButton.layer.cornerRadius = kGetScaleWidth(20)/2;
_goButton.layer.borderWidth = 1;
_goButton.layer.masksToBounds = YES;
//
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)UIColorFromRGB(0xFFFADE).CGColor,
(__bridge id)UIColorFromRGB(0xFFE184).CGColor];
gradientLayer.startPoint = CGPointMake(0.0, 0.5); //
gradientLayer.endPoint = CGPointMake(1.0, 0.5); //
gradientLayer.frame = CGRectMake(0, 0, 55, 20); //
//
[_goButton.layer insertSublayer:gradientLayer atIndex:0];
[_goButton addTarget:self
action:@selector(handleTapGo)
forControlEvents:UIControlEventTouchUpInside];
}
return _goButton;
}