新增pag动效及首页bug修复

This commit is contained in:
liyuhua
2023-09-21 17:44:59 +08:00
parent 3cce473244
commit e4deece7b4
66 changed files with 1243 additions and 284 deletions

View File

@@ -316,6 +316,8 @@
23FF255B2AB956D50064E904 /* pi_home_new_pk.svga in Resources */ = {isa = PBXBuildFile; fileRef = 23FF255A2AB956D50064E904 /* pi_home_new_pk.svga */; };
23FF25602ABA932D0064E904 /* PIIAPManagers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23FF255F2ABA932D0064E904 /* PIIAPManagers.swift */; };
23FF25622ABAE6310064E904 /* pi_room_game_fine_love.svga in Resources */ = {isa = PBXBuildFile; fileRef = 23FF25612ABAE6310064E904 /* pi_room_game_fine_love.svga */; };
23FF25652ABC3B3C0064E904 /* XPHomeGameView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF25642ABC3B3B0064E904 /* XPHomeGameView.m */; };
23FF25682ABC3BC00064E904 /* XPHomeGameCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF25672ABC3BC00064E904 /* XPHomeGameCell.m */; };
23FF42632AA5861E0055733C /* XPNewHomePartyCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42622AA5861E0055733C /* XPNewHomePartyCollectionViewCell.m */; };
23FF42652AA5AC040055733C /* home_heat.gif in Resources */ = {isa = PBXBuildFile; fileRef = 23FF42642AA5AC040055733C /* home_heat.gif */; };
23FF42672AA5CFBB0055733C /* home_sound_wave.gif in Resources */ = {isa = PBXBuildFile; fileRef = 23FF42662AA5CFBB0055733C /* home_sound_wave.gif */; };
@@ -2011,6 +2013,10 @@
23FF255A2AB956D50064E904 /* pi_home_new_pk.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_home_new_pk.svga; sourceTree = "<group>"; };
23FF255F2ABA932D0064E904 /* PIIAPManagers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PIIAPManagers.swift; sourceTree = "<group>"; };
23FF25612ABAE6310064E904 /* pi_room_game_fine_love.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_room_game_fine_love.svga; sourceTree = "<group>"; };
23FF25632ABC3B3B0064E904 /* XPHomeGameView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPHomeGameView.h; sourceTree = "<group>"; };
23FF25642ABC3B3B0064E904 /* XPHomeGameView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPHomeGameView.m; sourceTree = "<group>"; };
23FF25662ABC3BC00064E904 /* XPHomeGameCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPHomeGameCell.h; sourceTree = "<group>"; };
23FF25672ABC3BC00064E904 /* XPHomeGameCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPHomeGameCell.m; sourceTree = "<group>"; };
23FF42612AA5861E0055733C /* XPNewHomePartyCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNewHomePartyCollectionViewCell.h; sourceTree = "<group>"; };
23FF42622AA5861E0055733C /* XPNewHomePartyCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNewHomePartyCollectionViewCell.m; sourceTree = "<group>"; };
23FF42642AA5AC040055733C /* home_heat.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = home_heat.gif; sourceTree = "<group>"; };
@@ -8425,6 +8431,8 @@
E87E625E2A3F565D002F68C9 /* CustomView */ = {
isa = PBXGroup;
children = (
23FF25632ABC3B3B0064E904 /* XPHomeGameView.h */,
23FF25642ABC3B3B0064E904 /* XPHomeGameView.m */,
23FF42742AA6E1480055733C /* XPHomeRecommendOtherRoomView.h */,
23FF42752AA6E1480055733C /* XPHomeRecommendOtherRoomView.m */,
E87DF4F12A42CBEC009C1185 /* XPHomeUserView.h */,
@@ -8444,6 +8452,8 @@
E87E625F2A3F5669002F68C9 /* Cell */ = {
isa = PBXGroup;
children = (
23FF25662ABC3BC00064E904 /* XPHomeGameCell.h */,
23FF25672ABC3BC00064E904 /* XPHomeGameCell.m */,
E87E627D2A3F5D28002F68C9 /* XPNewHomePlayItemCollectionViewCell.h */,
E87E627E2A3F5D28002F68C9 /* XPNewHomePlayItemCollectionViewCell.m */,
E87E62722A3F5907002F68C9 /* XPHomeBannerTableViewCell.h */,
@@ -10553,6 +10563,7 @@
140A818D299CFF1C00841594 /* XPVendorCallViewController.m in Sources */,
E8EEB8F226FC2050007C6EBA /* SDPhotoBrowser.m in Sources */,
E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */,
23FF25682ABC3BC00064E904 /* XPHomeGameCell.m in Sources */,
E8788950273A699900BF1D57 /* ThemeColor+SendGift.m in Sources */,
E81C279D26EEEC620031E639 /* YUMIConstant.m in Sources */,
9B734F73288A787000CBDAA9 /* XPMineAccountView.m in Sources */,
@@ -10577,6 +10588,7 @@
E85E7B4C2A4EB0D300B6D00A /* XPMineGuildManagerPerViewController.m in Sources */,
23E9EA662A837BE400B792F2 /* XPTreasureFairyBallView.m in Sources */,
E87DF4BF2A42C8C1009C1185 /* HomeTagModel.m in Sources */,
23FF25652ABC3B3C0064E904 /* XPHomeGameView.m in Sources */,
E88863D3278ED4C0004BCFAB /* Timestamp.m in Sources */,
E8A3540A28FEC0510014A784 /* XPWishGiftListView.m in Sources */,
E88863CF278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m in Sources */,

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -40,6 +40,10 @@ NS_ASSUME_NONNULL_BEGIN
/// @param roomUid 房主的uid
- (void)openVipWithDiamondRoomUid:(NSString *)roomUid;
//联系客服
-(void)getContactCustomerService;
@end
NS_ASSUME_NONNULL_END

View File

@@ -10,6 +10,7 @@
///Api
#import "Api+NobleCenter.h"
#import "Api+Mine.h"
///Tool
#import "AccountInfoStorage.h"
#import "YYUtility.h"
@@ -107,4 +108,13 @@
[[self getView] openVipWithDiamondFail];
}showLoading:YES errorToast:YES] roomUid:roomUid];
}
//
-(void)getContactCustomerService{
[Api requestContactCustomerServiceCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
[[self getView]getContactCustomerServiceSuccessWithUid:uid];
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:NO]];
}
@end

View File

@@ -39,4 +39,6 @@
-(void)openVipWithDiamondSuccess;
///钻石开通会员失败
-(void)openVipWithDiamondFail;
//联系客服成功
-(void)getContactCustomerServiceSuccessWithUid:(NSString *)uid;
@end

View File

