feat: 优化 LUDO 的退房提示
This commit is contained in:
@@ -63,11 +63,20 @@
|
||||
}
|
||||
///开始匹配游戏
|
||||
-(void)startMatchGameWithroomId:(NSString *)roomId mgId:(NSString *)mgId gameMode:(NSString *)gameMode{
|
||||
@kWeakify(self);
|
||||
[Api startMatchGame:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
[[self getView]startMatchGameSuccess];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
} showLoading:YES errorToast:YES] roomId:roomId mgId:mgId gameMode:gameMode];
|
||||
if (code == 34792) { // 特殊操作,后续优化
|
||||
[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{
|
||||
|
@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user gameModel:(MSTabbarRoomGameModel *)gameModel;
|
||||
///开始游戏
|
||||
-(void)startMatchGameSuccess;
|
||||
///用户选择退出房间并重新排位
|
||||
-(void)forceExitRoom;
|
||||
///得到游戏详情
|
||||
-(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model;
|
||||
///得到金币数量
|
||||
|
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSTabbarRoomGameVC : MvpViewController
|
||||
|
||||
@property (nonatomic, copy) void(^needForceExitRoom)(void);
|
||||
|
||||
@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
|
||||
///得到金币数量
|
||||
|
@@ -754,8 +754,20 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
// viewController = [[XPNewHomeViewController alloc] init];
|
||||
viewController = [[XPHomePagingViewController alloc] init];
|
||||
break;
|
||||
case 1:
|
||||
viewController = [[MSTabbarRoomGameVC alloc] init];
|
||||
case 1: {
|
||||
@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;
|
||||
case 2:
|
||||
viewController = [[XPMomentsViewController alloc] init];
|
||||
|
Reference in New Issue
Block a user