新用户进入房间自动打招呼

This commit is contained in:
fengshuo
2022-06-07 16:16:27 +08:00
parent f3778b4c63
commit e74ac4c211
20 changed files with 195 additions and 59 deletions

View File

@@ -28,6 +28,7 @@
#import "RtcManager.h"
#import "XPRoomMiniManager.h"
#import "Api+RoomPK.h"
#import "Api+Room.h"
///Model
#import "RoomInfoModel.h"
#import "MicroQueueModel.h"
@@ -45,6 +46,7 @@
#import "GiftReceiveInfoModel.h"
#import "GiftInfoModel.h"
#import "RoomPKTeamModel.h"
#import "RoomNewUserGreetModel.h"
///View
#import "XPRoomHalfWebView.h"
#import "XPAnchorAudienceUpMicView.h"
@@ -70,6 +72,8 @@
#import "XPRoomRankEntranceView.h"
#import "XPRoomAnchorRankEnterView.h"
#import "XPRoomBackMusicPlayerView.h"
#import "XPRoomNewUserGreetView.h"
#import "XPRoomHalfMessageView.h"
///PK
#import "XPAnchorFansTeamEntranceView.h"
#import "XPAnchorFansTeamViewController.h"
@@ -78,7 +82,7 @@
#import "XPWebViewController.h"
#import "XPRoomPKProgressView.h"
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPRoomLittleGameListViewDelegate, XPAnchorPkPanelViewDelegate, XPRoomBackMusicPlayerViewDelegate>
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPRoomLittleGameListViewDelegate, XPAnchorPkPanelViewDelegate, XPRoomBackMusicPlayerViewDelegate, XPRoomNewUserGreetViewDelegate>
///host
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
///
@@ -310,6 +314,41 @@
return isGamePlaying;
}
#pragma mark -
- (void)handleNewUserGreet {
if (self.delegate.getUserInfo.fromType == UserEnterRoomFromType_New_User_Greet) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
[Api newUserStartGreet:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomNewUserGreetModel * info = [RoomNewUserGreetModel modelWithDictionary:data.data];
if (info.roomPopup) {
XPRoomNewUserGreetView * greetView = [[XPRoomNewUserGreetView alloc] initWithFrame:CGRectMake(KScreenWidth, kSafeAreaTopHeight + 52, KScreenWidth, 80)];
greetView.delegate = self;
greetView.sayHelloUserAvatarList = info.sayHelloUserAvatarList;
[self addSubview:greetView];
[UIView animateWithDuration:.35 animations:^{
CGRect rect = greetView.frame;
rect.origin.x = 0;
greetView.frame = rect;
} completion:nil];
}
}
} roomUid:roomUid];
});
}
}
- (void)xPRoomNewUserGreetView:(XPRoomNewUserGreetView *)view didClickCheckout:(UIButton *)sender {
XPRoomHalfMessageView *halfMessageView = [[XPRoomHalfMessageView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight)];
[self addSubview:halfMessageView];
[UIView animateWithDuration:.35 animations:^{
CGRect rect = halfMessageView.frame;
rect.origin.y = 0;
halfMessageView.frame = rect;
}];
}
#pragma mark - PK
- (void)configRoomPKPanelView:(BOOL)isEnter {
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
@@ -473,6 +512,7 @@
[self showLittleGameMiniView:roomInfo.type micCount:roomInfo.mgMicNum];
[self configLittleGameState];
[self configRoomPKPanelView:YES];
[self handleNewUserGreet];
}
- (void)onRoomMiniEntered {