@@ -17,7 +17,7 @@
#import "DJDKMIMOMColor.h"
#import "ThemeColor+NobleCenter.h"
#import "Api+NobleCenter.h"
#import "Api+Main.h"
#import "RechargeStorage.h"
#import "AccountInfoStorage.h"
@@ -31,6 +31,7 @@
#import "XPWebViewController.h"
#import "XPNobleSettingViewController.h"
#import "XPSkillCardPlayerManager.h"
#import "SessionViewController.h"
///P
#import "XPNobleCenterPresenter.h"
#import "Api+Gift.h"
@@ -44,6 +45,7 @@
#import "XPNobleCenterProtocol.h"
#import "XPIAPRechargeViewController.h"
#import "YuMi-swift.h"
#import "ClientConfig.h"
@interface XPNobleCenterViewController ()<XPNobleCenterProtocol,XPNobleCenterPayViewDelegate,JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, NIMSystemNotificationManagerDelegate>
///
@property (nonatomic, strong) NSArray<NSString *> *titles;
@@ -80,6 +82,7 @@
@property (nonatomic, assign) NSInteger roomUid;
@property (nonatomic,strong) WalletInfoModel * infoModel;
@property(nonatomic,strong) UIButton *rankBtn;
@property(nonatomic,assign) BOOL pi_IsNative;
@end
@implementation XPNobleCenterViewController
@@ -98,7 +101,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.pi_IsNative = YES;
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
[self requestHttp];
[self initSubViews];
@@ -208,6 +211,18 @@
[self.presenter openVipWithDiamondRoomUid:roomUid];
return;
}
if(self.pi_IsNative == NO){
XPWebViewController *vc = [[XPWebViewController alloc]init];
NSString *channel = @"p";
channel = [NSString stringWithFormat:@"%@a",channel];
channel = [NSString stringWithFormat:@"%@y",channel];
NSString *url = [NSString stringWithFormat:URLWithType(kChannelUrl),channel,@"5",[YYUtility deviceID]];
vc.url = url;
[self.navigationController pushViewController:vc animated:YES];
return;
}
if(self.rechargeModel.list.count == 0)return;
[self showLoading];
RechargeListModel *rechargeModel = [self.rechargeModel.list safeObjectAtIndex1:0];
@@ -232,6 +247,23 @@
self.infoModel = model;
}
} uid:uid ticket:ticket];
if([ClientConfig shareConfig].canOpen){
[Api requestMineChannel:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
if(data.data[@"isNative"] != nil){
self.pi_IsNative = [data.data[@"isNative"] boolValue];
}
}
}];
}
}
///
@@ -289,6 +321,7 @@
///id
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
if (orderId.length > 0) {
self.orderId = orderId;
if (@available(iOS 15.0, *)) {
@@ -334,9 +367,40 @@
///
- (void)requestIAPRechargeOrderFail:(NSString *)message code:(NSInteger)code {
[self hideHUD];
if(code == 50000){
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.title = YMLocalizedString(@"XPIAPRechargeViewController7");
config.message = YMLocalizedString(@"XPIAPRechargeViewController8");
TTAlertButtonConfig *confirmButtonConfig = [[TTAlertButtonConfig alloc]init];
confirmButtonConfig.title = YMLocalizedString(@"XPIAPRechargeViewController9");
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x13E2F5),UIColorFromRGB(0x9DB4FF),UIColorFromRGB(0xCC67FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(200, 200)];
confirmButtonConfig.backgroundColor = [UIColor colorWithPatternImage:image];
confirmButtonConfig.cornerRadius = 38/2;
config.confirmButtonConfig = confirmButtonConfig;
[TTPopup alertWithConfig:config confirmHandler:^{
[self.presenter getContactCustomerService];
} cancelHandler:^{
}];
return;
}
[self showErrorToast:message];
}
- (void)getContactCustomerServiceSuccessWithUid:(NSString *)uid{
[self hideHUD];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
[self.navigationController pushViewController:sessionVC animated:YES];
});
}
///
- (void)checkReceiptSuccess:(NSString *)transcationId {
[self hideHUD];

View File

@@ -401,9 +401,11 @@
[self.presenter getContactCustomerService];
} cancelHandler:^{
}];
}
}
- (void)getContactCustomerServiceSuccessWithUid:(NSString *)uid{
[self hideHUD];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];

View File

@@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getPlayGameWithTeam:(int)pageNum withGroup:(dispatch_group_t)group;
///发现新朋友
-(void)getFriendListWithGroup:(dispatch_group_t)group;
///获取小游戏列表
- (void)getLittleGameListWithGroup:(dispatch_group_t)group;
@end
NS_ASSUME_NONNULL_END

View File

@@ -9,6 +9,7 @@
#import <ReactiveObjC/ReactiveObjC.h>
#import "Api+Home.h"
#import "Api+Guild.h"
#import "Api+LittleGame.h"
#import "AccountInfoStorage.h"
#import "HomeMenuInfoModel.h"
#import "HomeRecommendRoomModel.h"
@@ -16,6 +17,7 @@
#import "HomePlayRoomModel.h"
#import "XPNewHomeRecommendProtocol.h"
#import "ClanDetailInfoModel.h"
#import "LittleGameInfoModel.h"
@implementation XPNewHomeRecommendPresenter
///
- (void)getHomeTopBannerListWithGroup:(dispatch_group_t)group {
@@ -140,4 +142,18 @@
[[self getView]getFriendListFailWithGroup:group];
}]];
}
///
- (void)getLittleGameListWithGroup:(dispatch_group_t)group {
NSString * uid = [[AccountInfoStorage instance] getUid];
if (!uid.length) {
[[self getView] getHomeRecommendDataFailWithGroup:group];
return;
}
[Api getLittleGameList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [LittleGameInfoModel modelsWithArray:data.data];
[[self getView] onGetLittleGameListSuccess:array withGroup:group];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getHomeRecommendDataFailWithGroup:group];
}errorToast:NO]];
}
@end

View File

@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class LittleGameInfoModel;
@protocol XPNewHomeRecommendProtocol <NSObject>
@optional
///获取首页轮播图列表成功
@@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
-(void)getFriendListSuccess:(NSArray *)list withGroup:(dispatch_group_t)group;
///发现新朋友
-(void)getFriendListFailWithGroup:(dispatch_group_t)group;
///获取小游戏列表
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items withGroup:(dispatch_group_t)group;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,17 @@
//
// XPHomeGameCell.h
// xplan-ios
//
// Created by duoban on 2022/11/21.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPHomeGameCell : UICollectionViewCell
@property (nonatomic,assign) BOOL isChoose;
@property (nonatomic,copy) NSString *imageUrl;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,55 @@
//
// XPHomeGameCell.m
// xplan-ios
//
// Created by duoban on 2022/11/21.
//
#import "XPHomeGameCell.h"
@interface XPHomeGameCell()
@property (nonatomic,strong) NetImageView *bgImageView;
@end
@implementation XPHomeGameCell
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self.contentView addSubview:self.bgImageView];
}
- (void)initSubViewConstraints {
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView);
}];
}
- (void)setImageUrl:(NSString *)imageUrl{
_imageUrl = imageUrl;
_bgImageView.imageUrl = _imageUrl;
}
-(void)setIsChoose:(BOOL)isChoose{
_isChoose = isChoose;
_bgImageView.layer.borderWidth = _isChoose == YES ? 2 : 0;
}
#pragma mark -
- (NetImageView *)bgImageView{
if (!_bgImageView){
NetImageConfig *config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_bgImageView = [[NetImageView alloc]initWithConfig:config];
_bgImageView.layer.cornerRadius = kGetScaleWidth(10);
_bgImageView.layer.masksToBounds = YES;
_bgImageView.layer.borderColor = [DJDKMIMOMColor appMainColor].CGColor;
}
return _bgImageView;
}
@end

View File

