// // WLStakeResultSuccessView.m // romantic // // Created by Xmac on 2024/4/22. // Copyright © 2024 romantic. All rights reserved. // #import "WLStakeResultSuccessView.h" #import "TFPopup.h" @interface WLStakeResultSuccessView () @property (weak, nonatomic) IBOutlet UIImageView *iconImageView; @property (weak, nonatomic) IBOutlet UILabel *valueLabel; @property (weak, nonatomic) IBOutlet UIButton *closeBtn; @property (weak, nonatomic) IBOutlet UILabel *priceLabel; @property (weak, nonatomic) IBOutlet UILabel *constellationLabel; @property (weak, nonatomic) IBOutlet UIImageView *constellationImageView; @property (weak, nonatomic) IBOutlet UIView *blackView; @end @implementation WLStakeResultSuccessView - (void)awakeFromNib { [super awakeFromNib]; WEAK_SELF [self.blackView dg_Tapped:^{ [weakSelf removeFromSuperview]; }]; } - (void)show { self.frame = [UIScreen mainScreen].bounds; [MainWindow() addSubview:self]; } - (void)onPopupWithSize:(CGSize)size parent:(UIView *)parent model:(WLStakeModel *)model { // [self tf_remove]; // self.frame = CGRectMake(0, 0, size.width, size.height); // TFPopupParam *param = [[TFPopupParam alloc] init]; // param.popupSize = size; // [self tf_showSlide:parent direction:PopupDirectionContainerCenter popupParam:param]; [self show]; [self.iconImageView sd_setImageWithURL:URL(C_string(model.base_image))]; self.valueLabel.text = [NSString stringWithFormat:@"%@*%ld", model.gift_name, (long)model.num]; self.priceLabel.text = [NSString stringWithFormat:@"%@", model.gift_price]; if ([model.win_type isEqualToString:@"1"]) { _constellationImageView.image = ImageNamed(@"stake_2_sel"); } else if ([model.win_type isEqualToString:@"2"]) { _constellationImageView.image = ImageNamed(@"stake_1_sel"); } else if ([model.win_type isEqualToString:@"3"]) { _constellationImageView.image = ImageNamed(@"stake_4_sel"); } else if ([model.win_type isEqualToString:@"4"]) { _constellationImageView.image = ImageNamed(@"stake_5_sel"); } else if ([model.win_type isEqualToString:@"5"]) { _constellationImageView.image = ImageNamed(@"stake_3_sel"); } _constellationLabel.text = [NSString stringWithFormat:@"炼仙传说:%@", model.type_name]; } - (void)remove { [self tf_remove]; } - (IBAction)onClose:(id)sender { if (self.onConfirmBlock) { self.onConfirmBlock(); } [self tf_remove]; } - (IBAction)onConfirm:(id)sender { if (self.onConfirmBlock) { self.onConfirmBlock(); } [self tf_remove]; } @end