糖果树公屏显示

This commit is contained in:
fengshuo
2021-12-10 21:20:34 +08:00
parent 2a1e90dbe5
commit ae29a3a80f
7 changed files with 110 additions and 2 deletions

View File

@@ -301,6 +301,8 @@
E8C6FFED27550CC2004DC9F0 /* HomeSearchResultModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C6FFEC27550CC2004DC9F0 /* HomeSearchResultModel.m */; };
E8CEA03D26EA3DE500644B44 /* LoginPasswordPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8CEA03C26EA3DE500644B44 /* LoginPasswordPresent.m */; };
E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC99427648FA50078CB70 /* ClientConfig.m */; };
E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8DEC98927637EA50078CB70 /* candyTree_open.svga */; };
E8DEC98C27637EA50078CB70 /* candyTree_transform.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8DEC98A27637EA50078CB70 /* candyTree_transform.svga */; };
E8E70D7726F2F15100F03460 /* XPMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E70D7626F2F15100F03460 /* XPMineViewController.m */; };
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E70D7926F2F16600F03460 /* XPMinePresent.m */; };
E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E70D7D26F2F19D00F03460 /* Api+Mine.m */; };
@@ -914,6 +916,8 @@
E8CEA03E26EA3E0200644B44 /* LoginPasswordProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPasswordProtocol.h; sourceTree = "<group>"; };
E8DEC99327648FA50078CB70 /* ClientConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ClientConfig.h; sourceTree = "<group>"; };
E8DEC99427648FA50078CB70 /* ClientConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ClientConfig.m; sourceTree = "<group>"; };
E8DEC98927637EA50078CB70 /* candyTree_open.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = candyTree_open.svga; sourceTree = "<group>"; };
E8DEC98A27637EA50078CB70 /* candyTree_transform.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = candyTree_transform.svga; sourceTree = "<group>"; };
E8E70D7526F2F15100F03460 /* XPMineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineViewController.h; sourceTree = "<group>"; };
E8E70D7626F2F15100F03460 /* XPMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineViewController.m; sourceTree = "<group>"; };
E8E70D7826F2F16600F03460 /* XPMinePresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMinePresent.h; sourceTree = "<group>"; };
@@ -2245,6 +2249,8 @@
E8A1E45C276220B100B294CA /* Sources */ = {
isa = PBXGroup;
children = (
E8DEC98927637EA50078CB70 /* candyTree_open.svga */,
E8DEC98A27637EA50078CB70 /* candyTree_transform.svga */,
E8A1E45D276220DA00B294CA /* candyTree_banner.svga */,
E8A1E45F276220DA00B294CA /* candyTree_light.svga */,
E8A1E45E276220DA00B294CA /* candyTree.svga */,
@@ -2789,9 +2795,11 @@
files = (
E8A1E461276220DA00B294CA /* candyTree.svga in Resources */,
189DD53C26DE255600AB55B1 /* LaunchScreen.storyboard in Resources */,
E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */,
E8A1E460276220DA00B294CA /* candyTree_banner.svga in Resources */,
E8A1E462276220DA00B294CA /* candyTree_light.svga in Resources */,
189DD53926DE255600AB55B1 /* Assets.xcassets in Resources */,
E8DEC98C27637EA50078CB70 /* candyTree_transform.svga in Resources */,
186A52E726FC559700D67B2C /* yw_1222_0769.jpg in Resources */,
186A52E326FC559200D67B2C /* RPSDK.bundle in Resources */,
);

View File

@@ -83,6 +83,14 @@ typedef NS_ENUM(NSUInteger, CustomNotificationSubKick) {
///first = CustomMessageType_Candy_Tree
typedef NS_ENUM(NSUInteger, CustomMessageSubCandyTree) {
//.自己可见 一级礼物(最小)
Custom_Message_Sub_Candy_Tree_Me = 261,
///当前房间可见 二级礼物
Custom_Message_Sub_Candy_Tree_InRoom = 262,
///所有房间可见 三级礼物
Custom_Message_Sub_Candy_Tree_AllRoom = 263,
///所有房间可见+小秘书 四级礼物(最大)
Custom_Message_Sub_Candy_Tree_AllRoom_Notify = 264,
///开箱子开到全麦送 (服务端发)
Custom_Message_Sub_Candy_Tree_InRoom_NeedAllMicSend = 265,
//暴击的没用 不写了

View File

@@ -58,6 +58,10 @@
@property (nonatomic,strong) SVGAImageView *candyTreeView;
///
@property (nonatomic,strong) SVGAImageView *candyTreeLightView;
///
@property (nonatomic,strong) SVGAImageView *candyTreeOpenView;
///
@property (nonatomic,strong) SVGAImageView *candyTreeTransView;
///
@property (nonatomic,strong) UILabel *expendLabel;
///
@@ -125,6 +129,17 @@
- (void)pickCandySuccess:(CandyTreeResultModel *)result {
self.isPicking = NO;
self.countLabel.text = result.remainKeyNum > 0 ? [NSString stringWithFormat:@"%ld", result.remainKeyNum] : @"0";
self.candyInfo.keyNum = result.remainKeyNum;
@kWeakify(self);
[self.parser parseWithNamed:@"candyTree_transform" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.candyTreeTransView.loops = 1;
self.candyTreeTransView.clearsAfterStop = YES;
self.candyTreeTransView.videoItem = videoItem;
[self.candyTreeTransView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
}
#pragma mark - NIMSystemNotificationManagerDelegate
@@ -152,10 +167,13 @@
[self.backView addSubview:self.moreImageView];
[self.backView addSubview:self.countStackView];
[self.backView addSubview:self.candyTreeView];
[self.backView addSubview:self.candyTreeLightView];
[self.backView addSubview:self.candyTreeOpenView];
[self.backView addSubview:self.expendLabel];
[self.backView addSubview:self.pickBackImageView];
[self.backView addSubview:self.pickStackView];
[self.backView addSubview:self.pickButton];
[self.backView addSubview:self.candyTreeTransView];
[self.rankStackView addArrangedSubview:self.rankImageView];
[self.rankStackView addArrangedSubview:self.rankLabel];
@@ -231,6 +249,14 @@
make.size.mas_equalTo(CGSizeMake(190, 242));
}];
[self.candyTreeLightView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.candyTreeView);
}];
[self.candyTreeOpenView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.candyTreeView);
}];
[self.expendLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView);
make.bottom.mas_equalTo(self.self.pickBackImageView.mas_top).offset(-3);
@@ -251,6 +277,13 @@
make.centerX.mas_equalTo(self.backView);
make.bottom.mas_equalTo(self.backView).offset(-21);
}];
CGFloat kscale = (CGFloat)350 / (CGFloat)755;
[self.candyTreeTransView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.candyTreeView);
make.bottom.right.mas_equalTo(self.view);
make.width.mas_equalTo(self.candyTreeTransView.mas_height).multipliedBy(kscale);
}];
}
#pragma mark - Event Response
- (void)moreTapRecognizer:(UITapGestureRecognizer *)tap {
@@ -297,17 +330,26 @@
[self.parser parseWithNamed:@"candyTree_light" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.candyTreeLightView.loops = 1;
self.candyTreeLightView.clearsAfterStop = NO;
self.candyTreeLightView.clearsAfterStop = YES;
self.candyTreeLightView.videoItem = videoItem;
[self.candyTreeLightView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
[self.parser parseWithNamed:@"candyTree_open" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.candyTreeOpenView.loops = 1;
self.candyTreeOpenView.clearsAfterStop = YES;
self.candyTreeOpenView.videoItem = videoItem;
[self.candyTreeOpenView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
///
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
NSString * candyNumber = [NSString stringWithFormat:@"%ld", self.numberCandy];
[self.presenter pickCandy:candyNumber roomUid:roomUid];
}
}
@@ -323,6 +365,11 @@
self.expendLabel.text = [NSString stringWithFormat:@"消耗%@糖果连续摘", textField.text];
}
#pragma mark - Getters And Setters
- (void)setIsPicking:(BOOL)isPicking {
_isPicking = isPicking;
self.pickButton.enabled = !_isPicking;
}
- (UIView *)topTapView {
if (!_topTapView) {
_topTapView = [[UIView alloc] init];
@@ -458,6 +505,24 @@
return _candyTreeLightView;
}
- (SVGAImageView *)candyTreeOpenView {
if (!_candyTreeOpenView) {
_candyTreeOpenView = [[SVGAImageView alloc]init];
_candyTreeOpenView.backgroundColor = [UIColor clearColor];
_candyTreeOpenView.userInteractionEnabled = NO;
}
return _candyTreeOpenView;
}
- (SVGAImageView *)candyTreeTransView {
if (!_candyTreeTransView) {
_candyTreeTransView = [[SVGAImageView alloc]init];
_candyTreeTransView.backgroundColor = [UIColor clearColor];
_candyTreeTransView.userInteractionEnabled = NO;
}
return _candyTreeTransView;
}
- (SVGAParser *)parser {
if (!_parser) {
_parser = [[SVGAParser alloc]init];

View File

@@ -64,6 +64,8 @@
} else if(first == CustomMessageType_Kick_User || first == CustomMessageType_Queue) {
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
return [self createKickUserAttribute:attachment info:kickModel];
} else if(first == CustomMessageType_Candy_Tree ) {//
return [self createCandyTreeHighLevelAttribute:attachment];
}
return nil;
}
@@ -126,6 +128,22 @@
return nil;
}
#pragma mark -
- (NSAttributedString *)createCandyTreeHighLevelAttribute:(AttachmentModel *)attachment {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
//action
[attribute appendAttributedString:[self createTextAttribute:@"厉害了 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
NSInteger uid = 0;
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
uid = ((NSNumber *)attachment.data[@"uid"]).integerValue;
} else if ([attachment.data[@"uid"] isKindOfClass:[NSString class]]) {
uid = ((NSString *)attachment.data[@"uid"]).integerValue;
}
[attribute appendAttributedString:[self createNickAtrribute:attachment.data[@"nick"] uid:uid]];
[attribute appendAttributedString:[self createTextAttribute:@"摘下糖果获得" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:attachment.data[@"prizeName"] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
return attribute;
}
#pragma mark - //
- (NSAttributedString *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];

View File

@@ -146,6 +146,7 @@
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
NSLog(@"%@", attachment);
return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)];
}
return NO;
@@ -179,6 +180,14 @@
[NSSet setWithObjects:
@(Custom_Message_Sub_Queue_Kick),
nil],
@(CustomMessageType_Candy_Tree):
[NSSet setWithObjects:
@(Custom_Message_Sub_Candy_Tree_Me),
@(Custom_Message_Sub_Candy_Tree_InRoom),
@(Custom_Message_Sub_Candy_Tree_AllRoom),
@(Custom_Message_Sub_Candy_Tree_AllRoom_Notify),
@(Custom_Message_Sub_Candy_Tree_InRoom_NeedAllMicSend),
nil],
};
}

Binary file not shown.

Binary file not shown.