@@ -200,10 +200,12 @@
_gameIconView.hidden = NO;
_borderImageView.hidden = NO;
[_chatBtn setTitle:YMLocalizedString(@"XPSessionFindNewAlertView2") forState:UIControlStateNormal];
}else{
if(_roomInfo.inOnline == YES){
_greenView.hidden = NO;
}
}
if(_roomInfo.inOnline == YES){
_greenView.hidden = NO;
}
_wealthView.imageUrl = _roomInfo.userLevelVo.experUrl;
_charmView.imageUrl = _roomInfo.userLevelVo.charmUrl;
if(_roomInfo.userVoice.length > 0){

View File

@@ -1,21 +1,25 @@
//
// XPNewHomePlayEmptyTableViewCell.h
// YuMi
// xplan-ios
//
// Created by YuMi on 2022/10/8.
// Created by 冯硕 on 2022/10/8.
//
#import <UIKit/UIKit.h>
#import "ClanDetailInfoModel.h"
@protocol XPNewHomePlayEmptyTableViewCellDelegate <NSObject>
-(void)emptyCellChooseGameAction;
@end
NS_ASSUME_NONNULL_BEGIN
@interface XPNewHomePlayEmptyTableViewCell : UITableViewCell
-(void)setConstraints;
-(void)setTitle:(NSString *)title;
@property (nonatomic,assign) BOOL isClan;
@property (nonatomic,weak) id<XPNewHomePlayEmptyTableViewCellDelegate> delegate;
@end

View File

@@ -1,82 +1,130 @@
//
// XPNewHomePlayEmptyTableViewCell.m
// YuMi
// xplan-ios
//
// Created by YuMi on 2022/10/8.
// Created by on 2022/10/8.
//
#import "XPNewHomePlayEmptyTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "DJDKMIMOMColor.h"
#import "UIImage+Utils.h"
@interface XPNewHomePlayEmptyTableViewCell ()
@property (nonatomic,strong) UIImageView *emptyImageView;
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIImageView *addImageView;
///
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UIButton *chooseGameBtn;
@end
@implementation XPNewHomePlayEmptyTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
-(void)setTitle:(NSString *)title{
_titleLabel.text = title;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.contentView.backgroundColor =[UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.emptyImageView];
[self.contentView addSubview:self.titleLabel];
}
-(void)setConstraints{
[self.emptyImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.contentView).offset(kGetScaleWidth(90));
}];
self.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.backImageView];
[self.backImageView addSubview:self.addImageView];
[self.backImageView addSubview:self.titleLabel];
[self.backImageView addSubview:self.chooseGameBtn];
}
- (void)initSubViewConstraints {
[self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView).offset(150);
make.size.mas_equalTo(CGSizeMake(100, 100));
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.left.mas_equalTo(self.contentView).inset(kGetScaleWidth(12));
make.top.mas_equalTo(self.contentView);
make.bottom.mas_equalTo(-kGetScaleWidth(10));
}];
[self.addImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(48), kGetScaleWidth(48)));
make.left.mas_equalTo(self.backImageView).offset(kGetScaleWidth(12));
make.centerY.mas_equalTo(self.backImageView);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.emptyImageView.mas_bottom).offset(20);
make.left.right.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.addImageView.mas_right).offset(kGetScaleWidth(15));
make.right.equalTo(self.backImageView.mas_right).mas_offset(-kGetScaleWidth(12));
make.centerY.mas_equalTo(self.backImageView);
}];
[self.chooseGameBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.backImageView);
}];
}
-(void)chooseGameAction{
if(self.delegate && [self.delegate respondsToSelector:@selector(emptyCellChooseGameAction)]){
[self.delegate emptyCellChooseGameAction];
}
}
-(void)setIsClan:(BOOL)isClan{
_isClan = isClan;
// if(_isClan == NO){
// _chooseGameBtn.hidden = NO;
// [self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.right.mas_equalTo(-kGetScaleWidth(141));
// }];
// return;
// }
// _chooseGameBtn.hidden = YES;
// [self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.right.mas_equalTo(-kGetScaleWidth(12));
// }];
}
#pragma mark - Getters And Setters
- (UIImageView *)emptyImageView {
if (!_emptyImageView) {
_emptyImageView = [[UIImageView alloc] init];
_emptyImageView.userInteractionEnabled = YES;
_emptyImageView.image = [UIImageConstant defalutEmptyPlaceholder];
_emptyImageView.layer.masksToBounds = YES;
_emptyImageView.contentMode = UIViewContentModeScaleAspectFit;
- (UIImageView *)addImageView {
if (!_addImageView) {
_addImageView = [[UIImageView alloc] init];
_addImageView.userInteractionEnabled = YES;
_addImageView.image = [UIImage imageNamed:@"home_play_create_room"];
}
return _emptyImageView;
return _addImageView;
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.image = [UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor colorWithHexString:@"#E7D7FC"], [DJDKMIMOMColor colorWithHexString:@"#D7F8FD"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
_backImageView.layer.masksToBounds = YES;
_backImageView.layer.cornerRadius = kGetScaleWidth(10);
_backImageView.contentMode = UIViewContentModeScaleAspectFill;
_backImageView.userInteractionEnabled = YES;
}
return _backImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = YMLocalizedString(@"XPGuildEmptyCollectionViewCell0");
_titleLabel.font = [UIFont systemFontOfSize:16];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [DJDKMIMOMColor secondTextColor];
_titleLabel.font = kFontMedium(12);
_titleLabel.textColor = [DJDKMIMOMColor mainTextColor];
_titleLabel.numberOfLines = 0;
_titleLabel.text = YMLocalizedString(@"XPNewHomePlayEmptyTableViewCell0");
}
return _titleLabel;
}
- (UIButton *)chooseGameBtn{
if (!_chooseGameBtn){
_chooseGameBtn = [UIButton new];
// [_chooseGameBtn setBackgroundImage:kImage(@"home_play_game") forState:UIControlStateNormal];
[_chooseGameBtn addTarget:self action:@selector(chooseGameAction) forControlEvents:UIControlEventTouchUpInside];
// _chooseGameBtn.hidden = YES;
}
return _chooseGameBtn;
}
@end

View File

@@ -0,0 +1,23 @@
//
// XPHomeGameView.h
// xplan-ios
//
// Created by duoban on 2022/11/21.
//
#import "LittleGameInfoModel.h"
#import <Foundation/Foundation.h>
@protocol XPHomeGameViewDelegate <NSObject>
-(void)xpHomeGameViewChooseGameWithGameModel:(LittleGameInfoModel *_Nullable)gameModel;
@end
NS_ASSUME_NONNULL_BEGIN
@interface XPHomeGameView : UIView
@property (nonatomic,strong) NSArray *playGameList;
@property (nonatomic,weak) id<XPHomeGameViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,158 @@
//
// XPHomeGameView.m
// xplan-ios
//
// Created by duoban on 2022/11/21.
//
#import "XPHomeGameView.h"
#import "XPHomeGameCell.h"
@interface XPHomeGameView()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic,strong) UILabel *titleView;
@property (nonatomic,strong) UIButton *backView;
@property (nonatomic,strong) UIButton *confirmBtn;
@property (nonatomic,strong) UICollectionView *collectionView;
@property (nonatomic,strong) NSIndexPath *path;
@property (nonatomic,strong) UIView *bgView;
@end
@implementation XPHomeGameView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
[self addSubview:self.bgView];
[self.bgView addSubview:self.titleView];
[self.bgView addSubview:self.backView];
[self.bgView addSubview:self.collectionView];
[self.bgView addSubview:self.confirmBtn];
}
- (void)initSubViewConstraints {
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.right.left.equalTo(self);
make.height.mas_equalTo(kGetScaleWidth(362));
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(14));
make.left.mas_equalTo(kGetScaleWidth(15));
make.height.mas_equalTo(kGetScaleWidth(22));
}];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(kGetScaleWidth(26));
make.right.mas_equalTo(-kGetScaleWidth(15));
make.centerY.equalTo(self.titleView);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.left.mas_equalTo(self.bgView);
make.height.mas_equalTo(kGetScaleWidth(118));
make.top.mas_equalTo(kGetScaleWidth(74));
}];
[self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.bgView).inset(kGetScaleWidth(15));
make.height.mas_equalTo(kGetScaleWidth(46));
make.top.equalTo(self.collectionView.mas_bottom).mas_offset(kGetScaleWidth(70));
}];
}
- (void)setPlayGameList:(NSArray *)playGameList{
_playGameList = playGameList;
[_collectionView reloadData];
}
#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.playGameList.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPHomeGameCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeGameCell class]) forIndexPath:indexPath];
LittleGameInfoModel *model = self.playGameList[indexPath.row];
cell.imageUrl = model.pic;
if(self.path != nil){
cell.isChoose = self.path.row == indexPath.row;
}
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
self.confirmBtn.enabled = YES;
self.path = indexPath;
[self.collectionView reloadData];
}
-(void)confirmAction{
[self removeFromSuperview];
LittleGameInfoModel *model = self.playGameList[self.path.row];
if(self.delegate && [self.delegate respondsToSelector:@selector(xpHomeGameViewChooseGameWithGameModel:)]){
[self.delegate xpHomeGameViewChooseGameWithGameModel:model];
}
}
-(void)backAction{
[self removeFromSuperview];
}
#pragma mark -
- (UIView *)bgView{
if (!_bgView){
_bgView = [UIView new];
_bgView.backgroundColor = [UIColor whiteColor];
[_bgView setCornerWithLeftTopCorner:kGetScaleWidth(25) rightTopCorner:kGetScaleWidth(25) bottomLeftCorner:0 bottomRightCorner:0 size:CGSizeMake(KScreenWidth, kGetScaleWidth(362))];
}
return _bgView;
}
- (UILabel *)titleView{
if (!_titleView){
_titleView = [UILabel labelInitWithText:YMLocalizedString(@"XPHomeGameView0") font:kFontMedium(kGetScaleWidth(16)) textColor:[DJDKMIMOMColor inputTextColor]];
}
return _titleView;
}
-(UIButton *)backView{
if (!_backView){
_backView = [UIButton buttonInitWithText:nil font:nil textColor:nil image:kImage(@"home_game_back") bgImage:nil];
[_backView addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backView;
}
- (UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(kGetScaleWidth(98), kGetScaleWidth(118));
layout.sectionInset = UIEdgeInsetsMake(0, kGetScaleWidth(15), 0, kGetScaleWidth(15));
layout.minimumLineSpacing = kGetScaleWidth(15);
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.showsHorizontalScrollIndicator = NO;
_collectionView.dataSource = self;
_collectionView.delegate = self;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[XPHomeGameCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeGameCell class])];
}
return _collectionView;
}
- (UIButton *)confirmBtn{
if (!_confirmBtn){
UIImage *image = [UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor],[DJDKMIMOMColor confirmButtonGradientMiddleColor],[DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth - kGetScaleWidth(30), kGetScaleWidth(46))];
_confirmBtn = [UIButton buttonInitWithText:YMLocalizedString(@"XPHomeGameView1") font:kFontRegular(16) textColor:[UIColor whiteColor] image:nil bgImage:image];
_confirmBtn.layer.cornerRadius = kGetScaleWidth(23);
_confirmBtn.layer.masksToBounds = YES;
[_confirmBtn addTarget:self action:@selector(confirmAction) forControlEvents:UIControlEventTouchUpInside];
_confirmBtn.enabled = NO;
}
return _confirmBtn;
}
@end

