修复了小游戏模式房间设置报错的bug
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#import "Api+Mine.h"
|
||||
#import "ClientConfig.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "XPConstant.h"
|
||||
#import "Api+RoomSetting.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "MicroQueueModel.h"
|
||||
@@ -29,6 +31,7 @@
|
||||
#import "AttachmentModel.h"
|
||||
#import "GiftValueInfoModel.h"
|
||||
#import "AcrossRoomPKPanelModel.h"
|
||||
#import "LittleGameInfoModel.h"
|
||||
///View
|
||||
#import "XPRoomHalfWebView.h"
|
||||
#import "XPAnchorAudienceUpMicView.h"
|
||||
@@ -45,7 +48,8 @@
|
||||
#import "XPUserCardViewController.h"
|
||||
#import "XPRoomViewController.h"
|
||||
#import "XPLittleGameMiniStageView.h"
|
||||
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate>
|
||||
#import "XPLittleGameRoomListView.h"
|
||||
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPRoomLittleGameListViewDelegate>
|
||||
///host 代理
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
||||
///房间榜
|
||||
@@ -66,6 +70,8 @@
|
||||
@property (nonatomic,strong) XPAcrpssRoomPKPanelView *acrossPKPanelView;
|
||||
///小游戏 最小化的坑位
|
||||
@property (nonatomic,strong) XPLittleGameMiniStageView *littleGameMiniView;
|
||||
///显示游戏的切换
|
||||
@property (nonatomic,strong) XPLittleGameRoomListView *gameListView;
|
||||
@end
|
||||
|
||||
@implementation XPRoomFunctionContainerView
|
||||
@@ -137,6 +143,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)configLittleGameState {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
if (roomInfo.isPermitRoom != PermitRoomType_Licnese && roomInfo.roomModeType != RoomModeType_Open_Blind && roomInfo.roomModeType != RoomModeType_Open_PK_Mode && roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode && roomInfo.roomModeType != RoomModeType_Open_Micro_Mode && !roomInfo.leaveMode && roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
if (!self.gameListView.superview) {
|
||||
[self addSubview:self.gameListView];
|
||||
[self.gameListView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self).offset(-75);
|
||||
make.top.mas_equalTo(self).offset(28 + kSafeAreaTopHeight - 3 * kScreenScale);
|
||||
}];
|
||||
}
|
||||
self.gameListView.mgId = roomInfo.mgId > 0 ? [NSString stringWithFormat:@"%lld", roomInfo.mgId] : @"-1";
|
||||
} else {
|
||||
if (self.gameListView.superview) {
|
||||
[self.gameListView removeFromSuperview];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//自己是否在游戏中
|
||||
- (BOOL)isInSudGame {
|
||||
BOOL isGamePlaying = NO;
|
||||
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||
for (int i = -1; i<5; i++) {
|
||||
NSMutableDictionary * micQueue = self.delegate.getMicroQueue;
|
||||
MicroQueueModel *micSequence = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i]];
|
||||
if (micSequence == nil || micSequence.userInfo == nil) {
|
||||
continue;
|
||||
}
|
||||
if (micSequence.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue && micSequence.userInfo.gameStatus == LittleGamePlayStatus_Plying) {
|
||||
isGamePlaying = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isGamePlaying;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - RoomGuestDelegate
|
||||
- (void)onRoomUpdate {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
@@ -191,6 +235,7 @@
|
||||
}
|
||||
[self updateRoomTopic];
|
||||
[self showLittleGameMiniView:roomInfo.type];
|
||||
[self configLittleGameState];
|
||||
}
|
||||
|
||||
- (void)onRoomEntered {
|
||||
@@ -246,6 +291,7 @@
|
||||
|
||||
[self updateRoomTopic];
|
||||
[self showLittleGameMiniView:roomInfo.type];
|
||||
[self configLittleGameState];
|
||||
}
|
||||
|
||||
- (void)onMicroGiftValueUpdate:(NSDictionary *)data {
|
||||
@@ -542,7 +588,7 @@
|
||||
}
|
||||
|
||||
- (void)updateRoomTopic {
|
||||
self.topicStackView.hidden= [ClientConfig shareConfig].configInfo.appStoreAuditNoticeVersion == YES;
|
||||
self.topicStackView.hidden= ([ClientConfig shareConfig].configInfo.appStoreAuditNoticeVersion || self.delegate.getRoomInfo.type == RoomType_MiniGame) == YES;
|
||||
[self updateRoomTopicViewConstraint];
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
@@ -666,6 +712,53 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomLittleGameListViewDelegate
|
||||
- (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
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"];
|
||||
}
|
||||
if ([itemInfo.mgId isEqualToString:@"-1"]) {
|
||||
[params setObject:@(RoomType_Game) forKey:@"type"];
|
||||
} else {
|
||||
[params setObject:@(RoomType_MiniGame) forKey:@"type"];
|
||||
[params setObject:itemInfo.mgId forKey:@"mgId"];
|
||||
}
|
||||
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
|
||||
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} params:params];
|
||||
}
|
||||
|
||||
- (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectChooseType:(UIButton *)sender {
|
||||
if ([self isInSudGame]) {
|
||||
[XCHUDTool showErrorWithMessage:@"游戏中不可切换游戏或玩法!"];
|
||||
} else {
|
||||
sender.selected = !sender.selected;
|
||||
view.tableView.hidden = !sender.selected;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIButton *)contributionButton {
|
||||
if (!_contributionButton) {
|
||||
@@ -757,5 +850,13 @@
|
||||
return _littleGameMiniView;
|
||||
}
|
||||
|
||||
- (XPLittleGameRoomListView *)gameListView {
|
||||
if (!_gameListView) {
|
||||
_gameListView = [[XPLittleGameRoomListView alloc] init];
|
||||
_gameListView.delegate = self;
|
||||
}
|
||||
return _gameListView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user