From faa6a2c4dc48ab92b851533bc669269fbd1f5658 Mon Sep 17 00:00:00 2001 From: AI Health Developer Date: Fri, 11 Apr 2025 10:45:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20combo=20=E9=87=91=E5=B8=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/AnimationView/RoomAnimationView.m | 2 +- .../View/SendGiftView/View/GiftComboView.h | 3 +- .../View/SendGiftView/View/GiftComboView.m | 30 +++++++++++++++---- .../View/SendGiftView/View/XPSendGiftView.m | 5 +++- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m index 56a98f88..94d26c81 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m @@ -690,7 +690,7 @@ XPRoomGraffitiGiftAnimationViewDelegate [self loadBroveSVGAVideoItem:level.integerValue]; } if (coins) { - [[NSNotificationCenter defaultCenter] postNotificationName:@"receiveLuckGiftWinning" object:[NSString stringByRemovingRedundantZeros:coins.stringValue]]; +// [[NSNotificationCenter defaultCenter] postNotificationName:@"receiveLuckGiftWinning" object:[NSString stringByRemovingRedundantZeros:coins.stringValue]]; } } } diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.h b/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.h index fd5f963c..f690dd04 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.h @@ -13,9 +13,10 @@ NS_ASSUME_NONNULL_BEGIN @interface GiftComboView : UIView - (void)setupCurrentGold:(double)gold; -- (void)updateCurrentGold:(double)gold giftPrice:(double)price isFromWinning:(BOOL)isFromWinning; +- (void)updateCurrentGold:(double)gold giftPrice:(double)price isFromWinning:(BOOL)isFromWinning isBrove:(BOOL)isBrove; - (void)updateCount; - (void)stopTimer; +- (void)endCombo; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.m index 73ca4f64..2f560cfe 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/GiftComboView.m @@ -50,7 +50,7 @@ if (self = [super init]) { self.feedbackGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy]; self.updateGoldQueue = @[].mutableCopy; - [self setupNotification]; + UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom]; [b addTarget:self action:@selector(handleTapSpace) forControlEvents:UIControlEventTouchUpInside]; @@ -64,6 +64,7 @@ [self setupTimer]; [self updateCount]; [self setupSVGAParser]; + [self setupNotification]; } return self; } @@ -90,10 +91,13 @@ } - (void)setupNotification { + @kWeakify(self); + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"receiveLuckGiftWinning" object:nil]; [[NSNotificationCenter defaultCenter] addObserverForName:@"receiveLuckGiftWinning" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull notification) { + @kStrongify(self); if ([notification.object isKindOfClass:[NSString class]]) { [self handleStringNotification:notification.object]; } else if ([notification.object isKindOfClass:[NSDictionary class]]) { @@ -104,7 +108,7 @@ - (void)handleStringNotification:(NSString *)coin { if (![NSString isEmpty:coin]) { - [self updateCurrentGold:coin.doubleValue giftPrice:0 isFromWinning:YES]; + [self updateCurrentGold:coin.doubleValue giftPrice:0 isFromWinning:YES isBrove:YES]; } } @@ -112,7 +116,7 @@ double coin = [[dic objectForKey:@"CurrentGold"] doubleValue]; double price = [[dic objectForKey:@"Price"] doubleValue]; BOOL isFromWinning = [[dic objectForKey:@"isFromWinning"] boolValue]; - [self updateCurrentGold:coin giftPrice:price isFromWinning:isFromWinning]; + [self updateCurrentGold:coin giftPrice:price isFromWinning:isFromWinning isBrove:YES]; } - (void)updateCount { @@ -132,6 +136,16 @@ [self.countdownRingView stopCountdown]; } +- (void)endCombo { +// [[NSNotificationCenter defaultCenter] removeObserver:self]; +// [self.countdownRingView stopCountdown]; +// [self.countdownRingView removeFromSuperview]; +// self.countdownRingView = nil; +// [self.playImageView stopAnimation]; +// [self.playImageView clear]; +// self.playImageView.delegate = nil; +} + - (void)setupUI { [self addSubview:self.container]; [self.container mas_makeConstraints:^(MASConstraintMaker *make) { @@ -239,6 +253,8 @@ #pragma mark - - (void)setupCurrentGold:(double)gold { + NSLog(@" --- --- --- 更新总数:%f", gold); + self.comboGoldNum = gold; self.comboGoldLabel.text = @(gold).stringValue; } @@ -266,11 +282,13 @@ } } -- (void)updateCurrentGold:(double)gold giftPrice:(double)price isFromWinning:(BOOL)isFromWinning { +- (void)updateCurrentGold:(double)gold giftPrice:(double)price isFromWinning:(BOOL)isFromWinning isBrove:(BOOL)isBrove { NSString *goldString = isFromWinning ? [NSString stringWithFormat:@"+ %@", @(gold)] : @(-price).stringValue; if (isFromWinning) { - double updateGold = self.comboGoldNum + gold; - [self setupCurrentGold:updateGold]; +// if (!isBrove) { + double updateGold = self.comboGoldNum + gold; + [self setupCurrentGold:updateGold]; +// } } else { // double updateGold = self.comboGoldNum + gold; [self setupCurrentGold:gold]; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m index 7b4defd6..96f7b846 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m @@ -177,10 +177,13 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; if (self->_luckyBroadcastView) { self.luckyBroadcastView.hidden = NO; } + + [self.presenter getUserWalletInfo]; + [self.comboView stopTimer]; + [self.comboView endCombo]; [self.comboView removeFromSuperview]; self.comboView = nil; - [self.presenter getUserWalletInfo]; } break; case ComboAction_Combo_Count_Update: {