From 8bfc5b505d4db4b20f993f205cbdd341e2bd07a3 Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Mon, 3 Jun 2024 10:51:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi/Info.plist | 2 +- .../RoomGame/Presenter/MSRoomGamePresenter.h | 2 ++ .../RoomGame/Presenter/MSRoomGamePresenter.m | 26 +++++++++--------- .../RoomGame/Protocol/MSRoomGameProtocol.h | 7 ++++- .../YMRoom/View/RoomGame/View/MSRoomGameVC.m | 23 +++++----------- .../View/RoomGame/View/MSTabbarRoomGameVC.m | 27 +++++++++---------- .../YMTabbar/View/TabbarViewController.m | 3 +-- YuMi/ar.lproj/Localizable.strings | 20 ++++++++++++++ YuMi/en.lproj/Localizable.strings | 20 ++++++++++++++ 9 files changed, 84 insertions(+), 46 deletions(-) diff --git a/YuMi/Info.plist b/YuMi/Info.plist index a8ddfd7f..fd3bd89a 100644 --- a/YuMi/Info.plist +++ b/YuMi/Info.plist @@ -54,7 +54,7 @@ CFBundleVersion - 4 + 1 FacebookAppID 1266232494209868 FacebookClientToken diff --git a/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.h b/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.h index 5ad0caab..5fe67da8 100644 --- a/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.h +++ b/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.h @@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)exitNIMRoom:(NSString *)roomId; ///退出房间 -(void)closeRoomGameWithRoomId:(NSString *)roomId; +///得到金币数量 +-(void)getCoinNum; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.m b/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.m index 7935d2f4..1ef39df7 100644 --- a/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.m +++ b/YuMi/Modules/YMRoom/View/RoomGame/Presenter/MSRoomGamePresenter.m @@ -17,17 +17,25 @@ #import #import "XPMessageRemoteExtModel.h" @implementation MSRoomGamePresenter --(void)getRoomGameConfig{ - +-(void)getCoinNum{ NSString * uid = [AccountInfoStorage instance].getUid; NSString * ticket = [AccountInfoStorage instance].getTicket; + [Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data]; + [[self getView]getCoinNumSuccess:model]; + } fail:^(NSInteger code, NSString * _Nullable msg) { + + }] uid:uid ticket:ticket]; +} + +-(void)getRoomGameConfig{ + NSString * uid = [AccountInfoStorage instance].getUid; RACSubject* user = [RACSubject subject]; - RACSubject* coin = [RACSubject subject]; RACSubject* game = [RACSubject subject]; - [[RACSignal combineLatest:@[user,coin,game] reduce:^id(UserInfoModel* userModel,WalletInfoModel *coinModel,MSTabbarRoomGameModel *gameModel){ - [[self getView]getRoomGameConfigSuccessWithUser:userModel coinModel:coinModel gameModel:gameModel]; + [[RACSignal combineLatest:@[user,game] reduce:^id(UserInfoModel* userModel,MSTabbarRoomGameModel *gameModel){ + [[self getView]getRoomGameConfigSuccessWithUser:userModel gameModel:gameModel]; return nil; }] subscribeError:^(NSError * _Nullable error) { @@ -43,13 +51,7 @@ } showLoading:NO errorToast:NO] uid:uid]; - [Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) { - WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data]; - [coin sendNext:model]; - [coin sendCompleted]; - } fail:^(NSInteger code, NSString * _Nullable msg) { - [coin sendError:nil]; - }] uid:uid ticket:ticket]; + [Api getRoomGameHomeConfig:[self createHttpCompletion:^(BaseModel * _Nonnull data) { MSTabbarRoomGameModel *model = [MSTabbarRoomGameModel modelWithJSON:data.data]; diff --git a/YuMi/Modules/YMRoom/View/RoomGame/Protocol/MSRoomGameProtocol.h b/YuMi/Modules/YMRoom/View/RoomGame/Protocol/MSRoomGameProtocol.h index a0dd6792..02cacdc9 100644 --- a/YuMi/Modules/YMRoom/View/RoomGame/Protocol/MSRoomGameProtocol.h +++ b/YuMi/Modules/YMRoom/View/RoomGame/Protocol/MSRoomGameProtocol.h @@ -13,9 +13,14 @@ NS_ASSUME_NONNULL_BEGIN @protocol MSRoomGameProtocol --(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user coinModel:(WalletInfoModel *)coinModel gameModel:(MSTabbarRoomGameModel *)gameModel; +///请求游戏配置 +-(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user gameModel:(MSTabbarRoomGameModel *)gameModel; +///开始游戏 -(void)startMatchGameSuccess; +///得到游戏详情 -(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model; +///得到金币数量 +-(void)getCoinNumSuccess:(WalletInfoModel *)model; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/RoomGame/View/MSRoomGameVC.m b/YuMi/Modules/YMRoom/View/RoomGame/View/MSRoomGameVC.m index 82a2869e..49eb699a 100644 --- a/YuMi/Modules/YMRoom/View/RoomGame/View/MSRoomGameVC.m +++ b/YuMi/Modules/YMRoom/View/RoomGame/View/MSRoomGameVC.m @@ -22,7 +22,7 @@ #import "MSRoomGameResultsModel.h" #import "Api.h" #import "XPIAPRechargeViewController.h" -@interface MSRoomGameVC () +@interface MSRoomGameVC () @property(nonatomic,strong) UIImageView *bgImageView; @property(nonatomic,strong) MSRoomGameHeadView *headView; @property(nonatomic,strong) MsRoomMessagChatHallView *chatView; @@ -60,20 +60,13 @@ [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]; + [self.presenter getCoinNum]; } -(void)installUI{ [self.view addSubview:self.bgImageView]; [self.view addSubview:self.headView]; [self.view addSubview:self.msgView]; [self.view addSubview:self.sendMsgView]; - - } -(void)installConstraints{ @@ -112,17 +105,14 @@ @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"]; - } + [self.presenter getRoomGameDetailWithRoomType:@"0"]; + } break; default: @@ -162,6 +152,9 @@ [self.view addSubview:sendTextView]; } #pragma mark - MSRoomGameProtocol +- (void)getCoinNumSuccess:(WalletInfoModel *)model{ + self.coinModel = model; +} -(void)getRoomGameDetailsSuccessWithModel:(MSRoomGameModel *)model{ self.headView.roomGameModel = model; self.headView.userInfo = self.userinfo; @@ -176,8 +169,6 @@ }]; [self.roomGameView onRoomEntered]; } - - }else{ [self.roomGameView handleSelfInExitEvent]; [self.roomGameView destroyMG]; diff --git a/YuMi/Modules/YMRoom/View/RoomGame/View/MSTabbarRoomGameVC.m b/YuMi/Modules/YMRoom/View/RoomGame/View/MSTabbarRoomGameVC.m index 3564088c..55781033 100644 --- a/YuMi/Modules/YMRoom/View/RoomGame/View/MSTabbarRoomGameVC.m +++ b/YuMi/Modules/YMRoom/View/RoomGame/View/MSTabbarRoomGameVC.m @@ -16,7 +16,7 @@ #import "XPIAPRechargeViewController.h" #import "XPWebViewController.h" #import "XPRoomHalfWebView.h" -@interface MSTabbarRoomGameVC () +@interface MSTabbarRoomGameVC () @property(nonatomic,strong) UIImageView *bgImageView; @property(nonatomic,strong) MSTabbarRoomGameHeadView *headView; @property(nonatomic,strong) MSTabbarRoomGameView *gameView; @@ -31,15 +31,15 @@ } - (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; - if(self.gameModel == nil){ - [self.presenter getRoomGameConfig]; - } + [self.presenter getRoomGameConfig]; + [self.presenter getCoinNum]; + } - (void)viewDidLoad { [super viewDidLoad]; [self installUI]; [self installConstraints]; - + } -(void)installUI{ @@ -72,7 +72,6 @@ config.confirmButtonConfig.title = YMLocalizedString(@"XPTreasureFairyViewController6"); [TTPopup alertWithConfig:config confirmHandler:^{ XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init]; - rechargeVC.delegate = self; [self.navigationController pushViewController:rechargeVC animated:YES]; } cancelHandler:^{ @@ -90,7 +89,6 @@ #pragma mark - MSTabbarRoomGameHeadViewDelegate - (void)clickPayAction{ XPIAPRechargeViewController *iapVC = [XPIAPRechargeViewController new]; - iapVC.delegate = self; [self.navigationController pushViewController:iapVC animated:YES]; } - (void)clickRankAction{ @@ -109,7 +107,7 @@ } -(void)startMatchGameSuccess{ - [self.presenter getRoomGameConfig]; + [self.presenter getCoinNum]; MSRoomGameVC *gameVC = [MSRoomGameVC new]; gameVC.chooseGameModel = self.chooseGameModel; gameVC.userinfo = self.headView.userModel; @@ -118,14 +116,15 @@ [self presentViewController:nav animated:YES completion:nil]; } -#pragma mark - XPIAPRechargeViewControllerDelegate -- (void)paySuccess{ - [self.presenter getRoomGameConfig]; -} + + #pragma mark - MSRoomGameProtocol --(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user coinModel:(WalletInfoModel *)coinModel gameModel:(MSTabbarRoomGameModel *)gameModel{ +///得到金币数量 +-(void)getCoinNumSuccess:(WalletInfoModel *)model{ + self.headView.coinModel= model; +} +-(void)getRoomGameConfigSuccessWithUser:(UserInfoModel *)user gameModel:(MSTabbarRoomGameModel *)gameModel{ self.headView.userModel = user; - self.headView.coinModel= coinModel; self.gameView.gameModel = gameModel; self.gameModel = gameModel; diff --git a/YuMi/Modules/YMTabbar/View/TabbarViewController.m b/YuMi/Modules/YMTabbar/View/TabbarViewController.m index 005016e9..c9a62bf4 100644 --- a/YuMi/Modules/YMTabbar/View/TabbarViewController.m +++ b/YuMi/Modules/YMTabbar/View/TabbarViewController.m @@ -141,8 +141,7 @@ 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]; diff --git a/YuMi/ar.lproj/Localizable.strings b/YuMi/ar.lproj/Localizable.strings index add048d5..1af08366 100644 --- a/YuMi/ar.lproj/Localizable.strings +++ b/YuMi/ar.lproj/Localizable.strings @@ -3806,3 +3806,23 @@ ineHeadView12" = "الحمل"; ///MSRoomSetingBackdropCell "MSRoomSetingBackdropCell0"="قيد الاستخدام"; "MSRoomSetingBackdropCell1"="هل أنت متأكد أنك تريد اختيار هذه الصورة لتكون خلفية لغرفتك؟"; + +///MSTabbarBeginGameView +"MSTabbarBeginGameView0"="ابدأ"; +///MSRoomGameVictoryView +"MSRoomGameVictoryView0"="إعادة المطابقة "; +///MSRoomGameQuitGameView +"MSRoomGameQuitGameView0"="لقد بدأت اللعبة. سيؤدي الخروج من الغرفة إلى فشل اللعبة. هل أنت متأكد من الخروج من الغرفة؟"; +"MSRoomGameQuitGameView1"="خروج"; +"MSRoomGameQuitGameView2"="متابعة اللعب"; +"MSRoomGameQuitGameView3"="فشلت المطابقة، هل تريد المحاولة مرة أخرى؟"; +"MSRoomGameQuitGameView4"="جاري التحميل، هل تريد العودة إلى الغرفة؟"; + +//MSRoomGameHeadView +"MSRoomGameHeadView0"="جاري المطابقة "; +"MSRoomGameHeadView1"="تمت المطابقة "; +"MSRoomGameHeadView2"="الفوز بمكافأة%@ عملة ذهبية"; +"MSRoomGameHeadView3"="%@ عملة ذهبية"; +//MSRoomGameVC +"MSRoomGameVC0"="فشلت المطابقة"; +"MSRoomGameVC1"="المحفظة"; diff --git a/YuMi/en.lproj/Localizable.strings b/YuMi/en.lproj/Localizable.strings index 8050a75a..2ba961f9 100644 --- a/YuMi/en.lproj/Localizable.strings +++ b/YuMi/en.lproj/Localizable.strings @@ -3610,3 +3610,23 @@ ///MSRoomSetingBackdropCell "MSRoomSetingBackdropCell0"="In use"; "MSRoomSetingBackdropCell1"="Are you sure you want to select this image as the room background?"; + +///MSTabbarBeginGameView +"MSTabbarBeginGameView0"="Start"; +///MSRoomGameVictoryView +"MSRoomGameVictoryView0"="Rematch"; +///MSRoomGameQuitGameView +"MSRoomGameQuitGameView0"="The game has started. Exiting the room will be considered a game failure. Are you sure you want to exit the room?"; +"MSRoomGameQuitGameView1"="Exit"; +"MSRoomGameQuitGameView2"="Continue the game"; +"MSRoomGameQuit tGameView3"="Match failed, do you want to rematch? "; +"MSRoomGameQuitGameView4"="Game in progress, do you want to return to the room? "; + +//MSRoomGameHeadView +"MSRoomGameHeadView0"="Matching"; +"MSRoomGameHeadView1"="Match successful"; +"MSRoomGameHeadView2"="Winning reward %@ gold coins"; +"MSRoomGameHeadView3"="%@ gold coins"; +//MSRoomGameVC +"MSRoomGameVC0"="Match failed"; +"MSRoomGameVC1"="Wallet";