View File

@@ -43,8 +43,9 @@
///P
#import "XPNewHomeRecommendPresenter.h"
#import "XPNewHomeRecommendProtocol.h"
#import "XPHomeGameView.h"
UIKIT_EXTERN NSString * const kShieldingNotification;
@interface XPHomeRecommendViewController ()<UITableViewDelegate, UITableViewDataSource, XPNewHomePlayTableViewCellDelegate, XPHomeBannerTableViewCellDelegate,XPNewHomeRecommendTableViewCellDelegate,XPNewHomeRecommendProtocol,XPNewHomePartyTableViewCellDelegate,CountDownHelperDelegate>
@interface XPHomeRecommendViewController ()<UITableViewDelegate, UITableViewDataSource, XPNewHomePlayTableViewCellDelegate, XPHomeBannerTableViewCellDelegate,XPNewHomeRecommendTableViewCellDelegate,XPNewHomeRecommendProtocol,XPNewHomePartyTableViewCellDelegate,CountDownHelperDelegate,XPNewHomePlayEmptyTableViewCellDelegate,XPHomeGameViewDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
@@ -63,6 +64,8 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
@property(nonatomic,strong)XPNewHomePartyTableViewCell *cell;
///cellUITableViewY
@property(nonatomic,assign) CGFloat cellY;
///
@property (nonatomic, strong) NSMutableArray<LittleGameInfoModel *> *littleGameArray;
@end
@implementation XPHomeRecommendViewController
@@ -138,7 +141,12 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
[self.presenter getFriendListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getLittleGameListWithGroup:group];
});
dispatch_group_notify(group,dispatch_get_main_queue(), ^{
self.isRequestData = NO;
@@ -176,14 +184,14 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section == 0)return self.playTeamList.count > 0 ? 1 : 0;
if(section == 0) return 1;
return self.personalRoomList.count > 0 ? self.personalRoomList.count : 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
return kGetScaleWidth(102);
return self.playTeamList.count > 0 ? kGetScaleWidth(102) : kGetScaleWidth(75);
}
return self.personalRoomList.count > 0 ? kGetScaleWidth(104) : 300;
@@ -191,30 +199,32 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.section == 0) {
XPNewHomePlayTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPNewHomePlayTableViewCell class])];
if (cell == nil) {
cell = [[XPNewHomePlayTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPNewHomePlayTableViewCell class])];
if(self.playTeamList.count > 0){
XPNewHomePlayTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPNewHomePlayTableViewCell class])];
if (cell == nil) {
cell = [[XPNewHomePlayTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPNewHomePlayTableViewCell class])];
}
cell.playRoomList = self.playTeamList;
cell.delegate = self;
return cell;
}
cell.playRoomList = self.playTeamList;
cell.delegate = self;
return cell;
}
if(self.personalRoomList.count == 0){
XPNewHomePlayEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPNewHomePlayEmptyTableViewCell class])];
if (cell == nil) {
cell = [[XPNewHomePlayEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPNewHomePlayEmptyTableViewCell class])];
}
[cell setConstraints];
[cell setTitle:YMLocalizedString(@"XPGuildEmptyCollectionViewCell0")];
cell.isClan = YES;
cell.delegate = self;
return cell;
}
XPNewHomePartyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPNewHomePartyTableViewCell class])];
if (cell == nil) {
cell = [[XPNewHomePartyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPNewHomePartyTableViewCell class])];
@@ -283,19 +293,79 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
}
}
- (void)chooseGameAction{
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
}
#pragma mark - XPNewHomePlayEmptyTableViewCellDelegate
- (void)emptyCellChooseGameAction{
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
// XPHomeGameView *gameView = [XPHomeGameView new];
// gameView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
// gameView.playGameList = self.littleGameArray;
// gameView.delegate = self;
// [kWindow addSubview:gameView];
}
#pragma mark - XPHomeGameViewDelegate
- (void)xpHomeGameViewChooseGameWithGameModel:(LittleGameInfoModel *)gameModel{
NSString * uid = [AccountInfoStorage instance].getUid;
[self showLoading];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
if(roomInfo.isReselect){
[XPRoomViewController openRoom:[AccountInfoStorage instance].getUid mgId:gameModel.mgId viewController:self];
}else{
[self updateRoomInformation:gameModel roomInfo:roomInfo];
}
} else {
[self hideHUD];
[self showErrorToast:msg];
}
} uid:uid intoUid:uid];
}
///
-(void)updateRoomInformation:(LittleGameInfoModel *)gameModel roomInfo:(RoomInfoModel *)roomInfo{
NSString * uid = [AccountInfoStorage instance].getUid;
NSMutableDictionary * params = [NSMutableDictionary dictionary];
NSString * ticket = [AccountInfoStorage instance].getTicket;
[params setObject:ticket forKey:@"ticket"];
[params setObject:uid forKey:@"uid"];
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.uid] forKey:@"roomUid"];
if (roomInfo.title.length > 0) {
[params setObject:roomInfo.title forKey:@"title"];
}
if (roomInfo.roomPwd.length > 0) {
[params setObject:roomInfo.roomPwd forKey:@"roomPwd"];
} else{
[params setObject:@"" forKey:@"roomPwd"];
}
if (roomInfo.tagId > 0) {
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.tagId] forKey:@"tagId"];
}
[params setObject:@(RoomType_MiniGame) forKey:@"type"];
[params setObject:gameModel.mgId forKey:@"mgId"];
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
@weakify(self)
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@strongify(self);
[self hideHUD];
if (code == 200) {
[XPRoomViewController openRoom:[AccountInfoStorage instance].getUid mgId:gameModel.mgId viewController:self];
} else {
[self showErrorToast:msg];
}
} params:params];
}
#pragma mark - XPHomeBannerTableViewCell
- (void)xPHomeBannerTableViewCell:(XPHomeBannerTableViewCell *)view didClickBanner:(HomeBannerInfoModel *)info {
@@ -351,6 +421,11 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
self.personalRoomList = [NSMutableArray arrayWithArray:list];
dispatch_group_leave(group);
}
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items withGroup:(nonnull dispatch_group_t)group{
self.littleGameArray = [[NSMutableArray alloc]initWithArray:items];
dispatch_group_leave(group);
}
- (void)getFriendListFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
}

