魔法屋礼物合成房间飘屏

This commit is contained in:
chenguilong
2022-08-05 15:38:21 +08:00
parent 4bfda07e5a
commit 96e663f014
11 changed files with 271 additions and 8 deletions

View File

@@ -198,6 +198,9 @@
9B86D8802817F4A300494FCD /* XPNobleSettingNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D87F2817F4A300494FCD /* XPNobleSettingNavView.m */; };
9B86D88328192DC000494FCD /* XPRoomRankEntranceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */; };
9B86D886281942D200494FCD /* SocialMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B86D885281942D200494FCD /* SocialMicroView.m */; };
9B8DE0E1289CF02900FB6EC2 /* XPGiftCompoundModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E0289CF02900FB6EC2 /* XPGiftCompoundModel.m */; };
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E3289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m */; };
9B8DE0E8289CFE8100FB6EC2 /* compound_gift_banner.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9B8DE0E7289CFE8100FB6EC2 /* compound_gift_banner.svga */; };
9B92A33C2797E38100AD168F /* XPMineHeadItemTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92A33B2797E38100AD168F /* XPMineHeadItemTableViewCell.m */; };
9B92A3442797EE6500AD168F /* XPMatchManagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92A3432797EE6500AD168F /* XPMatchManagePresenter.m */; };
9B92A3472797EECD00AD168F /* XPMatchManageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92A3462797EECD00AD168F /* XPMatchManageViewController.m */; };
@@ -1282,6 +1285,11 @@
9B86D88228192DC000494FCD /* XPRoomRankEntranceView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomRankEntranceView.m; sourceTree = "<group>"; };
9B86D884281942D200494FCD /* SocialMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SocialMicroView.h; sourceTree = "<group>"; };
9B86D885281942D200494FCD /* SocialMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SocialMicroView.m; sourceTree = "<group>"; };
9B8DE0DF289CF02900FB6EC2 /* XPGiftCompoundModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCompoundModel.h; sourceTree = "<group>"; };
9B8DE0E0289CF02900FB6EC2 /* XPGiftCompoundModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCompoundModel.m; sourceTree = "<group>"; };
9B8DE0E2289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomGiftCompoundView.h; sourceTree = "<group>"; };
9B8DE0E3289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomGiftCompoundView.m; sourceTree = "<group>"; };
9B8DE0E7289CFE8100FB6EC2 /* compound_gift_banner.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = compound_gift_banner.svga; sourceTree = "<group>"; };
9B92A33A2797E38100AD168F /* XPMineHeadItemTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineHeadItemTableViewCell.h; sourceTree = "<group>"; };
9B92A33B2797E38100AD168F /* XPMineHeadItemTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineHeadItemTableViewCell.m; sourceTree = "<group>"; };
9B92A3412797EE1200AD168F /* XPMatchManageProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMatchManageProtocol.h; sourceTree = "<group>"; };
@@ -4867,6 +4875,8 @@
E83DB47E274649B200D8CBD1 /* Model */,
E8C214FF274B76F60079E6BF /* XPRoomAnimationHitView.h */,
E8C21500274B76F60079E6BF /* XPRoomAnimationHitView.m */,
9B8DE0E2289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.h */,
9B8DE0E3289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m */,
E83DB47B2746372300D8CBD1 /* XPRoomGiftBannerView.h */,
E83DB47C2746372300D8CBD1 /* XPRoomGiftBannerView.m */,
E83DB4822746661800D8CBD1 /* XPRoomGiftBroadcastView.h */,
@@ -5032,6 +5042,8 @@
E83DB486274670DA00D8CBD1 /* XPRoomGiftBroadCastModel.m */,
E86F6183284F4E4800E8EC9A /* RoomHalfHourRankModel.h */,
E86F6184284F4E4800E8EC9A /* RoomHalfHourRankModel.m */,
9B8DE0DF289CF02900FB6EC2 /* XPGiftCompoundModel.h */,
9B8DE0E0289CF02900FB6EC2 /* XPGiftCompoundModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -5844,6 +5856,7 @@
E8A1E45C276220B100B294CA /* Sources */ = {
isa = PBXGroup;
children = (
9B8DE0E7289CFE8100FB6EC2 /* compound_gift_banner.svga */,
E852D7372862C615001465ED /* room_lucky_gift_bg.svga */,
E8998D81285982EE00C68558 /* lucky_gift_streamer.svga */,
9B5F1502280FF02600C3C2B1 /* anchorPk_crossPking.svga */,
@@ -7303,6 +7316,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9B8DE0E8289CFE8100FB6EC2 /* compound_gift_banner.svga in Resources */,
E8E859E128264D7B00EE4857 /* images in Resources */,
E8E859E028264D7B00EE4857 /* css in Resources */,
E8937AC7276C3EDE00B2C7E1 /* svga_member_in_lv40.svga in Resources */,
@@ -7946,6 +7960,7 @@
E8E859D328264C2300EE4857 /* DDTTYLogger.m in Sources */,
9B92A33C2797E38100AD168F /* XPMineHeadItemTableViewCell.m in Sources */,
189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */,
9B8DE0E1289CF02900FB6EC2 /* XPGiftCompoundModel.m in Sources */,
9B9DD94A281BC17600DBA903 /* XPCandyTreeMoreRuleCell.m in Sources */,
E86507E5281A7D4D006951B0 /* MessageContentTweetView.m in Sources */,
E824544B26F5BBB800BE8163 /* XPMineModifPayPwdViewController.m in Sources */,
@@ -8011,6 +8026,7 @@
9BFE0D922899042600F53C24 /* XPTaskCompleteTipView.m in Sources */,
9BE01AE728938AB600B50299 /* XPDressUpShopCardTableViewCell.m in Sources */,
E82E75062828E76400C25EF7 /* XPCoreDataManager.m in Sources */,
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */,
1808072D2731598F001FD836 /* XPNetImageYYLabel.m in Sources */,
E800806827FD3B520055A8AB /* XPClanMenuView.m in Sources */,
E896EFAF2771AF0F00AD2CC1 /* XPMineFriendEmptyTableViewCell.m in Sources */,

View File

@@ -80,6 +80,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_Licnese_Hour_Rank = 91,
///任务完成通知
CustomMessageType_Task_Complete = 92,
///礼物合成
CustomMessageType_Gift_Compound = 93,
};
@@ -425,6 +427,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageTaskComplete) {
Custom_Message_Sub_TaskComplete = 921,
};
///first = CustomMessageType_Gift_Compound
typedef NS_ENUM(NSUInteger, CustomMessageGiftCompound) {
///礼物合成通知
Custom_Message_Sub_Gift_Compound = 931,
};
@interface AttachmentModel : NSObject<NIMCustomAttachment>
@property (nonatomic,assign) int first;
@property (nonatomic,assign) int second;

