MODiamondWinAlertView.m 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // MODiamondWinAlertView.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2024/7/2.
  6. //
  7. #import "MODiamondWinAlertView.h"
  8. #import "MOBezierAnimationLab.h"
  9. @interface MODiamondWinAlertView ()
  10. @property (weak, nonatomic) IBOutlet UIView *bgView;
  11. @property (weak, nonatomic) IBOutlet MOBezierAnimationLab *titleLab;
  12. @property (weak, nonatomic) IBOutlet UILabel *contentLab;
  13. @property (weak, nonatomic) IBOutlet UIButton *goPlayBtn;
  14. @end
  15. @implementation MODiamondWinAlertView
  16. + (instancetype)moDiamondWinAlertView{
  17. return [[[NSBundle mainBundle] loadNibNamed:@"MODiamondWinAlertView" owner:self options:nil] firstObject];
  18. }
  19. - (void)awakeFromNib{
  20. [super awakeFromNib];
  21. self.titleLab.text = NSLocalString(@"mimo_diamonds_win_title");
  22. [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)];
  23. NSArray *colorArr = @[[MOTools colorWithHexString:@"#FFE04F" alpha:1.0],[MOTools colorWithHexString:@"#D77E00" alpha:1.0],[MOTools colorWithHexString:@"#FFE640" alpha:1.0]];
  24. UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 153.0, 46.0) Colors:colorArr GradientType:1];
  25. [self.goPlayBtn setBackgroundImage:image forState:UIControlStateNormal];
  26. [self.goPlayBtn setTitle:NSLocalString(@"mimo_diamonds_win_go_play_btn") forState:UIControlStateNormal];
  27. self.goPlayBtn.layer.cornerRadius = 46.0 / 2.0;
  28. self.goPlayBtn.layer.masksToBounds = YES;
  29. 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"];
  30. self.titleLab.font = [MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalTitleFontStr];
  31. [self.goPlayBtn setFont:[MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalTitleFontStr]];
  32. self.contentLab.font = [MOTextTools getTheFontWithSize:14.0 AndFontName:kNormalTitleFontStr];
  33. }
  34. - (IBAction)closeBtnClick:(id)sender {
  35. [self dismissDiamondWinAlertView];
  36. }
  37. - (IBAction)playBtnClick:(id)sender {
  38. [self dismissDiamondWinAlertView];
  39. self.openDiamondWinBlock ? self.openDiamondWinBlock() : nil;
  40. }
  41. - (void)showDiamondWinAlertView//界面显示动画
  42. {
  43. UIWindow *keyWindow = [[UIApplication sharedApplication] delegate].window;
  44. [keyWindow addSubview:self];
  45. self.frame = CGRectMake(0.0, 0.0, SCREENWIDTH, SCREENHEIGHT);
  46. //动画效果
  47. self.bgView.transform = CGAffineTransformMakeScale(1.3, 1.3);
  48. self.bgView.alpha = 0;
  49. [UIView animateWithDuration:0.2 animations:^
  50. {
  51. self.bgView.transform = CGAffineTransformMakeScale(1.0, 1.0);
  52. self.bgView.alpha = 1;
  53. } completion:^(BOOL finished)
  54. {
  55. }];
  56. }
  57. - (void)dismissDiamondWinAlertView
  58. {
  59. [UIView animateWithDuration:0.2 animations:^
  60. {
  61. self.bgView.transform = CGAffineTransformMakeScale(1.3, 1.3);
  62. self.bgView.alpha = 0;
  63. } completion:^(BOOL finished)
  64. {
  65. if (finished)
  66. {
  67. [self removeFromSuperview];
  68. }
  69. }];
  70. }
  71. @end