View File

@@ -274,8 +274,8 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
#pragma mark - JXCategoryViewDelegate
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
if(self.headView.bannerList.count == 0)return kGetScaleWidth(103);
return kGetScaleWidth(188);
if(self.headView.bannerList.count == 0)return kGetScaleWidth(80);
return kGetScaleWidth(170);
}
- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {

View File

@@ -63,7 +63,7 @@
#import "PIFullScreenBannerAnimation.h"
#import "XPTreasureFairyGiftView.h"
#import "XPRoomTarrowBannerView.h"
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate, XPRoomStarKitchenBannerViewDelegate>
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate, XPRoomStarKitchenBannerViewDelegate,PAGViewListener>
///
///
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
@@ -118,6 +118,8 @@
@property (nonatomic,strong) SVGAImageView *carEffectView;
///VAP
@property (nonatomic, strong) VAPView *carVapEffectView;
///pag
@property(nonatomic,strong) PAGView *carPagView;
#pragma mark -
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *enterEffectQueue;
@property (nonatomic,strong) SVGAImageView *enterEffectView;
@@ -157,15 +159,7 @@
- (void)dealloc {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
if(self.giftEffectTimer != nil){
dispatch_resume(self.giftEffectTimer);
self.giftEffectTimer = nil;
}
if(self.giftTimer != nil){
dispatch_resume(self.giftTimer);
self.giftTimer = nil;
}
}
-(void)resumeTimer{
if(self.giftEffectTimer != nil){
@@ -177,6 +171,7 @@
dispatch_resume(self.giftTimer);
self.giftTimer = nil;
}
[self.giftPagView removeListener:self];
}
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
@@ -457,7 +452,7 @@
[self.animationListB addObject:giftNotifyInfo];
}
- (void)createCommonH5BannerAnimation:(PIBaseAnimationViewModel *)attatchment {
CGFloat kscale = (CGFloat)55 / (CGFloat)375;
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
@@ -489,12 +484,12 @@
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
[self playAnimationWithModel];
}
}];
@@ -503,7 +498,7 @@
}];
[tarrowVeiw pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"];
}
#pragma mark -
-(void)receiveTarotBanner:(AttachmentModel *)attachment{
@@ -518,7 +513,7 @@
}
- (void)createTarotBannerAnimation:(PIBaseAnimationViewModel *)attatchment {
CGFloat kscale = (CGFloat)55 / (CGFloat)375;
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
@@ -550,12 +545,12 @@
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
[self playAnimationWithModel];
}
}];
@@ -564,7 +559,7 @@
}];
[tarrowVeiw pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"];
}
#pragma mark -
- (void)receiveTreasureFairyGiftHighLevel:(AttachmentModel *)attatchment {
@@ -578,7 +573,7 @@
[self createTreasureFairyBannerAnimation:giftModel];
}
[self.animationListB addObject:giftModel];
}
- (void)createTreasureFairyBannerAnimation:(PIBaseAnimationViewModel *)attatchment {
self.isPlayOfB = YES;
@@ -621,12 +616,12 @@
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
[self playAnimationWithModel];
}
}];
@@ -912,6 +907,26 @@
[self.vapParser parseWithURL:viewUrl completionBlock:^(NSString * _Nullable videoUrl) {
if (videoUrl.length) {
if([videoUrl containsString:@".pag"]){
self.carPagView.hidden = NO;
if(self.carPagView.superview == nil){
[self.middleLevelView addSubview:self.carPagView];
[self.carPagView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
[self.carPagView setPath:videoUrl];
self.carPagView.userInteractionEnabled = NO;
self.carPagView.repeatCount = 1;
self.carPagView.scaleMode = PAGScaleModeStretch;
[self.carPagView play];
}
return;
}
self.carVapEffectView.hidden = NO;
if (self.carVapEffectView.superview == nil) {
[self.middleLevelView addSubview:self.carVapEffectView];
@@ -1009,12 +1024,12 @@
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
// if(self. isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
[self playAnimationWithModel];
}
}];
@@ -1113,12 +1128,12 @@
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
// if(self.isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
// if(self.isAnimationListAFinish == YES){
//
// [self playAnimationWithModel];
// self.isAnimationListAFinish = NO;
// return;
// }
[self playAnimationWithModel];
}
}];
@@ -1213,11 +1228,11 @@
if(self.animationListB.count > 0){
[self.animationListB removeObjectAtIndex:0];
}
// if(self.isAnimationListAFinish == YES){
// self.isAnimationListAFinish = NO;
// [self playAnimationWithModel];
// return;
// }
// if(self.isAnimationListAFinish == YES){
// self.isAnimationListAFinish = NO;
// [self playAnimationWithModel];
// return;
// }
[self playAnimationWithModel];
}];
[anchorRankView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
@@ -1272,11 +1287,11 @@
if(self.animationListB.count > 0){
[self.animationListB removeObjectAtIndex:0];
}
// if(self.isAnimationListAFinish == YES){
// self.isAnimationListAFinish = NO;
// [self playAnimationWithModel];
// return;
// }
// if(self.isAnimationListAFinish == YES){
// self.isAnimationListAFinish = NO;
// [self playAnimationWithModel];
// return;
// }
[self playAnimationWithModel];
}];
[anchorRankView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
@@ -1505,8 +1520,8 @@
GiftReceiveInfoModel *giftNotifyInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
///广 tabbar
if (giftNotifyInfo.ceremonyGift)return;
// if(giftNotifyInfo.isHomeShow == YES)return; /// tabbar
// if(giftNotifyInfo.roomUid == self.delegate.getRoomInfo.uid)return; ///
// if(giftNotifyInfo.isHomeShow == YES)return; /// tabbar
// if(giftNotifyInfo.roomUid == self.delegate.getRoomInfo.uid)return; ///
if (self.animationListA.count == 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) {
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
}
@@ -1589,16 +1604,16 @@
#pragma mark -
- (void)receiveLuckyGiftBigPrize:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
PIBaseAnimationViewModel * prizeModel = [PIBaseAnimationViewModel modelWithDictionary:attachment.data];
prizeModel.type = GiftBannerType_Lucky;
prizeModel.isInRoomVisiable = attachment.second == Custom_Message_Sub_Room_Gift_LuckBag;
if(self.animationListB.count == 0 && self.isPlayOfB == NO){
[self createBigPrizeAnimation:prizeModel];
}
[self.animationListB addObject:prizeModel];
PIBaseAnimationViewModel * prizeModel = [PIBaseAnimationViewModel modelWithDictionary:attachment.data];
prizeModel.type = GiftBannerType_Lucky;
prizeModel.isInRoomVisiable = attachment.second == Custom_Message_Sub_Room_Gift_LuckBag;
if(self.animationListB.count == 0 && self.isPlayOfB == NO){
[self createBigPrizeAnimation:prizeModel];
}
[self.animationListB addObject:prizeModel];
}
@@ -1624,17 +1639,17 @@
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, luckyGiftEffectView.center.y)];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 6 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[luckyGiftEffectView removeFromSuperview];
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
self.isPlayOfB = NO;
// if(self.isAnimationListAFinish == YES){
// self.isAnimationListAFinish = NO;
// [self playAnimationWithModel];
// return;
// }
[self playAnimationWithModel];
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
self.isPlayOfB = NO;
// if(self.isAnimationListAFinish == YES){
// self.isAnimationListAFinish = NO;
// [self playAnimationWithModel];
// return;
// }
[self playAnimationWithModel];
});
[luckyGiftEffectView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"];
}
@@ -1662,13 +1677,13 @@
}
-(void)playAnimationWithModel{
// if(self.isAnimationListAFinish == YES)return;
// if(self.isAnimationListAFinish == YES)return;
if(self.animationListB.count <= 0){
if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
});
}
return;
}
@@ -1718,7 +1733,7 @@
// SVGA
if (receiveInfo.displayGift.count > 0) {
[receiveInfo.displayGift enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.otherViewType == GiftOtherViewTypeMp4 && obj.viewUrl && obj.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
if ((obj.otherViewType == GiftOtherViewTypeMp4 || obj.otherViewType == GiftOtherViewTypePag) && obj.viewUrl && obj.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
model.viewUrl = obj.viewUrl;
model.avatar = receiveInfo.sendUserAvatar;
@@ -1730,8 +1745,8 @@
model.targetAvatar = receiveInfo.targetAvatar;
model.targetNick = receiveInfo.targetNick;
[self.svgaQueue addObject:model];
// [self.animationListA addObject:model];
// [self.animationListA addObject:model];
} else if (obj.hasVggPic && roomInfor.hasAnimationEffect) {
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
model.viewUrl = obj.viewUrl;
@@ -1744,8 +1759,8 @@
model.targetAvatar = receiveInfo.targetAvatar;
model.targetNick = receiveInfo.targetNick;
[self.svgaQueue addObject:model];
// [self.animationListA addObject:model];
// [self.animationListA addObject:model];
}
}];
}
@@ -1761,7 +1776,7 @@
}
if (receiveInfo.targetUsers.count > 0 && receiveInfo.targetUids.count <= 0) {
receiveInfo.targetUids = [receiveInfo.targetUsers valueForKeyPath:@"uid"];
}
}
NSInteger giftTotal = 0;
if (receiveInfo.targetUids.count > 0) {
@@ -1770,25 +1785,25 @@
giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
}
if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
if ((giftInfo.otherViewType == GiftOtherViewTypeMp4 || giftInfo.otherViewType == GiftOtherViewTypePag) && giftInfo.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
receiveInfo.viewUrl = giftInfo.viewUrl;
// [self.animationListA addObject:receiveInfo];
// [self.animationListA addObject:receiveInfo];
[self.svgaQueue addObject:receiveInfo];
} else if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && roomInfor.hasAnimationEffect) {///SVGA
receiveInfo.vggUrl = giftInfo.vggUrl;
// [self.animationListA addObject:receiveInfo];
// [self.animationListA addObject:receiveInfo];
[self.svgaQueue addObject:receiveInfo];
}
}
// if (self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) {
// [self createGiftBannerViewAnimation:self.animationListA.firstObject];
// }
// if (self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) {
// [self createGiftBannerViewAnimation:self.animationListA.firstObject];
// }
// if(self.svgaQueue.count > 0 && self.isLargeGiftAnimating == NO){
// [self createGiftSvgaAnimation:self.svgaQueue.firstObject];
//
// }
// if(self.svgaQueue.count > 0 && self.isLargeGiftAnimating == NO){
// [self createGiftSvgaAnimation:self.svgaQueue.firstObject];
//
// }
if (self.giftEffectTimer == nil && self.svgaQueue.count > 0) {
[self startHandleGiftEffectTimer];
}
@@ -1820,89 +1835,97 @@
self.giftEffectTimer = _timer;
}
-(void)createGiftSvgaAnimation:(GiftReceiveInfoModel *)receiveInfo{
GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
if (!giftInfo) {
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId];
}
if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
[self largeGiftStopCarEffect:giftInfo.goldPrice];
[self playGiftEffectWithVapUrl:giftInfo.viewUrl];
if ((giftInfo.otherViewType == GiftOtherViewTypeMp4 || giftInfo.otherViewType == GiftOtherViewTypePag) && giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
if(giftInfo.otherViewType == GiftOtherViewTypePag){
[self largeGiftStopCarEffect:giftInfo.goldPrice];
[self playGiftEffectWithPagUrl:giftInfo.viewUrl];
}else{
[self largeGiftStopCarEffect:giftInfo.goldPrice];
[self playGiftEffectWithVapUrl:giftInfo.viewUrl];
}
}
if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
[self largeGiftStopCarEffect:giftInfo.goldPrice];
[self playGiftEffect:giftInfo.vggUrl];
}
}
- (void)createGiftBannerViewAnimation:(GiftReceiveInfoModel *)receiveInfo {
[self createGiftBroadcastViewAnimation:receiveInfo];
// GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
// if (!giftInfo) {
// giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId];
// }
// NSInteger giftTotal = 0;
// if (receiveInfo.targetUids.count > 0) {
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice * receiveInfo.targetUids.count;
// } else {
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
// }
// if (giftTotal >= 520) {
// self.isPlayOfA = YES;
// __block XPRoomGiftBannerView *view = [self.bannerDequePool anyObject];
// if (view == nil) {
// view = [[XPRoomGiftBannerView alloc] init];
// [self.bannerVisiablePool addObject:view];
// }else{
// [self.bannerDequePool removeObject:view];
// }
// [self removeGiftBannerView:view];
// [view configGiftBanner:receiveInfo users:[self makeBannerUsers]];
// view.frame = CGRectMake(KScreenWidth, 80, KScreenWidth, 153);
// [self.highLevleView addSubview:view];
// POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
// springAnimation.springSpeed = 12;
// springAnimation.springBounciness = 10.f;
// springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
// springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(view.frame.size.width / 2, view.center.y)];
// @kWeakify(self);
// [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
// @kStrongify(self);
// if (finished) {
// [self removeAnimation:view];
// }
// }];
//
// [springAnimation setAnimationDidStartBlock:^(POPAnimation *anim) {
// @kStrongify(self);
//
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffectWithVapUrl:giftInfo.viewUrl];
//// }
//// if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffect:giftInfo.vggUrl];
//// }
// }];
//
// [view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
// } else {
//
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && receiveInfo.viewUrl.length > 0) {//vap
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffectWithVapUrl:receiveInfo.viewUrl];
//// }
//// if (receiveInfo.vggUrl.length > 0) {///
////
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffect:receiveInfo.vggUrl];
//// }
// [self.animationListA removeObjectAtIndex:0];
// }
// GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
// if (!giftInfo) {
// giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId];
// }
// NSInteger giftTotal = 0;
// if (receiveInfo.targetUids.count > 0) {
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice * receiveInfo.targetUids.count;
// } else {
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
// }
// if (giftTotal >= 520) {
// self.isPlayOfA = YES;
// __block XPRoomGiftBannerView *view = [self.bannerDequePool anyObject];
// if (view == nil) {
// view = [[XPRoomGiftBannerView alloc] init];
// [self.bannerVisiablePool addObject:view];
// }else{
// [self.bannerDequePool removeObject:view];
// }
// [self removeGiftBannerView:view];
// [view configGiftBanner:receiveInfo users:[self makeBannerUsers]];
// view.frame = CGRectMake(KScreenWidth, 80, KScreenWidth, 153);
// [self.highLevleView addSubview:view];
// POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
// springAnimation.springSpeed = 12;
// springAnimation.springBounciness = 10.f;
// springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
// springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(view.frame.size.width / 2, view.center.y)];
// @kWeakify(self);
// [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
// @kStrongify(self);
// if (finished) {
// [self removeAnimation:view];
// }
// }];
//
// [springAnimation setAnimationDidStartBlock:^(POPAnimation *anim) {
// @kStrongify(self);
//
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffectWithVapUrl:giftInfo.viewUrl];
//// }
//// if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffect:giftInfo.vggUrl];
//// }
// }];
//
// [view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
// } else {
//
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && receiveInfo.viewUrl.length > 0) {//vap
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffectWithVapUrl:receiveInfo.viewUrl];
//// }
//// if (receiveInfo.vggUrl.length > 0) {///
////
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
//// [self playGiftEffect:receiveInfo.vggUrl];
//// }
// [self.animationListA removeObjectAtIndex:0];
// }
}
- (void)largeGiftStopCarEffect:(double)goldPrice {
@@ -1910,6 +1933,7 @@
self.isLargeGiftAnimating = YES;
[self.carEffectView stopAnimation];
[self.carVapEffectView stopHWDMP4];
[self.carPagView stop];
[self.carEffectQueue removeAllObjects];
}
}
@@ -1932,14 +1956,14 @@
}
if(self.animationListB.count > 0){
// self.isAnimationListAFinish = YES;
[self playAnimationWithModel];
return;
}
if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
}
if(self.animationListB.count > 0){
// self.isAnimationListAFinish = YES;
[self playAnimationWithModel];
return;
}
if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
}
}
@@ -1970,7 +1994,7 @@
NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
[self.parser parseWithData:data cacheKey:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
self.giftEffectView.hidden = NO;
if (self.giftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.giftEffectView];
@@ -1998,16 +2022,16 @@
self.giftEffectView.videoItem = videoItem;
[self.giftEffectView startAnimation];
}
} failureBlock:^(NSError * _Nonnull error) {
self.giftEffectView.hidden = YES;
}];
} failureBlock:^(NSError * _Nonnull error) {
self.giftEffectView.hidden = YES;
}];
return;
};
[self.parser parseWithURL:[NSURL URLWithString:vggUrl] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
if (videoItem != nil) {
self.giftEffectView.hidden = NO;
if (self.giftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.giftEffectView];
@@ -2039,7 +2063,29 @@
self.giftEffectView.hidden = YES;
}];
}
/// pag
- (void)playGiftEffectWithPagUrl:(NSString *)pagUrl {
if ([self isInSudGame]) {return;}
[self.vapParser parseWithURL:pagUrl completionBlock:^(NSString * _Nullable videoUrl) {
self.giftPagView.hidden = NO;
if(self.giftPagView.superview == nil){
[self.middleLevelView addSubview:self.giftPagView];
[self.giftPagView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight);
}];
[self.giftPagView setPath:videoUrl];
self.giftPagView.userInteractionEnabled = NO;
self.giftPagView.repeatCount = 1;
self.giftPagView.scaleMode = PAGScaleModeStretch;
[self.giftPagView play];
}
} failureBlock:^(NSError * _Nullable error) {
self.giftPagView.hidden = YES;
}];
}
/// vap
- (void)playGiftEffectWithVapUrl:(NSString *)vapUrl {
@@ -2352,7 +2398,71 @@
}
});
}
#pragma mark - PAGViewListener
/**
* Notifies the beginning of the animation. It can be called from either the UI thread or the thread
* that calls the play method.
*/
- (void)onAnimationStart:(PAGView*)pagView{
}
/**
* Notifies the end of the animation. It can only be called from the UI thread.
*/
- (void)onAnimationEnd:(PAGView*)pagView{
dispatch_async(dispatch_get_main_queue(), ^{
pagView.hidden = YES;
if (pagView == self.giftPagView) {
[self.giftPagView removeFromSuperview];
self.giftPagView = nil;
if (self.isLargeGiftAnimating == YES) {
self.isLargeGiftAnimating = NO;
}
}else if(pagView == self.carPagView){
[self.carPagView removeFromSuperview];
self.carPagView = nil;
if (self.carEffectQueue.count > 0) {
[self.carEffectQueue removeObjectAtIndex:0];
}
if (self.carEffectQueue.count > 0) {
[self playCarEffect:self.carEffectQueue.firstObject];
}
}
});
}
/**
* Notifies the cancellation of the animation. It can be called from either the UI thread or the
* thread that calls the stop method.
*/
- (void)onAnimationCancel:(PAGView*)pagView{
dispatch_async(dispatch_get_main_queue(), ^{
pagView.hidden = YES;
if (pagView == self.giftPagView) {
[self.giftPagView removeFromSuperview];
self.giftPagView = nil;
if (self.isLargeGiftAnimating == YES) {
self.isLargeGiftAnimating = NO;
}
}
});
}
/**
* Notifies the repetition of the animation. It can only be called from the UI thread.
*/
- (void)onAnimationRepeat:(PAGView*)pagView{
}
/**
* Notifies another frame of the animation has occurred. It may be called from an arbitrary
* thread if the animation is running asynchronously.
*/
- (void)onAnimationUpdate:(PAGView*)pagView{
}
#pragma mark - Getters And Setters
- (SVGAImageView *)giftEffectView {
if (!_giftEffectView) {
@@ -2609,8 +2719,17 @@
- (PAGView *)giftPagView{
if(!_giftPagView){
_giftPagView = [[PAGView alloc]init];
[_giftPagView addListener:self];
_giftPagView.backgroundColor = [UIColor clearColor];
}
return _giftPagView;
}
- (PAGView *)carPagView{
if(!_carPagView){
_carPagView = [[PAGView alloc]init];
[_carPagView addListener:self];
_carPagView.backgroundColor = [UIColor clearColor];
}
return _carPagView;
}
@end

View File

@@ -14,12 +14,7 @@
@implementation XPRoomGiftAnimationParser
static NSOperationQueue *parseQueue;
+ (void)load {
parseQueue = [NSOperationQueue new];
parseQueue.maxConcurrentOperationCount = 8;
}
- (void)parseWithURL:(nonnull NSString *)URL
completionBlock:(void ( ^ _Nonnull )(NSString * _Nullable videoUrl))completionBlock

View File

@@ -39,13 +39,13 @@
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
[self.subtractBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(40));
make.height.mas_equalTo(kGetScaleWidth(21));
make.centerY.equalTo(self.bgView);
make.leading.mas_equalTo(kGetScaleWidth(5));
}];
[self.subtractBtn mas_makeConstraints:^(MASConstraintMaker *make) {
[self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(40));
make.height.mas_equalTo(kGetScaleWidth(21));
make.centerY.equalTo(self.bgView);
@@ -53,8 +53,8 @@
}];
[self.textFiled mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.equalTo(self.subtractBtn.mas_leading).mas_offset(-kGetScaleWidth(0));
make.leading.equalTo(self.addBtn.mas_trailing).mas_offset(kGetScaleWidth(0));
make.trailing.equalTo(self.addBtn.mas_leading).mas_offset(-kGetScaleWidth(0));
make.leading.equalTo(self.subtractBtn.mas_trailing).mas_offset(kGetScaleWidth(0));
make.bottom.top.equalTo(self);
}];

