feat: 优化 LUDO 的退房提示
This commit is contained in:
@@ -63,11 +63,20 @@
|
|||||||
}
|
}
|
||||||
///开始匹配游戏
|
///开始匹配游戏
|
||||||
-(void)startMatchGameWithroomId:(NSString *)roomId mgId:(NSString *)mgId gameMode:(NSString *)gameMode{
|
-(void)startMatchGameWithroomId:(NSString *)roomId mgId:(NSString *)mgId gameMode:(NSString *)gameMode{
|
||||||
|
@kWeakify(self);
|
||||||
[Api startMatchGame:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api startMatchGame:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
@kStrongify(self);
|
||||||
[[self getView]startMatchGameSuccess];
|
[[self getView]startMatchGameSuccess];
|
||||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
|
if (code == 34792) { // 特殊操作,后续优化
|
||||||
} showLoading:YES errorToast:YES] roomId:roomId mgId:mgId gameMode:gameMode];
|
[TTPopup alertWithMessage:msg confirmHandler:^{
|
||||||
|
@kStrongify(self);
|
||||||
|
[[self getView] forceExitRoom];
|
||||||
|
} cancelHandler:^{}];
|
||||||
|
} else {
|
||||||
|
[[self getView] showErrorToast:msg];
|
||||||
|
}
|
||||||
|
} showLoading:YES errorToast:NO] roomId:roomId mgId:mgId gameMode:gameMode];
|
||||||
}
|
}
|
||||||
///得到房间详情
|
///得到房间详情
|
||||||
-(void)getRoomGameDetailWithRoomType:(NSString *)roomType{
|
-(void)getRoomGameDetailWithRoomType:(NSString *)roomType{
|
||||||
|
@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
-(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user gameModel:(MSTabbarRoomGameModel *)gameModel;
|
-(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user gameModel:(MSTabbarRoomGameModel *)gameModel;
|
||||||
///开始游戏
|
///开始游戏
|
||||||
-(void)startMatchGameSuccess;
|
-(void)startMatchGameSuccess;
|
||||||
|
///用户选择退出房间并重新排位
|
||||||
|
-(void)forceExitRoom;
|
||||||
///得到游戏详情
|
///得到游戏详情
|
||||||
-(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model;
|
-(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model;
|
||||||
///得到金币数量
|
///得到金币数量
|
||||||
|
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface MSTabbarRoomGameVC : MvpViewController
|
@interface MSTabbarRoomGameVC : MvpViewController
|
||||||
|
|
||||||
|
@property (nonatomic, copy) void(^needForceExitRoom)(void);
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -119,6 +119,17 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)forceExitRoom {
|
||||||
|
if (_needForceExitRoom) {
|
||||||
|
_needForceExitRoom();
|
||||||
|
@kWeakify(self);
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
@kStrongify(self);
|
||||||
|
[self startMatchGameActionWithModel:self.chooseGameModel];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - MSRoomGameProtocol
|
#pragma mark - MSRoomGameProtocol
|
||||||
///得到金币数量
|
///得到金币数量
|
||||||
|
@@ -754,8 +754,20 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
// viewController = [[XPNewHomeViewController alloc] init];
|
// viewController = [[XPNewHomeViewController alloc] init];
|
||||||
viewController = [[XPHomePagingViewController alloc] init];
|
viewController = [[XPHomePagingViewController alloc] init];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: {
|
||||||
viewController = [[MSTabbarRoomGameVC alloc] init];
|
@kWeakify(self);
|
||||||
|
MSTabbarRoomGameVC *vc = [[MSTabbarRoomGameVC alloc] init];
|
||||||
|
vc.needForceExitRoom = ^{
|
||||||
|
@kStrongify(self);
|
||||||
|
if ([XPRoomMiniManager shareManager].getRoomInfo) {
|
||||||
|
[[RtcManager instance] exitRoom];
|
||||||
|
[[NIMSDK sharedSDK].chatroomManager exitChatroom:[NSString stringWithFormat:@"%ld", [XPRoomMiniManager shareManager].getRoomInfo.roomId]
|
||||||
|
completion:nil];
|
||||||
|
[self.roomMineView hiddenRoomMiniView];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
viewController = vc;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
viewController = [[XPMomentsViewController alloc] init];
|
viewController = [[XPMomentsViewController alloc] init];
|
||||||
|
Reference in New Issue
Block a user