房间游戏

This commit is contained in:
liyuhua
2024-05-31 19:56:25 +08:00
parent a58cee448b
commit 37e7dbf183
58 changed files with 1401 additions and 913 deletions

View File

@@ -34,7 +34,10 @@
#import "YYUtility.h"
#import "XPWeakTimer.h"
#import "PLTimeUtil.h"
#import "Api+MSRoomGameApi.h"
///Model
#import "MSRoomGameModel.h"
#import "AccountModel.h"
#import "RoomInfoModel.h"
#import "AttachmentModel.h"
@@ -48,6 +51,7 @@
#import "XPRedPacketModel.h"
#import "GiftReceiveInfoModel.h"
#import "XPVersionUpdateModel.h"
#import "MSRoomGameQuitGameView.h"
///VC
#import "TabbarViewController.h"
#import "XPBlankViewController.h"
@@ -66,6 +70,7 @@
#import "XPWebViewController.h"
#import "XPMineUserInfoViewController.h"
#import "MSTabbarRoomGameVC.h"
#import "MSRoomGameVC.h"
#import "XPMonentsRecommendViewController.h"
#import "XPMonentsViewController.h"
@@ -82,7 +87,7 @@
#import <SVGA.h>
#import "Api+Gift.h"
#import "UploadFile.h"
#import "XPTabBar.h"
NSString * const kUserFirstLoginKey = @"kUserFirstLoginKey";
@@ -92,7 +97,7 @@ NSString * const kNetworkReachabilityKey = @"kNetworkReachabilityKey";
UIKIT_EXTERN NSString * kNewUserRechargeKey;
UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol, NIMLoginManagerDelegate, NIMSystemNotificationManagerDelegate, NIMChatManagerDelegate,XPLoginAuthCodeVCDelegate, XPAnchorCardViewDelegate, NIMBroadcastManagerDelegate, XPRoomYearActivityViewDelegate>
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol, NIMLoginManagerDelegate, NIMSystemNotificationManagerDelegate, NIMChatManagerDelegate,XPLoginAuthCodeVCDelegate, XPAnchorCardViewDelegate, NIMBroadcastManagerDelegate, XPRoomYearActivityViewDelegate,MSRoomGameQuitGameViewDelegate>
{
NSTimer * timer;
}
@@ -136,7 +141,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
- (void)viewDidLoad {
[super viewDidLoad];
// XPTabBar *tabbar = [[XPTabBar alloc]initWithFrame:CGRectMake(0, KScreenHeight - kTabBarHeight, KScreenWidth, kTabBarHeight)];
// [self setValue:tabbar forKey:@"tabBar"];
[self.presenter autoLogin];
[self configTheme];
[self initTabs:NO];
@@ -248,7 +254,41 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
-(void)getRoomGameInfo{
[Api getRoomGameDetails:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
MSRoomGameModel *model = [MSRoomGameModel modelWithJSON:data.data];
if(model.data.matchStatus == 1 && model.data.roundStatus == 0){
MSTabbarRoomGameItemModel *chooseGameModel = [MSTabbarRoomGameItemModel new];
chooseGameModel.scores = model.data.scores;
chooseGameModel.roomId = model.roomId;
MSRoomGameQuitGameView *quitGameView = [[MSRoomGameQuitGameView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
quitGameView.chooseGameModel = chooseGameModel;
quitGameView.delegate = self;
[TTPopup popupView:quitGameView style:TTPopupStyleAlert];
}
}
} roomType:@"0"];
}
#pragma mark -MSRoomGameQuitGameViewDelegate
///退
- (void)closeGameActionWithModel:(MSTabbarRoomGameItemModel *)model{
[Api closeRoomGame:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
} roomId:model.roomId];
}
///app,
-(void)replayTheGameWithModel:(MSTabbarRoomGameItemModel *)model{
MSRoomGameVC *gameVC = [MSRoomGameVC new];
gameVC.chooseGameModel = model;
gameVC.userinfo = self.userInfo;
BaseNavigationController *nav = [[BaseNavigationController alloc]initWithRootViewController:gameVC];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:nav animated:YES completion:nil];
}
/// 12
/// ticket
/// BaseMvpPresenter1415
@@ -261,6 +301,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
return;
}
self.userInfo = userInfo;
[self getRoomGameInfo];
[AccountInfoStorage instance].name = self.userInfo.nick;
if ((userInfo.nick == nil || userInfo.avatar == nil) && self.isFormLogin == NO) {
@@ -726,7 +767,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
}
- (BaseNavigationController *)createTabBarItem:(UIViewController *)itemVc title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage{
itemVc.title = title;
itemVc.title = @"" ;
itemVc.tabBarItem.image = [[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
itemVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[itemVc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x1F1B4F)} forState:UIControlStateSelected];
@@ -760,7 +801,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
if (model.total > 99) {
badge = @"99+";
}
NSUInteger index = 1;
NSUInteger index = 2;
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
[item setBadgeValue:badge];
}
@@ -773,7 +814,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
unreadCount += obj.unreadCount;
}];
if(unreadCount > 0){
NSUInteger index = 2;
NSUInteger index = 3;
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
[item setBadgeValue:[NSString stringWithFormat:@"%ld",unreadCount]];
}