View File

@@ -33,6 +33,7 @@
#import "XPIAPRechargeViewController.h"
#import "XPCandyTreeBuyView.h"
#import "XPCandyTreeConfirmBuyView.h"
#import "XPCandyTreeBuySuccessView.h"
///P
#import "XPCandyTreePresenter.h"
#import "XPCandyTreeProtocol.h"
@@ -137,6 +138,9 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey;
self.buyView.num = self.setModel.ticketNum;
}
- (void)buyLoveTicketSuccessWithNum:(NSString *)num{
XPCandyTreeBuySuccessView *successView = [[XPCandyTreeBuySuccessView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
successView.num = num;
[TTPopup popupView:successView style:TTPopupStyleAlert];
[self.presenter getLoveSettingInfo];
}
- (void)pickCandyFail {
@@ -490,15 +494,14 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey;
}
#pragma mark -XPCandyTreeConfirmBuyViewDelegate
-(void)buyLoveNumWithType:(int)type num:(NSString *)num{
NSInteger price = num.integerValue * self.setModel.ticketPrice.integerValue;
if(price > self.setModel.diamond.integerValue){
[self pickCandyPay];
return;
}
if(type == 0){
NSInteger price = num.integerValue * self.setModel.ticketPrice.integerValue;
if(price > self.setModel.diamond.integerValue){
[self pickCandyPay];
return;
}
[self.presenter buyLoveTicket:num];
return;
}
[self.presenter buyLoveTicket:num];
}

View File

@@ -11,8 +11,10 @@ NS_ASSUME_NONNULL_BEGIN
@protocol XPFirstRechargeViewDelegate <NSObject>
@optional
///
-(void)rechargeHandle;
///联系客服
-(void)contactCustomerService;
@end

View File

@@ -6,6 +6,7 @@
//
///Third
#import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h>
///Tool
#import <Base64/MF_Base64Additions.h>
#import "YUMIMacroUitls.h"
@@ -17,6 +18,7 @@
#import "AccountInfoStorage.h"
#import "YYUtility.h"
#import "Api+Mine.h"
#import "Api+Main.h"
#import "RechargeStorage.h"
///Model
@@ -29,12 +31,14 @@
#import "XPFirstRechargeProtocol.h"
///VC
#import "XPMineRechargeViewController.h"
#import "XPWebViewController.h"
#import "XPFirstRechargeView.h"
#import "Api+FirstRecharge.h"
#import "FirstRechargeModel.h"
#import "XPSkillCardPlayerManager.h"
#import "YuMi-swift.h"
#import "ClientConfig.h"
@interface XPFirstRechargeView ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
///
@property (nonatomic,strong) UIButton *backBtn;
@@ -68,6 +72,7 @@
@property (nonatomic,strong) XPFirstRechargeCollectionView *rechargeView;
@property (nonatomic,strong) FirstRechargeModel *currentInfo;
@property (nonatomic,copy) NSString *orderId;
@property(nonatomic,assign) BOOL pi_IsNative;
@end
@implementation XPFirstRechargeView
@@ -100,6 +105,21 @@
[XNDJTDDLoadingTool showErrorWithMessage:msg];
} channelType:@"3"];
[self checkTranscationIds];
if([ClientConfig shareConfig].canOpen){
[Api requestMineChannel:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
if(data.data[@"isNative"] != nil){
self.pi_IsNative = [data.data[@"isNative"] boolValue];
}
}
}];
}
}
#pragma mark - Private Method
- (void)initSubViews {
@@ -265,6 +285,7 @@
///
/// @param chargeProdId id
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSString * deviceInfo = [YYUtility deviceID];
@@ -276,11 +297,19 @@
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
} else {
[XNDJTDDLoadingTool hideHUD];
if(code == 50000){
if(self.delegate && [self.delegate respondsToSelector:@selector(contactCustomerService)]){
[self.delegate contactCustomerService];
}
[self backAction];
return;
}
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
}
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
if (orderId.length > 0) {
self.orderId = orderId;
@@ -453,6 +482,15 @@
}
- (void)rechargeButtonAction {
if(self.pi_IsNative == NO){
if(self.delegate && [self.delegate respondsToSelector:@selector(rechargeHandle)]){
[self.delegate rechargeHandle];
}
[self backAction];
return;
}
if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) {
return;
}

