fix: 修正发现问题
This commit is contained in:
@@ -193,9 +193,9 @@ exitCurrentRoom:(void(^)(void))exit {
|
||||
|
||||
[self addSubview:self.coinsLabel];
|
||||
[self.coinsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.centerX.mas_equalTo(self.ballImageView);
|
||||
make.top.mas_equalTo(self).offset(25);
|
||||
make.height.mas_equalTo(28);
|
||||
make.centerX.mas_equalTo(self.ballImageView);
|
||||
make.top.mas_equalTo(self).offset(kGetScaleWidth(18));
|
||||
make.height.mas_equalTo(kGetScaleWidth(28));
|
||||
make.width.mas_equalTo(self.ballImageView);
|
||||
}];
|
||||
|
||||
|
@@ -277,6 +277,7 @@
|
||||
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend;
|
||||
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
||||
receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend;
|
||||
[self receiveGiftHandleSendGiftAnimation:attachment];
|
||||
if (receiveInfo.isLuckyBagGift) {
|
||||
if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;}
|
||||
@@ -288,7 +289,6 @@
|
||||
if (luckyGiftSvgaUrl.absoluteString.length > 0) {
|
||||
[self playLuckyGiftEffect:luckyGiftSvgaUrl];
|
||||
}
|
||||
|
||||
}
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self receiveGift:receiveInfo];
|
||||
@@ -299,6 +299,7 @@
|
||||
} else if (attachment.first == CustomMessageType_AllMicroSend) { //发送全麦礼物 或者多人礼物
|
||||
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
||||
receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend;
|
||||
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
|
||||
[self receiveGiftHandleSendGiftAnimation:attachment];
|
||||
if (receiveInfo.isLuckyBagGift) {
|
||||
@@ -1591,9 +1592,13 @@
|
||||
[uid isEqualToString:[AccountInfoStorage instance].getUid] &&
|
||||
isEnd == false) {
|
||||
if (isMSRTL()) {
|
||||
point = CGPointMake(kGetScaleWidth(80), [UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - kGetScaleWidth(110));
|
||||
point = CGPointMake(kGetScaleWidth(86), [UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - kGetScaleWidth(140));
|
||||
} else {
|
||||
point = CGPointMake(kGetScaleWidth([UIScreen mainScreen].bounds.size.width - kGetScaleWidth(110)), [UIScreen mainScreen].bounds.size.height - kSafeAreaTopHeight - kGetScaleWidth(110));
|
||||
if (KScreenWidth <= 375) {
|
||||
point = CGPointMake(kGetScaleWidth([UIScreen mainScreen].bounds.size.width - kGetScaleWidth(86)), [UIScreen mainScreen].bounds.size.height - kSafeAreaBottomHeight - kGetScaleWidth(140));
|
||||
} else {
|
||||
point = CGPointMake(kGetScaleWidth([UIScreen mainScreen].bounds.size.width - kGetScaleWidth(150)), [UIScreen mainScreen].bounds.size.height - kSafeAreaBottomHeight - kGetScaleWidth(140));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1618,14 +1623,17 @@
|
||||
giftImageView.hidden = NO;
|
||||
giftImageView.imageUrl = giftUrl;
|
||||
[self.lowLevelView addSubview:giftImageView];
|
||||
|
||||
CGFloat delay = 3.2;
|
||||
CAAnimationGroup *group = [self createGiftAnimationStartPoint:startPoint endPoint:endPoint];
|
||||
if (isGiftCombing) {
|
||||
delay = 1.0;
|
||||
group = [self createGiftComboAnimationStartPoint:startPoint endPoint:endPoint];
|
||||
}
|
||||
// 确保视图在动画开始前设置到 startPoint 位置
|
||||
giftImageView.layer.position = startPoint;
|
||||
[giftImageView.layer addAnimation:group forKey:@"giftDisplayViewAnimation"];
|
||||
[self performSelector:@selector(aniationDidFinish:) withObject:giftImageView afterDelay:(3.2+0.25)];
|
||||
[self performSelector:@selector(aniationDidFinish:) withObject:giftImageView afterDelay:(delay+0.25)];
|
||||
}
|
||||
|
||||
- (CAAnimationGroup *)createGiftComboAnimationStartPoint:(CGPoint)startPoint
|
||||
|
@@ -15,6 +15,7 @@
|
||||
typedef enum : NSUInteger {
|
||||
ComboAction_ShowPanel,
|
||||
ComboAction_RemovePanel,
|
||||
ComboAction_Error,
|
||||
ComboAction_Combo_Count_Update,
|
||||
} ComboActionType;
|
||||
|
||||
@@ -54,6 +55,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (NSInteger)loadTotalGiftNum;
|
||||
- (BOOL)isGiftCombing;
|
||||
|
||||
- (NSString *)loadErrorMessage;
|
||||
|
||||
- (void)receiveGiftInfoForDisplayComboFlags:(GiftReceiveInfoModel *)receiveInfo
|
||||
container:(UIView *)container;
|
||||
|
||||
|
@@ -45,11 +45,9 @@
|
||||
|
||||
@property (nonatomic, copy) void (^actionCallback)(ComboActionType type);
|
||||
|
||||
@property (nonatomic, strong) NSTimer *comboFlagTimer_1;
|
||||
@property (nonatomic, strong) NSTimer *comboFlagTimer_2;
|
||||
@property (nonatomic, copy) NSString *errorMessage;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray<GiftComboFlagView *> *activeViews; // 用于存储最多2个活跃的动画视图
|
||||
//@property (nonatomic, strong) NSMutableArray<GiftReceiveInfoModel *> *activeModels; // 存储活跃的模型数据
|
||||
|
||||
@end
|
||||
|
||||
@@ -97,7 +95,7 @@
|
||||
// 开始连击,重置
|
||||
- (void)resetCombo {
|
||||
_combo = 1;
|
||||
|
||||
_errorMessage = @"";
|
||||
if (self.actionCallback) {
|
||||
self.actionCallback(ComboAction_ShowPanel);
|
||||
}
|
||||
@@ -162,6 +160,10 @@
|
||||
}
|
||||
|
||||
- (void)handleGiftInfo:(GiftReceiveInfoModel *)receiveInfo {
|
||||
if (receiveInfo.comboCount < 1) {
|
||||
// 不正常的数据,不处理
|
||||
return;
|
||||
}
|
||||
if ([self updateExistingViewWithModel:receiveInfo]) {
|
||||
// 如果更新了现有视图,就不需要创建新视图
|
||||
return;
|
||||
@@ -190,17 +192,19 @@
|
||||
[self allCurrentFlagMoveDown];
|
||||
|
||||
[self.containerView addSubview:flagView];
|
||||
[self.activeViews addObject:flagView];
|
||||
[self.activeViews insertObject:flagView atIndex:0];
|
||||
|
||||
[self animateView:flagView positionY:positionY];
|
||||
}
|
||||
|
||||
- (void)allCurrentFlagMoveDown {
|
||||
CGFloat positionY = kGetScaleWidth(380);
|
||||
[self.activeViews enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(GiftComboFlagView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
CGRect rect = obj.frame;
|
||||
rect.origin.y = positionY + idx * 50;
|
||||
obj.frame = rect;
|
||||
[self.activeViews enumerateObjectsWithOptions:NSEnumerationConcurrent usingBlock:^(GiftComboFlagView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
CGRect rect = obj.frame;
|
||||
rect.origin.y = positionY + idx * 50;
|
||||
obj.frame = rect;
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -230,6 +234,8 @@
|
||||
[self.activeViews removeObject:flagView];
|
||||
flagView = nil;
|
||||
}
|
||||
|
||||
[self allCurrentFlagMoveDown];
|
||||
}
|
||||
|
||||
// 更新现有 View 的数据,如果存在相同的 ID
|
||||
@@ -311,6 +317,10 @@
|
||||
[self sendCustomMessage:info];
|
||||
}
|
||||
|
||||
- (NSString *)loadErrorMessage {
|
||||
return self.errorMessage;
|
||||
}
|
||||
|
||||
#pragma mark - Gift meta data
|
||||
- (void)saveSendGiftTo:(NSArray *)UIDs
|
||||
{
|
||||
@@ -366,13 +376,18 @@
|
||||
@kWeakify(self);
|
||||
[Api requestSendGift:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
if (code == 200) {
|
||||
GiftReceiveInfoModel *receive = [GiftReceiveInfoModel modelWithJSON:data.data];
|
||||
receive.sourceType = self.giftSourceType;
|
||||
receive.roomSendGiftType = self.roomSendGiftType;
|
||||
[self handleSendGiftSuccess:data];
|
||||
} else {
|
||||
// TODO: 发送失败处理
|
||||
self.errorMessage = msg;
|
||||
self.actionCallback(ComboAction_RemovePanel);
|
||||
self.actionCallback(ComboAction_Error);
|
||||
}
|
||||
}
|
||||
targetUids:allUIDs
|
||||
@@ -387,7 +402,6 @@
|
||||
}
|
||||
|
||||
- (void)handleSendGiftSuccess:(BaseModel *)response {
|
||||
// NSInteger sendCombo = [self loadTotalGiftNum];
|
||||
|
||||
if (self.actionCallback) {
|
||||
self.actionCallback(ComboAction_Combo_Count_Update);
|
||||
|
@@ -98,6 +98,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,assign) BOOL isLuckyBagGift;
|
||||
///是不是全麦
|
||||
@property (nonatomic,assign) BOOL isBatch;
|
||||
@property (nonatomic,assign) BOOL isComboBatch;
|
||||
///播放哪个动画
|
||||
@property (nonatomic, assign) BOOL isShowAnimation;
|
||||
|
||||
|
@@ -59,18 +59,13 @@
|
||||
|
||||
- (void)updateReceiveInfoModel:(GiftReceiveInfoModel *)model
|
||||
animationType:(NSInteger)type {
|
||||
|
||||
if (model.comboCount < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
_receiveInfo = model;
|
||||
|
||||
self.giftGiverAvatar.imageUrl = model.avatar;
|
||||
self.giftIcon.imageUrl = model.gift.giftUrl;
|
||||
self.giftGiverNameLabel.text = model.nick;
|
||||
|
||||
if (model.isBatch) {
|
||||
if (model.isComboBatch) {
|
||||
self.giftReceiverNameLabel.text = YMLocalizedString(@"Combo_1");
|
||||
} else {
|
||||
if (model.targetUids.count == 1) {
|
||||
@@ -184,7 +179,7 @@
|
||||
if (!_giftIcon) {
|
||||
_giftIcon = [[NetImageView alloc] init];
|
||||
_giftIcon.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_giftIcon.layer.cornerRadius = kGetScaleWidth(24);
|
||||
// _giftIcon.layer.cornerRadius = kGetScaleWidth(24);
|
||||
_giftIcon.layer.masksToBounds = YES;
|
||||
_giftIcon.clipsToBounds = YES;
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#import "CountdownRingView.h"
|
||||
|
||||
#import <SVGA.h>
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
@interface GiftComboView ()<SVGAPlayerDelegate>
|
||||
|
||||
@@ -72,7 +73,7 @@
|
||||
}];
|
||||
|
||||
[self.container addSubview:self.playImageView];
|
||||
[self.playImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
[self.playImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.trailing.mas_equalTo(self.container);
|
||||
make.width.mas_equalTo(kGetScaleWidth(150));
|
||||
make.height.mas_equalTo(kGetScaleWidth(300));
|
||||
@@ -84,10 +85,10 @@
|
||||
make.bottom.mas_equalTo(self.playImageView).offset(-100);
|
||||
}];
|
||||
|
||||
[self addSubview:self.countdownRingView];
|
||||
[self.container addSubview:self.countdownRingView];
|
||||
[self.countdownRingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.playImageView);
|
||||
make.bottom.mas_equalTo(self.playImageView).offset(-6);
|
||||
make.centerX.mas_equalTo(self.playImageView.mas_centerX);
|
||||
make.bottom.mas_equalTo(self.playImageView.mas_bottom).offset(4);
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(90));
|
||||
}];
|
||||
}
|
||||
@@ -103,6 +104,12 @@
|
||||
}
|
||||
|
||||
- (void)handleTap {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// 1521 连续震动 3 次
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
|
||||
});
|
||||
|
||||
[[GiftComboManager sharedManager] sendGift];
|
||||
[self.playImageView startAnimation];
|
||||
[self.countdownRingView resetCountdown];
|
||||
@@ -142,7 +149,7 @@
|
||||
- (SVGAImageView *)playImageView {
|
||||
if (_playImageView == nil) {
|
||||
_playImageView = [[SVGAImageView alloc]init];
|
||||
_playImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_playImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_playImageView.hidden = NO;
|
||||
_playImageView.delegate = self;
|
||||
}
|
||||
@@ -151,7 +158,7 @@
|
||||
|
||||
- (CountdownRingView *)countdownRingView {
|
||||
if (!_countdownRingView) {
|
||||
_countdownRingView = [[CountdownRingView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)
|
||||
_countdownRingView = [[CountdownRingView alloc] initWithFrame:CGRectMake(0, 0, kGetScaleWidth(90), kGetScaleWidth(90))
|
||||
duration:5];
|
||||
}
|
||||
return _countdownRingView;
|
||||
|
@@ -134,6 +134,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
[self initSubViewConstraints];
|
||||
[self initHttpRequest];
|
||||
|
||||
if (self.usingplaceType == SendGiftType_User) {
|
||||
return;
|
||||
}
|
||||
@kWeakify(self);
|
||||
[[GiftComboManager sharedManager] registerActions:^(ComboActionType type) {
|
||||
@kStrongify(self);
|
||||
@@ -157,7 +160,6 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
make.edges.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
break;
|
||||
case ComboAction_RemovePanel:{
|
||||
self.contentView.hidden = NO;
|
||||
@@ -176,6 +178,10 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
break;
|
||||
case ComboAction_Combo_Count_Update: {
|
||||
[self.comboView updateCount];
|
||||
}
|
||||
break;
|
||||
case ComboAction_Error: {
|
||||
[self showErrorToast:[[GiftComboManager sharedManager] loadErrorMessage]];
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
Reference in New Issue
Block a user