房间内贵族礼物面板

This commit is contained in:
chenguilong
2021-12-27 17:17:21 +08:00
committed by fengshuo
parent 1b257041de
commit 90a615c468
8 changed files with 98 additions and 16 deletions

View File

@@ -118,6 +118,7 @@
9B7B605B27BB53060070BB72 /* XPAnchorAudienceUpMicView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B605A27BB53060070BB72 /* XPAnchorAudienceUpMicView.m */; };
9B7B606227BB96E40070BB72 /* XPRoomAnchorInfoCardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B606127BB96E40070BB72 /* XPRoomAnchorInfoCardView.m */; };
9B7B606627BBA0EE0070BB72 /* XPAnchorAttentSendInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7B606527BBA0EE0070BB72 /* XPAnchorAttentSendInfo.m */; };
9B208A362779B50100F9E54A /* GiftNobleInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B208A352779B50100F9E54A /* GiftNobleInfoModel.m */; };
9B7D804A2753783D003DAC0C /* SessionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80492753783D003DAC0C /* SessionViewController.m */; };
9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; };
9B7D80502753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804E2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m */; };
@@ -684,6 +685,8 @@
9B7B606127BB96E40070BB72 /* XPRoomAnchorInfoCardView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPRoomAnchorInfoCardView.m; sourceTree = "<group>"; };
9B7B606427BBA0EE0070BB72 /* XPAnchorAttentSendInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorAttentSendInfo.h; sourceTree = "<group>"; };
9B7B606527BBA0EE0070BB72 /* XPAnchorAttentSendInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorAttentSendInfo.m; sourceTree = "<group>"; };
9B208A342779B50100F9E54A /* GiftNobleInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftNobleInfoModel.h; sourceTree = "<group>"; };
9B208A352779B50100F9E54A /* GiftNobleInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftNobleInfoModel.m; sourceTree = "<group>"; };
9B7D80482753783D003DAC0C /* SessionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionViewController.h; sourceTree = "<group>"; };
9B7D80492753783D003DAC0C /* SessionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SessionViewController.m; sourceTree = "<group>"; };
9B7D804B27537950003DAC0C /* MessageCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = "<group>"; };
@@ -2781,6 +2784,8 @@
E8E7DAEA2745158500C631CC /* XPGiftUserInfoModel.m */,
E8DACCFC27673F870052092C /* GiftValueInfoModel.h */,
E8DACCFD27673F870052092C /* GiftValueInfoModel.m */,
9B208A342779B50100F9E54A /* GiftNobleInfoModel.h */,
9B208A352779B50100F9E54A /* GiftNobleInfoModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -4180,6 +4185,7 @@
E88B5CAD26FB16A800DA9178 /* XPMineTeenagerDesView.m in Sources */,
E896EF972771AAE400AD2CC1 /* XPMineAttentionPresenter.m in Sources */,
E8E5E19127C369F000F457D8 /* XPHomeRecommendListView.m in Sources */,
9B208A362779B50100F9E54A /* GiftNobleInfoModel.m in Sources */,
E8C6FFDA2754BE81004DC9F0 /* ThemeColor+Home.m in Sources */,
E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */,
E8EEB90F26FC6AB8007C6EBA /* XPMineUserInfoEditPresenter.m in Sources */,

View File

@@ -22,7 +22,7 @@
/// @param complection
/// @param roomUid roomuid
+ (void)requestNormalGiftList:(HttpRequestHelperCompletion)complection roomUid:(NSString *)roomUid {
[self makeRequest:@"gift/listV3" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, roomUid, nil];
[self makeRequest:@"gift/listV4" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, roomUid, nil];
}
///

View File

@@ -6,12 +6,15 @@
//
#import <Foundation/Foundation.h>
#import "GiftNobleInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
//礼物类型
typedef NS_ENUM(NSUInteger, GiftType) {
GiftType_Game = 2, // 游戏轰趴礼物
GiftType_Lucky = 3, // 福袋礼物
GiftType_LuckyPool = 5, //福袋奖池礼物
GiftType_Noble = 7, // 贵族礼物
};
//礼物类型
@@ -86,6 +89,9 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) {
@property (nonatomic,assign) BOOL isSelected;//是否被选中
///礼物来源
@property (nonatomic,assign) GiftSourceType sourceType;
///贵族礼物专属信息
@property (nonatomic, strong) GiftNobleInfoModel *giftVipInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,21 @@
//
// GiftNobleInfoModel.h
// xplan-ios
//
// Created by GreenLand on 2021/12/27.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface GiftNobleInfoModel : NSObject
///贵族图标
@property (nonatomic, copy)NSString *vipIcon;
///可用贵族等级
@property (nonatomic, assign) NSInteger vipLevel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// GiftNobleInfoModel.m
// xplan-ios
//
// Created by GreenLand on 2021/12/27.
//
#import "GiftNobleInfoModel.h"
@implementation GiftNobleInfoModel
@end

View File

@@ -12,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, GiftSegmentType) {
GiftSegmentType_Normal = 1, ///普通的礼物
GiftSegmentType_Lucky,///幸运礼物
GiftSegmentType_Noble,///贵族礼物
GiftSegmentType_Pack,///背包礼物
};
@@ -29,7 +30,7 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
@interface XPGiftInfoView : UIView
///普通礼物/幸运礼物
///普通礼物/幸运礼物/贵族礼物
@property (nonatomic,strong) NSArray *normalOriginArray;
///背包礼物
@property (nonatomic,strong) NSArray *packOriginArray;

