This commit is contained in:
2025-12-03 20:02:37 +08:00
parent f026b9f9fd
commit eca168957d
3 changed files with 33 additions and 30 deletions

View File

@@ -63,17 +63,12 @@
}
weakSelf.allCharacters = list ?: @[];
//
NSMutableArray *topItems = [NSMutableArray array];
// KBTopThreeView
NSInteger topCount = MIN(3, weakSelf.allCharacters.count);
for (NSInteger i = 0; i < topCount; i++) {
KBCharacter *c = weakSelf.allCharacters[i];
// NSInteger rank = (c.rank > 0) ? c.rank : (i + 1);
NSString *title = c.characterName ?: @"";
[topItems addObject:@{ @"title": title, @"rank": @(i + 1) }];
}
if (topItems.count > 0) {
[weakSelf.topThreeView configWithItems:topItems];
if (topCount > 0) {
NSRange range = NSMakeRange(0, topCount);
NSArray<KBCharacter *> *topThree = [weakSelf.allCharacters subarrayWithRange:range];
[weakSelf.topThreeView configWithCharacters:topThree];
}
// 4