|
|
|
@@ -41,8 +41,12 @@
|
|
|
|
|
@property (nonatomic,strong)XPGiftInfoView *weekStarVC;
|
|
|
|
|
///VIP
|
|
|
|
|
@property (nonatomic,strong)XPGiftInfoView *nobleVC;
|
|
|
|
|
///人气
|
|
|
|
|
///人气/个播
|
|
|
|
|
@property (nonatomic,strong)XPGiftInfoView *anchorVC;
|
|
|
|
|
///超级幸运
|
|
|
|
|
@property (nonatomic,strong)XPGiftInfoView *superLuckyVC;
|
|
|
|
|
///国家
|
|
|
|
|
@property (nonatomic,strong)XPGiftInfoView *countryVC;
|
|
|
|
|
|
|
|
|
|
@property (nonatomic, strong) UIActivityIndicatorView *loadingView;
|
|
|
|
|
|
|
|
|
@@ -99,9 +103,8 @@
|
|
|
|
|
}];
|
|
|
|
|
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.leading.equalTo(self);
|
|
|
|
|
make.trailing.equalTo(self.packGiftButton.mas_leading).offset(-16);
|
|
|
|
|
make.height.mas_equalTo(34);
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(200));
|
|
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
[self.packGiftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.trailing.mas_equalTo(-15);
|
|
|
|
@@ -159,31 +162,77 @@
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
-(XPGiftInfoView *)getListVC:(NSInteger)index{
|
|
|
|
|
if(self.usingPlaceType == SendGiftType_User){
|
|
|
|
|
return [@[self.normalVC,self.weekStarVC,self.nobleVC] xpSafeObjectAtIndex:index];
|
|
|
|
|
GiftPanelTabModel *targetTab = nil;// [self.tagsArray xpSafeObjectAtIndex:index];
|
|
|
|
|
for (GiftPanelTabModel *tab in self.tagsArray) {
|
|
|
|
|
if (tab.seq-1 == index) {
|
|
|
|
|
targetTab = tab;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(self.roomType == RoomType_Anchor){
|
|
|
|
|
return [@[self.normalVC,self.luckyVC,self.weekStarVC,self.nobleVC,self.anchorVC] xpSafeObjectAtIndex:index];
|
|
|
|
|
switch ([targetTab tabGiftType]) {
|
|
|
|
|
case GiftType_Game:{
|
|
|
|
|
return self.normalVC;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GiftType_Lucky:{
|
|
|
|
|
return self.luckyVC;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GiftType_Noble:{
|
|
|
|
|
return self.nobleVC;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GiftType_WeekStar:{
|
|
|
|
|
return self.weekStarVC;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GiftType_Anchor:{
|
|
|
|
|
if (self.roomType == RoomType_Anchor) {
|
|
|
|
|
return self.anchorVC;
|
|
|
|
|
} else {
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GiftType_super:{
|
|
|
|
|
return self.superLuckyVC;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GiftType_Country:{
|
|
|
|
|
return self.countryVC;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return self.normalVC;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return [@[self.normalVC,self.luckyVC,self.weekStarVC,self.nobleVC] xpSafeObjectAtIndex:index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(NSInteger)getIndex{
|
|
|
|
|
if(self.usingPlaceType == SendGiftType_User){
|
|
|
|
|
if(self.segmentType == GiftSegmentType_Normal){
|
|
|
|
|
return 0;
|
|
|
|
|
}else if (self.segmentType == GiftSegmentType_WeekStar){
|
|
|
|
|
return 1;
|
|
|
|
|
}else{
|
|
|
|
|
return 2;
|
|
|
|
|
for (int i = 0; i< self.tagsArray.count; i++) {
|
|
|
|
|
GiftPanelTabModel *tab = [self.tagsArray xpSafeObjectAtIndex:i];
|
|
|
|
|
if ([tab tabGiftType] == GiftType_Game && self.segmentType == GiftSegmentType_Normal) {
|
|
|
|
|
return i;
|
|
|
|
|
} else if ([tab tabGiftType] == GiftType_Lucky && self.segmentType == GiftSegmentType_Lucky) {
|
|
|
|
|
return i;
|
|
|
|
|
} else if ([tab tabGiftType] == GiftType_super && self.segmentType == GiftSegmentType_SuperLucky) {
|
|
|
|
|
return i;
|
|
|
|
|
} else if ([tab tabGiftType] == GiftType_WeekStar && self.segmentType == GiftSegmentType_WeekStar) {
|
|
|
|
|
return i;
|
|
|
|
|
} else if ([tab tabGiftType] == GiftType_Noble && self.segmentType == GiftSegmentType_Noble) {
|
|
|
|
|
return i;
|
|
|
|
|
} else if ([tab tabGiftType] == GiftType_Country && self.segmentType == GiftSegmentType_Country) {
|
|
|
|
|
return i;
|
|
|
|
|
} else if ([tab tabGiftType] == GiftSegmentType_Anchor && self.segmentType == GiftSegmentType_Anchor) {
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
else if ([tab tabGiftType] == GiftSegmentType_Anchor && self.segmentType == GiftSegmentType_Anchor) {
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(self.roomType == RoomType_Anchor){
|
|
|
|
|
NSString *index = [@[@"0",@"1",@"2",@"3",@"4"] xpSafeObjectAtIndex:self.segmentType];
|
|
|
|
|
return index.integerValue;
|
|
|
|
|
}
|
|
|
|
|
NSString *index = [@[@"0",@"1",@"2",@"3"] xpSafeObjectAtIndex:self.segmentType];
|
|
|
|
|
return index.integerValue;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(void)didClickGiftSegmentAction:(UIButton *)sender{
|
|
|
|
@@ -231,22 +280,50 @@
|
|
|
|
|
NSMutableArray *tempGifts = @[].mutableCopy;
|
|
|
|
|
for (GiftPanelTabModel *tab in tagsArray) {
|
|
|
|
|
// 聊天界面不显示 幸运/个播 礼物
|
|
|
|
|
if (self.usingPlaceType == SendGiftType_User && ([tab.key isEqualToString:@"luckyBagGift"] || [tab.key isEqualToString:@"superLuckyGift"] || [tab.key isEqualToString:@"singlePopularGift"])) {
|
|
|
|
|
if (self.usingPlaceType == SendGiftType_User &&
|
|
|
|
|
([tab.key isEqualToString:@"luckyBagGift"] ||
|
|
|
|
|
[tab.key isEqualToString:@"superLuckyGift"] ||
|
|
|
|
|
[tab.key isEqualToString:@"singlePopularGift"])) {
|
|
|
|
|
continue;
|
|
|
|
|
} else if (self.roomType != RoomType_Anchor && [tab.key isEqualToString:@"singlePopularGift"]) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool canAddGift = false;
|
|
|
|
|
if (isMSRTL()) {
|
|
|
|
|
[tempTitles addObject:tab.nameMap.ar];
|
|
|
|
|
if ([tab.nameMap.ar length] > 0) {
|
|
|
|
|
canAddGift = true;
|
|
|
|
|
[tempTitles addObject:tab.nameMap.ar];
|
|
|
|
|
}
|
|
|
|
|
} else if (isMSEN()) {
|
|
|
|
|
[tempTitles addObject:tab.nameMap.en];
|
|
|
|
|
if ([tab.nameMap.en length] > 0) {
|
|
|
|
|
canAddGift = true;
|
|
|
|
|
[tempTitles addObject:tab.nameMap.en];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
[tempTitles addObject:tab.nameMap.zh];
|
|
|
|
|
if ([tab.nameMap.zh length] > 0) {
|
|
|
|
|
canAddGift = true;
|
|
|
|
|
[tempTitles addObject:tab.nameMap.zh];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[tempGifts addObject:tab.gifts ? tab.gifts : @[]];
|
|
|
|
|
if (canAddGift) {
|
|
|
|
|
[tempGifts addObject:tab.gifts ? tab.gifts : @[]];
|
|
|
|
|
} else {
|
|
|
|
|
[tempGifts addObject:@[]];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[self.titleView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.leading.equalTo(self);
|
|
|
|
|
make.height.mas_equalTo(34);
|
|
|
|
|
if (tempTitles.count<5) {
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(200));
|
|
|
|
|
} else {
|
|
|
|
|
make.trailing.equalTo(self.packGiftButton.mas_leading).offset(-16);
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
self.pi_titles = tempTitles.copy;
|
|
|
|
|
self.titleView.titles = self.pi_titles;
|
|
|
|
|
|
|
|
|
@@ -264,34 +341,6 @@
|
|
|
|
|
- (void)setNormalOriginArray:(NSArray *)normalOriginArray {
|
|
|
|
|
[self hideLoading];
|
|
|
|
|
_normalOriginArray = normalOriginArray;
|
|
|
|
|
// __block NSMutableArray * normalArray = [NSMutableArray array];
|
|
|
|
|
// __block NSMutableArray * luckyArray = [NSMutableArray array];
|
|
|
|
|
// __block NSMutableArray * weekStarArray = [NSMutableArray array];
|
|
|
|
|
// __block NSMutableArray * nobleArray = [NSMutableArray array];
|
|
|
|
|
// __block NSMutableArray * anchorArray = [NSMutableArray array];
|
|
|
|
|
// [self.normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
|
// if (obj.giftType == GiftType_Lucky || obj.giftType == GiftType_super) {
|
|
|
|
|
// [luckyArray addObject:obj];
|
|
|
|
|
// } else if(obj.giftType == GiftType_Game) {
|
|
|
|
|
// [normalArray addObject:obj];
|
|
|
|
|
// } else if (obj.giftType == GiftType_Noble) {
|
|
|
|
|
// [nobleArray addObject:obj];
|
|
|
|
|
// } else if (obj.giftType == GiftType_WeekStar) {
|
|
|
|
|
// [weekStarArray addObject:obj];
|
|
|
|
|
// }else if(obj.giftType == GiftType_Anchor){
|
|
|
|
|
// [anchorArray addObject:obj];
|
|
|
|
|
// }
|
|
|
|
|
// }];
|
|
|
|
|
// if (self.usingPlaceType == SendGiftType_User) {
|
|
|
|
|
// _giftList = [[NSMutableArray alloc]initWithArray:@[normalArray, weekStarArray, nobleArray]];
|
|
|
|
|
// }else{
|
|
|
|
|
// _giftList = [[NSMutableArray alloc]initWithArray:@[normalArray, luckyArray, weekStarArray, nobleArray, anchorArray]];
|
|
|
|
|
// }
|
|
|
|
|
// @kWeakify(self);
|
|
|
|
|
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
// @kStrongify(self);
|
|
|
|
|
// [self.pi_containerView reloadData];
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(void)setPackOriginArray:(NSArray *)packOriginArray{
|
|
|
|
@@ -308,27 +357,11 @@
|
|
|
|
|
}
|
|
|
|
|
-(void)setRoomType:(RoomType)roomType{
|
|
|
|
|
_roomType = roomType;
|
|
|
|
|
// if(_roomType == RoomType_Anchor){
|
|
|
|
|
// self.pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),
|
|
|
|
|
// YMLocalizedString(@"XPGiftInfoView3"),
|
|
|
|
|
// YMLocalizedString(@"XPGiftInfoView4"),
|
|
|
|
|
// YMLocalizedString(@"XPGiftInfoView9"),
|
|
|
|
|
// YMLocalizedString(@"XPGiftInfoView8")];
|
|
|
|
|
//
|
|
|
|
|
// self.titleView.titles = self.pi_titles;
|
|
|
|
|
//
|
|
|
|
|
// [self.titleView reloadData];
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
- (void)setUsingPlaceType:(SendGiftType)usingPlaceType {
|
|
|
|
|
_usingPlaceType = usingPlaceType;
|
|
|
|
|
self.packGiftView.usingPlaceType = _usingPlaceType;
|
|
|
|
|
if (_usingPlaceType == SendGiftType_User) {
|
|
|
|
|
// self.pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),
|
|
|
|
|
// YMLocalizedString(@"XPGiftInfoView4"),
|
|
|
|
|
// YMLocalizedString(@"XPGiftInfoView9")];
|
|
|
|
|
// self.titleView.titles = self.pi_titles;
|
|
|
|
|
// [self.titleView reloadData];
|
|
|
|
|
self.titleView.titleColor = [DJDKMIMOMColor secondTextColor];
|
|
|
|
|
self.titleView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
|
|
|
|
|
self.segmentBgView.hidden = NO;
|
|
|
|
@@ -377,7 +410,7 @@
|
|
|
|
|
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
|
|
|
|
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
|
|
|
|
_titleView.defaultSelectedIndex = 0;
|
|
|
|
|
_titleView.cellSpacing = 0;
|
|
|
|
|
_titleView.cellSpacing = 10;
|
|
|
|
|
_titleView.cellWidthIncrement = 5;
|
|
|
|
|
// _titleView.cellWidth = 30;
|
|
|
|
|
_titleView.listContainer = self.pi_containerView;
|
|
|
|
@@ -437,38 +470,50 @@
|
|
|
|
|
|
|
|
|
|
- (XPGiftInfoView *)luckyVC{
|
|
|
|
|
if(!_luckyVC){
|
|
|
|
|
XPGiftInfoView *luckyVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
luckyVC.delegate = self;
|
|
|
|
|
luckyVC.segmentType = GiftSegmentType_Lucky;
|
|
|
|
|
_luckyVC = luckyVC;
|
|
|
|
|
_luckyVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
_luckyVC.delegate = self;
|
|
|
|
|
_luckyVC.segmentType = GiftSegmentType_Lucky;
|
|
|
|
|
}
|
|
|
|
|
return _luckyVC;
|
|
|
|
|
}
|
|
|
|
|
- (XPGiftInfoView *)weekStarVC{
|
|
|
|
|
if(!_weekStarVC){
|
|
|
|
|
XPGiftInfoView *weekStarVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
weekStarVC.delegate = self;
|
|
|
|
|
weekStarVC.segmentType = GiftSegmentType_WeekStar;
|
|
|
|
|
_weekStarVC = weekStarVC;
|
|
|
|
|
_weekStarVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
_weekStarVC.delegate = self;
|
|
|
|
|
_weekStarVC.segmentType = GiftSegmentType_WeekStar;
|
|
|
|
|
}
|
|
|
|
|
return _weekStarVC;
|
|
|
|
|
}
|
|
|
|
|
- (XPGiftInfoView *)nobleVC{
|
|
|
|
|
if(!_nobleVC){
|
|
|
|
|
XPGiftInfoView *nobleVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
nobleVC.delegate = self;
|
|
|
|
|
nobleVC.segmentType = GiftSegmentType_Noble;
|
|
|
|
|
_nobleVC = nobleVC;
|
|
|
|
|
_nobleVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
_nobleVC.delegate = self;
|
|
|
|
|
_nobleVC.segmentType = GiftSegmentType_Noble;
|
|
|
|
|
}
|
|
|
|
|
return _nobleVC;
|
|
|
|
|
}
|
|
|
|
|
-(XPGiftInfoView *)anchorVC{
|
|
|
|
|
if(!_anchorVC){
|
|
|
|
|
XPGiftInfoView *anchorVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
anchorVC.delegate = self;
|
|
|
|
|
anchorVC.segmentType = GiftSegmentType_Anchor;
|
|
|
|
|
_anchorVC = anchorVC;
|
|
|
|
|
_anchorVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
_anchorVC.delegate = self;
|
|
|
|
|
_anchorVC.segmentType = GiftSegmentType_Anchor;
|
|
|
|
|
}
|
|
|
|
|
return _anchorVC;;
|
|
|
|
|
return _anchorVC;
|
|
|
|
|
}
|
|
|
|
|
-(XPGiftInfoView *)superLuckyVC{
|
|
|
|
|
if(!_superLuckyVC){
|
|
|
|
|
_superLuckyVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
_superLuckyVC.delegate = self;
|
|
|
|
|
_superLuckyVC.segmentType = GiftSegmentType_SuperLucky;
|
|
|
|
|
}
|
|
|
|
|
return _superLuckyVC;
|
|
|
|
|
}
|
|
|
|
|
-(XPGiftInfoView *)countryVC{
|
|
|
|
|
if(!_countryVC){
|
|
|
|
|
_countryVC = [[XPGiftInfoView alloc]init];
|
|
|
|
|
_countryVC.delegate = self;
|
|
|
|
|
_countryVC.segmentType = GiftSegmentType_Country;
|
|
|
|
|
}
|
|
|
|
|
return _countryVC;
|
|
|
|
|
}
|
|
|
|
|
@end
|
|
|
|
|