首页增加PK中动画标签

This commit is contained in:
chenguilong
2022-04-18 19:55:06 +08:00
parent 4c56587ca8
commit 49cbfc3a43
5 changed files with 97 additions and 2 deletions

View File

@@ -153,6 +153,7 @@
9B3A1DF4280571000058E2DD /* XPAnchorPKInviteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */; };
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; };
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; };
9B5F1503280FF02600C3C2B1 /* anchorPk_crossPking.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B5F1502280FF02600C3C2B1 /* anchorPk_crossPking.svga */; };
9B6B3AAB278C2EA7005551EC /* XPRoomNobleLevelUpView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */; };
9B73CD05279A9A6A006AF255 /* XPSkillCardSaveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD04279A9A6A006AF255 /* XPSkillCardSaveModel.m */; };
9B73CD09279A9AA2006AF255 /* XPSkillCardUpdatePropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD08279A9AA2006AF255 /* XPSkillCardUpdatePropModel.m */; };
@@ -924,6 +925,7 @@
9B5BF8A627E1BED1005DD346 /* Api+RoomTrumpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+RoomTrumpet.h"; sourceTree = "<group>"; };
9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+RoomTrumpet.m"; sourceTree = "<group>"; };
9B5BF8A927E1BF45005DD346 /* XPRoomTrumpetProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetProtocol.h; sourceTree = "<group>"; };
9B5F1502280FF02600C3C2B1 /* anchorPk_crossPking.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchorPk_crossPking.svga; sourceTree = "<group>"; };
9B6B3AA9278C2EA7005551EC /* XPRoomNobleLevelUpView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomNobleLevelUpView.h; sourceTree = "<group>"; };
9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomNobleLevelUpView.m; sourceTree = "<group>"; };
9B73CD03279A9A6A006AF255 /* XPSkillCardSaveModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardSaveModel.h; sourceTree = "<group>"; };
@@ -4443,6 +4445,7 @@
E8A1E45C276220B100B294CA /* Sources */ = {
isa = PBXGroup;
children = (
9B5F1502280FF02600C3C2B1 /* anchorPk_crossPking.svga */,
9B0AABDD280D4CD20025269D /* anchorPK_vs.svga */,
E88863C2278E7BCC004BCFAB /* crossRoomPk_progress.svga */,
9B85F34F2806A34B006EDF51 /* anchorPK_progress.svga */,
@@ -5309,6 +5312,7 @@
E8937AC7276C3EDE00B2C7E1 /* svga_member_in_lv40.svga in Resources */,
E8A1E461276220DA00B294CA /* candyTree.svga in Resources */,
E8937AC9276C3EDE00B2C7E1 /* svga_member_in_lv90.svga in Resources */,
9B5F1503280FF02600C3C2B1 /* anchorPk_crossPking.svga in Resources */,
E8937ACC276C3EDE00B2C7E1 /* svga_member_in_lv80.svga in Resources */,
9BE29A6B27D1BFF700446AB5 /* anchor_room_speak.svga in Resources */,
9BE29A6D27D210A500446AB5 /* anchor_room_bg.svga in Resources */,

View File

@@ -8,6 +8,7 @@
#import "XPHomeHotRoomCollectionViewCell.h"
///Third
#import <Masonry/Masonry.h>
#import <SVGA.h>
///Tool
#import "NetImageView.h"
#import "ThemeColor.h"
@@ -37,6 +38,10 @@
@property (nonatomic,strong) UILabel *nickLabel;
///
@property (nonatomic,strong) UIView *rippleView;
///
@property (strong, nonatomic) SVGAParser *parser;
///PK
@property (nonatomic, strong) SVGAImageView *svgDisplayView;
@end
@implementation XPHomeHotRoomCollectionViewCell
@@ -56,6 +61,7 @@
[self.contentView addSubview:self.backImageView];
[self.backImageView addSubview:self.rippleView];
[self.backImageView addSubview:self.roomTagImageView];
[self.backImageView addSubview:self.svgDisplayView];
[self.backImageView addSubview:self.roomDesLabel];
[self.backImageView addSubview:self.notImageView];
[self.backImageView addSubview:self.roomTitleLabel];
@@ -114,6 +120,11 @@
make.left.top.mas_equalTo(self.backImageView);
}];
[self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.mas_equalTo(self.contentView);
make.size.mas_equalTo(CGSizeMake(40, 20));
}];
[self.roomDesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backImageView).offset(13 * kScreenScale);
make.right.mas_equalTo(self.backImageView).offset(-4 *kScreenScale);
@@ -170,6 +181,22 @@
self.nickLabel.text = _hotRoomInfo.nick;
self.sexImageView.image = _hotRoomInfo.gender == GenderType_Female ? [UIImage imageNamed:@"common_female"] : [UIImage imageNamed:@"common_male"];
self.roomDesLabel.text = _hotRoomInfo.roomDesc;
if (hotRoomInfo.crossPking) {
self.roomTagImageView.hidden = YES;
self.svgDisplayView.hidden = NO;
[self.parser parseWithNamed:@"anchorPk_crossPking" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
self.svgDisplayView.loops = INT_MAX;
self.svgDisplayView.clearsAfterStop = NO;
self.svgDisplayView.videoItem = videoItem;
[self.svgDisplayView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
} else {
self.roomTagImageView.hidden = NO;
[self.svgDisplayView stopAnimation];
self.svgDisplayView.hidden = YES;
}
}
}
@@ -266,5 +293,21 @@
return _rippleView;
}
- (SVGAImageView *)svgDisplayView {
if (_svgDisplayView == nil) {
_svgDisplayView = [[SVGAImageView alloc]init];
_svgDisplayView.contentMode = UIViewContentModeScaleToFill;
_svgDisplayView.userInteractionEnabled = NO;
_svgDisplayView.backgroundColor = [UIColor clearColor];
}
return _svgDisplayView;
}
- (SVGAParser *)parser {
if (!_parser) {
_parser = [[SVGAParser alloc]init];
}
return _parser;
}
@end

