房间游戏
This commit is contained in:
@@ -288,6 +288,7 @@
|
||||
237701102BCF740400D661F1 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 2377010F2BCF740400D661F1 /* libsqlite3.tbd */; };
|
||||
237701122BCF742C00D661F1 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 237701112BCF742C00D661F1 /* libz.tbd */; };
|
||||
237701192BD6143700D661F1 /* pi_happy_egg_smash.svga in Resources */ = {isa = PBXBuildFile; fileRef = 237701182BD6143700D661F1 /* pi_happy_egg_smash.svga */; };
|
||||
237852A12C072D8D00E360AC /* MSRoomGameModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 237852A02C072D8D00E360AC /* MSRoomGameModel.m */; };
|
||||
237B94BC2A984DA7007853E3 /* XPTrumpetPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94AE2A984DA7007853E3 /* XPTrumpetPresenter.m */; };
|
||||
237B94BD2A984DA7007853E3 /* XPNobleTrumpetModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94B32A984DA7007853E3 /* XPNobleTrumpetModel.m */; };
|
||||
237B94BE2A984DA7007853E3 /* XPRoomTrumpetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 237B94B72A984DA7007853E3 /* XPRoomTrumpetViewController.m */; };
|
||||
@@ -2107,6 +2108,8 @@
|
||||
2377010F2BCF740400D661F1 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
|
||||
237701112BCF742C00D661F1 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
|
||||
237701182BD6143700D661F1 /* pi_happy_egg_smash.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_happy_egg_smash.svga; sourceTree = "<group>"; };
|
||||
2378529F2C072D8D00E360AC /* MSRoomGameModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSRoomGameModel.h; sourceTree = "<group>"; };
|
||||
237852A02C072D8D00E360AC /* MSRoomGameModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSRoomGameModel.m; sourceTree = "<group>"; };
|
||||
237B94AD2A984DA7007853E3 /* XPTrumpetPresenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPTrumpetPresenter.h; sourceTree = "<group>"; };
|
||||
237B94AE2A984DA7007853E3 /* XPTrumpetPresenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPTrumpetPresenter.m; sourceTree = "<group>"; };
|
||||
237B94B02A984DA7007853E3 /* XPRoomTrumpetProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetProtocol.h; sourceTree = "<group>"; };
|
||||
@@ -6058,6 +6061,8 @@
|
||||
children = (
|
||||
239D0FD62C047DD8002977CE /* MSTabbarRoomGameModel.h */,
|
||||
239D0FD72C047DD8002977CE /* MSTabbarRoomGameModel.m */,
|
||||
2378529F2C072D8D00E360AC /* MSRoomGameModel.h */,
|
||||
237852A02C072D8D00E360AC /* MSRoomGameModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
@@ -11831,6 +11836,7 @@
|
||||
E81060EB2987BE8300B772F0 /* MessageGiftModel.m in Sources */,
|
||||
E8EEB91726FC7B35007C6EBA /* XPMineUserInfoDesViewController.m in Sources */,
|
||||
9B1B72AC280031DB003FACE9 /* XPAnchorPKViewController.m in Sources */,
|
||||
237852A12C072D8D00E360AC /* MSRoomGameModel.m in Sources */,
|
||||
180806FB2729A354001FD836 /* ThemeColor+Room.m in Sources */,
|
||||
9BC8C83028090C9200C24F85 /* XPRoomAnchorRankBannerView.m in Sources */,
|
||||
E81A653F283511BE00F55894 /* XPMonentsInteractiveViewController.m in Sources */,
|
||||
|
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_room_game_underwa_top_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_room_game_underwa_top_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
@@ -122,6 +122,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
||||
CustomMessageType_General_Floating_Screen = 107,
|
||||
///聊天大厅上头条
|
||||
CustomMessageType_Chat_Hall_Headlinesn = 108,
|
||||
///游戏
|
||||
CustomMessageType_Chat_Room_Game = 109,
|
||||
///家族新协议
|
||||
CustomMessageType_New_Hall = 110,
|
||||
};
|
||||
@@ -663,6 +665,14 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeChatHallHeadlinesn) {
|
||||
///所有房间
|
||||
Custom_Message_Sub_Chat_Hall_Headlinesn = 1081,//单房间
|
||||
|
||||
};
|
||||
//CustomMessageType_Chat_Room_Game = 109,
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageTypeRoomGame) {
|
||||
|
||||
Custom_Message_Sub_Room_Game_Match_Success = 1091,//匹配成功
|
||||
Custom_Message_Sub_Room_Game_Match_Fail = 1092,//匹配失败
|
||||
|
||||
|
||||
};
|
||||
///家族新协议
|
||||
//CustomMessageType_New_Hall = 110,
|
||||
|
@@ -78,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,copy) NSString *nick;
|
||||
///用户的uid
|
||||
@property (nonatomic,copy) NSString *uid;
|
||||
|
||||
@property(nonatomic,copy) NSString *erbanNo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+(void)getRoomGameHomeConfig:(HttpRequestHelperCompletion)completion;
|
||||
///开始匹配游戏
|
||||
+(void)startMatchGame:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId mgId:(NSString *)mgId gameMode:(NSString *)gameMode;
|
||||
///得到房间详情
|
||||
+(void)getRoomGameDetails:(HttpRequestHelperCompletion)completion roomType:(NSString *)roomType;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -16,4 +16,8 @@
|
||||
+(void)startMatchGame:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId mgId:(NSString *)mgId gameMode:(NSString *)gameMode{
|
||||
[self makeRequest:@"miniGame/nav/start" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,roomId,mgId,gameMode,nil];
|
||||
}
|
||||
///得到房间详情
|
||||
+(void)getRoomGameDetails:(HttpRequestHelperCompletion)completion roomType:(NSString *)roomType{
|
||||
[self makeRequest:@"chatRoom/getByType" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,roomType,nil];
|
||||
}
|
||||
@end
|
||||
|
56
YuMi/Modules/YMRoom/View/RoomGame/Model/MSRoomGameModel.h
Normal file
56
YuMi/Modules/YMRoom/View/RoomGame/Model/MSRoomGameModel.h
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// MSRoomGameModel.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/29.
|
||||
//
|
||||
|
||||
#import "PIBaseModel.h"
|
||||
#import "HomePlayRoomModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
MSRoomGameInfoModelMatchmaking,// 匹配中
|
||||
MSRoomGameInfoModelMatchSuccessfully,//匹配成功
|
||||
MSRoomGameInfoModelGameEnd,///游戏结束
|
||||
MSRoomGameInfoModelMatchFail ,/// 匹配失败
|
||||
} MSRoomGameInfoModelType;
|
||||
|
||||
|
||||
|
||||
|
||||
@class MSRoomGameMicModel,MSRoomGameInfoModel;
|
||||
@interface MSRoomGameModel : PIBaseModel
|
||||
@property(nonatomic,strong) MSRoomGameInfoModel *data;
|
||||
@property(nonatomic,assign) int roomType;
|
||||
@property(nonatomic,copy)NSString *chatRoomId;
|
||||
@property(nonatomic,copy) NSString *roomId;
|
||||
@property(nonatomic,copy) NSArray <MSRoomGameMicModel *> *roomMics;
|
||||
@end
|
||||
|
||||
|
||||
@interface MSRoomGameMicModel : PIBaseModel
|
||||
|
||||
@property(nonatomic,assign)BOOL micState;
|
||||
@property(nonatomic,copy) NSString *roomId;
|
||||
@property(nonatomic,strong) HomePlayMicUserModel *micUser;
|
||||
@property(nonatomic,assign) int posState;
|
||||
@property(nonatomic,assign) int position;
|
||||
@end
|
||||
|
||||
@interface MSRoomGameInfoModel : PIBaseModel
|
||||
@property(nonatomic,copy) NSString *gameRoomIcon;
|
||||
@property(nonatomic,copy) NSString *mgId;
|
||||
//"轮次状态 0 进行中 1 结束
|
||||
@property(nonatomic,assign) int roundStatus;
|
||||
///结果分值
|
||||
@property(nonatomic,copy) NSArray *scores;
|
||||
@property(nonatomic,copy) NSString *configJson;
|
||||
@property(nonatomic,assign) MSRoomGameInfoModelType matchStatus;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
22
YuMi/Modules/YMRoom/View/RoomGame/Model/MSRoomGameModel.m
Normal file
22
YuMi/Modules/YMRoom/View/RoomGame/Model/MSRoomGameModel.m
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// MSRoomGameModel.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/29.
|
||||
//
|
||||
|
||||
#import "MSRoomGameModel.h"
|
||||
|
||||
@implementation MSRoomGameModel
|
||||
+ (NSDictionary *)objectClassInArray{
|
||||
return @{@"roomMics":MSRoomGameMicModel.class};
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation MSRoomGameMicModel
|
||||
|
||||
@end
|
||||
@implementation MSRoomGameInfoModel
|
||||
|
||||
@end
|
||||
|
@@ -6,7 +6,7 @@
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
#import "UserInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGamePresenter : BaseMvpPresenter
|
||||
@@ -14,6 +14,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)getRoomGameConfig;
|
||||
///开始匹配游戏
|
||||
-(void)startMatchGameWithroomId:(NSString *)roomId mgId:(NSString *)mgId gameMode:(NSString *)gameMode;
|
||||
///得到房间详情
|
||||
-(void)getRoomGameDetailWithRoomType:(NSString *)roomType;
|
||||
///进入房间
|
||||
- (void)enterNIMRoom:(NSString *)roomId user:(UserInfoModel *)userInfo;
|
||||
///退出房间
|
||||
- (void)exitNIMRoom:(NSString *)roomId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -13,6 +13,9 @@
|
||||
#import "WalletInfoModel.h"
|
||||
#import "MSTabbarRoomGameModel.h"
|
||||
#import "MSRoomGameProtocol.h"
|
||||
#import "MSRoomGameModel.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
@implementation MSRoomGamePresenter
|
||||
-(void)getRoomGameConfig{
|
||||
|
||||
@@ -64,4 +67,55 @@
|
||||
|
||||
} showLoading:YES errorToast:YES] roomId:roomId mgId:mgId gameMode:gameMode];
|
||||
}
|
||||
///得到房间详情
|
||||
-(void)getRoomGameDetailWithRoomType:(NSString *)roomType{
|
||||
[Api getRoomGameDetails:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
MSRoomGameModel *model = [MSRoomGameModel modelWithJSON:data.data];
|
||||
[[self getView]getRoomGameDetailsSuccessWithModel:model];
|
||||
}] roomType:roomType];
|
||||
}
|
||||
- (void)enterNIMRoom:(NSString *)roomId user:(UserInfoModel *)userInfo {
|
||||
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
|
||||
request.roomId = roomId;
|
||||
//设置ext
|
||||
XPMessageRemoteExtModel * extModel = [[XPMessageRemoteExtModel alloc] init];
|
||||
extModel.defUser = userInfo.defUser;
|
||||
extModel.erbanNo = userInfo.erbanNo;
|
||||
extModel.carName = userInfo.carName;
|
||||
extModel.inRoomNameplatePic = userInfo.nameplatePic;
|
||||
extModel.inRoomNameplateWord = userInfo.nameplateWord;
|
||||
extModel.isCustomWord = userInfo.isCustomWord;
|
||||
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
|
||||
extModel.experLevelSeq = userInfo.userLevelVo.experLevelSeq;
|
||||
extModel.experUrl = userInfo.userLevelVo.experUrl;
|
||||
extModel.newUser = userInfo.newUser;
|
||||
extModel.vipIcon = userInfo.userVipInfoVO.vipIcon;
|
||||
extModel.fromUid = userInfo.fromUid;
|
||||
extModel.fromType = userInfo.fromType;
|
||||
extModel.fromNick = userInfo.fromNick;
|
||||
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
|
||||
extModel.androidBubbleUrl = userInfo.androidBubbleUrl;
|
||||
extModel.enterHide = userInfo.userVipInfoVO.enterHide;
|
||||
extModel.preventKick = userInfo.userVipInfoVO.preventKick;
|
||||
extModel.enterRoomEffects = userInfo.userVipInfoVO.enterRoomEffects;
|
||||
extModel.gender = userInfo.gender;
|
||||
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
|
||||
extModel.platformRole = userInfo.platformRole;
|
||||
|
||||
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
|
||||
request.roomExt = [ext toJSONString];
|
||||
[[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {
|
||||
if (error) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)exitNIMRoom:(NSString *)roomId {
|
||||
[[NIMSDK sharedSDK].chatroomManager exitChatroom:roomId completion:nil];
|
||||
|
||||
}
|
||||
@end
|
||||
|
@@ -9,11 +9,13 @@
|
||||
#import "UserInfoModel.h"
|
||||
#import "WalletInfoModel.h"
|
||||
#import "MSTabbarRoomGameModel.h"
|
||||
#import "MSRoomGameModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MSRoomGameProtocol <NSObject>
|
||||
-(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user coinModel:(WalletInfoModel *)coinModel gameModel:(MSTabbarRoomGameModel *)gameModel;
|
||||
-(void)startMatchGameSuccess;
|
||||
-(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -6,11 +6,13 @@
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
|
||||
#import "MSTabbarRoomGameModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGameVC : MvpViewController
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid;
|
||||
@property(nonatomic,strong) MSTabbarRoomGameItemModel *chooseGameModel;
|
||||
@property(nonatomic,strong) UserInfoModel *userinfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -13,31 +13,42 @@
|
||||
#import "XPRoomLittleGameContainerView.h"
|
||||
#import "MSRoomGameVictoryView.h"
|
||||
#import "MSRoomGameQuitGameView.h"
|
||||
@interface MSRoomGameVC ()<MSRoomGameHeadViewDelegate,MSRoomGameQuitGameViewDelegate,MSRoomGameVictoryViewDelegate>
|
||||
#import "MSRoomGamePresenter.h"
|
||||
#import "MSRoomGameProtocol.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "AttachmentModel.h"
|
||||
@interface MSRoomGameVC ()<MSRoomGameHeadViewDelegate,MSRoomGameQuitGameViewDelegate,MSRoomGameVictoryViewDelegate,NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate>
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic,strong) MSRoomGameHeadView *headView;
|
||||
@property(nonatomic,strong) MsRoomMessagChatHallView *chatView;
|
||||
@property(nonatomic,strong) MSRoomGameMsgView *msgView;
|
||||
@property (nonatomic,copy)NSString *roomUid;
|
||||
@property(nonatomic,copy) NSString *roomId;
|
||||
@property(nonatomic,strong) MSRoomGameSendMsgView *sendMsgView;
|
||||
///小游戏的容器
|
||||
@property (nonatomic,strong) XPRoomLittleGameContainerView *littleGameView;
|
||||
@end
|
||||
|
||||
@implementation MSRoomGameVC
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.roomUid = roomUid;
|
||||
}
|
||||
return self;
|
||||
- (MSRoomGamePresenter *)createPresenter {
|
||||
return [[MSRoomGamePresenter alloc] init];
|
||||
}
|
||||
-(void)dealloc{
|
||||
[[NIMSDK sharedSDK].chatroomManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].loginManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager removeDelegate:self];
|
||||
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
[self.presenter getRoomGameDetailWithRoomType:@"0"];
|
||||
[[NIMSDK sharedSDK].chatroomManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].loginManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||
|
||||
|
||||
}
|
||||
-(void)installUI{
|
||||
[self.view addSubview:self.bgImageView];
|
||||
@@ -71,6 +82,13 @@
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - MSRoomGameProtocol
|
||||
-(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model{
|
||||
self.headView.roomGameModel = model;
|
||||
self.roomId = model.roomId;
|
||||
[self.presenter enterNIMRoom:model.roomId user:self.userinfo];
|
||||
}
|
||||
#pragma mark -MSRoomGameVictoryViewDelegate
|
||||
- (void)closeGameAction{
|
||||
|
||||
@@ -80,17 +98,85 @@
|
||||
}
|
||||
#pragma mark - MSRoomGameQuitGameViewDelegate
|
||||
- (void)quitGameAction{
|
||||
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
#pragma mark -MSRoomGameHeadViewDelegate
|
||||
- (void)clickQuitGameAction{
|
||||
// MSRoomGameQuitGameView *quitGameView = [[MSRoomGameQuitGameView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
// quitGameView.delegate = self;
|
||||
// [TTPopup popupView:quitGameView style:TTPopupStyleAlert];
|
||||
MSRoomGameVictoryView *victoryView = [[MSRoomGameVictoryView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
victoryView.delegate = self;
|
||||
[TTPopup popupView:victoryView style:TTPopupStyleAlert];
|
||||
MSRoomGameQuitGameView *quitGameView = [[MSRoomGameQuitGameView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
quitGameView.delegate = self;
|
||||
[TTPopup popupView:quitGameView style:TTPopupStyleAlert];
|
||||
// MSRoomGameVictoryView *victoryView = [[MSRoomGameVictoryView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
// victoryView.delegate = self;
|
||||
// [TTPopup popupView:victoryView style:TTPopupStyleAlert];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - NIMChatManagerDelegate
|
||||
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||
for (NIMMessage * message in messages) {
|
||||
|
||||
|
||||
// 非房间内消息不处理
|
||||
if (message.session.sessionType != NIMSessionTypeChatroom) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(![message.session.sessionId isEqualToString:self.roomId]){
|
||||
|
||||
continue;
|
||||
}
|
||||
if (message.messageType == NIMMessageTypeNotification) {
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||
switch (content.eventType) {
|
||||
case NIMChatroomEventTypeEnter:
|
||||
{
|
||||
[self.msgView handleNIMNotificationMessage:message];
|
||||
break;
|
||||
};
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}else if (message.messageType == NIMMessageTypeText) {
|
||||
[self.msgView handleNIMTextMessage:message];
|
||||
}else if (message.messageType == NIMMessageTypeCustom) {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
AttachmentModel * attachment = (AttachmentModel *)obj.attachment;
|
||||
if(attachment.first == CustomMessageType_Chat_Room_Game && attachment.second == Custom_Message_Sub_Room_Game_Match_Success){
|
||||
[self.presenter exitNIMRoom:self.roomId];
|
||||
MSRoomGameModel *model = [MSRoomGameModel modelWithJSON:attachment.data];
|
||||
self.roomId = model.roomId;
|
||||
self.headView.roomGameModel = model;
|
||||
[self.presenter enterNIMRoom:model.roomId user:self.userinfo];
|
||||
|
||||
}if(attachment.first == CustomMessageType_Chat_Room_Game && attachment.second == Custom_Message_Sub_Room_Game_Match_Fail){
|
||||
[self.presenter exitNIMRoom:self.roomId];
|
||||
[self showErrorToast:YMLocalizedString(@"MSRoomGameVC0")];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma mark - NIMBroadcastDelegate
|
||||
|
||||
//发送消息成功回调
|
||||
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
|
||||
// 非本房间不处理
|
||||
if([message.session.sessionId isEqualToString:self.roomId]){
|
||||
return;;
|
||||
}
|
||||
if (message.messageType == NIMMessageTypeText) {
|
||||
[self.msgView handleNIMTextMessage:message];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - 懒加载
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
@@ -104,12 +190,13 @@
|
||||
if(!_headView){
|
||||
_headView = [[MSRoomGameHeadView alloc]initWithFrame:CGRectZero];
|
||||
_headView.delegate = self;
|
||||
_headView.chooseGameModel = self.chooseGameModel;
|
||||
}
|
||||
return _headView;
|
||||
}
|
||||
- (MSRoomGameMsgView *)msgView{
|
||||
if(!_msgView){
|
||||
_msgView = [[MSRoomGameMsgView alloc]initWithRoomUid:self.roomUid];
|
||||
_msgView = [[MSRoomGameMsgView alloc]initWithFrame:CGRectZero];
|
||||
}
|
||||
return _msgView;
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@
|
||||
@property(nonatomic,strong) MSTabbarRoomGameHeadView *headView;
|
||||
@property(nonatomic,strong) MSTabbarRoomGameView *gameView;
|
||||
@property(nonatomic,strong) MSTabbarRoomGameModel *gameModel;
|
||||
@property(nonatomic,strong) MSTabbarRoomGameItemModel *chooseGameModel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MSTabbarRoomGameVC
|
||||
@@ -90,15 +92,21 @@
|
||||
}
|
||||
#pragma mark -MSTabbarRoomGameViewDelegate
|
||||
-(void)chooseGameType:(MSTabbarRoomGameItemModel *)model{
|
||||
// MSTabbarBeginGameView *beginGameView = [[MSTabbarBeginGameView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
// beginGameView.itemModel = model;
|
||||
// beginGameView.delegate = self;
|
||||
// [kWindow addSubview:beginGameView];
|
||||
MSTabbarBeginGameView *beginGameView = [[MSTabbarBeginGameView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
beginGameView.itemModel = model;
|
||||
beginGameView.delegate = self;
|
||||
self.chooseGameModel = model;
|
||||
[kWindow addSubview:beginGameView];
|
||||
|
||||
|
||||
}
|
||||
-(void)startMatchGameSuccess{
|
||||
MSRoomGameVC *gameVC = [MSRoomGameVC new];
|
||||
gameVC.chooseGameModel = self.chooseGameModel;
|
||||
gameVC.userinfo = self.headView.userModel;
|
||||
BaseNavigationController *nav = [[BaseNavigationController alloc]initWithRootViewController:gameVC];
|
||||
nav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self presentViewController:nav animated:YES completion:nil];
|
||||
|
||||
}
|
||||
#pragma mark - XPIAPRechargeViewControllerDelegate
|
||||
- (void)paySuccess{
|
||||
|
@@ -10,7 +10,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGameHeadAvatarView : UIView
|
||||
|
||||
@property(nonatomic,copy) NSString *imageUrl;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -35,6 +35,10 @@
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)setImageUrl:(NSString *)imageUrl{
|
||||
_imageUrl = imageUrl;
|
||||
_avatarView.imageUrl = imageUrl;
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (NetImageView *)avatarView{
|
||||
if(!_avatarView){
|
||||
|
@@ -6,7 +6,8 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "MSRoomGameModel.h"
|
||||
#import "MSTabbarRoomGameModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MSRoomGameHeadViewDelegate <NSObject>
|
||||
|
||||
@@ -15,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@end
|
||||
@interface MSRoomGameHeadView : UIView
|
||||
@property(nonatomic,weak) id<MSRoomGameHeadViewDelegate>delegate;
|
||||
@property(nonatomic,strong) MSRoomGameModel *roomGameModel;
|
||||
@property(nonatomic,strong) MSTabbarRoomGameItemModel *chooseGameModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -7,9 +7,10 @@
|
||||
|
||||
#import "MSRoomGameHeadView.h"
|
||||
#import "MSRoomGameHeadAvatarView.h"
|
||||
#import "HomePlayRoomModel.h"
|
||||
@interface MSRoomGameHeadView()
|
||||
|
||||
@property(nonatomic,strong) UIImageView *topImageView;
|
||||
@property(nonatomic,strong) NetImageView *topImageView;
|
||||
@property(nonatomic,strong) UIButton *backBtn;
|
||||
@property(nonatomic,strong) UILabel *titleView;
|
||||
@property(nonatomic,strong) UIImageView *pkImageView;
|
||||
@@ -104,11 +105,38 @@
|
||||
[self.delegate clickQuitGameAction];
|
||||
}
|
||||
}
|
||||
-(void)setChooseGameModel:(MSTabbarRoomGameItemModel *)chooseGameModel{
|
||||
_chooseGameModel = chooseGameModel;
|
||||
id coin = _chooseGameModel.scores.firstObject;
|
||||
if(coin != nil){
|
||||
self.coinNumView.text = [NSString stringWithFormat:@"%@",coin];
|
||||
}
|
||||
}
|
||||
- (void)setRoomGameModel:(MSRoomGameModel *)roomGameModel{
|
||||
_roomGameModel = roomGameModel;
|
||||
NSString *uid = [[AccountInfoStorage instance]getUid];
|
||||
for (MSRoomGameMicModel *obj in _roomGameModel.roomMics) {
|
||||
if([obj.micUser.uid isEqualToString:uid]){
|
||||
self.mineView.imageUrl = obj.micUser.avatar;
|
||||
}else{
|
||||
self.rivalView.imageUrl = obj.micUser.avatar;
|
||||
}
|
||||
|
||||
}
|
||||
MSRoomGameInfoModel *data = _roomGameModel.data;
|
||||
if(data != nil){
|
||||
_topImageView.imageUrl = data.gameRoomIcon;
|
||||
if (data.matchStatus == MSRoomGameInfoModelMatchmaking){
|
||||
_titleView.text = YMLocalizedString(@"MSRoomGameHeadView0");
|
||||
}else if(data.matchStatus == MSRoomGameInfoModelMatchSuccessfully){
|
||||
_titleView.text = YMLocalizedString(@"MSRoomGameHeadView1");
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIImageView *)topImageView{
|
||||
- (NetImageView *)topImageView{
|
||||
if(!_topImageView){
|
||||
_topImageView = [UIImageView new];
|
||||
_topImageView.image = kImage(@"ms_room_game_underwa_top_icon");
|
||||
_topImageView = [NetImageView new];
|
||||
}
|
||||
return _topImageView;
|
||||
}
|
||||
@@ -123,7 +151,7 @@
|
||||
}
|
||||
- (UILabel *)titleView{
|
||||
if(!_titleView){
|
||||
_titleView = [UILabel labelInitWithText:@"匹配中" font:kFontBold(18) textColor:[UIColor whiteColor]];
|
||||
_titleView = [UILabel labelInitWithText:YMLocalizedString(@"MSRoomGameHeadView0") font:kFontBold(18) textColor:[UIColor whiteColor]];
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
@@ -149,7 +177,7 @@
|
||||
- (UILabel *)hintView{
|
||||
if(!_hintView){
|
||||
_hintView = [UILabel new];
|
||||
NSMutableAttributedString *attText = [[NSMutableAttributedString alloc]initWithString:@"获胜奖励18金币" attributes:@{NSFontAttributeName:kFontMedium(14),NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
NSMutableAttributedString *attText = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:YMLocalizedString(@"MSRoomGameHeadView0"),@"18"] attributes:@{NSFontAttributeName:kFontMedium(14),NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[attText addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0xFF6629)} range:[attText.string rangeOfString:@"18金币"]];
|
||||
_hintView.attributedText = attText;
|
||||
_hintView.numberOfLines = 0;
|
||||
|
@@ -6,13 +6,14 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "UserInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGameMsgView : UIView
|
||||
@property(nonatomic,strong) UserInfoModel *userInfo;
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid;
|
||||
- (void)handleNIMNotificationMessage:(NIMMessage *)message;
|
||||
- (void)handleNIMTextMessage:(NIMMessage *)message;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#import "MSRoomGameMsgView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
|
||||
|
||||
///Tool
|
||||
#import "DJDKMIMOMColor.h"
|
||||
@@ -68,17 +68,17 @@
|
||||
- (void)dealloc {
|
||||
|
||||
}
|
||||
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.isLoadHistoryMessage = YES;
|
||||
self.roomUid = roomUid;
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - 懒加载
|
||||
|
||||
#pragma mark - JXCategoryListContentViewDelegate
|
||||
- (UIView *)listView {
|
||||
return self;
|
||||
@@ -190,7 +190,7 @@
|
||||
option.limit = 100;
|
||||
option.startTime = 0;
|
||||
option.order = NIMMessageSearchOrderAsc;
|
||||
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeImage)];
|
||||
option.messageTypes = @[@(NIMMessageTypeText)];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||
if(error != nil){
|
||||
self.isLoadHistoryMessage = NO;
|
||||
@@ -201,7 +201,7 @@
|
||||
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||
option.limit = 100;
|
||||
option.order = NIMMessageSearchOrderDesc;
|
||||
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeImage)];
|
||||
option.messageTypes = @[@(NIMMessageTypeText)];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||
if(error != nil){
|
||||
self.isLoadHistoryMessage = NO;
|
||||
@@ -253,36 +253,8 @@
|
||||
BOOL isHaveSave = NO;
|
||||
if(item.messageType == NIMMessageTypeText){
|
||||
isHaveSave = YES;
|
||||
}else if(item.messageType == NIMMessageTypeImage){
|
||||
isHaveSave = YES;
|
||||
}else if(item.messageType == NIMMessageTypeCustom){
|
||||
NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn) {
|
||||
isHaveSave = YES;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(isHaveSave == NO)return;
|
||||
if (item.messageType == NIMMessageTypeImage){
|
||||
PIRoomPhotoAlbumItemModel*model = [PIRoomPhotoAlbumItemModel new];
|
||||
model.type = @"1";
|
||||
model.status = 1;
|
||||
NIMImageObject * imageObject = (NIMImageObject*)item.messageObject;
|
||||
model.photoUrl = imageObject.url;
|
||||
XPMessageInfoModel * messageInfo = [[XPMessageInfoModel alloc] init];
|
||||
messageInfo.albumModel = model;
|
||||
messageInfo.first = CustomMessageType_Room_Album;
|
||||
XPMessageRemoteExtModel * extModel = [XPMessageRemoteExtModel modelWithJSON:item.remoteExt[item.from]];
|
||||
messageInfo.charmUrl = extModel.charmUrl;
|
||||
messageInfo.experUrl = extModel.experUrl;
|
||||
messageInfo.bubbleImageUrl = extModel.iosBubbleUrl;
|
||||
messageInfo.nameText = extModel.nick;
|
||||
[self.datasource addObject:messageInfo];
|
||||
return;
|
||||
}
|
||||
[self.datasource addObject:[self.messageParser parseMessageAttributeForChatHall:item]];
|
||||
}
|
||||
- (void)handleNIMTextMessage:(NIMMessage *)message {
|
||||
@@ -315,17 +287,7 @@
|
||||
return self.datasource.count;
|
||||
}
|
||||
|
||||
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// XPMessageInfoModel* messageInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
//
|
||||
// if(messageInfo.first == CustomMessageType_Room_Album){
|
||||
// return 186;
|
||||
// }else if(messageInfo.first == CustomMessageType_Chat_Hall_Headlinesn){
|
||||
// return 40;
|
||||
// }
|
||||
//
|
||||
// return messageInfo.rowHeight;
|
||||
//}
|
||||
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPMessageInfoModel* attr = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -3278,3 +3278,11 @@
|
||||
"MSRoomGameQuitGameView1"="退出";
|
||||
"MSRoomGameQuitGameView2"="继续游戏";
|
||||
|
||||
//MSRoomGameHeadView
|
||||
"MSRoomGameHeadView0"="匹配中";
|
||||
"MSRoomGameHeadView1"="匹配成功";
|
||||
"MSRoomGameHeadView2"="获胜奖励%@金币";
|
||||
|
||||
//MSRoomGameVC
|
||||
"MSRoomGameVC0"="匹配失败";
|
||||
|
||||
|
@@ -3259,11 +3259,4 @@
|
||||
///MSRoomSetingBackdropCell
|
||||
"MSRoomSetingBackdropCell0"="使用中";
|
||||
"MSRoomSetingBackdropCell1"="確認選擇這張圖片作為房間主題嗎?";
|
||||
///MSTabbarBeginGameView
|
||||
"MSTabbarBeginGameView0"="開始";
|
||||
///MSRoomGameVictoryView
|
||||
"MSRoomGameVictoryView0"="重新匹配";
|
||||
///MSRoomGameQuitGameView
|
||||
"MSRoomGameQuitGameView0"="遊戲已經開始,退出房間將默認 遊戲失敗,確認退出房間?";
|
||||
"MSRoomGameQuitGameView1"="退出";
|
||||
"MSRoomGameQuitGameView2"="繼續遊戲";
|
||||
|
||||
|
Reference in New Issue
Block a user