View File

@@ -29,10 +29,11 @@ typedef NS_ENUM(NSUInteger, GiftSourceType) {
GiftSourceType_Pack = 2, // 背包礼物
};
///礼物播放类型0 无, 1 MP4、VAP播放)
///礼物播放类型0 无, 1 MP4、VAP播放,2,pag动画播放)
typedef NS_ENUM(NSUInteger, GiftOtherViewType) {
GiftOtherViewTypeNormal = 0,
GiftOtherViewTypeMp4 = 1,
GiftOtherViewTypePag = 2,
};
/**

View File

@@ -65,10 +65,10 @@
[self.contentView addSubview:self.priceStackView];
[self.contentView addSubview:self.coverView];
[self.contentView addSubview:self.giftNumLabel];
[self.contentView addSubview:self.nobleIconImageView];
[self.contentView addSubview:self.lockImageView];
[self.contentView addSubview:self.tagStackView];
[self.tagStackView addArrangedSubview:self.nobleIconImageView];
[self.tagStackView addArrangedSubview:self.exclusiveImageView];
[self.tagStackView addArrangedSubview:self.giftNewImageView];
[self.tagStackView addArrangedSubview:self.limitImageView];
@@ -129,8 +129,7 @@
[self.nobleIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(16);
make.right.mas_equalTo(self.tagStackView.mas_left).mas_offset(-2);
make.centerY.mas_equalTo(self.tagStackView);
}];
[self.lockImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.mas_equalTo(self.contentView).mas_offset(-4);

View File

@@ -57,6 +57,7 @@
#import "XPReceiveRedPacketView.h"
#import "XPFirstRechargeView.h"
#import "XPWebViewController.h"
#import "SessionViewController.h"
///P
#import "XPRoomPresenter.h"
#import "XPRoomProtocol.h"
@@ -1810,7 +1811,36 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
}
-(void)contactCustomerService{
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.title = YMLocalizedString(@"XPIAPRechargeViewController7");
config.message = YMLocalizedString(@"XPIAPRechargeViewController8");
TTAlertButtonConfig *confirmButtonConfig = [[TTAlertButtonConfig alloc]init];
confirmButtonConfig.title = YMLocalizedString(@"XPIAPRechargeViewController9");
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x13E2F5),UIColorFromRGB(0x9DB4FF),UIColorFromRGB(0xCC67FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(200, 200)];
confirmButtonConfig.backgroundColor = [UIColor colorWithPatternImage:image];
confirmButtonConfig.cornerRadius = 38/2;
config.confirmButtonConfig = confirmButtonConfig;
[TTPopup alertWithConfig:config confirmHandler:^{
[self requestContactCustomerService];
} cancelHandler:^{
}];
}
-(void)requestContactCustomerService{
[XNDJTDDLoadingTool showLoading];
[Api requestContactCustomerServiceCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[XNDJTDDLoadingTool hideHUD];
if(code == 200){
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
[self.getCurrentNav pushViewController:sessionVC animated:YES];
});
}
}];
}
- (XPRoomBackContainerView *)backContainerView {
if (!_backContainerView) {
_backContainerView = [[XPRoomBackContainerView alloc] initWithdelegate:self];

View File

@@ -3046,6 +3046,9 @@
"PIMessageContentServiceReplyView6"="3.如遇提示\"储值失败,请联系客服处理~\",请\n添加客服进行处理";
///XPRoomTarrowBannerView
"XPRoomTarrowBannerView0"="恭喜%@在幸运塔罗中运气爆发 获得%@钻石";
///XPHomeGameView
"XPHomeGameView0"="新建房间";
"XPHomeGameView1"="创建房间";
///不能脚本生成的
"App_Common_And" = "和";
"App_Common_Male" = "男";

View File

@@ -3055,6 +3055,10 @@
///XPRoomTarrowBannerView
"XPRoomTarrowBannerView0"="恭喜%@在幸運塔羅中運氣爆發 獲得%@鉆石";
///XPHomeGameView
"XPHomeGameView0"="新建房間";
"XPHomeGameView1"="創建房間";
///不能腳本生成的
"App_Common_And" = "和";
"App_Common_Male" = "男";