新增游戏

This commit is contained in:
liyuhua
2023-09-01 14:29:14 +08:00
parent 04c5e0390a
commit 9349d6b084
22 changed files with 885 additions and 58 deletions

View File

@@ -58,6 +58,10 @@
#import "XPIAPRechargeViewController.h"
#import "XPIncomeRecordVC.h"
#import "XPNobleCenterViewController.h"
#import "LittleGameInfoModel.h"
#import "HomeLittleGameRoomModel.h"
#import "XPLittleGameRoomOpenView.h"
#import "XPMineGameTableViewCell.h"
UIKIT_EXTERN NSString *kRequestRicket;
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineHeadItemTableViewCellDelegate, XPMineHeadViewDelegate, XPHomeBannerTableViewCellDelegate>
@@ -83,6 +87,8 @@ UIKIT_EXTERN NSString *kRequestRicket;
@property (nonatomic,assign) BOOL isRefreshRoomInfo;
///,
@property (nonatomic,assign) BOOL isRequestData;
///
@property (nonatomic, strong) NSMutableArray<LittleGameInfoModel *> *littleGameArray;
@end
@implementation XPMineViewController
@@ -226,8 +232,22 @@ UIKIT_EXTERN NSString *kRequestRicket;
break;
case XPMineItemType_My_Room:
{
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[XPRoomViewController openRoom:roomUid viewController:self];
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
if (roomInfo.isReselect) {
XPLittleGameRoomOpenView * roomOpenView = [[XPLittleGameRoomOpenView alloc] init];
roomOpenView.roomInfo = roomInfo;
roomOpenView.currentVC = self;
[TTPopup popupView:roomOpenView style:TTPopupStyleActionSheet];
} else {
[XPRoomViewController openRoom:roomUid viewController:self];
}
} else {
[self showErrorToast:msg];
}
} uid:roomUid intoUid:roomUid];
}
break;
case XPMineItemType_Collect_Room://
@@ -430,9 +450,24 @@ UIKIT_EXTERN NSString *kRequestRicket;
///
-(void)pushMyRoomVC{
if(self.isRefreshRoomInfo == YES)return;
self.isRefreshRoomInfo = YES;
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[XPRoomViewController openRoom:roomUid viewController:self];
self.isRefreshRoomInfo = YES;
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
self.isRefreshRoomInfo = NO;
if (code == 200) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
if (roomInfo.isReselect) {
XPLittleGameRoomOpenView * roomOpenView = [[XPLittleGameRoomOpenView alloc] init];
roomOpenView.roomInfo = roomInfo;
roomOpenView.currentVC = self;
[TTPopup popupView:roomOpenView style:TTPopupStyleActionSheet];
} else {
[XPRoomViewController openRoom:roomUid viewController:self];
}
} else {
[self showErrorToast:msg];
}
} uid:roomUid intoUid:roomUid];
}
#pragma mark - XPMineHeadViewDelegate
///
@@ -490,7 +525,21 @@ UIKIT_EXTERN NSString *kRequestRicket;
- (void)onGetMineFuntionItemFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
}
///
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items WithGroup:(nonnull dispatch_group_t)group{
[self.littleGameArray removeAllObjects];
[self.littleGameArray addObjectsFromArray:items];
dispatch_group_leave(group);
NSMutableArray *array = [NSMutableArray array];
for (LittleGameInfoModel *item in self.littleGameArray) {
[array addObject:item.name];
}
NSString *trackName = [array componentsJoinedByString:@","];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entry_show eventAttributes:@{@"gameName" : trackName}];
}
- (void)onGetLittleGameListFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
}
///banner
- (void)onGetPersonalBannerListSuccess:(NSArray<HomeBannerInfoModel *> *)items WithGroup:(nonnull dispatch_group_t)group{
[self.bannerArray removeAllObjects];
@@ -539,7 +588,10 @@ UIKIT_EXTERN NSString *kRequestRicket;
dispatch_group_async(group, queue, ^{
[self.presenter getPersonItemListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getLittleGameListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getMineBannerListWithGroup:group];
@@ -585,6 +637,56 @@ UIKIT_EXTERN NSString *kRequestRicket;
- (void)onGetClanDetailInfofailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
}
///
- (void)quickMatchLittleGameRoomSuccess:(HomeLittleGameRoomModel *)roomInfo mgId:(NSString *)mgId {
if (roomInfo.isPick && roomInfo.uid.length > 0) {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entrysuccess_click eventAttributes:@{@"roomUid" : roomInfo.uid}];
[XPRoomViewController openRoom:roomInfo.uid viewController:self];
} else if (roomInfo.needOpenSelfRoom) {
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entrysuccess_click eventAttributes:@{@"roomUid" : roomUid}];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
if (roomInfo.mgId != [mgId intValue]) {///
NSMutableDictionary * params = [NSMutableDictionary dictionary];
NSString * uid = [AccountInfoStorage instance].getUid;
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:mgId forKey:@"mgId"];
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
[XPRoomViewController openRoom:[AccountInfoStorage instance].getUid mgId:mgId viewController:self];
}
} params:params];
}
} else {
[self showErrorToast:msg];
}
} uid:roomUid intoUid:roomUid];
}
}
///
- (void)quickMatchLittleGameRoomFail:(NSString *)mgId {
[XPRoomViewController openRoom:[NSString stringWithFormat:@"%ld", self.userInfo.uid] mgId:mgId viewController:self];
}
#pragma mark - XPMineHeadItemTableViewCellDelegate
- (void)xPMineHeadItemTableViewCell:(XPMineHeadItemTableViewCell *)cell didSelectItem:(XPMineFuntionItemModel *)item {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_function_click eventAttributes:@{@"functionName" : item.centerName}];
@@ -614,7 +716,11 @@ UIKIT_EXTERN NSString *kRequestRicket;
break;
}
}
#pragma mark - XPMineGameTableViewCellDelegate
///
- (void)xPMineGameTableViewCell:(XPMineGameTableViewCell *)cell didSelectItem:(LittleGameInfoModel *)item {
[self.presenter quickMatchLittleGameWithMgId:item.mgId];
}
#pragma mark - NSNotification
- (void)onVisitorUnReadCountUpdate:(NSNotification *)noti {
@@ -661,6 +767,12 @@ UIKIT_EXTERN NSString *kRequestRicket;
}
return _functionArray;
}
- (NSMutableArray<LittleGameInfoModel *> *)littleGameArray {
if (!_littleGameArray) {
_littleGameArray = [NSMutableArray array];
}
return _littleGameArray;
}
- (NSMutableArray<HomeBannerInfoModel *> *)bannerArray {
if (!_bannerArray) {