View File

@@ -137,11 +137,6 @@
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
if (userInfo.userLevelVo.experLevelSeq >= [ClientConfig shareConfig].openCandyTreeLimitLevel && [ClientConfig shareConfig].openCandyTree && roomInfo.boxSwitchVo.openBoxSwitch) {
self.candyTreeImageView.hidden = NO;
if (roomInfo.boxSwitchVo.openBoxIcon.length > 0) {
self.candyTreeImageView.imageUrl = roomInfo.boxSwitchVo.openBoxIcon;
} else {
self.candyTreeImageView.image = [UIImage imageNamed:@"openBoxIcon"];
}
} else {
self.candyTreeImageView.hidden = YES;
}

View File

@@ -0,0 +1,27 @@
//
// XPGiftCompoundModel.h
// xplan-ios
//
// Created by GreenLand on 2022/8/5.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPGiftCompoundModel : NSObject
///昵称
@property(nonatomic, copy)NSString *nick;
///礼物的名称
@property(nonatomic, copy)NSString *giftName;
///礼物id
@property (nonatomic,copy) NSString *giftId;
///用户uid
@property (nonatomic,copy) NSString *uid;
///消息
@property (nonatomic,copy) NSString *msg;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// XPGiftCompoundModel.m
// xplan-ios
//
// Created by GreenLand on 2022/8/5.
//
#import "XPGiftCompoundModel.h"
@implementation XPGiftCompoundModel
@end

