房间游戏
@@ -289,6 +289,8 @@
|
||||
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 */; };
|
||||
237852A42C082A9800E360AC /* MSRoomGameSendTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 237852A32C082A9800E360AC /* MSRoomGameSendTextView.m */; };
|
||||
237852A72C08764B00E360AC /* MSRoomGameResultsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 237852A62C08764B00E360AC /* MSRoomGameResultsModel.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 */; };
|
||||
@@ -2110,6 +2112,10 @@
|
||||
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>"; };
|
||||
237852A22C082A9800E360AC /* MSRoomGameSendTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSRoomGameSendTextView.h; sourceTree = "<group>"; };
|
||||
237852A32C082A9800E360AC /* MSRoomGameSendTextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSRoomGameSendTextView.m; sourceTree = "<group>"; };
|
||||
237852A52C08764B00E360AC /* MSRoomGameResultsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSRoomGameResultsModel.h; sourceTree = "<group>"; };
|
||||
237852A62C08764B00E360AC /* MSRoomGameResultsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSRoomGameResultsModel.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>"; };
|
||||
@@ -6063,6 +6069,8 @@
|
||||
239D0FD72C047DD8002977CE /* MSTabbarRoomGameModel.m */,
|
||||
2378529F2C072D8D00E360AC /* MSRoomGameModel.h */,
|
||||
237852A02C072D8D00E360AC /* MSRoomGameModel.m */,
|
||||
237852A52C08764B00E360AC /* MSRoomGameResultsModel.h */,
|
||||
237852A62C08764B00E360AC /* MSRoomGameResultsModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
@@ -6118,6 +6126,8 @@
|
||||
239D0FF62C05BD2A002977CE /* MSRoomGameVictoryView.m */,
|
||||
239D0FFB2C05D086002977CE /* MSRoomGameQuitGameView.h */,
|
||||
239D0FFC2C05D086002977CE /* MSRoomGameQuitGameView.m */,
|
||||
237852A22C082A9800E360AC /* MSRoomGameSendTextView.h */,
|
||||
237852A32C082A9800E360AC /* MSRoomGameSendTextView.m */,
|
||||
);
|
||||
path = SubView;
|
||||
sourceTree = "<group>";
|
||||
@@ -11322,6 +11332,7 @@
|
||||
E87A24F1272935920086A794 /* XPMessageRemoteExtModel.m in Sources */,
|
||||
E8D34D5028080362009C4835 /* XPMineDataGiftTableViewCell.m in Sources */,
|
||||
E87C54BE2823CC5B0051AA11 /* XPMineResetLoginPwdPresenter.m in Sources */,
|
||||
237852A42C082A9800E360AC /* MSRoomGameSendTextView.m in Sources */,
|
||||
E85E7B322A4EB0D300B6D00A /* XPGuildAnchorIncomeSectionView.m in Sources */,
|
||||
E87C0AA027D9DE6400CB2241 /* RoomFaceSendInfoModel.m in Sources */,
|
||||
1464C5F629A4CA8C00AF7C94 /* XPIAPRechargeCollectionViewCell.m in Sources */,
|
||||
@@ -12058,6 +12069,7 @@
|
||||
239D0FDB2C047F24002977CE /* MSTabbarRoomGameCell.m in Sources */,
|
||||
239D0FB02BFD8C4D002977CE /* MSRoomSetingBackdropVC.m in Sources */,
|
||||
235714982BEDF54E004C81D6 /* MsRoomMessageMainView.m in Sources */,
|
||||
237852A72C08764B00E360AC /* MSRoomGameResultsModel.m in Sources */,
|
||||
9BE9F10227FEE5C200667200 /* XPAnchorFansTaskDetailModel.m in Sources */,
|
||||
E8E0DAE6285C280E00566A2F /* XPSessionFindNewAlertView.m in Sources */,
|
||||
E85E7B1A2A4EB0D200B6D00A /* XPMineGoldIncomeRecordVC.m in Sources */,
|
||||
|
@@ -88,6 +88,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
}
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
[self getAdvertisingTrackingAuthority];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAppDidBecomeActive" object:nil];
|
||||
}
|
||||
- (void)getAdvertisingTrackingAuthority {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
|
Before Width: | Height: | Size: 902 B After Width: | Height: | Size: 956 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 783 B |
Before Width: | Height: | Size: 1013 B After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 647 B After Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 810 B After Width: | Height: | Size: 773 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 752 B |
Before Width: | Height: | Size: 945 B After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -22,7 +22,7 @@ NSString * const URLWithType(URLType type) {
|
||||
@(kGoldEarningsRecord) : @"modules/myincome/index.html#/GoldLog",///金币收益记录
|
||||
@(kCandyTreeRuleURL) : @"modules/rule/newWishingWellRule.html",///糖果树规则 modules/rank/index.html#/wishingWellRule
|
||||
@(kChannelUrl) : @"modules/%@/index.html?channelType=%@&deviceId=%@",
|
||||
@(kLUDOUrl) : @"molistar/modules/gameRank/index.html"///LUDO排行榜路径
|
||||
@(kLUDOUrl) : @"modules/gameRank/index.html"///LUDO排行榜路径
|
||||
};
|
||||
NSString * newUrl = [newDic objectForKey:@(type)];
|
||||
if(newUrl != nil){
|
||||
|
@@ -671,7 +671,7 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeRoomGame) {
|
||||
|
||||
Custom_Message_Sub_Room_Game_Match_Success = 1091,//匹配成功
|
||||
Custom_Message_Sub_Room_Game_Match_Fail = 1092,//匹配失败
|
||||
|
||||
Custom_Message_Sub_Room_Game_Early_Exit = 1093,//提前退出游戏
|
||||
|
||||
};
|
||||
///家族新协议
|
||||
|
@@ -90,7 +90,10 @@
|
||||
_itemList = itemList;
|
||||
self.collectionView.scrollEnabled = _itemList.count > 2;
|
||||
self.collectionView.hidden = _itemList.count == 0;
|
||||
[self.collectionView reloadData];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.collectionView reloadData];
|
||||
});
|
||||
|
||||
if (_itemList.count == 0){
|
||||
[self.collectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(0);
|
||||
|
@@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+(void)startMatchGame:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId mgId:(NSString *)mgId gameMode:(NSString *)gameMode;
|
||||
///得到房间详情
|
||||
+(void)getRoomGameDetails:(HttpRequestHelperCompletion)completion roomType:(NSString *)roomType;
|
||||
///退出房间
|
||||
+(void)closeRoomGame:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -20,4 +20,8 @@
|
||||
+(void)getRoomGameDetails:(HttpRequestHelperCompletion)completion roomType:(NSString *)roomType{
|
||||
[self makeRequest:@"chatRoom/getByType" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,roomType,nil];
|
||||
}
|
||||
///退出房间
|
||||
+(void)closeRoomGame:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId{
|
||||
[self makeRequest:@"miniGame/nav/close" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,roomId,nil];
|
||||
}
|
||||
@end
|
||||
|
@@ -48,6 +48,7 @@ typedef enum : NSUInteger {
|
||||
@property(nonatomic,copy) NSArray *scores;
|
||||
@property(nonatomic,copy) NSString *configJson;
|
||||
@property(nonatomic,assign) MSRoomGameInfoModelType matchStatus;
|
||||
@property(nonatomic,copy) NSString *matchRoundId;
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// MSRoomGameResultsModel.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/30.
|
||||
//
|
||||
|
||||
#import "PIBaseModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGameResultsModel : PIBaseModel
|
||||
@property(nonatomic,assign) int rank;
|
||||
@property(nonatomic,copy) NSString *uid;
|
||||
@property(nonatomic,copy) NSString *avatar;
|
||||
@property(nonatomic,copy) NSString *nick;
|
||||
@property(nonatomic,strong) NSNumber *winNum;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// MSRoomGameResultsModel.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/30.
|
||||
//
|
||||
|
||||
#import "MSRoomGameResultsModel.h"
|
||||
|
||||
@implementation MSRoomGameResultsModel
|
||||
|
||||
@end
|
@@ -26,5 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property(nonatomic,copy) NSString *modeName;
|
||||
@property(nonatomic,copy) NSString *ruleUrl;
|
||||
@property(nonatomic,copy) NSString *ticket;
|
||||
@property(nonatomic,copy) NSString *roomId;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -20,6 +20,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)enterNIMRoom:(NSString *)roomId user:(UserInfoModel *)userInfo;
|
||||
///退出房间
|
||||
- (void)exitNIMRoom:(NSString *)roomId;
|
||||
///退出房间
|
||||
-(void)closeRoomGameWithRoomId:(NSString *)roomId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -118,4 +118,10 @@
|
||||
[[NIMSDK sharedSDK].chatroomManager exitChatroom:roomId completion:nil];
|
||||
|
||||
}
|
||||
///退出房间
|
||||
-(void)closeRoomGameWithRoomId:(NSString *)roomId{
|
||||
[Api closeRoomGame:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
} roomId:roomId];
|
||||
}
|
||||
@end
|
||||
|
@@ -6,11 +6,11 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "MSRoomGameResultsModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGameVictoryCell : UITableViewCell
|
||||
|
||||
@property(nonatomic,strong) MSRoomGameResultsModel *resultsModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -80,6 +80,18 @@
|
||||
make.trailing.equalTo(self.coinView.mas_leading).mas_offset(-kGetScaleWidth(5));
|
||||
}];
|
||||
}
|
||||
- (void)setResultsModel:(MSRoomGameResultsModel *)resultsModel{
|
||||
_resultsModel = resultsModel;
|
||||
_rankView.image = _resultsModel.rank == 1 ? kImage(@"ms_room_game_victory_rank_first"):kImage(@"ms_room_game_victory_rank_second");
|
||||
_avatarView.image = nil;
|
||||
[_avatarView loadImageWithUrl:_resultsModel.avatar completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.avatarView.image = image;
|
||||
}];
|
||||
_nameView.text = _resultsModel.nick;
|
||||
_bgImageView.image = _resultsModel.rank == 1 ? kImage(@"ms_room_game_victory_bg_first"):kImage(@"ms_room_game_victory_bg_second");
|
||||
_bgCoinView.image = _resultsModel.rank == 1 ? kImage(@"ms_room_game_victory_coin_bg_first"):kImage(@"ms_room_game_victory_coin_bg_second");
|
||||
_coinNumView.text = _resultsModel.rank == 1 ? [NSString stringWithFormat:@"+%@",_resultsModel.winNum.stringValue]:_resultsModel.winNum.stringValue;
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
|
@@ -10,14 +10,19 @@
|
||||
#import "MsRoomMessagChatHallView.h"
|
||||
#import "MSRoomGameMsgView.h"
|
||||
#import "MSRoomGameSendMsgView.h"
|
||||
#import "XPRoomLittleGameContainerView.h"
|
||||
#import <AFNetworkReachabilityManager.h>
|
||||
#import "MSRoomGameVictoryView.h"
|
||||
#import "MSRoomGameQuitGameView.h"
|
||||
#import "MSRoomGamePresenter.h"
|
||||
#import "MSRoomGameProtocol.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "AttachmentModel.h"
|
||||
@interface MSRoomGameVC ()<MSRoomGameHeadViewDelegate,MSRoomGameQuitGameViewDelegate,MSRoomGameVictoryViewDelegate,NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate>
|
||||
#import "MSRoomGameSendTextView.h"
|
||||
#import "MSRoomGameView.h"
|
||||
#import "MSRoomGameResultsModel.h"
|
||||
#import "Api.h"
|
||||
#import "XPIAPRechargeViewController.h"
|
||||
@interface MSRoomGameVC ()<MSRoomGameHeadViewDelegate,MSRoomGameQuitGameViewDelegate,MSRoomGameVictoryViewDelegate,NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate,MSRoomGameSendMsgViewDelegate,MSRoomGameViewDelegate,XPIAPRechargeViewControllerDelegate>
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic,strong) MSRoomGameHeadView *headView;
|
||||
@property(nonatomic,strong) MsRoomMessagChatHallView *chatView;
|
||||
@@ -25,7 +30,9 @@
|
||||
@property(nonatomic,copy) NSString *roomId;
|
||||
@property(nonatomic,strong) MSRoomGameSendMsgView *sendMsgView;
|
||||
///小游戏的容器
|
||||
@property (nonatomic,strong) XPRoomLittleGameContainerView *littleGameView;
|
||||
@property(nonatomic,strong) MSRoomGameView *roomGameView;
|
||||
@property(nonatomic,strong) WalletInfoModel *coinModel;
|
||||
@property(nonatomic,assign) BOOL isShowResults;
|
||||
@end
|
||||
|
||||
@implementation MSRoomGameVC
|
||||
@@ -37,7 +44,7 @@
|
||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].loginManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager removeDelegate:self];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
@@ -48,22 +55,32 @@
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].loginManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||
|
||||
[self getCoinNum];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(appDidBecomeActive) name:@"kAppDidBecomeActive" object:nil];
|
||||
[self networkReachability];
|
||||
}
|
||||
-(void)getCoinNum{
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
[Api getUserWalletInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
||||
self.coinModel = model;
|
||||
} uid:uid ticket:ticket];
|
||||
}
|
||||
-(void)installUI{
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.view addSubview:self.littleGameView];
|
||||
[self.view addSubview:self.headView];
|
||||
[self.view addSubview:self.msgView];
|
||||
[self.view addSubview:self.sendMsgView];
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)installConstraints{
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
[self.littleGameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(22));
|
||||
make.leading.trailing.equalTo(self.view).inset(kGetScaleWidth(0));
|
||||
@@ -82,48 +99,153 @@
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(void)appDidBecomeActive{
|
||||
if(self.headView.roomGameModel.data.roundStatus == 0 && self.headView.roomGameModel.data.matchStatus == 1){
|
||||
[self.presenter getRoomGameDetailWithRoomType:@"0"];
|
||||
}
|
||||
}
|
||||
///网络监听
|
||||
-(void)networkReachability{
|
||||
@kWeakify(self);
|
||||
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
|
||||
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||||
@kStrongify(self);
|
||||
switch (status) {
|
||||
case AFNetworkReachabilityStatusUnknown:
|
||||
|
||||
break;
|
||||
case AFNetworkReachabilityStatusNotReachable:
|
||||
|
||||
break;
|
||||
case AFNetworkReachabilityStatusReachableViaWWAN:
|
||||
case AFNetworkReachabilityStatusReachableViaWiFi:
|
||||
{
|
||||
if(self.headView.roomGameModel.data.roundStatus == 0 && self.headView.roomGameModel.data.matchStatus == 1){
|
||||
[self.presenter getRoomGameDetailWithRoomType:@"0"];
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}];
|
||||
}
|
||||
#pragma mark -MSRoomGameViewDelegate
|
||||
- (void)getGameRsultsWithList:(NSArray *)list{
|
||||
if(self.isShowResults == YES)return;
|
||||
self.isShowResults = YES;
|
||||
MSRoomGameVictoryView *victoryView = [[MSRoomGameVictoryView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
for (MSRoomGameResultsModel *obj in list) {
|
||||
if([obj.uid isEqualToString:self.headView.mineModel.uid]){
|
||||
obj.avatar = self.headView.mineModel.avatar;
|
||||
obj.nick = self.headView.mineModel.nick;
|
||||
|
||||
}
|
||||
if([obj.uid isEqualToString:self.headView.rivalModel.uid]){
|
||||
obj.avatar = self.headView.rivalModel.avatar;
|
||||
obj.nick = self.headView.rivalModel.nick;
|
||||
}
|
||||
obj.winNum = obj.rank == 1 ? self.chooseGameModel.scores.firstObject : self.chooseGameModel.scores.lastObject;
|
||||
}
|
||||
victoryView.delegate = self;
|
||||
victoryView.resultsList = list;
|
||||
[TTPopup popupView:victoryView style:TTPopupStyleAlert];
|
||||
[self.presenter exitNIMRoom:self.roomId];
|
||||
[self.roomGameView handleSelfInExitEvent];
|
||||
[self.roomGameView destroyMG];
|
||||
self.roomGameView = nil;
|
||||
[self.headView setDataInNull];
|
||||
}
|
||||
#pragma mark- MSRoomGameSendMsgViewDelegate
|
||||
- (void)clickSendMsgAction{
|
||||
MSRoomGameSendTextView *sendTextView = [[MSRoomGameSendTextView alloc]initWithRoomId:self.roomId userInfo:self.userinfo];
|
||||
[self.view addSubview:sendTextView];
|
||||
}
|
||||
#pragma mark - MSRoomGameProtocol
|
||||
-(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model{
|
||||
self.headView.roomGameModel = model;
|
||||
self.headView.userInfo = self.userinfo;
|
||||
self.roomId = model.roomId;
|
||||
[self.presenter enterNIMRoom:model.roomId user:self.userinfo];
|
||||
if(model.data.matchStatus == MSRoomGameInfoModelMatchSuccessfully && model.data.roundStatus == 0){
|
||||
self.roomGameView.gameModel = model;
|
||||
if(self.roomGameView.superview == nil){
|
||||
[self.bgImageView addSubview:self.roomGameView];
|
||||
[self.roomGameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.bgImageView);
|
||||
}];
|
||||
[self.roomGameView onRoomEntered];
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
[self.roomGameView handleSelfInExitEvent];
|
||||
[self.roomGameView destroyMG];
|
||||
self.roomGameView = nil;
|
||||
[self.headView setDataInNull];
|
||||
|
||||
}
|
||||
}
|
||||
#pragma mark -MSRoomGameVictoryViewDelegate
|
||||
- (void)closeGameAction{
|
||||
|
||||
self.isShowResults = NO;
|
||||
[self quitGameActionWtihIsColse:YES];
|
||||
}
|
||||
-(void)rematchGameAction{
|
||||
|
||||
self.isShowResults = NO;
|
||||
if(self.coinModel.diamonds.integerValue < self.chooseGameModel.ticket.integerValue){
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.message = YMLocalizedString(@"XPTreasureFairyViewController5");
|
||||
config.confirmButtonConfig.title = YMLocalizedString(@"XPTreasureFairyViewController6");
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init];
|
||||
rechargeVC.delegate = self;
|
||||
[self.navigationController pushViewController:rechargeVC animated:YES];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
return;
|
||||
}
|
||||
[self.presenter startMatchGameWithroomId:@"" mgId:self.headView.roomGameModel.data.mgId gameMode:self.chooseGameModel.gameMode];
|
||||
}
|
||||
-(void)startMatchGameSuccess{
|
||||
[self.presenter getRoomGameDetailWithRoomType:@"0"];
|
||||
}
|
||||
#pragma mark -XPIAPRechargeViewControllerDelegate
|
||||
-(void)paySuccess{
|
||||
[self getCoinNum];
|
||||
}
|
||||
#pragma mark - MSRoomGameQuitGameViewDelegate
|
||||
- (void)quitGameAction{
|
||||
[self quitGameActionWtihIsColse:YES];
|
||||
|
||||
}
|
||||
-(void)quitGameActionWtihIsColse:(BOOL)isColse{
|
||||
self.isShowResults = YES;
|
||||
if(isColse == YES){
|
||||
[self.presenter closeRoomGameWithRoomId:self.roomId];
|
||||
}
|
||||
[self.presenter exitNIMRoom:self.roomId];
|
||||
[self.roomGameView handleSelfInExitEvent];
|
||||
[self.roomGameView destroyMG];
|
||||
[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];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#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) {
|
||||
@@ -146,16 +268,44 @@
|
||||
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.presenter exitNIMRoom:self.roomId];
|
||||
self.roomId = model.roomId;
|
||||
self.headView.roomGameModel = model;
|
||||
[self.presenter enterNIMRoom:model.roomId user:self.userinfo];
|
||||
|
||||
[self.presenter enterNIMRoom:model.roomId user:self.userinfo];
|
||||
self.roomGameView.gameModel = model;
|
||||
if(self.roomGameView.superview == nil){
|
||||
[self.bgImageView addSubview:self.roomGameView];
|
||||
[self.roomGameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.bgImageView);
|
||||
}];
|
||||
[self.roomGameView onRoomEntered];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}if(attachment.first == CustomMessageType_Chat_Room_Game && attachment.second == Custom_Message_Sub_Room_Game_Match_Fail){
|
||||
|
||||
MSRoomGameQuitGameView *quitGameView = [[MSRoomGameQuitGameView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
quitGameView.delegate = self;
|
||||
quitGameView.isNormalFail = YES;
|
||||
[TTPopup popupView:quitGameView style:TTPopupStyleAlert];
|
||||
|
||||
}if(attachment.first == CustomMessageType_Chat_Room_Game && attachment.second == Custom_Message_Sub_Room_Game_Early_Exit){
|
||||
if(self.isShowResults == YES)return;
|
||||
self.isShowResults = YES;
|
||||
NSArray *list = [MSRoomGameResultsModel modelsWithArray:attachment.data[@"results"]];
|
||||
MSRoomGameVictoryView *victoryView = [[MSRoomGameVictoryView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
victoryView.delegate = self;
|
||||
victoryView.resultsList = list;
|
||||
[TTPopup popupView:victoryView style:TTPopupStyleAlert];
|
||||
[self.presenter exitNIMRoom:self.roomId];
|
||||
[self showErrorToast:YMLocalizedString(@"MSRoomGameVC0")];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
[self.roomGameView handleSelfInExitEvent];
|
||||
[self.roomGameView destroyMG];
|
||||
self.roomGameView = nil;
|
||||
[self.headView setDataInNull];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -168,7 +318,7 @@
|
||||
//发送消息成功回调
|
||||
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
|
||||
// 非本房间不处理
|
||||
if([message.session.sessionId isEqualToString:self.roomId]){
|
||||
if(![message.session.sessionId isEqualToString:self.roomId]){
|
||||
return;;
|
||||
}
|
||||
if (message.messageType == NIMMessageTypeText) {
|
||||
@@ -203,14 +353,16 @@
|
||||
- (MSRoomGameSendMsgView *)sendMsgView{
|
||||
if(!_sendMsgView){
|
||||
_sendMsgView = [[MSRoomGameSendMsgView alloc]initWithFrame:CGRectZero];
|
||||
_sendMsgView.delegate = self;
|
||||
}
|
||||
return _sendMsgView;
|
||||
}
|
||||
- (XPRoomLittleGameContainerView *)littleGameView {
|
||||
if (!_littleGameView) {
|
||||
_littleGameView = [[XPRoomLittleGameContainerView alloc] initWithDelegate:self];
|
||||
_littleGameView.delegate = self;
|
||||
- (MSRoomGameView *)roomGameView{
|
||||
if(!_roomGameView){
|
||||
_roomGameView = [[MSRoomGameView alloc]initWithFrame:CGRectZero];
|
||||
_roomGameView.delegate = self;
|
||||
|
||||
}
|
||||
return _littleGameView;
|
||||
return _roomGameView;
|
||||
}
|
||||
@end
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#import "MSRoomGameProtocol.h"
|
||||
#import "XPIAPRechargeViewController.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "XPRoomHalfWebView.h"
|
||||
@interface MSTabbarRoomGameVC ()<MSTabbarRoomGameViewDelegate,MSTabbarRoomGameHeadViewDelegate,MSTabbarBeginGameViewDelegate,XPIAPRechargeViewControllerDelegate>
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic,strong) MSTabbarRoomGameHeadView *headView;
|
||||
@@ -40,6 +41,7 @@
|
||||
[self installConstraints];
|
||||
|
||||
}
|
||||
|
||||
-(void)installUI{
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.view addSubview:self.headView];
|
||||
@@ -79,6 +81,12 @@
|
||||
}
|
||||
[self.presenter startMatchGameWithroomId:@"" mgId:self.gameModel.mgId gameMode:model.gameMode];
|
||||
}
|
||||
///规则
|
||||
-(void)clickRuleActionWithModel:(MSTabbarRoomGameItemModel *)model{
|
||||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
webView.url = model.ruleUrl;
|
||||
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
||||
}
|
||||
#pragma mark - MSTabbarRoomGameHeadViewDelegate
|
||||
- (void)clickPayAction{
|
||||
XPIAPRechargeViewController *iapVC = [XPIAPRechargeViewController new];
|
||||
@@ -101,12 +109,14 @@
|
||||
|
||||
}
|
||||
-(void)startMatchGameSuccess{
|
||||
[self.presenter getRoomGameConfig];
|
||||
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{
|
||||
@@ -118,6 +128,7 @@
|
||||
self.headView.coinModel= coinModel;
|
||||
self.gameView.gameModel = gameModel;
|
||||
self.gameModel = gameModel;
|
||||
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIImageView *)bgImageView{
|
||||
|
@@ -10,7 +10,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGameHeadAvatarView : UIView
|
||||
@property(nonatomic,copy) NSString *imageUrl;
|
||||
@property(nonatomic,copy) NSString *__nullable imageUrl;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -35,8 +35,12 @@
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)setImageUrl:(NSString *)imageUrl{
|
||||
-(void)setImageUrl:(NSString *__nullable)imageUrl{
|
||||
_imageUrl = imageUrl;
|
||||
if(_imageUrl == nil){
|
||||
_avatarView.imageUrl = nil;
|
||||
return;
|
||||
}
|
||||
_avatarView.imageUrl = imageUrl;
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MSRoomGameModel.h"
|
||||
#import "MSTabbarRoomGameModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MSRoomGameHeadViewDelegate <NSObject>
|
||||
|
||||
@@ -15,9 +16,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@end
|
||||
@interface MSRoomGameHeadView : UIView
|
||||
@property(nonatomic,copy) NSString *gainProfit;
|
||||
@property(nonatomic,weak) id<MSRoomGameHeadViewDelegate>delegate;
|
||||
@property(nonatomic,strong) MSRoomGameModel *roomGameModel;
|
||||
@property(nonatomic,strong) MSRoomGameModel *__nullable roomGameModel;
|
||||
@property(nonatomic,strong) MSTabbarRoomGameItemModel *chooseGameModel;
|
||||
@property(nonatomic,strong) HomePlayMicUserModel *mineModel;
|
||||
@property(nonatomic,strong) HomePlayMicUserModel *rivalModel;
|
||||
@property(nonatomic,strong) UserInfoModel *userInfo;
|
||||
-(void)setDataInNull;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -100,6 +100,16 @@
|
||||
make.centerY.equalTo(self.bgCoinView);
|
||||
}];
|
||||
}
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||
for (NSInteger i = (self.subviews.count - 1) ; i >= 0 ; i--) {
|
||||
UIView * subView = [self.subviews safeObjectAtIndex1:i];
|
||||
CGPoint convertPoint = [subView convertPoint:point fromView:self];
|
||||
if (CGRectContainsPoint(subView.bounds, convertPoint)) {
|
||||
return [subView hitTest:convertPoint withEvent:event];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
-(void)clickBackBtnAction{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(clickQuitGameAction)]){
|
||||
[self.delegate clickQuitGameAction];
|
||||
@@ -110,19 +120,30 @@
|
||||
id coin = _chooseGameModel.scores.firstObject;
|
||||
if(coin != nil){
|
||||
self.coinNumView.text = [NSString stringWithFormat:@"%@",coin];
|
||||
NSMutableAttributedString *attText = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:YMLocalizedString(@"MSRoomGameHeadView2"),self.coinNumView.text] attributes:@{NSFontAttributeName:kFontMedium(14),NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[attText addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0xFF6629)} range:[attText.string rangeOfString:[NSString stringWithFormat:YMLocalizedString(@"MSRoomGameHeadView3"),self.coinNumView.text]]];
|
||||
_hintView.attributedText = attText;
|
||||
}
|
||||
}
|
||||
- (void)setRoomGameModel:(MSRoomGameModel *)roomGameModel{
|
||||
-(void)setDataInNull{
|
||||
self.titleView.text = YMLocalizedString(@"MSRoomGameHeadView0");
|
||||
self.rivalView.imageUrl = nil;
|
||||
}
|
||||
- (void)setRoomGameModel:(MSRoomGameModel *__nullable)roomGameModel{
|
||||
_roomGameModel = roomGameModel;
|
||||
|
||||
if(_roomGameModel == nil){
|
||||
|
||||
return;
|
||||
}
|
||||
NSString *uid = [[AccountInfoStorage instance]getUid];
|
||||
for (MSRoomGameMicModel *obj in _roomGameModel.roomMics) {
|
||||
if([obj.micUser.uid isEqualToString:uid]){
|
||||
self.mineView.imageUrl = obj.micUser.avatar;
|
||||
}else{
|
||||
if(![obj.micUser.uid isEqualToString:uid]){
|
||||
self.rivalModel = obj.micUser;
|
||||
self.rivalView.imageUrl = obj.micUser.avatar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MSRoomGameInfoModel *data = _roomGameModel.data;
|
||||
if(data != nil){
|
||||
_topImageView.imageUrl = data.gameRoomIcon;
|
||||
@@ -133,6 +154,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)setUserInfo:(UserInfoModel *)userInfo{
|
||||
_userInfo = userInfo;
|
||||
HomePlayMicUserModel *mineModel = [HomePlayMicUserModel new];
|
||||
mineModel.uid = @(_userInfo.uid).stringValue;
|
||||
mineModel.nick = _userInfo.nick;
|
||||
mineModel.avatar = _userInfo.avatar;
|
||||
self.mineView.imageUrl = mineModel.avatar;
|
||||
self.mineModel = mineModel;
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (NetImageView *)topImageView{
|
||||
if(!_topImageView){
|
||||
@@ -177,9 +207,7 @@
|
||||
- (UILabel *)hintView{
|
||||
if(!_hintView){
|
||||
_hintView = [UILabel new];
|
||||
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;
|
||||
_hintView.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
|
@@ -8,12 +8,21 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class MSTabbarRoomGameItemModel;
|
||||
@protocol MSRoomGameQuitGameViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
///退出游戏
|
||||
- (void)quitGameAction;
|
||||
|
||||
///继续游戏
|
||||
-(void)rematchGameAction;
|
||||
///强杀app打开后,是否重新玩游戏
|
||||
-(void)replayTheGameWithModel:(MSTabbarRoomGameItemModel *)model;
|
||||
///强杀app打开后,退出游戏
|
||||
- (void)closeGameActionWithModel:(MSTabbarRoomGameItemModel *)model;
|
||||
@end
|
||||
@interface MSRoomGameQuitGameView : UIView
|
||||
@property(nonatomic,strong) MSTabbarRoomGameItemModel *chooseGameModel;
|
||||
@property(nonatomic,assign) BOOL isNormalFail;
|
||||
@property(nonatomic,weak) id<MSRoomGameQuitGameViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
|
@@ -51,14 +51,41 @@
|
||||
make.top.mas_equalTo(kGetScaleWidth(48));
|
||||
}];
|
||||
}
|
||||
-(void)setChooseGameModel:(MSTabbarRoomGameItemModel *)chooseGameModel{
|
||||
_chooseGameModel = chooseGameModel;
|
||||
|
||||
_titleView.text = YMLocalizedString(@"MSRoomGameQuitGameView4");
|
||||
|
||||
}
|
||||
- (void)setIsNormalFail:(BOOL)isNormalFail{
|
||||
_isNormalFail = isNormalFail;
|
||||
_titleView.text = YMLocalizedString(@"MSRoomGameQuitGameView3");
|
||||
[_resumeBtn setTitle:YMLocalizedString(@"MSRoomGameVictoryView0") forState:UIControlStateNormal];
|
||||
}
|
||||
-(void)qutiBtnAction{
|
||||
[TTPopup dismiss];
|
||||
if(self.chooseGameModel != nil){
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(closeGameActionWithModel:)]){
|
||||
[self.delegate closeGameActionWithModel:self.chooseGameModel];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(quitGameAction)]){
|
||||
[self.delegate quitGameAction];
|
||||
}
|
||||
}
|
||||
-(void)resumeBtnAction{
|
||||
[TTPopup dismiss];
|
||||
if(self.chooseGameModel != nil){
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(replayTheGameWithModel:)]){
|
||||
[self.delegate replayTheGameWithModel:self.chooseGameModel];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(self.isNormalFail == NO)return;
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(rematchGameAction)]){
|
||||
[self.delegate rematchGameAction];
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIView *)bgView{
|
||||
|
@@ -8,9 +8,13 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MSRoomGameSendMsgViewDelegate <NSObject>
|
||||
|
||||
- (void)clickSendMsgAction;
|
||||
|
||||
@end
|
||||
@interface MSRoomGameSendMsgView : UIView
|
||||
|
||||
@property(nonatomic,weak) id<MSRoomGameSendMsgViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -38,6 +38,11 @@
|
||||
make.centerY.equalTo(self.sendBtn);
|
||||
}];
|
||||
}
|
||||
-(void)clickSendBtnAction{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(clickSendMsgAction)]){
|
||||
[self.delegate clickSendMsgAction];
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIButton *)sendBtn{
|
||||
if(!_sendBtn){
|
||||
@@ -45,6 +50,7 @@
|
||||
_sendBtn.backgroundColor = UIColorRGBAlpha(0x0B032D , 0.1);
|
||||
_sendBtn.layer.cornerRadius = kGetScaleWidth(28)/2;
|
||||
_sendBtn.layer.masksToBounds = YES;
|
||||
[_sendBtn addTarget:self action:@selector(clickSendBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _sendBtn;
|
||||
}
|
||||
|
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MSRoomGameSendTextView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/30.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "UserInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSRoomGameSendTextView : UIView
|
||||
///输入框
|
||||
@property (nonatomic, strong, readonly) UITextField *editTextFiled;
|
||||
-(void)showInputView:(NSString *)text;
|
||||
- (instancetype)initWithRoomId:(NSString *)roomId userInfo:(UserInfoModel *)userInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// MSRoomGameSendTextView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/30.
|
||||
//
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "NSObject+MJExtension.h"
|
||||
#import <IQKeyboardManager/IQKeyboardManager.h>
|
||||
///Tool
|
||||
#import "ThemeColor+Room.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
///Model
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "ClientConfig.h"
|
||||
#import "MSRoomGameSendTextView.h"
|
||||
#import "MSRoomGameSendTextView.h"
|
||||
//公屏限制最大字数
|
||||
#define MAX_STARWORDS_LENGTH 300
|
||||
@interface MSRoomGameSendTextView()
|
||||
///输入框
|
||||
@property (nonatomic, strong) MSBaseTextField *editTextFiled;
|
||||
@property (nonatomic, strong) UIView *bgEditTextFiled;
|
||||
///发送按钮
|
||||
@property (nonatomic, strong) UIButton *sendButton;
|
||||
///文本输入的内容
|
||||
@property (nonatomic,copy) NSString *inputMessage;
|
||||
@property(nonatomic,strong) UserInfoModel * userInfo;
|
||||
@property(nonatomic,copy) NSString *roomId;
|
||||
|
||||
@end
|
||||
@implementation MSRoomGameSendTextView
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (instancetype)initWithRoomId:(NSString *)roomId userInfo:(UserInfoModel *)userInfo {
|
||||
self = [super initWithFrame:CGRectMake(0, KScreenHeight - 60, KScreenWidth, 60)];
|
||||
if (self) {
|
||||
self.roomId = roomId;
|
||||
self.userInfo = userInfo;
|
||||
[self addNotification];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[IQKeyboardManager sharedManager].enable = NO;
|
||||
[self.editTextFiled becomeFirstResponder];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Response
|
||||
|
||||
- (void)sendButtonDidClick:(UIButton *)sender {
|
||||
UserInfoModel * userInfo = self.userInfo;
|
||||
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.androidBubbleUrl = userInfo.androidBubbleUrl;
|
||||
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
|
||||
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
|
||||
|
||||
|
||||
|
||||
NIMMessage * message = [[NIMMessage alloc] init];
|
||||
message.text = self.inputMessage;
|
||||
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[AccountInfoStorage instance].getUid];
|
||||
message.remoteExt = remoteExt;
|
||||
|
||||
///网易易盾 拦截高风险
|
||||
NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init];
|
||||
option.yidunEnabled = YES;
|
||||
option.businessId = KeyWithType(keyType_YiDunBussinessId);
|
||||
message.antiSpamOption = option;
|
||||
NSString * sessionId = self.roomId;
|
||||
//构造会话
|
||||
self.sendButton.enabled = NO;
|
||||
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) {
|
||||
self.editTextFiled.text = @"";
|
||||
[self.editTextFiled resignFirstResponder];
|
||||
self.inputMessage = nil;
|
||||
}];
|
||||
}
|
||||
-(void)showSendheadlineBtnAction{
|
||||
if(self.editTextFiled.text.length == 0){
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"MSSessionReleaseHeadlinesView0")];
|
||||
return;
|
||||
}
|
||||
if(self.editTextFiled.text.length > 100){
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"MSSessionReleaseHeadlinesView0")];
|
||||
return;
|
||||
}
|
||||
[self.editTextFiled resignFirstResponder];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kShowSendheadlineView" object:self.editTextFiled.text];
|
||||
self.editTextFiled.text = @"";
|
||||
}
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
[self.superview bringSubviewToFront:self];
|
||||
NSDictionary *info = [notification userInfo];
|
||||
NSValue *value = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
|
||||
CGFloat keyBoardEndY = value.CGRectValue.origin.y;
|
||||
NSNumber *curve = [info objectForKey:UIKeyboardAnimationCurveUserInfoKey];
|
||||
CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
CGRect endKeyboardRect = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
CGFloat h = endKeyboardRect.size.height;
|
||||
[UIView animateWithDuration:duration animations:^{
|
||||
if(self.superview){
|
||||
[self mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.equalTo(self.superview);
|
||||
make.height.equalTo(@60);
|
||||
make.bottom.equalTo(self.superview).offset(-h);
|
||||
}];
|
||||
}
|
||||
[UIView setAnimationBeginsFromCurrentState:YES];
|
||||
[UIView setAnimationCurve:[curve intValue]];
|
||||
self.center = CGPointMake(self.center.x, keyBoardEndY - statusbarHeight - self.bounds.size.height/2.0);
|
||||
}];
|
||||
}
|
||||
|
||||
//键盘隐藏
|
||||
- (void)keyboardWillHidden:(NSNotification *)notification {
|
||||
|
||||
NSDictionary *info = [notification userInfo];
|
||||
CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
[UIView animateWithDuration:duration animations:^{
|
||||
[self mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.leading.trailing.equalTo(self.superview);
|
||||
make.height.equalTo(@60);
|
||||
}];
|
||||
self.hidden = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)textFieldEditChanged:(NSNotification *)notification{
|
||||
|
||||
UITextField *textField = (UITextField *)notification.object;
|
||||
NSString *toBeString = textField.text;
|
||||
NSString *lang = [textField.textInputMode primaryLanguage];
|
||||
if ([lang isEqualToString:@"zh-Hans"]){// 简体中文输入
|
||||
//获取高亮部分
|
||||
UITextRange *selectedRange = [textField markedTextRange];
|
||||
UITextPosition *position = [textField positionFromPosition:selectedRange.start offset:0];
|
||||
// 没有高亮选择的字,则对已输入的文字进行字数统计和限制
|
||||
if (!position){
|
||||
if (toBeString.length > MAX_STARWORDS_LENGTH){
|
||||
NSRange rangeIndex = [toBeString rangeOfComposedCharacterSequenceAtIndex:MAX_STARWORDS_LENGTH];
|
||||
if (rangeIndex.length == 1){
|
||||
|
||||
textField.text = [toBeString substringToIndex:MAX_STARWORDS_LENGTH];
|
||||
}else{
|
||||
NSRange rangeRange = [toBeString rangeOfComposedCharacterSequencesForRange:NSMakeRange(0, MAX_STARWORDS_LENGTH)];
|
||||
textField.text = [toBeString substringWithRange:rangeRange];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{ // 中文输入法以外的直接对其统计限制即可,不考虑其他语种情况
|
||||
if (toBeString.length > MAX_STARWORDS_LENGTH){
|
||||
NSRange rangeIndex = [toBeString rangeOfComposedCharacterSequenceAtIndex:MAX_STARWORDS_LENGTH];
|
||||
if (rangeIndex.length == 1){
|
||||
|
||||
textField.text = [toBeString substringToIndex:MAX_STARWORDS_LENGTH];
|
||||
}else{
|
||||
|
||||
NSRange rangeRange = [toBeString rangeOfComposedCharacterSequencesForRange:NSMakeRange(0, MAX_STARWORDS_LENGTH)];
|
||||
textField.text = [toBeString substringWithRange:rangeRange];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.inputMessage = textField.text;
|
||||
|
||||
if (self.inputMessage.length > 0) {
|
||||
self.sendButton.enabled = YES;
|
||||
} else {
|
||||
self.sendButton.enabled = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = UIColorFromRGB(0x260159);
|
||||
[self addSubview:self.bgEditTextFiled];
|
||||
[self.bgEditTextFiled addSubview:self.editTextFiled];
|
||||
[self addSubview:self.sendButton];
|
||||
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
|
||||
|
||||
|
||||
|
||||
[self.bgEditTextFiled mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(6);
|
||||
make.height.mas_equalTo(36);
|
||||
make.top.mas_equalTo(12);
|
||||
make.trailing.equalTo(self.sendButton.mas_leading).mas_offset(-8);
|
||||
|
||||
}];
|
||||
[self.editTextFiled mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(20);
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(20));
|
||||
make.top.bottom.mas_equalTo(0);
|
||||
}];
|
||||
|
||||
|
||||
[self.sendButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(58);
|
||||
make.height.mas_equalTo(29);
|
||||
make.trailing.mas_equalTo(-15);
|
||||
make.centerY.equalTo(self);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)addNotification {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldEditChanged:) name:UITextFieldTextDidChangeNotification object:self.editTextFiled];
|
||||
}
|
||||
-(void)showInputView:(NSString *)text{
|
||||
self.editTextFiled.text = text;
|
||||
self.inputMessage = text;
|
||||
if(text.length > 0){
|
||||
self.sendButton.enabled = YES;
|
||||
}
|
||||
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (MSBaseTextField *)editTextFiled{
|
||||
if (!_editTextFiled) {
|
||||
_editTextFiled = [[MSBaseTextField alloc] init];
|
||||
NSAttributedString * attribute = [[NSAttributedString alloc] initWithString:YMLocalizedString(@"XPRoomSendTextView0") attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName : [UIColor colorWithWhite:1 alpha:0.5]}];
|
||||
_editTextFiled.attributedPlaceholder = attribute;
|
||||
_editTextFiled.borderStyle = UITextBorderStyleNone;
|
||||
_editTextFiled.textColor = [UIColor whiteColor];
|
||||
_editTextFiled.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
|
||||
[_editTextFiled setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
|
||||
|
||||
}
|
||||
return _editTextFiled;
|
||||
}
|
||||
- (UIButton *)sendButton{
|
||||
if (!_sendButton) {
|
||||
_sendButton = [[UIButton alloc] init];
|
||||
[_sendButton setTitle:YMLocalizedString(@"XPRoomSendTextView1") forState:UIControlStateNormal];
|
||||
_sendButton.titleLabel.textColor = [UIColor whiteColor];
|
||||
_sendButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
[_sendButton setBackgroundImage:[UIImage imageWithColor:[DJDKMIMOMColor disableButtonColor] ]forState:UIControlStateDisabled];
|
||||
[_sendButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x7E5AFF), UIColorFromRGB(0x52CAD3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
_sendButton.enabled = NO;
|
||||
_sendButton.layer.cornerRadius = 7.5;
|
||||
_sendButton.layer.masksToBounds = YES;
|
||||
[_sendButton addTarget:self action:@selector(sendButtonDidClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_sendButton.tag = 101;
|
||||
}
|
||||
return _sendButton;
|
||||
}
|
||||
|
||||
- (UIView *)bgEditTextFiled{
|
||||
if(!_bgEditTextFiled){
|
||||
_bgEditTextFiled = [UIView new];
|
||||
_bgEditTextFiled.backgroundColor = UIColorFromRGB(0x361661);
|
||||
_bgEditTextFiled.layer.cornerRadius = 18;
|
||||
_bgEditTextFiled.layer.masksToBounds = YES;
|
||||
}
|
||||
return _bgEditTextFiled;
|
||||
}
|
||||
@end
|
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)rematchGameAction;
|
||||
@end
|
||||
@interface MSRoomGameVictoryView : UIView
|
||||
@property(nonatomic,copy) NSArray *resultsList;
|
||||
@property(nonatomic,weak) id<MSRoomGameVictoryViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "MSRoomGameVictoryView.h"
|
||||
#import "MSRoomGameVictoryCell.h"
|
||||
#import "MSRoomGameResultsModel.h"
|
||||
@interface MSRoomGameVictoryView()<UITableViewDelegate,UITableViewDataSource>
|
||||
@property(nonatomic,strong) UIView *bgView;
|
||||
@property(nonatomic,strong) UIView *bgSubView;
|
||||
@@ -71,11 +72,11 @@
|
||||
}
|
||||
#pragma mark- UITableViewDelegate,UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return 2;
|
||||
return self.resultsList.count;
|
||||
}
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
MSRoomGameVictoryCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([MSRoomGameVictoryCell class]) forIndexPath:indexPath];
|
||||
|
||||
cell.resultsModel = [self.resultsList safeObjectAtIndex1:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
-(void)closeBtnAction{
|
||||
@@ -90,6 +91,13 @@
|
||||
[self.delegate rematchGameAction];
|
||||
}
|
||||
}
|
||||
-(void)setResultsList:(NSArray *)resultsList{
|
||||
_resultsList = resultsList;
|
||||
MSRoomGameResultsModel *resultsModel = _resultsList.firstObject;
|
||||
NSString *uid = [AccountInfoStorage instance].getUid;
|
||||
self.topView.image = [resultsModel.uid isEqualToString:[AccountInfoStorage instance].getUid] ? kImage(@"ms_room_game_victory_top_icon") : kImage(@"ms_room_game_victory_top_fail_icon");
|
||||
[_tableView reloadData];
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIView *)bgView{
|
||||
if(!_bgView){
|
||||
|
@@ -6,26 +6,25 @@
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomGuestDelegate.h"
|
||||
#import "MSRoomGameModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MSRoomGameViewDelegate <NSObject>
|
||||
|
||||
- (void)hiddenSudGamePostionView;
|
||||
- (void)getGameRsultsWithList:(NSArray *)list;
|
||||
|
||||
@end
|
||||
@interface MSRoomGameView : UIView
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
@property(nonatomic,strong) MSRoomGameModel *gameModel;
|
||||
|
||||
///代理
|
||||
@property (nonatomic,weak) id<MSRoomGameViewDelegate> delegate;
|
||||
@property(nonatomic,weak) id<MSRoomGameViewDelegate>delegate;
|
||||
|
||||
- (void)onRoomEntered;
|
||||
///销毁游戏的引擎
|
||||
- (void)destroyMG;
|
||||
|
||||
/// 退出游戏
|
||||
- (void)handleSelfInExitEvent;
|
||||
|
||||
- (void)handleNIMNotificationMessage:(NIMMessage *)message;
|
||||
//自己是否在游戏中
|
||||
- (BOOL)isInSudGame;
|
||||
|
||||
|
@@ -11,7 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MSTabbarBeginGameViewDelegate <NSObject>
|
||||
//开始游戏
|
||||
-(void)startMatchGameActionWithModel:(MSTabbarRoomGameItemModel *)model;
|
||||
|
||||
///规则
|
||||
-(void)clickRuleActionWithModel:(MSTabbarRoomGameItemModel *)model;
|
||||
@end
|
||||
@interface MSTabbarBeginGameView : UIView
|
||||
@property(nonatomic,weak) id<MSTabbarBeginGameViewDelegate>delegate;
|
||||
|
@@ -98,7 +98,11 @@
|
||||
_coinNumView.text = _itemModel.ticket;
|
||||
_titleView.text = _itemModel.modeName;
|
||||
}
|
||||
|
||||
-(void)ruleBtnAction{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(clickRuleActionWithModel:)]){
|
||||
[self.delegate clickRuleActionWithModel:self.itemModel];
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
@@ -155,6 +159,7 @@
|
||||
_ruleBtn = [UIButton new];
|
||||
[_ruleBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
||||
[_ruleBtn setBackgroundImage:kImage(@"ms_room_game_begin_rule_icon") forState:UIControlStateNormal];
|
||||
[_ruleBtn addTarget:self action:@selector(ruleBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _ruleBtn;
|
||||
}
|
||||
|
@@ -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]];
|
||||
}
|
||||
|
@@ -10,15 +10,14 @@
|
||||
#import "YUMIMacroUitls.h"
|
||||
#import "DJDKMIMOMColor.h"
|
||||
|
||||
CGFloat tabBarHeight = 60.0; // TabBar高度
|
||||
CGFloat leftRightSpace = 8.0; // TabBar左右距离
|
||||
|
||||
CGFloat leftRightSpace = 20.0; // TabBar左右距离
|
||||
CGFloat bottomSpace = 29.0; // TabBar离底部距离
|
||||
NSInteger itemCount = 4; // tabBarItem的数量
|
||||
NSInteger itemCount = 5; // tabBarItem的数量
|
||||
|
||||
@interface XPTabBar()
|
||||
|
||||
/// 背景
|
||||
@property (nonatomic, strong) UIView *bgView;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,7 +27,7 @@ NSInteger itemCount = 4; // tabBarItem的数量
|
||||
self = [super initWithFrame:frame];
|
||||
if(self) {
|
||||
|
||||
[self addSubview:self.bgView];
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
// 去除顶部横线
|
||||
[self setBackgroundImage:[UIImage new]];
|
||||
[self setShadowImage:[UIImage new]];
|
||||
@@ -57,7 +56,7 @@ NSInteger itemCount = 4; // tabBarItem的数量
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
// 重设tabBar的位置
|
||||
self.frame = CGRectMake(0, KScreenHeight- tabBarHeight-bottomSpace, KScreenWidth, tabBarHeight);
|
||||
self.frame = CGRectMake(0, KScreenHeight- kTabBarHeight, KScreenWidth, kTabBarHeight);
|
||||
|
||||
// 设置其他tabbarbtn的frame
|
||||
CGFloat tabBarButtonW = (KScreenWidth-leftRightSpace*2)/itemCount;
|
||||
@@ -65,25 +64,13 @@ NSInteger itemCount = 4; // tabBarItem的数量
|
||||
for (UIView *child in self.subviews) {
|
||||
Class class = NSClassFromString(@"UITabBarButton");
|
||||
if ([child isKindOfClass:class]) {
|
||||
CGRect frame = CGRectMake(tabBarButtonIndex * tabBarButtonW+leftRightSpace, (tabBarHeight-49)/2, tabBarButtonW, 49);
|
||||
CGRect frame = CGRectMake(tabBarButtonIndex * tabBarButtonW+leftRightSpace, 17, 34, 34);
|
||||
child.frame = frame;
|
||||
tabBarButtonIndex ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)bgView {
|
||||
if (!_bgView) {
|
||||
_bgView = [[UIView alloc] init];
|
||||
_bgView.backgroundColor = [[DJDKMIMOMColor tabbarViewColor] colorWithAlphaComponent:0.95];
|
||||
_bgView.frame = CGRectMake(leftRightSpace, 0, KScreenWidth-leftRightSpace*2, tabBarHeight);
|
||||
_bgView.layer.cornerRadius = tabBarHeight/2.0;
|
||||
_bgView.layer.shadowColor = [UIColor.blackColor colorWithAlphaComponent:0.5].CGColor;
|
||||
_bgView.layer.shadowOffset = CGSizeMake(0, 0);
|
||||
_bgView.layer.shadowOpacity = 0.2;
|
||||
_bgView.layer.shadowRadius = 5;
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///关闭webView 目前适用于半屏的情况下
|
||||
@property (nonatomic,copy) void (^CloseWebViewBlock)(BOOL result);
|
||||
- (instancetype)initWithCustomizeNav:(BOOL)isCustom;
|
||||
|
||||
- (instancetype)initWithGame;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -3269,13 +3269,17 @@
|
||||
///MSRoomGameVictoryView
|
||||
"MSRoomGameVictoryView0"="重新匹配";
|
||||
///MSRoomGameQuitGameView
|
||||
"MSRoomGameQuitGameView0"="游戏已经开始,退出房间将默认 游戏失败,确认退出房间?";
|
||||
"MSRoomGameQuitGameView0"="游戏已经开始,退出房间将默认游戏失败,确认退出房间?";
|
||||
"MSRoomGameQuitGameView1"="退出";
|
||||
"MSRoomGameQuitGameView2"="继续游戏";
|
||||
"MSRoomGameQuitGameView3"="匹配失败,是否重新匹配?";
|
||||
"MSRoomGameQuitGameView4"="游戏进行中,是否返回房间?";
|
||||
|
||||
//MSRoomGameHeadView
|
||||
"MSRoomGameHeadView0"="匹配中";
|
||||
"MSRoomGameHeadView1"="匹配成功";
|
||||
"MSRoomGameHeadView2"="获胜奖励%@金币";
|
||||
|
||||
"MSRoomGameHeadView3"="%@金币";
|
||||
//MSRoomGameVC
|
||||
"MSRoomGameVC0"="匹配失败";
|
||||
"MSRoomGameVC1"="钱包";
|
||||
|
@@ -3258,3 +3258,22 @@
|
||||
"MSRoomSetingBackdropCell0"="使用中";
|
||||
"MSRoomSetingBackdropCell1"="確認選擇這張圖片作為房間主題嗎?";
|
||||
|
||||
///MSTabbarBeginGameView
|
||||
"MSTabbarBeginGameView0"="开始";
|
||||
///MSRoomGameVictoryView
|
||||
"MSRoomGameVictoryView0"="重新匹配";
|
||||
///MSRoomGameQuitGameView
|
||||
"MSRoomGameQuitGameView0"="游戏已经开始,退出房间将默认游戏失败,确认退出房间?";
|
||||
"MSRoomGameQuitGameView1"="退出";
|
||||
"MSRoomGameQuitGameView2"="继续游戏";
|
||||
"MSRoomGameQuitGameView3"="匹配失败,是否重新匹配?";
|
||||
"MSRoomGameQuitGameView4"="游戏进行中,是否返回房间?";
|
||||
|
||||
//MSRoomGameHeadView
|
||||
"MSRoomGameHeadView0"="匹配中";
|
||||
"MSRoomGameHeadView1"="匹配成功";
|
||||
"MSRoomGameHeadView2"="获胜奖励%@金币";
|
||||
"MSRoomGameHeadView3"="%@金币";
|
||||
//MSRoomGameVC
|
||||
"MSRoomGameVC0"="匹配失败";
|
||||
"MSRoomGameVC1"="钱包";
|
||||
|