房间游戏
This commit is contained in:
@@ -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];
|
||||
}
|
||||
/// 获取用户信息后检查:1、是否绑定手机号;2、是否需要完善用户信息。
|
||||
/// 该逻辑仅在刷新ticket后执行一次。
|
||||
/// 当前服务端接口是有未完善信息的全局拦截的,在BaseMvpPresenter里会触发1415去完善用户信息。
|
||||
@@ -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]];
|
||||
}
|
||||
|
Reference in New Issue
Block a user