修复了航海开出特效的不同步问题

This commit is contained in:
fengshuo
2022-08-24 18:28:13 +08:00
parent d444fe1c26
commit d683903509
3 changed files with 25 additions and 19 deletions

View File

@@ -9,6 +9,7 @@
#import "XPWeakTimer.h" #import "XPWeakTimer.h"
#import "XPMacro.h" #import "XPMacro.h"
@interface XPRoomGraffitiGiftAnimationView () @interface XPRoomGraffitiGiftAnimationView ()
@property (nonatomic,strong) NSTimer *timer; @property (nonatomic,strong) NSTimer *timer;
@property (nonatomic,assign) int index; @property (nonatomic,assign) int index;

View File

@@ -12,11 +12,13 @@
#import "ThemeColor.h" #import "ThemeColor.h"
#import "RoomSailingPrizeModel.h" #import "RoomSailingPrizeModel.h"
#import "NSObject+MJExtension.h" #import "NSObject+MJExtension.h"
#import <MarqueeLabel.h>
@interface XPSailingAnimationView () @interface XPSailingAnimationView ()
/// ///
@property (nonatomic,strong) UIImageView *backImageView; @property (nonatomic,strong) UIImageView *backImageView;
/// ///
@property (nonatomic,strong) UILabel *titleLabel; @property (nonatomic,strong) MarqueeLabel *titleLabel;
@end @end
@implementation XPSailingAnimationView @implementation XPSailingAnimationView
@@ -67,7 +69,7 @@
} }
[attribute appendAttributedString:[self createAttribute:nick color:UIColorFromRGB(0xFFFE95) fontSize:fontSize]]; [attribute appendAttributedString:[self createAttribute:nick color:UIColorFromRGB(0xFFFE95) fontSize:fontSize]];
[attribute appendAttributedString:[self createAttribute:@"在航海冒险中获得 " color:[UIColor whiteColor] fontSize:fontSize]]; [attribute appendAttributedString:[self createAttribute:@"在航海冒险中获得 " color:[UIColor whiteColor] fontSize:fontSize]];
[attribute appendAttributedString:[self createAttribute:info.prizeName color:[ThemeColor appEmphasizeColor] fontSize:fontSize]]; [attribute appendAttributedString:[self createAttribute:info.prizeName color:UIColorFromRGB(0xFFFE95) fontSize:fontSize]];
if (info.prizeNum > 1) { if (info.prizeNum > 1) {
[attribute appendAttributedString:[self createAttribute:[NSString stringWithFormat:@" X%d", info.prizeNum] color:[UIColor whiteColor] fontSize:fontSize]]; [attribute appendAttributedString:[self createAttribute:[NSString stringWithFormat:@" X%d", info.prizeNum] color:[UIColor whiteColor] fontSize:fontSize]];
} }
@@ -84,12 +86,13 @@
return _backImageView; return _backImageView;
} }
- (UILabel *)titleLabel { - (MarqueeLabel *)titleLabel{
if (!_titleLabel) { if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init]; _titleLabel = [[MarqueeLabel alloc] init];
_titleLabel.scrollDuration = 4.0;
_titleLabel.userInteractionEnabled = YES;
} }
return _titleLabel; return _titleLabel;
} }
@end @end

View File

