fix:修正部分问题

This commit is contained in:
eggmanQQQ
2024-10-16 17:28:37 +08:00
parent 0505054aec
commit e72f39ffde
5 changed files with 43 additions and 7 deletions

View File

@@ -137,7 +137,7 @@
}];
[self.boomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.contentView).offset(11);
make.bottom.mas_equalTo(self.heatView.mas_top).offset(-6);
make.trailing.mas_equalTo(self.contentView).offset(-8);
make.size.mas_equalTo(CGSizeMake(40, 40));
}];

View File

@@ -1104,7 +1104,7 @@
- (UIImageView *)progressBar {
if (!_progressBar) {
UIImage *progressImage = [kImage(@"room_boom_progress_bar") resizableImageWithCapInsets:UIEdgeInsetsMake(40, 0, 0, 0) resizingMode:UIImageResizingModeTile];
UIImage *progressImage = [kImage(@"room_boom_progress_bar") resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 20, 0) resizingMode:UIImageResizingModeTile];
_progressBar = [[UIImageView alloc] initWithImage:progressImage];
_progressBar.userInteractionEnabled = YES;
_progressBar.hidden = NO;

View File

@@ -112,17 +112,27 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
- (void)updateForBoomDetailArray:(NSArray <BoomDetailModel*> *)models {
_boomModels = models;
if (!models || models.count == 0) {
self.boomView.hidden = YES;
return;
}
self.boomView.hidden = NO;
BOOL hasBoom = NO;
if (models) {
for (BoomDetailModel *boom in models) {
if (boom.currLevel == 1) {
hasBoom = YES;
self.boomView.boomModel = boom;
self.boomView.hidden = NO;
break;
}
}
}
if (!hasBoom) {
//
self.boomView.boomModel = [models lastObject];
}
}
- (void)setupBoomManager {

View File

@@ -126,14 +126,15 @@ exitCurrentRoom:(void(^)(void))exit {
return;
}
__block NSString *targetRoomUid = self.model.roomUid;
@kWeakify(self);
[TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{
@kStrongify(self);
if (self.exitCurrentRoom) {
self.exitCurrentRoom();
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:self.model.roomUid
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:targetRoomUid
viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
} cancelHandler:^{}];

View File

@@ -58,11 +58,14 @@
BOOL isNumeric(NSString *string) {
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^[0-9]+$" options:0 error:&error];
//
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^[0-9]*\\.?[0-9]+$" options:0 error:&error];
if (error) {
NSLog(@"Error creating regex: %@", error.localizedDescription);
return NO;
}
NSRange range = NSMakeRange(0, string.length);
NSTextCheckingResult *match = [regex firstMatchInString:string options:0 range:range];
return match != nil;
@@ -84,6 +87,28 @@ BOOL isNumeric(NSString *string) {
}
return formattedString;
}
- (NSString *)formatCoinsWithDouble:(double)coins {
NSString *formattedString;
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setMinimumFractionDigits:0]; // 0
[formatter setMaximumFractionDigits:2]; // 2
[formatter setNumberStyle:NSNumberFormatterDecimalStyle]; // 使
if (coins >= 1000000.0) {
// M
double valueInMillions = coins / 1000000.0;
formattedString = [NSString stringWithFormat:@"%@M", [formatter stringFromNumber:@(valueInMillions)]];
} else if (coins >= 1000.0) {
// K
double valueInThousands = coins / 1000.0;
formattedString = [NSString stringWithFormat:@"%@K", [formatter stringFromNumber:@(valueInThousands)]];
} else {
//
formattedString = [formatter stringFromNumber:@(coins)];
}
return formattedString;
}
#pragma mark - Getters And Setters
- (void)setTitle:(NSString *)title {
if (![title isKindOfClass:[NSString class]]) {
@@ -94,7 +119,7 @@ BOOL isNumeric(NSString *string) {
}
if (isNumeric(title)) {
_titleLabel.text = [self formatCoins:[title integerValue]];
_titleLabel.text = [self formatCoinsWithDouble:[title doubleValue]];
} else {
_titleLabel.text = title;
}