涂鸦礼物完成
This commit is contained in:
@@ -845,6 +845,7 @@
|
|||||||
E8E20BE828169BDC0033B688 /* XPMineLoginPasswordPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BE728169BDC0033B688 /* XPMineLoginPasswordPresenter.m */; };
|
E8E20BE828169BDC0033B688 /* XPMineLoginPasswordPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BE728169BDC0033B688 /* XPMineLoginPasswordPresenter.m */; };
|
||||||
E8E20BEC2816A5B90033B688 /* XPMineBlackListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BEB2816A5B90033B688 /* XPMineBlackListViewController.m */; };
|
E8E20BEC2816A5B90033B688 /* XPMineBlackListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BEB2816A5B90033B688 /* XPMineBlackListViewController.m */; };
|
||||||
E8E20BEF2816A5FC0033B688 /* XPMineBlackListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BEE2816A5FC0033B688 /* XPMineBlackListTableViewCell.m */; };
|
E8E20BEF2816A5FC0033B688 /* XPMineBlackListTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BEE2816A5FC0033B688 /* XPMineBlackListTableViewCell.m */; };
|
||||||
|
E8E21A9B28B4BD92008F7C9D /* XPRoomGraffitiGiftAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E21A9A28B4BD92008F7C9D /* XPRoomGraffitiGiftAnimationView.m */; };
|
||||||
E8E5E18B27C332EE00F457D8 /* XPHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */; };
|
E8E5E18B27C332EE00F457D8 /* XPHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */; };
|
||||||
E8E5E18E27C3331E00F457D8 /* XPHomeRecommendViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18D27C3331E00F457D8 /* XPHomeRecommendViewController.m */; };
|
E8E5E18E27C3331E00F457D8 /* XPHomeRecommendViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18D27C3331E00F457D8 /* XPHomeRecommendViewController.m */; };
|
||||||
E8E5E19127C369F000F457D8 /* XPHomeRecommendListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E19027C369F000F457D8 /* XPHomeRecommendListView.m */; };
|
E8E5E19127C369F000F457D8 /* XPHomeRecommendListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E19027C369F000F457D8 /* XPHomeRecommendListView.m */; };
|
||||||
@@ -2619,6 +2620,8 @@
|
|||||||
E8E20BEB2816A5B90033B688 /* XPMineBlackListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineBlackListViewController.m; sourceTree = "<group>"; };
|
E8E20BEB2816A5B90033B688 /* XPMineBlackListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineBlackListViewController.m; sourceTree = "<group>"; };
|
||||||
E8E20BED2816A5FC0033B688 /* XPMineBlackListTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineBlackListTableViewCell.h; sourceTree = "<group>"; };
|
E8E20BED2816A5FC0033B688 /* XPMineBlackListTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineBlackListTableViewCell.h; sourceTree = "<group>"; };
|
||||||
E8E20BEE2816A5FC0033B688 /* XPMineBlackListTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineBlackListTableViewCell.m; sourceTree = "<group>"; };
|
E8E20BEE2816A5FC0033B688 /* XPMineBlackListTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineBlackListTableViewCell.m; sourceTree = "<group>"; };
|
||||||
|
E8E21A9928B4BD92008F7C9D /* XPRoomGraffitiGiftAnimationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomGraffitiGiftAnimationView.h; sourceTree = "<group>"; };
|
||||||
|
E8E21A9A28B4BD92008F7C9D /* XPRoomGraffitiGiftAnimationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomGraffitiGiftAnimationView.m; sourceTree = "<group>"; };
|
||||||
E8E5E18927C332EE00F457D8 /* XPHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeViewController.h; sourceTree = "<group>"; };
|
E8E5E18927C332EE00F457D8 /* XPHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeViewController.h; sourceTree = "<group>"; };
|
||||||
E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeViewController.m; sourceTree = "<group>"; };
|
E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeViewController.m; sourceTree = "<group>"; };
|
||||||
E8E5E18C27C3331E00F457D8 /* XPHomeRecommendViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeRecommendViewController.h; sourceTree = "<group>"; };
|
E8E5E18C27C3331E00F457D8 /* XPHomeRecommendViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeRecommendViewController.h; sourceTree = "<group>"; };
|
||||||
@@ -4968,6 +4971,8 @@
|
|||||||
E8998D7F28597B0300C68558 /* XPRoomLuckyBigPrizeView.m */,
|
E8998D7F28597B0300C68558 /* XPRoomLuckyBigPrizeView.m */,
|
||||||
E838D99E275E1BF60079E0B5 /* XPRoomAnimationView.h */,
|
E838D99E275E1BF60079E0B5 /* XPRoomAnimationView.h */,
|
||||||
E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */,
|
E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */,
|
||||||
|
E8E21A9928B4BD92008F7C9D /* XPRoomGraffitiGiftAnimationView.h */,
|
||||||
|
E8E21A9A28B4BD92008F7C9D /* XPRoomGraffitiGiftAnimationView.m */,
|
||||||
9BC9DAED27E33B3F009EE409 /* XPRoomGiftAnimationParser.h */,
|
9BC9DAED27E33B3F009EE409 /* XPRoomGiftAnimationParser.h */,
|
||||||
9BC9DAEE27E33B3F009EE409 /* XPRoomGiftAnimationParser.m */,
|
9BC9DAEE27E33B3F009EE409 /* XPRoomGiftAnimationParser.m */,
|
||||||
);
|
);
|
||||||
@@ -8119,6 +8124,7 @@
|
|||||||
9BE9F10227FEE5C200667200 /* XPAnchorFansTaskDetailModel.m in Sources */,
|
9BE9F10227FEE5C200667200 /* XPAnchorFansTaskDetailModel.m in Sources */,
|
||||||
E8E0DAE6285C280E00566A2F /* XPSessionFindNewAlertView.m in Sources */,
|
E8E0DAE6285C280E00566A2F /* XPSessionFindNewAlertView.m in Sources */,
|
||||||
E86596542701A55500846EBD /* StatisticsServiceHelper.m in Sources */,
|
E86596542701A55500846EBD /* StatisticsServiceHelper.m in Sources */,
|
||||||
|
E8E21A9B28B4BD92008F7C9D /* XPRoomGraffitiGiftAnimationView.m in Sources */,
|
||||||
E8E70D8C26F2F5A500F03460 /* XPMineHeadItemCollectionViewCell.m in Sources */,
|
E8E70D8C26F2F5A500F03460 /* XPMineHeadItemCollectionViewCell.m in Sources */,
|
||||||
E883E82E28153BDF0000005D /* XPGuildAnchorIncomeSectionView.m in Sources */,
|
E883E82E28153BDF0000005D /* XPGuildAnchorIncomeSectionView.m in Sources */,
|
||||||
9B17F71827BD150600440843 /* SVGAParserManager.m in Sources */,
|
9B17F71827BD150600440843 /* SVGAParserManager.m in Sources */,
|
||||||
|
@@ -86,6 +86,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
|||||||
CustomMessageType_Task_Complete = 92,
|
CustomMessageType_Task_Complete = 92,
|
||||||
///礼物合成
|
///礼物合成
|
||||||
CustomMessageType_Gift_Compound = 93,
|
CustomMessageType_Gift_Compound = 93,
|
||||||
|
///涂鸦礼物
|
||||||
|
CustomMessageType_Graffiti_Gift = 94,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -458,6 +460,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageGiftCompound) {
|
|||||||
Custom_Message_Sub_Gift_Compound = 931,
|
Custom_Message_Sub_Gift_Compound = 931,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///first = CustomMessageType_Graffiti_Gift
|
||||||
|
typedef NS_ENUM(NSUInteger, CustomMessageGraffitiGift) {
|
||||||
|
///涂鸦礼物
|
||||||
|
Custom_Message_Sub_Graffiti_Gift = 941,
|
||||||
|
};
|
||||||
|
|
||||||
@interface AttachmentModel : NSObject<NIMCustomAttachment>
|
@interface AttachmentModel : NSObject<NIMCustomAttachment>
|
||||||
@property (nonatomic,assign) int first;
|
@property (nonatomic,assign) int first;
|
||||||
@property (nonatomic,assign) int second;
|
@property (nonatomic,assign) int second;
|
||||||
|
@@ -17,6 +17,7 @@ typedef NS_ENUM(NSUInteger, GiftType) {
|
|||||||
GiftType_LuckyPool = 5, //福袋奖池礼物
|
GiftType_LuckyPool = 5, //福袋奖池礼物
|
||||||
GiftType_Noble = 7, // 贵族礼物
|
GiftType_Noble = 7, // 贵族礼物
|
||||||
GiftType_WeekStar = 8, //周星礼物
|
GiftType_WeekStar = 8, //周星礼物
|
||||||
|
GiftType_Graffiti = 10, //涂鸦礼物
|
||||||
};
|
};
|
||||||
|
|
||||||
//礼物类型
|
//礼物类型
|
||||||
|
@@ -62,12 +62,14 @@
|
|||||||
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];// 福袋奖池礼物
|
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];// 福袋奖池礼物
|
||||||
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; // 普通面板礼物
|
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; // 普通面板礼物
|
||||||
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; // 周星礼物
|
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; // 周星礼物
|
||||||
|
NSArray *drawGift = [GiftInfoModel modelsWithArray:data.data[@"drawGift"]]; // 涂鸦礼物
|
||||||
NSMutableArray *info = [NSMutableArray array];
|
NSMutableArray *info = [NSMutableArray array];
|
||||||
NSMutableArray *totalInfo = [NSMutableArray array];
|
NSMutableArray *totalInfo = [NSMutableArray array];
|
||||||
[info addObjectsFromArray:luckyBagGift];
|
[info addObjectsFromArray:luckyBagGift];
|
||||||
[info addObjectsFromArray:vipGift];
|
[info addObjectsFromArray:vipGift];
|
||||||
[info addObjectsFromArray:normalGift];
|
[info addObjectsFromArray:normalGift];
|
||||||
[info addObjectsFromArray:weekStarGift];
|
[info addObjectsFromArray:weekStarGift];
|
||||||
|
[info addObjectsFromArray:drawGift];
|
||||||
[totalInfo addObjectsFromArray:info];
|
[totalInfo addObjectsFromArray:info];
|
||||||
[totalInfo addObjectsFromArray:luckyPoolGift];
|
[totalInfo addObjectsFromArray:luckyPoolGift];
|
||||||
///把礼物信息保存一下
|
///把礼物信息保存一下
|
||||||
|
@@ -23,7 +23,8 @@
|
|||||||
#import "XPWeekStarInfoView.h"
|
#import "XPWeekStarInfoView.h"
|
||||||
|
|
||||||
@interface XPGiftInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, XPWeekStarInfoViewDelegate, XPGiftWeekStarCollectionViewCellDelegate>
|
@interface XPGiftInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, XPWeekStarInfoViewDelegate, XPGiftWeekStarCollectionViewCellDelegate>
|
||||||
///
|
///滚动的容器
|
||||||
|
@property (nonatomic,strong) UIScrollView *scrollView;
|
||||||
@property (nonatomic,strong) UIStackView *segmentStackView;
|
@property (nonatomic,strong) UIStackView *segmentStackView;
|
||||||
///普通礼物
|
///普通礼物
|
||||||
@property (nonatomic,strong) UIButton *normalGiftButton;
|
@property (nonatomic,strong) UIButton *normalGiftButton;
|
||||||
@@ -131,8 +132,10 @@
|
|||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)initSubViews {
|
- (void)initSubViews {
|
||||||
|
|
||||||
[self addSubview:self.segmentStackView];
|
[self addSubview:self.scrollView];
|
||||||
[self addSubview:self.giftStackView];
|
[self addSubview:self.giftStackView];
|
||||||
|
|
||||||
|
[self.scrollView addSubview:self.segmentStackView];
|
||||||
///分段控制
|
///分段控制
|
||||||
[self.segmentStackView addArrangedSubview:self.normalGiftButton];
|
[self.segmentStackView addArrangedSubview:self.normalGiftButton];
|
||||||
[self.segmentStackView addArrangedSubview:self.luckyGiftButton];
|
[self.segmentStackView addArrangedSubview:self.luckyGiftButton];
|
||||||
@@ -154,9 +157,12 @@
|
|||||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.height.mas_equalTo(30 + 108 * 2 + 10 + 10 + 15);
|
make.height.mas_equalTo(30 + 108 * 2 + 10 + 10 + 15);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
[self.segmentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
[self.segmentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.bottom.leading.trailing.height.mas_equalTo(self.scrollView);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.mas_equalTo(self).inset(15);
|
make.left.right.mas_equalTo(self).inset(15);
|
||||||
make.top.mas_equalTo(self);
|
make.top.mas_equalTo(self);
|
||||||
make.height.mas_equalTo(30);
|
make.height.mas_equalTo(30);
|
||||||
@@ -394,6 +400,10 @@
|
|||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftInfoView:didClickSegment:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftInfoView:didClickSegment:)]) {
|
||||||
[self.delegate xPGiftInfoView:self didClickSegment:_segmentType];
|
[self.delegate xPGiftInfoView:self didClickSegment:_segmentType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftInfoView:didClickItem:type:)]) {
|
||||||
|
[self.delegate xPGiftInfoView:self didClickItem:self.lastSelectGift type:_segmentType];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setNormalOriginArray:(NSArray *)normalOriginArray {
|
- (void)setNormalOriginArray:(NSArray *)normalOriginArray {
|
||||||
@@ -402,6 +412,7 @@
|
|||||||
NSMutableArray * normaleArray = [NSMutableArray array];
|
NSMutableArray * normaleArray = [NSMutableArray array];
|
||||||
NSMutableArray * nobleArray = [NSMutableArray array];
|
NSMutableArray * nobleArray = [NSMutableArray array];
|
||||||
NSMutableArray * weekStarArray = [NSMutableArray array];
|
NSMutableArray * weekStarArray = [NSMutableArray array];
|
||||||
|
NSMutableArray * graffiti = [NSMutableArray array];
|
||||||
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
if (obj.giftType == GiftType_Lucky) {
|
if (obj.giftType == GiftType_Lucky) {
|
||||||
[luckyArray addObject:obj];
|
[luckyArray addObject:obj];
|
||||||
@@ -411,13 +422,15 @@
|
|||||||
[nobleArray addObject:obj];
|
[nobleArray addObject:obj];
|
||||||
} else if (obj.giftType == GiftType_WeekStar) {
|
} else if (obj.giftType == GiftType_WeekStar) {
|
||||||
[weekStarArray addObject:obj];
|
[weekStarArray addObject:obj];
|
||||||
}
|
} else if (obj.giftType == GiftType_Graffiti) {
|
||||||
|
[graffiti addObject:obj];
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
self.giftArray = normaleArray;
|
self.giftArray = normaleArray;
|
||||||
self.giftLuckyArray = luckyArray;
|
self.giftLuckyArray = luckyArray;
|
||||||
self.giftNobleArray = nobleArray;
|
self.giftNobleArray = nobleArray;
|
||||||
self.giftWeekStarArray = weekStarArray;
|
self.giftWeekStarArray = weekStarArray;
|
||||||
self.giftGraffitiArray = luckyArray;
|
self.giftGraffitiArray = graffiti;
|
||||||
if (self.defaultSelectGiftId.length) {
|
if (self.defaultSelectGiftId.length) {
|
||||||
for (GiftInfoModel *gift in self.normalOriginArray) {
|
for (GiftInfoModel *gift in self.normalOriginArray) {
|
||||||
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||||
@@ -469,6 +482,7 @@
|
|||||||
_usingplaceType = usingplaceType;
|
_usingplaceType = usingplaceType;
|
||||||
if (_usingplaceType == SendGiftType_User) {
|
if (_usingplaceType == SendGiftType_User) {
|
||||||
self.luckyGiftButton.hidden = YES;
|
self.luckyGiftButton.hidden = YES;
|
||||||
|
self.graffitiButton.hidden = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,5 +683,14 @@
|
|||||||
return _datasource;
|
return _datasource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIScrollView *)scrollView {
|
||||||
|
if (!_scrollView) {
|
||||||
|
_scrollView = [[UIScrollView alloc] init];
|
||||||
|
_scrollView.backgroundColor = [UIColor clearColor];
|
||||||
|
_scrollView.showsHorizontalScrollIndicator = NO;
|
||||||
|
}
|
||||||
|
return _scrollView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -8,9 +8,24 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@class XPGraffitiGiftView;
|
||||||
|
@protocol XPGraffitiGiftViewDelegate <NSObject>
|
||||||
|
///点击切换
|
||||||
|
- (void)xPGraffitiGiftView:(XPGraffitiGiftView *)view didClickChange:(UILabel *)sender;
|
||||||
|
///点击了关闭
|
||||||
|
- (void)xPGraffitiGiftView:(XPGraffitiGiftView *)view didClickClose:(UIButton *)sender;
|
||||||
|
///绘画完成了
|
||||||
|
- (void)xPGraffitiGiftView:(XPGraffitiGiftView *)view didDrawCompletion:(NSArray *)pointArray;
|
||||||
|
@end
|
||||||
|
|
||||||
@interface XPGraffitiGiftView : UIView
|
@interface XPGraffitiGiftView : UIView
|
||||||
@property (nonatomic,strong) UIImage *image;
|
@property (nonatomic,strong) UIImage *image;
|
||||||
|
///代理
|
||||||
|
@property (nonatomic,weak) id<XPGraffitiGiftViewDelegate> delegate;
|
||||||
|
///价格
|
||||||
|
@property (nonatomic,assign) double price;
|
||||||
|
///动画的数据
|
||||||
|
@property (nonatomic,strong) NSArray *animationArray;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -11,10 +11,14 @@
|
|||||||
///Tool
|
///Tool
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
#import "XPMacro.h"
|
#import "XPMacro.h"
|
||||||
|
#import "XCHUDTool.h"
|
||||||
|
#import "XPHomeGradientLabel.h"
|
||||||
|
|
||||||
@interface XPGraffitiGiftView ()
|
@interface XPGraffitiGiftView ()
|
||||||
///回话的内容
|
///回话的内容
|
||||||
@property (nonatomic,strong) UIView * contentView;
|
@property (nonatomic,strong) UIView * contentView;
|
||||||
|
///绘画的view
|
||||||
|
@property (nonatomic,strong) UIView * drawView;
|
||||||
///类型
|
///类型
|
||||||
@property (nonatomic,strong) UIStackView *tipsStackView;
|
@property (nonatomic,strong) UIStackView *tipsStackView;
|
||||||
///✋🏻
|
///✋🏻
|
||||||
@@ -28,23 +32,27 @@
|
|||||||
///类型
|
///类型
|
||||||
@property (nonatomic,strong) UIStackView *toolStackView;
|
@property (nonatomic,strong) UIStackView *toolStackView;
|
||||||
///切换
|
///切换
|
||||||
@property (nonatomic,strong) UIButton *changeButton;
|
@property (nonatomic,strong) XPHomeGradientLabel *changeButton;
|
||||||
///撤销
|
///撤销
|
||||||
@property (nonatomic,strong) UIButton *repealButton;
|
@property (nonatomic,strong) UIButton *repealButton;
|
||||||
///删除
|
///删除
|
||||||
@property (nonatomic,strong) UIButton *deleteButton;
|
@property (nonatomic,strong) UIButton *deleteButton;
|
||||||
///关闭
|
///关闭
|
||||||
@property (nonatomic,strong) UIButton *closeButton;
|
@property (nonatomic,strong) UIButton *closeButton;
|
||||||
|
///手指滑动的point
|
||||||
@property (nonatomic,assign) CGPoint panPoint;
|
@property (nonatomic,assign) CGPoint panPoint;
|
||||||
///
|
///开始的point
|
||||||
@property (nonatomic,assign) CGPoint beginPoint;
|
@property (nonatomic,assign) CGPoint beginPoint;
|
||||||
///
|
///两个涂鸦的间距
|
||||||
@property (nonatomic,assign) CGFloat step;
|
@property (nonatomic,assign) CGFloat step;
|
||||||
///
|
///
|
||||||
@property (nonatomic,strong) NSMutableArray *datasource;
|
|
||||||
///
|
|
||||||
@property (nonatomic,assign) int index;
|
@property (nonatomic,assign) int index;
|
||||||
|
///是否展示超过最大值的
|
||||||
|
@property (nonatomic,assign) BOOL isShowMaxToast;
|
||||||
|
@property (nonatomic,strong) NSMutableArray<UIImageView *> *viewsArray;
|
||||||
|
@property (nonatomic,strong) NSMutableArray<NSNumber *> *indexArray;
|
||||||
|
@property (nonatomic,strong) NSMutableArray<NSArray<NSNumber *> *> *pointArray;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XPGraffitiGiftView
|
@implementation XPGraffitiGiftView
|
||||||
@@ -60,12 +68,15 @@
|
|||||||
|
|
||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)initSubViews {
|
- (void)initSubViews {
|
||||||
self.step = 20;
|
self.isShowMaxToast = YES;
|
||||||
|
self.step = 10;
|
||||||
UIPanGestureRecognizer * panGes = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)];
|
UIPanGestureRecognizer * panGes = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)];
|
||||||
[self addGestureRecognizer:panGes];
|
[self addGestureRecognizer:panGes];
|
||||||
self.backgroundColor = [UIColor clearColor];
|
self.backgroundColor = [UIColor clearColor];
|
||||||
[self addSubview:self.contentView];
|
[self addSubview:self.contentView];
|
||||||
|
|
||||||
[self.contentView addSubview:self.tipsStackView];
|
[self.contentView addSubview:self.tipsStackView];
|
||||||
|
[self.contentView addSubview:self.drawView];
|
||||||
[self.contentView addSubview:self.toolView];
|
[self.contentView addSubview:self.toolView];
|
||||||
|
|
||||||
[self.tipsStackView addArrangedSubview:self.handImageView];
|
[self.tipsStackView addArrangedSubview:self.handImageView];
|
||||||
@@ -98,6 +109,11 @@
|
|||||||
make.width.mas_equalTo(KScreenWidth);
|
make.width.mas_equalTo(KScreenWidth);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
[self.drawView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.top.mas_equalTo(self.contentView).offset(kSafeAreaTopHeight);
|
||||||
|
make.left.right.mas_equalTo(self.contentView);
|
||||||
|
make.bottom.mas_equalTo(self.toolView.mas_top);
|
||||||
|
}];
|
||||||
|
|
||||||
[self.handImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.handImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.size.mas_equalTo(CGSizeMake(78, 93));
|
make.size.mas_equalTo(CGSizeMake(78, 93));
|
||||||
@@ -142,12 +158,23 @@
|
|||||||
UITouch *touch = touches.anyObject;
|
UITouch *touch = touches.anyObject;
|
||||||
CGPoint point = [touch locationInView:self.contentView];
|
CGPoint point = [touch locationInView:self.contentView];
|
||||||
self.beginPoint = point;
|
self.beginPoint = point;
|
||||||
NSLog(@"beginPoint:X:%.2f, Y:%.2f", point.x, point.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)panAction:(UIPanGestureRecognizer *)tap {
|
- (void)panAction:(UIPanGestureRecognizer *)tap {
|
||||||
|
if (self.pointArray.count >= 300) {
|
||||||
|
if (self.isShowMaxToast) {
|
||||||
|
[XCHUDTool showErrorWithMessage:@"最多只能画300个呦"];
|
||||||
|
self.isShowMaxToast = YES;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tap.state == UIGestureRecognizerStateBegan) {
|
||||||
|
[self.indexArray addObject:[NSNumber numberWithInteger:self.viewsArray.count]];
|
||||||
|
} else if(tap.state == UIGestureRecognizerStateEnded) {
|
||||||
|
self.isShowMaxToast = YES;
|
||||||
|
}
|
||||||
CGPoint point = [tap translationInView:self.contentView];
|
CGPoint point = [tap translationInView:self.contentView];
|
||||||
NSLog(@"panAction:X:%.2f, Y:%.2f", point.x, point.y);
|
|
||||||
CGFloat dx = [self myAbs:point.x - self.panPoint.x];
|
CGFloat dx = [self myAbs:point.x - self.panPoint.x];
|
||||||
CGFloat dy = [self myAbs:point.y - self.panPoint.y];
|
CGFloat dy = [self myAbs:point.y - self.panPoint.y];
|
||||||
CGPoint drawPoint = CGPointMake(self.beginPoint.x + point.x , self.beginPoint.y + point.y);
|
CGPoint drawPoint = CGPointMake(self.beginPoint.x + point.x , self.beginPoint.y + point.y);
|
||||||
@@ -171,24 +198,63 @@
|
|||||||
imageView.layer.masksToBounds = YES;
|
imageView.layer.masksToBounds = YES;
|
||||||
imageView.image = self.image;
|
imageView.image = self.image;
|
||||||
imageView.frame = CGRectMake(point.x, point.y, 20, 20);
|
imageView.frame = CGRectMake(point.x, point.y, 20, 20);
|
||||||
[self.contentView addSubview:imageView];
|
[self.drawView addSubview:imageView];
|
||||||
|
[self.viewsArray addObject:imageView];
|
||||||
|
[self.pointArray addObject:@[@([self changeWidthDraw:point.x]), @([self changeHeightDraw:point.y])]];
|
||||||
|
[self cratePriceAttribute];
|
||||||
|
if (self.pointArray.count > 10 && self.delegate && [self.delegate respondsToSelector:@selector(xPGraffitiGiftView:didDrawCompletion:)]) {
|
||||||
|
[self.delegate xPGraffitiGiftView:self didDrawCompletion:self.pointArray];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Event Response
|
- (NSInteger)changeWidthDraw:(CGFloat)number {
|
||||||
- (void)changeButtonAction:(UIButton *)sender {
|
return number / KScreenWidth * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger)changeHeightDraw:(CGFloat)number {
|
||||||
|
return number / KScreenHeight * 1000;
|
||||||
|
}
|
||||||
|
#pragma mark - Event Response
|
||||||
|
- (void)changeButtonAction{
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGraffitiGiftView:didClickChange:)]) {
|
||||||
|
[self.delegate xPGraffitiGiftView:self didClickChange:self.changeButton];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)repealButtonAction:(UIButton *)sender {
|
- (void)repealButtonAction:(UIButton *)sender {
|
||||||
|
NSInteger index = [self.indexArray lastObject].integerValue;
|
||||||
|
if (index < self.viewsArray.count) {
|
||||||
|
NSArray<UIImageView *> * array = [self.viewsArray subarrayWithRange:NSMakeRange(index, self.viewsArray.count - index)];
|
||||||
|
NSArray * array2 = [self.pointArray subarrayWithRange:NSMakeRange(index, self.pointArray.count - index)];
|
||||||
|
[self.pointArray removeObjectsInArray:array2];
|
||||||
|
[self.viewsArray removeObjectsInArray:array];
|
||||||
|
if (array.count) {
|
||||||
|
[array makeObjectsPerformSelector:@selector(removeFromSuperview)];
|
||||||
|
}
|
||||||
|
[self.indexArray removeLastObject];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)deleteButtonAction:(UIButton *)sender {
|
- (void)deleteButtonAction:(UIButton *)sender {
|
||||||
|
[self.viewsArray makeObjectsPerformSelector:@selector(removeFromSuperview)];
|
||||||
|
[self.pointArray removeAllObjects];
|
||||||
|
[self.indexArray removeAllObjects];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)closeButtonAction:(UIButton *)sender {
|
- (void)closeButtonAction:(UIButton *)sender {
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGraffitiGiftView:didClickClose:)]) {
|
||||||
|
[self.delegate xPGraffitiGiftView:self didClickClose:sender];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)cratePriceAttribute {
|
||||||
|
NSString * count = [NSString stringWithFormat:@"%ld", self.viewsArray.count];
|
||||||
|
NSString * price = [NSString stringWithFormat:@"%.0f", self.viewsArray.count * self.price];
|
||||||
|
NSString * title = [NSString stringWithFormat:@"已画%@个,需花费%@钻石", count, price];
|
||||||
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14], NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||||
|
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor appMainColor] range:[title rangeOfString:count]];
|
||||||
|
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor appMainColor] range:[title rangeOfString:price]];
|
||||||
|
self.titleLabel.attributedText = attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
@@ -200,6 +266,14 @@
|
|||||||
return _contentView;
|
return _contentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIView *)drawView {
|
||||||
|
if (!_drawView) {
|
||||||
|
_drawView = [[UIView alloc] init];
|
||||||
|
_drawView.backgroundColor = [UIColor clearColor];
|
||||||
|
}
|
||||||
|
return _drawView;
|
||||||
|
}
|
||||||
|
|
||||||
- (UIStackView *)tipsStackView {
|
- (UIStackView *)tipsStackView {
|
||||||
if (!_tipsStackView) {
|
if (!_tipsStackView) {
|
||||||
_tipsStackView = [[UIStackView alloc] init];
|
_tipsStackView = [[UIStackView alloc] init];
|
||||||
@@ -262,13 +336,15 @@
|
|||||||
return _toolStackView;
|
return _toolStackView;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIButton *)changeButton {
|
- (XPHomeGradientLabel *)changeButton {
|
||||||
if (!_changeButton) {
|
if (!_changeButton) {
|
||||||
_changeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
_changeButton = [[XPHomeGradientLabel alloc] init];
|
||||||
[_changeButton setTitle:@"切换涂鸦" forState:UIControlStateNormal];
|
_changeButton.font = [UIFont systemFontOfSize:12];
|
||||||
[_changeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
_changeButton.gradientColor = @[(id)UIColorFromRGB(0x33ECFF).CGColor, (id)UIColorFromRGB(0x57CF99).CGColor];
|
||||||
_changeButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
_changeButton.text = @"切换涂鸦";
|
||||||
[_changeButton addTarget:self action:@selector(changeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
_changeButton.userInteractionEnabled = YES;
|
||||||
|
UITapGestureRecognizer * tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(changeButtonAction)];
|
||||||
|
[_changeButton addGestureRecognizer:tap];
|
||||||
}
|
}
|
||||||
return _changeButton;
|
return _changeButton;
|
||||||
}
|
}
|
||||||
@@ -303,5 +379,25 @@
|
|||||||
return _closeButton;
|
return _closeButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSMutableArray *)indexArray {
|
||||||
|
if (!_indexArray) {
|
||||||
|
_indexArray = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
return _indexArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSMutableArray *)pointArray {
|
||||||
|
if (!_pointArray) {
|
||||||
|
_pointArray = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
return _pointArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSMutableArray *)viewsArray {
|
||||||
|
if (!_viewsArray) {
|
||||||
|
_viewsArray = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
return _viewsArray;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
#import "XPFirstRechargeViewController.h"
|
#import "XPFirstRechargeViewController.h"
|
||||||
#import "XPNobleCenterViewController.h"
|
#import "XPNobleCenterViewController.h"
|
||||||
|
|
||||||
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate>
|
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate, XPGraffitiGiftViewDelegate>
|
||||||
///顶部的区域
|
///顶部的区域
|
||||||
@property (nonatomic,strong) UIView * topView;
|
@property (nonatomic,strong) UIView * topView;
|
||||||
///内容区域
|
///内容区域
|
||||||
@@ -66,6 +66,10 @@
|
|||||||
///背包礼物的重试次数
|
///背包礼物的重试次数
|
||||||
@property (nonatomic,assign) int packGiftRetryCount;
|
@property (nonatomic,assign) int packGiftRetryCount;
|
||||||
@property (nonatomic,strong) NSArray<XPGiftUserInfoModel *> *userArray;
|
@property (nonatomic,strong) NSArray<XPGiftUserInfoModel *> *userArray;
|
||||||
|
///涂鸦礼物的坐标
|
||||||
|
@property (nonatomic,strong) NSArray *graffitiPoint;
|
||||||
|
///选择了滑块的类型
|
||||||
|
@property (nonatomic,assign) GiftSegmentType segmentType;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XPSendGiftView
|
@implementation XPSendGiftView
|
||||||
@@ -130,6 +134,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Send Custom Message
|
#pragma mark - Send Custom Message
|
||||||
|
- (void)sendGraffitiGiftMessage {
|
||||||
|
if (self.segmentType == GiftSegmentType_Graffiti && self.graffitiPoint.count > 0) {
|
||||||
|
AttachmentModel * attachment = [[AttachmentModel alloc] init];
|
||||||
|
attachment.first = CustomMessageType_Graffiti_Gift;
|
||||||
|
attachment.second = Custom_Message_Sub_Graffiti_Gift;
|
||||||
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||||
|
[dic setValue:@(self.giftInfoView.lastSelectGift.giftId) forKey:@"giftId"];
|
||||||
|
[dic setValue:self.graffitiPoint forKey:@"drawFixedArray"];
|
||||||
|
attachment.data = dic;
|
||||||
|
[self sendCustomMessage:attachment];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)sendCustomMessage:(GiftReceiveInfoModel *)receiveModel oringinDic:(NSDictionary *)originDic {
|
- (void)sendCustomMessage:(GiftReceiveInfoModel *)receiveModel oringinDic:(NSDictionary *)originDic {
|
||||||
NSDictionary * dict = originDic;
|
NSDictionary * dict = originDic;
|
||||||
if (receiveModel.roomSendGiftType == RoomSendGiftType_AllMic) { // 全麦
|
if (receiveModel.roomSendGiftType == RoomSendGiftType_AllMic) { // 全麦
|
||||||
@@ -381,6 +398,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickSegment:(GiftSegmentType)type {
|
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickSegment:(GiftSegmentType)type {
|
||||||
|
self.segmentType = type;
|
||||||
self.giftBarView.type = type;
|
self.giftBarView.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +421,7 @@
|
|||||||
if (type == GiftSegmentType_Graffiti) {
|
if (type == GiftSegmentType_Graffiti) {
|
||||||
self.giftInfoView.hidden = YES;
|
self.giftInfoView.hidden = YES;
|
||||||
self.graffitiView.hidden = NO;
|
self.graffitiView.hidden = NO;
|
||||||
|
self.graffitiView.price = info.goldPrice;
|
||||||
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
||||||
if (error == nil && image) {
|
if (error == nil && image) {
|
||||||
self.graffitiView.image = image;
|
self.graffitiView.image = image;
|
||||||
@@ -413,6 +432,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - XPGraffitiGiftViewDelegate
|
||||||
|
- (void)xPGraffitiGiftView:(XPGraffitiGiftView *)view didClickClose:(UIButton *)sender {
|
||||||
|
[UIView animateWithDuration:0.2 animations:^{
|
||||||
|
self.graffitiView.hidden = YES;
|
||||||
|
self.giftInfoView.hidden = NO;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)xPGraffitiGiftView:(XPGraffitiGiftView *)view didClickChange:(UIButton *)sender {
|
||||||
|
[UIView animateWithDuration:0.2 animations:^{
|
||||||
|
self.graffitiView.hidden = YES;
|
||||||
|
self.giftInfoView.hidden = NO;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)xPGraffitiGiftView:(XPGraffitiGiftView *)view didDrawCompletion:(NSArray *)pointArray {
|
||||||
|
self.graffitiPoint = pointArray;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - XPGiftProtocol
|
#pragma mark - XPGiftProtocol
|
||||||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
||||||
self.giftBarView.isShowFirstRecharge = userInfo.isFirstCharge;
|
self.giftBarView.isShowFirstRecharge = userInfo.isFirstCharge;
|
||||||
@@ -459,6 +497,13 @@
|
|||||||
[self.presenter getUserWallInfo];
|
[self.presenter getUserWallInfo];
|
||||||
}
|
}
|
||||||
[self sendCustomMessage:receiveInfo oringinDic:originDic];
|
[self sendCustomMessage:receiveInfo oringinDic:originDic];
|
||||||
|
///发送涂鸦礼物消息
|
||||||
|
[self sendGraffitiGiftMessage];
|
||||||
|
if (self.segmentType == GiftSegmentType_Graffiti) {
|
||||||
|
NSString * title = [NSString stringWithFormat:@"发送涂鸦礼物:%@成功",self.giftInfoView.lastSelectGift.giftName];
|
||||||
|
[self showSuccessToast:title];
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///送礼物失败
|
///送礼物失败
|
||||||
@@ -573,6 +618,7 @@
|
|||||||
if (!_graffitiView) {
|
if (!_graffitiView) {
|
||||||
_graffitiView = [[XPGraffitiGiftView alloc] init];
|
_graffitiView = [[XPGraffitiGiftView alloc] init];
|
||||||
_graffitiView.hidden = YES;
|
_graffitiView.hidden = YES;
|
||||||
|
_graffitiView.delegate = self;
|
||||||
}
|
}
|
||||||
return _graffitiView;
|
return _graffitiView;
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#import "QGVAPConfigModel.h"
|
#import "QGVAPConfigModel.h"
|
||||||
#import "UIView+VAP.h"
|
#import "UIView+VAP.h"
|
||||||
#import <YYText/YYText.h>
|
#import <YYText/YYText.h>
|
||||||
|
#import <UIImageView+WebCache.h>
|
||||||
///Tool
|
///Tool
|
||||||
#import "XPGiftStorage.h"
|
#import "XPGiftStorage.h"
|
||||||
#import "XPMacro.h"
|
#import "XPMacro.h"
|
||||||
@@ -53,8 +54,9 @@
|
|||||||
#import "XPRoomLuckyBigPrizeView.h"
|
#import "XPRoomLuckyBigPrizeView.h"
|
||||||
#import "XPRoomGiftCompoundView.h"
|
#import "XPRoomGiftCompoundView.h"
|
||||||
#import "XPSailingAnimationView.h"
|
#import "XPSailingAnimationView.h"
|
||||||
|
#import "XPRoomGraffitiGiftAnimationView.h"
|
||||||
|
|
||||||
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate>
|
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate>
|
||||||
///展示的不同层级
|
///展示的不同层级
|
||||||
///最底层的
|
///最底层的
|
||||||
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
|
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
|
||||||
@@ -124,6 +126,8 @@
|
|||||||
@property (nonatomic, strong) NSMutableArray<AcrossRoomPKPrizeModel *> *acrossRoomPKQueue;
|
@property (nonatomic, strong) NSMutableArray<AcrossRoomPKPrizeModel *> *acrossRoomPKQueue;
|
||||||
#pragma mark - 航海
|
#pragma mark - 航海
|
||||||
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *sailingQueue;
|
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *sailingQueue;
|
||||||
|
#pragma mark - 涂鸦礼物
|
||||||
|
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *graffitiGiftQueue;
|
||||||
///幸运礼物动画是否在播放
|
///幸运礼物动画是否在播放
|
||||||
@property (nonatomic,assign) BOOL isLuckyGiftAnimation;
|
@property (nonatomic,assign) BOOL isLuckyGiftAnimation;
|
||||||
@end
|
@end
|
||||||
@@ -277,6 +281,8 @@
|
|||||||
[self receiveGiftCompound:attachment];
|
[self receiveGiftCompound:attachment];
|
||||||
} else if(attachment.first == CustomMessageType_Room_Sailing) {
|
} else if(attachment.first == CustomMessageType_Room_Sailing) {
|
||||||
[self receiveRoomSailing:attachment];
|
[self receiveRoomSailing:attachment];
|
||||||
|
} else if(attachment.first == CustomMessageType_Graffiti_Gift) {///涂鸦礼物
|
||||||
|
[self receiveRoomGraffitiGift:attachment];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -298,6 +304,57 @@
|
|||||||
[self userEnterRoom:content ext:extModel];
|
[self userEnterRoom:content ext:extModel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - 涂鸦礼物动画
|
||||||
|
- (void)receiveRoomGraffitiGift:(AttachmentModel *)attacment {
|
||||||
|
if (self.graffitiGiftQueue.count == 0) {
|
||||||
|
[self startGraffitiGiftAnimation:attacment];
|
||||||
|
}
|
||||||
|
[self.graffitiGiftQueue addObject:attacment];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startGraffitiGiftAnimation:(AttachmentModel *)model {
|
||||||
|
NSDictionary * dic = model.data;
|
||||||
|
NSNumber * giftId = dic[@"giftId"];
|
||||||
|
GiftInfoModel * giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftId.stringValue];
|
||||||
|
NSArray * array = dic[@"drawFixedArray"];
|
||||||
|
if (giftInfo.giftUrl.length > 0 && array.count > 0) {
|
||||||
|
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:giftInfo.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
||||||
|
if (error == nil && image) {
|
||||||
|
XPRoomGraffitiGiftAnimationView *graffitiView = [[XPRoomGraffitiGiftAnimationView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||||
|
graffitiView.giftImage = image;
|
||||||
|
graffitiView.delegate = self;
|
||||||
|
graffitiView.model = model;
|
||||||
|
graffitiView.pointArray = array;
|
||||||
|
[graffitiView beginDrawAnimation];
|
||||||
|
[self.highLevleView addSubview:graffitiView];
|
||||||
|
} else {
|
||||||
|
[self.graffitiGiftQueue removeObject:model];
|
||||||
|
if (self.graffitiGiftQueue.count > 0) {
|
||||||
|
[self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
} else {
|
||||||
|
[self.graffitiGiftQueue removeObject:model];
|
||||||
|
if (self.graffitiGiftQueue.count > 0) {
|
||||||
|
[self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- (void)xPRoomGraffitiGiftAnimationViewCompletion:(XPRoomGraffitiGiftAnimationView *)view attachment:(nonnull AttachmentModel *)attachment{
|
||||||
|
[view removeFromSuperview];
|
||||||
|
if ([self.graffitiGiftQueue containsObject:attachment]) {
|
||||||
|
[self.graffitiGiftQueue removeObject:attachment];
|
||||||
|
}
|
||||||
|
if (self.graffitiGiftQueue.count > 0) {
|
||||||
|
[self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - 跨房PK横幅动画
|
#pragma mark - 跨房PK横幅动画
|
||||||
- (void)acrossRoomPKBannerAnimation:(AttachmentModel *)attacment {
|
- (void)acrossRoomPKBannerAnimation:(AttachmentModel *)attacment {
|
||||||
AcrossRoomPKPrizeModel * prizeModel = [AcrossRoomPKPrizeModel modelWithJSON:attacment.data];
|
AcrossRoomPKPrizeModel * prizeModel = [AcrossRoomPKPrizeModel modelWithJSON:attacment.data];
|
||||||
@@ -1822,5 +1879,12 @@
|
|||||||
return _sailingQueue;
|
return _sailingQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSMutableArray<AttachmentModel *> *)graffitiGiftQueue {
|
||||||
|
if (!_graffitiGiftQueue) {
|
||||||
|
_graffitiGiftQueue = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
return _graffitiGiftQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// XPRoomGraffitiGiftAnimationView.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/8/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@class XPRoomGraffitiGiftAnimationView, AttachmentModel;
|
||||||
|
@protocol XPRoomGraffitiGiftAnimationViewDelegate <NSObject>
|
||||||
|
|
||||||
|
///动画完成
|
||||||
|
- (void)xPRoomGraffitiGiftAnimationViewCompletion:(XPRoomGraffitiGiftAnimationView *)view attachment:(AttachmentModel *)attachment;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface XPRoomGraffitiGiftAnimationView : UIView
|
||||||
|
@property (nonatomic,strong) UIImage *giftImage;
|
||||||
|
///代理
|
||||||
|
@property (nonatomic,weak) id<XPRoomGraffitiGiftAnimationViewDelegate> delegate;
|
||||||
|
@property (nonatomic,strong) NSArray *pointArray;
|
||||||
|
@property (nonatomic,strong) AttachmentModel *model;
|
||||||
|
///开始涂鸦动画
|
||||||
|
- (void)beginDrawAnimation;
|
||||||
|
///结束涂鸦动画
|
||||||
|
- (void)endDrawAnimation;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,82 @@
|
|||||||
|
//
|
||||||
|
// XPRoomGraffitiGiftAnimationView.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/8/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "XPRoomGraffitiGiftAnimationView.h"
|
||||||
|
#import "XPWeakTimer.h"
|
||||||
|
#import "XPMacro.h"
|
||||||
|
|
||||||
|
@interface XPRoomGraffitiGiftAnimationView ()
|
||||||
|
@property (nonatomic,strong) NSTimer *timer;
|
||||||
|
@property (nonatomic,assign) int index;
|
||||||
|
///数据
|
||||||
|
@property (nonatomic,strong) NSMutableArray *datasource;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation XPRoomGraffitiGiftAnimationView
|
||||||
|
|
||||||
|
- (instancetype)initWithFrame:(CGRect)frame {
|
||||||
|
self = [super initWithFrame:frame];
|
||||||
|
if (self) {
|
||||||
|
self.timer = [XPWeakTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(dramGraffitiAnimationView) userInfo:@"" repeats:YES];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)beginDrawAnimation {
|
||||||
|
self.index = 0;
|
||||||
|
for (int i = 0; i < self.pointArray.count; i++) {
|
||||||
|
NSArray * pointArray = self.pointArray[i];
|
||||||
|
NSNumber * first = [pointArray firstObject];
|
||||||
|
NSNumber * second = [pointArray lastObject];
|
||||||
|
CGFloat x = first.floatValue / 1000.0 * KScreenWidth;
|
||||||
|
CGFloat y = second.floatValue / 1000.0 * KScreenHeight;
|
||||||
|
if (x <= 0 || x >= KScreenWidth || y <= 0 || y >= KScreenHeight) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CGPoint point = CGPointMake(x, y);
|
||||||
|
[self.datasource addObject:[NSValue valueWithCGPoint:point]];
|
||||||
|
}
|
||||||
|
self.timer.fireDate = NSDate.distantPast;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)endDrawAnimation {
|
||||||
|
self.timer.fireDate = NSDate.distantFuture;
|
||||||
|
[self.datasource removeAllObjects];
|
||||||
|
self.index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)dramGraffitiAnimationView {
|
||||||
|
if (self.index > (self.datasource.count -1)) {
|
||||||
|
self.timer.fireDate = NSDate.distantFuture;
|
||||||
|
[self.datasource removeAllObjects];
|
||||||
|
self.index = 0;
|
||||||
|
[self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomGraffitiGiftAnimationViewCompletion:attachment:)]) {
|
||||||
|
[self.delegate xPRoomGraffitiGiftAnimationViewCompletion:self attachment:self.model];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NSValue * valeu= [self.datasource objectAtIndex:self.index];
|
||||||
|
CGPoint point = valeu.CGPointValue;
|
||||||
|
UIImageView * imageView = [[UIImageView alloc] init];
|
||||||
|
imageView.layer.masksToBounds = YES;
|
||||||
|
imageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||||
|
imageView.image = self.giftImage;
|
||||||
|
imageView.frame = CGRectMake(point.x, point.y, 20, 20);
|
||||||
|
[self addSubview:imageView];
|
||||||
|
self.index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSMutableArray *)datasource {
|
||||||
|
if (!_datasource) {
|
||||||
|
_datasource = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
return _datasource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -618,6 +618,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
if (!self.menuContainerView.superview) {
|
if (!self.menuContainerView.superview) {
|
||||||
[self.view addSubview:self.menuContainerView];
|
[self.view addSubview:self.menuContainerView];
|
||||||
}
|
}
|
||||||
|
[self.view bringSubviewToFront:self.animationView];
|
||||||
|
|
||||||
[self updateViewConstraintsOnAnchorRoom];
|
[self updateViewConstraintsOnAnchorRoom];
|
||||||
[self changeStageViewOnAnchorRoom];
|
[self changeStageViewOnAnchorRoom];
|
||||||
@@ -893,6 +894,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
[self.anchorScrollView addSubview:self.roomHeaderView];
|
[self.anchorScrollView addSubview:self.roomHeaderView];
|
||||||
[self.anchorScrollView addSubview:self.functionView];
|
[self.anchorScrollView addSubview:self.functionView];
|
||||||
[self.anchorScrollView addSubview:self.menuContainerView];
|
[self.anchorScrollView addSubview:self.menuContainerView];
|
||||||
|
[self.view bringSubviewToFront:self.animationView];
|
||||||
|
|
||||||
[self updateViewConstraintsOnAnchorRoom];
|
[self updateViewConstraintsOnAnchorRoom];
|
||||||
[self changeStageViewOnAnchorRoom];
|
[self changeStageViewOnAnchorRoom];
|
||||||
@@ -1481,6 +1483,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
if (!self.menuContainerView.superview) {
|
if (!self.menuContainerView.superview) {
|
||||||
[self.view addSubview:self.menuContainerView];
|
[self.view addSubview:self.menuContainerView];
|
||||||
}
|
}
|
||||||
|
[self.view bringSubviewToFront:self.animationView];
|
||||||
|
|
||||||
[self updateViewConstraintsOnAnchorRoom];
|
[self updateViewConstraintsOnAnchorRoom];
|
||||||
[self changeStageViewOnAnchorRoom];
|
[self changeStageViewOnAnchorRoom];
|
||||||
|
Reference in New Issue
Block a user