View File

@@ -27,6 +27,8 @@
@property (nonatomic,strong) UIButton *packGiftButton;
///
@property (nonatomic,strong) UIButton *luckyGiftButton;
///
@property (nonatomic,strong) UIButton *nobleGiftButton;
///
@property (nonatomic,strong) UIView * segmentPlaceView;
///
@@ -45,6 +47,8 @@
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftArray;
/////
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftLuckyArray;
///
@property (nonatomic, strong) NSArray<GiftInfoModel *> *giftNobleArray;
/////
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftPackArray;
///
@@ -71,6 +75,7 @@
- (void)didClickGiftSegmentAction:(UIButton *)sender {
self.normalGiftButton.selected = NO;
self.luckyGiftButton.selected = NO;
self.nobleGiftButton.selected = NO;
self.packGiftButton.selected = NO;
sender.selected = !sender.selected;
self.segmentType = sender.tag;
@@ -100,6 +105,7 @@
///
[self.segmentStackView addArrangedSubview:self.normalGiftButton];
[self.segmentStackView addArrangedSubview:self.luckyGiftButton];
[self.segmentStackView addArrangedSubview:self.nobleGiftButton];
[self.segmentStackView addArrangedSubview:self.packGiftButton];
[self.segmentStackView addArrangedSubview:self.segmentPlaceView];
[self.segmentStackView addArrangedSubview:self.playRuleButton];
@@ -253,6 +259,7 @@
[self resetSelectGift:self.giftArray];
[self resetSelectGift:self.packOriginArray];
[self resetSelectGift:self.giftLuckyArray];
[self resetSelectGift:self.giftNobleArray];
self.totalValueLabel.hidden = YES;
switch (_segmentType) {
case GiftSegmentType_Normal:
@@ -261,6 +268,9 @@
case GiftSegmentType_Lucky:
[self.datasource addObjectsFromArray:self.giftLuckyArray];
break;
case GiftSegmentType_Noble:
[self.datasource addObjectsFromArray:self.giftNobleArray];
break;
case GiftSegmentType_Pack:
{
[self.datasource addObjectsFromArray:self.packOriginArray];
@@ -293,15 +303,19 @@
_normalOriginArray = normalOriginArray;
NSMutableArray * luckyArray = [NSMutableArray array];
NSMutableArray * normaleArray = [NSMutableArray array];
NSMutableArray * nobleArray = [NSMutableArray array];
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.giftType == GiftType_Lucky) {
[luckyArray addObject:obj];
} else if(obj.giftType == GiftType_Game) {
[normaleArray addObject:obj];
} else if (obj.giftType == GiftType_Noble) {
[nobleArray addObject:obj];
}
}];
self.giftArray = normaleArray;
self.giftLuckyArray = luckyArray;
self.giftNobleArray = nobleArray;
self.segmentType = GiftSegmentType_Normal;
}
@@ -357,11 +371,25 @@
_luckyGiftButton.titleLabel.font = [UIFont systemFontOfSize:14];
_luckyGiftButton.tag = GiftSegmentType_Lucky;
_luckyGiftButton.selected = NO;
[_luckyGiftButton addTarget:self action:@ selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
[_luckyGiftButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _luckyGiftButton;
}
- (UIButton *)nobleGiftButton {
if (!_nobleGiftButton) {
_nobleGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_nobleGiftButton setTitle:@"贵族礼物" forState:UIControlStateNormal];
[_nobleGiftButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
[_nobleGiftButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
_nobleGiftButton.titleLabel.font = [UIFont systemFontOfSize:14];
_nobleGiftButton.tag = GiftSegmentType_Noble;
_nobleGiftButton.selected = NO;
[_nobleGiftButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _nobleGiftButton;
}
- (UIButton *)packGiftButton {
if (!_packGiftButton) {
_packGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

@@ -130,7 +130,15 @@
///
[[XPGiftStorage shareStorage] getGiftDatasource:roomUid];
[Api requestNormalGiftList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
NSArray * info = [GiftInfoModel modelsWithArray:data.data[@"gift"]];
NSArray *luckyBagGift = [GiftInfoModel modelsWithArray:data.data[@"luckyBagGift"]]; //
NSArray *vipGift = [GiftInfoModel modelsWithArray:data.data[@"vipGift"]]; //
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];//
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; //
NSMutableArray *info = [NSMutableArray array];
[info addObjectsFromArray:luckyBagGift];
[info addObjectsFromArray:vipGift];
[info addObjectsFromArray:luckyPoolGift];
[info addObjectsFromArray:normalGift];
///
[[XPGiftStorage shareStorage] saveGiftDatasource:info roomUid:roomUid];
} roomUid:roomUid];