@@ -75,9 +75,7 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
@property (nonatomic,strong) UILabel *consumLabel; @property (nonatomic,strong) UILabel *consumLabel;
/// ///
@property (nonatomic,strong) UIStackView *tipsStackView; @property (nonatomic,strong) UIStackView *tipsStackView;
///
@property (nonatomic,strong) UIButton *boxButton; @property (nonatomic,strong) UIButton *boxButton;
///
@property (nonatomic,strong) UILabel *tipLabel; @property (nonatomic,strong) UILabel *tipLabel;
@property (nonatomic,strong) UIView * animationView; @property (nonatomic,strong) UIView * animationView;
@@ -86,8 +84,10 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
@property (nonatomic,strong) RoomSailingInfoModel *sailingInfo; @property (nonatomic,strong) RoomSailingInfoModel *sailingInfo;
///uid ///uid
@property (nonatomic,strong) NSString *roomUid; @property (nonatomic,strong) NSString *roomUid;
/// ///
@property (nonatomic,strong) NSArray<NSString *> *levelArray; @property (nonatomic,strong) NSArray<NSString *> *levelArray;
///
@property (nonatomic,strong) RoomSailingPrizeListModel *prizeInfo;
@end @end
@implementation XPSailingViewController @implementation XPSailingViewController
@@ -292,6 +292,7 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
} }
- (void)openSailingSuccess:(RoomSailingPrizeListModel *)model { - (void)openSailingSuccess:(RoomSailingPrizeListModel *)model {
self.prizeInfo = model;
self.sailingInfo.keyNum = model.remainKeyNum; self.sailingInfo.keyNum = model.remainKeyNum;
NSString * fuleStr = [NSString stringWithFormat:@"%ld", self.sailingInfo.keyNum]; NSString * fuleStr = [NSString stringWithFormat:@"%ld", self.sailingInfo.keyNum];
[self.fuleButton setTitle:fuleStr forState:UIControlStateNormal]; [self.fuleButton setTitle:fuleStr forState:UIControlStateNormal];
@@ -309,9 +310,6 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
if (model.specialStatus) { if (model.specialStatus) {
[self startSailingPrizeCowrySVGA]; [self startSailingPrizeCowrySVGA];
} else {
self.sailingImageView.hidden = NO;
[self.sailingView stopAnimation];
} }
@@ -361,8 +359,11 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
#pragma mark - SVGAPlayerDelegate #pragma mark - SVGAPlayerDelegate
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player { - (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
if (player == self.sailingCowryView) { if (self.prizeInfo.specialStatus) {
[self.sailingView stopAnimation]; if (player == self.sailingView) {
self.sailingImageView.hidden = NO;
}
} else {
self.sailingImageView.hidden = NO; self.sailingImageView.hidden = NO;
} }
} }
@@ -413,6 +414,7 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
} }
- (void)exploreButtonAction:(UIButton *)sender { - (void)exploreButtonAction:(UIButton *)sender {
self.prizeInfo = nil;
if (self.textField.text.integerValue > self.sailingInfo.keyNum) { if (self.textField.text.integerValue > self.sailingInfo.keyNum) {
XPSailingBuyFuelView * buyView = [[XPSailingBuyFuelView alloc] init]; XPSailingBuyFuelView * buyView = [[XPSailingBuyFuelView alloc] init];
buyView.delegate = self; buyView.delegate = self;
@@ -430,10 +432,10 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
sender.selected = !sender.selected; sender.selected = !sender.selected;
if (sender.selected) { if (sender.selected) {
NSString * key = [NSString stringWithFormat:@"%@_%@", kSailingPrizeAlertKey, [AccountInfoStorage instance].getUid]; NSString * key = [NSString stringWithFormat:@"%@_%@", kSailingPrizeAlertKey, [AccountInfoStorage instance].getUid];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:key]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:key];
} else { } else {
NSString * key = [NSString stringWithFormat:@"%@_%@", kSailingPrizeAlertKey, [AccountInfoStorage instance].getUid]; NSString * key = [NSString stringWithFormat:@"%@_%@", kSailingPrizeAlertKey, [AccountInfoStorage instance].getUid];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:key]; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:key];
} }
} }
#pragma mark - NIMSystemNotificationManagerDelegate #pragma mark - NIMSystemNotificationManagerDelegate
@@ -700,7 +702,7 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
[_boxButton addTarget:self action:@selector(boxButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [_boxButton addTarget:self action:@selector(boxButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_boxButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; [_boxButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
NSString * key = [NSString stringWithFormat:@"%@_%@", kSailingPrizeAlertKey, [AccountInfoStorage instance].getUid]; NSString * key = [NSString stringWithFormat:@"%@_%@", kSailingPrizeAlertKey, [AccountInfoStorage instance].getUid];
_boxButton.selected = ![[NSUserDefaults standardUserDefaults] boolForKey:key]; _boxButton.selected = [[NSUserDefaults standardUserDefaults] boolForKey:key];
} }
return _boxButton; return _boxButton;
} }
@@ -709,8 +711,8 @@ NSString * const kSailingPrizeAlertKey = @"kSailingPrizeAlertKey";
if (!_tipLabel) { if (!_tipLabel) {
_tipLabel = [[UILabel alloc] init]; _tipLabel = [[UILabel alloc] init];
_tipLabel.font = [UIFont systemFontOfSize:10]; _tipLabel.font = [UIFont systemFontOfSize:10];
_tipLabel.textColor = UIColorFromRGB(0xE9C57B); _tipLabel.textColor = UIColorFromRGB(0xA16A2F);
_tipLabel.text = @"显示中奖窗口"; _tipLabel.text = @"不展示结果弹框";
} }
return _tipLabel; return _tipLabel;
} }