View File

@@ -11,6 +11,7 @@
///Tool
#import "ThemeColor.h"
#import "UIImage+Utils.h"
#import <SVGA.h>
///Model
#import "HomeRecommendRoomModel.h"
///View
@@ -34,6 +35,10 @@
@property (nonatomic,strong) XPNoteView *noteView;
///线
@property (nonatomic,strong) UILabel *numberLabel;
///
@property (strong, nonatomic) SVGAParser *parser;
///PK
@property (nonatomic, strong) SVGAImageView *svgDisplayView;
@end
@implementation XPHomeListCollectionViewCell
@@ -51,6 +56,7 @@
- (void)initSubViews {
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.tagImageView];
[self.contentView addSubview:self.svgDisplayView];
[self.contentView addSubview:self.shadowImageView];
[self.contentView addSubview:self.noteContainImageView];
[self.contentView addSubview:self.bottomView];
@@ -71,6 +77,10 @@
make.size.mas_equalTo(CGSizeMake(43, 18));
make.left.top.mas_equalTo(self.contentView);
}];
[self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.mas_equalTo(self.contentView);
make.size.mas_equalTo(CGSizeMake(40, 20));
}];
[self.noteContainImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.avatarImageView).offset(-5);
@@ -114,6 +124,21 @@
self.nickLabel.text = _roomModel.title.length > 0 ? _roomModel.title : @"";
self.numberLabel.text = [NSString stringWithFormat:@"%ld", _roomModel.onlineNum];
self.tagImageView.imageUrl = _roomModel.tagPict;
if (roomModel.crossPking) {
self.tagImageView.hidden = YES;
self.svgDisplayView.hidden = NO;
[self.parser parseWithNamed:@"anchorPk_crossPking" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
self.svgDisplayView.loops = INT_MAX;
self.svgDisplayView.clearsAfterStop = NO;
self.svgDisplayView.videoItem = videoItem;
[self.svgDisplayView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
} else {
self.tagImageView.hidden = NO;
[self.svgDisplayView stopAnimation];
self.svgDisplayView.hidden = YES;
}
}
}
@@ -128,6 +153,13 @@
return _avatarImageView;;
}
- (NetImageView *)tagImageView {
if (!_tagImageView) {
_tagImageView = [[NetImageView alloc] init];
}
return _tagImageView;;
}
- (UIView *)bottomView {
if (!_bottomView) {
_bottomView = [[UIView alloc] init];
@@ -182,5 +214,21 @@
return _noteView;
}
- (SVGAImageView *)svgDisplayView {
if (_svgDisplayView == nil) {
_svgDisplayView = [[SVGAImageView alloc]init];
_svgDisplayView.contentMode = UIViewContentModeScaleToFill;
_svgDisplayView.userInteractionEnabled = NO;
_svgDisplayView.backgroundColor = [UIColor clearColor];
}
return _svgDisplayView;
}
- (SVGAParser *)parser {
if (!_parser) {
_parser = [[SVGAParser alloc]init];
}
return _parser;
}
@end

View File

@@ -91,7 +91,7 @@
self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%@", _roomPKInfo.erbanNo];
self.selectButton.userInteractionEnabled = !roomPKInfo.crossPking;
if (roomPKInfo.crossPking) {
[_selectButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x4C4C6A)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
[_selectButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x4C4C6A), UIColorFromRGB(0x4C4C6A)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
[_selectButton setTitle:@"PK中" forState:UIControlStateNormal];
} else {
[_selectButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];

Binary file not shown.