// // MODiamondWinAlertView.m // MiMoLive // // Created by SuperC on 2024/7/2. // #import "MODiamondWinAlertView.h" #import "MOBezierAnimationLab.h" @interface MODiamondWinAlertView () @property (weak, nonatomic) IBOutlet UIView *bgView; @property (weak, nonatomic) IBOutlet MOBezierAnimationLab *titleLab; @property (weak, nonatomic) IBOutlet UILabel *contentLab; @property (weak, nonatomic) IBOutlet UIButton *goPlayBtn; @end @implementation MODiamondWinAlertView + (instancetype)moDiamondWinAlertView{ return [[[NSBundle mainBundle] loadNibNamed:@"MODiamondWinAlertView" owner:self options:nil] firstObject]; } - (void)awakeFromNib{ [super awakeFromNib]; self.titleLab.text = NSLocalString(@"mimo_diamonds_win_title"); [self.titleLab mo_setGradientWithColors: @[(id)[MOTools colorWithHexString:@"#0EFFFC" alpha:1.0].CGColor,(id)[MOTools colorWithHexString:@"#6D9AFF" alpha:1.0].CGColor] startPoint:CGPointMake(0.0, 0.3) endPoint:CGPointMake(0.0, 1.0)]; NSArray *colorArr = @[[MOTools colorWithHexString:@"#FFE04F" alpha:1.0],[MOTools colorWithHexString:@"#D77E00" alpha:1.0],[MOTools colorWithHexString:@"#FFE640" alpha:1.0]]; UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 153.0, 46.0) Colors:colorArr GradientType:1]; [self.goPlayBtn setBackgroundImage:image forState:UIControlStateNormal]; [self.goPlayBtn setTitle:NSLocalString(@"mimo_diamonds_win_go_play_btn") forState:UIControlStateNormal]; self.goPlayBtn.layer.cornerRadius = 46.0 / 2.0; self.goPlayBtn.layer.masksToBounds = YES; self.contentLab.attributedText = [MOTextTools base_colorfulStringWith:NSLocalString(@"mimo_diamonds_win_content") AndNameStr:NSLocalString(@"mimo_diamonds_win_content_g") AndBaseColor:@"#FFFFFF" AndNameColor:@"#8AFF73" AndStrokeColor:@"#912BFF" AndStrokeWidth:-2 AndShadowColor:@"#b2b2b2"]; self.titleLab.font = [MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalTitleFontStr]; [self.goPlayBtn setFont:[MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalTitleFontStr]]; self.contentLab.font = [MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalTitleFontStr]; } - (IBAction)closeBtnClick:(id)sender { [self dismissDiamondWinAlertView]; } - (IBAction)playBtnClick:(id)sender { [self dismissDiamondWinAlertView]; self.openDiamondWinBlock ? self.openDiamondWinBlock() : nil; } - (void)showDiamondWinAlertView//界面显示动画 { UIWindow *keyWindow = [[UIApplication sharedApplication] delegate].window; [keyWindow addSubview:self]; self.frame = CGRectMake(0.0, 0.0, SCREENWIDTH, SCREENHEIGHT); //动画效果 self.bgView.transform = CGAffineTransformMakeScale(1.3, 1.3); self.bgView.alpha = 0; [UIView animateWithDuration:0.2 animations:^ { self.bgView.transform = CGAffineTransformMakeScale(1.0, 1.0); self.bgView.alpha = 1; } completion:^(BOOL finished) { }]; } - (void)dismissDiamondWinAlertView { [UIView animateWithDuration:0.2 animations:^ { self.bgView.transform = CGAffineTransformMakeScale(1.3, 1.3); self.bgView.alpha = 0; } completion:^(BOOL finished) { if (finished) { [self removeFromSuperview]; } }]; } @end