View File

@@ -50,6 +50,7 @@
#import "XPRoomEnterHideTipView.h"
#import "XPRoomLicneseHourRankView.h"
#import "XPRoomLuckyBigPrizeView.h"
#import "XPRoomGiftCompoundView.h"
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate>
///
@@ -100,6 +101,8 @@
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray;
///
@property (nonatomic,strong) NSMutableArray *candyTreegiftQueue;
///
@property (nonatomic,strong) NSMutableArray *compoundGiftQueue;
///
@property (nonatomic, strong) NSMutableArray *nobleLevelUpQueue;
#pragma mark -
@@ -264,7 +267,9 @@
[self receiveAnchorHourRank:attachment];
} else if (attachment.first == CustomMessageType_Licnese_Hour_Rank && attachment.second == Custom_Message_Sub_Licnese_Hour_Rank) {///
[self receiveLicneseHourRank:attachment];
}
} else if (attachment.first == CustomMessageType_Gift_Compound && attachment.second == Custom_Message_Sub_Gift_Compound) {///
[self receiveGiftCompound:attachment];
}
}
}
@@ -647,6 +652,50 @@
[nobleLevelUpView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"];
}
#pragma mark -
- (void)receiveGiftCompound:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
if (self.compoundGiftQueue.count == 0) {
[self createGiftCompoundBannerAnimation:attachment];
}
[self.compoundGiftQueue addObject:attachment];
}
- (void)createGiftCompoundBannerAnimation:(AttachmentModel *)attachment {
XPRoomGiftCompoundView *compoundGiftView = [[XPRoomGiftCompoundView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 45)];
compoundGiftView.compoundGiftInfo = attachment.data;
[self.middleLevelView addSubview:compoundGiftView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:compoundGiftView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(compoundGiftView.frame.size.width / 2, compoundGiftView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, compoundGiftView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, compoundGiftView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime() + 3;
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[compoundGiftView removeFromSuperview];
[self.compoundGiftQueue removeObjectAtIndex:0];
if (self.compoundGiftQueue.count > 0) {
[self createGiftCompoundBannerAnimation:self.compoundGiftQueue.firstObject];
}
}
}];
[compoundGiftView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[compoundGiftView pop_addAnimation:springAnimation forKey:@"compoundGiftSpingOutAnimation"];
}
#pragma mark -
- (void)receiveLicneseHourRank:(AttachmentModel *)attachment {
XPRoomLicneseHourRankView *anchorRankView = [[XPRoomLicneseHourRankView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, 375, 60)];
@@ -1608,6 +1657,13 @@
return _candyTreegiftQueue;
}
- (NSMutableArray *)compoundGiftQueue {
if (!_compoundGiftQueue) {
_compoundGiftQueue = [NSMutableArray array];
}
return _compoundGiftQueue;
}
- (NSMutableArray *)nobleLevelUpQueue {
if (!_nobleLevelUpQueue) {
_nobleLevelUpQueue = [NSMutableArray array];

View File

@@ -0,0 +1,19 @@
//
// XPRoomGiftCompoundView.h
// xplan-ios
//
// Created by GreenLand on 2022/8/5.
// 魔法小屋礼物合成
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomGiftCompoundView : UIView
///礼物合成的信息
@property (nonatomic,copy) NSDictionary * compoundGiftInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,112 @@
//
// XPRoomGiftCompoundView.m
// xplan-ios
//
// Created by GreenLand on 2022/8/5.
//
#import "XPRoomGiftCompoundView.h"
///Third
#import <Masonry/Masonry.h>
#import <SVGA.h>
#import "XPMacro.h"
#import "ThemeColor+Room.h"
#import "XPGiftCompoundModel.h"
#import "NSObject+MJExtension.h"
@interface XPRoomGiftCompoundView ()
///
@property (strong, nonatomic) SVGAParser *parser;
///
@property (nonatomic,strong) SVGAImageView *compoundGiftView;
///
@property (nonatomic,strong) UILabel *titleLabel;
@end
@implementation XPRoomGiftCompoundView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.compoundGiftView];
[self addSubview:self.titleLabel];
}
- (void)initSubViewConstraints {
[self.compoundGiftView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self);
make.height.mas_equalTo(45);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.compoundGiftView);
}];
}
- (NSAttributedString *)createAttribute:(NSString * )text color:(UIColor *)color fontSize:(CGFloat)fonSize {
NSDictionary * attribute = @{NSFontAttributeName:[UIFont systemFontOfSize:fonSize], NSForegroundColorAttributeName:color};
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:attribute];
return attr;
}
#pragma mark - Getters And Setters
- (void)setCompoundGiftInfo:(NSDictionary *)compoundGiftInfo {
if (compoundGiftInfo) {
XPGiftCompoundModel * giftInfo = [XPGiftCompoundModel modelWithDictionary:compoundGiftInfo];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
CGFloat fontSize = 22;
NSString *nickStr = giftInfo.nick;
if (nickStr.length > 6) {
nickStr = [NSString stringWithFormat:@"%@…", [giftInfo.nick substringToIndex:6]];
}
[attribute appendAttributedString:[self createAttribute:@"恭喜" color:[UIColor whiteColor] fontSize:fontSize]];
[attribute appendAttributedString:[self createAttribute:nickStr color:[ThemeColor messageNickColor] fontSize:fontSize]];
[attribute appendAttributedString:[self createAttribute:giftInfo.msg color:[UIColor whiteColor] fontSize:fontSize]];
[attribute appendAttributedString:[self createAttribute:giftInfo.giftName color:[ThemeColor messageNickColor] fontSize:fontSize]];
@kWeakify(self);
[self.parser parseWithNamed:@"compound_gift_banner" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.compoundGiftView.loops = 1;
self.compoundGiftView.clearsAfterStop = NO;
self.compoundGiftView.videoItem = videoItem;
[self.compoundGiftView setAttributedText:attribute forKey:@"noble_text_tx"];
[self.compoundGiftView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
}
}
- (SVGAImageView *)compoundGiftView {
if (!_compoundGiftView) {
_compoundGiftView = [[SVGAImageView alloc]init];
_compoundGiftView.backgroundColor = [UIColor clearColor];
_compoundGiftView.userInteractionEnabled = NO;
}
return _compoundGiftView;
}
- (SVGAParser *)parser {
if (!_parser) {
_parser = [[SVGAParser alloc]init];
}
return _parser;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
}
return _titleLabel;
}
@end

View File

@@ -34,6 +34,7 @@
#import "RoomPKInfoModel.h"
#import "CandyTreeResultModel.h"
#import "XPGiftBigPrizeModel.h"
#import "XPGiftCompoundModel.h"
#import "NetImageView.h"
@@ -108,7 +109,9 @@
return [self createRoomPKAttribute:attachment];
} else if (first == CustomMessageType_LuckyBag) {///
return [self createRoomLuckyBigPrizeAttribute:attachment];
}
} else if(first == CustomMessageType_Gift_Compound) {///
return [self createRoomGiftCompoundAttribute:attachment];
}
return nil;
}
@@ -264,6 +267,18 @@
return nil;
}
#pragma mark -
- (NSAttributedString *)createRoomGiftCompoundAttribute:(AttachmentModel *)attachment {
XPGiftCompoundModel *info = [XPGiftCompoundModel modelWithDictionary:attachment.data];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:info.nick color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:info.msg color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:info.giftName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:info.uid.integerValue];
return attribute;
}
#pragma mark -
- (NSAttributedString *)createRoomLuckyBigPrizeAttribute:(AttachmentModel *)attachment {
XPGiftBigPrizeModel * info= [XPGiftBigPrizeModel modelWithDictionary:attachment.data];

View File

@@ -463,7 +463,10 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@(CustomMessageType_LuckyBag):
[NSSet setWithObjects:
@(Custom_Message_Sub_Room_Gift_LuckBag_Server),
nil]
nil],
@(CustomMessageType_Gift_Compound):
[NSSet setWithObjects:@(Custom_Message_Sub_Gift_Compound),
nil]
};
}

Binary file not shown.