新增房间底部阴影图像资源及其配置文件,优化 XPHomePartyViewController 和 XPPartyRoomItemCollectionViewCell 的布局逻辑,确保在不同布局模式下正确显示底部阴影。更新布局相关逻辑以提升用户体验和代码可维护性。

This commit is contained in:
edwinQQQ
2025-09-12 14:31:53 +08:00
parent ca963cf52b
commit 645be6184e
6 changed files with 64 additions and 7 deletions

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "矩形 309@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -18,6 +18,8 @@
@property(nonatomic,strong) UILabel *subLabel;
@property(nonatomic,strong) UIImageView *heatIcon;
@property(nonatomic,strong) UILabel *heatNumLable;
@property (nonatomic, strong) UIImageView *bottomShadow;
@end
@implementation XPPartyRoomItemCollectionViewCell
@@ -104,6 +106,12 @@
make.bottom.mas_equalTo(self.heatNumLable.mas_top).offset(-8);
make.size.mas_equalTo(CGSizeMake(25, 37));
}];
[self.contentView insertSubview:self.bottomShadow belowSubview:self.rankImageView];
[self.bottomShadow mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.leading.trailing.mas_equalTo(self.avatarView);
make.height.mas_equalTo(kGetScaleWidth(34));
}];
}
- (void)setRoomInfo:(HomePlayRoomModel *)roomInfo {
@@ -278,4 +286,11 @@
return _heatNumLable;
}
- (UIImageView *)bottomShadow {
if (!_bottomShadow) {
_bottomShadow = [[UIImageView alloc] initWithImage:kImage(@"room_bottom_shadow")];
}
return _bottomShadow;
}
@end

View File

@@ -138,6 +138,7 @@ static NSString * const kHomeLayoutTypeKey = @"kHomeLayoutTypeKey";
[self initSubViews];
[self initSubViewConstraints];
[self setupLayoutNotification];
[self updateCollectionViewLayout];
}
- (void)starBeginHeaderRefresh {
@@ -172,6 +173,7 @@ static NSString * const kHomeLayoutTypeKey = @"kHomeLayoutTypeKey";
self.isTwoColumnLayout = !self.isTwoColumnLayout;
[self saveLayoutTypeToCache];
[self processCurrentDataSourceForLayout];
[self updateCollectionViewLayout];
[self.collectionView reloadData];
}
@@ -217,6 +219,15 @@ static NSString * const kHomeLayoutTypeKey = @"kHomeLayoutTypeKey";
self.datasource = newDataSource;
}
- (void)updateCollectionViewLayout {
if ([self.collectionView.collectionViewLayout isKindOfClass:[MSBaseRTLFlowLayout class]]) {
MSBaseRTLFlowLayout *layout = (MSBaseRTLFlowLayout *)self.collectionView.collectionViewLayout;
CGFloat topInset = self.isTwoColumnLayout ? 4 : 20;
CGFloat bottomInset = self.isTwoColumnLayout ? 40 : 0;
layout.sectionInset = UIEdgeInsetsMake(topInset, 15, bottomInset, 15);
}
}
- (NSArray *)processDataSourceForLayout:(NSArray *)originalList {
if (originalList.count == 0) return originalList;
@@ -370,7 +381,7 @@ static NSString * const kHomeLayoutTypeKey = @"kHomeLayoutTypeKey";
}
if (self.isTwoColumnLayout || [item isKindOfClass:[XPBlankRoomModel class]]) {
CGFloat width = kGetScaleWidth(345)/2;
CGFloat height = width + 24;
CGFloat height = width + 8;
return CGSizeMake(width, height);
}
return CGSizeMake(kGetScaleWidth(345), kGetScaleWidth(92));
@@ -538,7 +549,8 @@ static NSString * const kHomeLayoutTypeKey = @"kHomeLayoutTypeKey";
MSBaseRTLFlowLayout *layout = [[MSBaseRTLFlowLayout alloc] init];
layout.minimumInteritemSpacing = kGetScaleWidth(0);
layout.minimumLineSpacing = kGetScaleWidth(18);
layout.sectionInset = UIEdgeInsetsMake(20, 15, 0, 15);
CGFloat topInset = self.isTwoColumnLayout ? 4 : 20;
layout.sectionInset = UIEdgeInsetsMake(topInset, 15, 0, 15);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.backgroundColor = [UIColor clearColor];
_collectionView.dataSource = self;

View File

@@ -1121,7 +1121,7 @@
@property(nonatomic, strong) UIView *bgView;
@property(nonatomic, strong) NetImageView *giftIconImageView;
@property(nonatomic, strong) UILabel *giftNameLabel;
@property(nonatomic, strong) MarqueeLabel *giftNameLabel;
@property(nonatomic, strong) UILabel *giftCountLabel;
@property(nonatomic, strong) GiftCountCalculator *giftCountView;
@property(nonatomic, strong) MoliMoneyLabel *priceLabel;
@@ -1230,10 +1230,16 @@
return _giftIconImageView;
}
- (UILabel *)giftNameLabel {
- (MarqueeLabel *)giftNameLabel {
if (!_giftNameLabel) {
_giftNameLabel = [UILabel labelInitWithText:@"Name" font:kFontRegular(13) textColor:UIColorFromRGB(0xffea5c)];
_giftNameLabel = [[MarqueeLabel alloc] init];
_giftNameLabel.text = @"Name";
_giftNameLabel.font = kFontRegular(13);
_giftNameLabel.textColor = UIColorFromRGB(0xffea5c);
_giftNameLabel.textAlignment = NSTextAlignmentCenter;
_giftNameLabel.scrollDuration = 3.0;
_giftNameLabel.fadeLength = 8.0f;
_giftNameLabel.animationDelay = 1.0;
}
return _giftNameLabel;
}

View File

@@ -1201,7 +1201,7 @@ XPCandyTreeInsufficientBalanceViewDelegate>
NSString *roomId = @(self.roomInfo.roomId).stringValue;
NSLog(@"🎮 设置房间ID: %@", roomId);
[[TurboModeStateManager sharedManager] setCurrentRoomId:roomId];
[[LuckyPackageLogicManager sharedInstance] setRoomUid:roomId];
[[LuckyPackageLogicManager sharedInstance] setRoomUid:@(roomInfo.uid).stringValue];
[[RoomResourceManager sharedManager] updateCurrentSkinID:roomInfo.usedMicSkinId
effectID:roomInfo.usedMicEffectId];
@@ -2590,6 +2590,9 @@ XPCandyTreeInsufficientBalanceViewDelegate>
// CP API
[self callMicCpListByUidListOnMicChangeWithQueue:queue];
// 🔧 19 mic
[self checkCentralPositionUserQualification:queue];
} else {
NSLog(@"🔧 进房初始化中跳过CP相关处理");
}
@@ -4337,7 +4340,7 @@ XPCandyTreeInsufficientBalanceViewDelegate>
// 使 NIM API mic
NIMChatroomQueueRemoveRequest *request = [[NIMChatroomQueueRemoveRequest alloc] init];
request.key = [NSString stringWithFormat:@"%ld", (long)position];
request.roomId = @(self.roomInfo.uid).stringValue;
request.roomId = @(self.roomInfo.roomId).stringValue;
[[NIMSDK sharedSDK].chatroomManager removeChatroomQueueObject:request completion:^(NSError * _Nullable error, NSDictionary<NSString *,NSString *> * _Nullable element) {
if (error) {