个播房UI

This commit is contained in:
chenguilong
2022-02-14 20:23:26 +08:00
parent d8849882d4
commit 0ce0b911ad
17 changed files with 410 additions and 11 deletions

View File

@@ -201,4 +201,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 1fa9307cda450b37197ea1356c5e0679d82d1d41 PODFILE CHECKSUM: 1fa9307cda450b37197ea1356c5e0679d82d1d41
COCOAPODS: 1.11.0 COCOAPODS: 1.11.2

View File

@@ -110,6 +110,8 @@
18F404C3276098F100A6C548 /* Api+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C2276098F100A6C548 /* Api+Message.m */; }; 18F404C3276098F100A6C548 /* Api+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C2276098F100A6C548 /* Api+Message.m */; };
18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C827609A4300A6C548 /* MessagePresenter.m */; }; 18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C827609A4300A6C548 /* MessagePresenter.m */; };
73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CACF623970097D653132D69A /* Pods_xplan_ios.framework */; }; 73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CACF623970097D653132D69A /* Pods_xplan_ios.framework */; };
9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0086C527BA392B0032BD2B /* AnchorStageView.m */; };
9B0086CA27BA4F570032BD2B /* AnchorMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0086C927BA4F570032BD2B /* AnchorMicroView.m */; };
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; }; 9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; };
9B7D804A2753783D003DAC0C /* SessionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80492753783D003DAC0C /* SessionViewController.m */; }; 9B7D804A2753783D003DAC0C /* SessionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80492753783D003DAC0C /* SessionViewController.m */; };
9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; }; 9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; };
@@ -629,6 +631,10 @@
18F404C727609A4300A6C548 /* MessagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagePresenter.h; sourceTree = "<group>"; }; 18F404C727609A4300A6C548 /* MessagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagePresenter.h; sourceTree = "<group>"; };
18F404C827609A4300A6C548 /* MessagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagePresenter.m; sourceTree = "<group>"; }; 18F404C827609A4300A6C548 /* MessagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagePresenter.m; sourceTree = "<group>"; };
7DB00EC07F1D0ADFF900B38D /* Pods-xplan-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.debug.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.debug.xcconfig"; sourceTree = "<group>"; }; 7DB00EC07F1D0ADFF900B38D /* Pods-xplan-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.debug.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.debug.xcconfig"; sourceTree = "<group>"; };
9B0086C427BA392B0032BD2B /* AnchorStageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorStageView.h; sourceTree = "<group>"; };
9B0086C527BA392B0032BD2B /* AnchorStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorStageView.m; sourceTree = "<group>"; };
9B0086C827BA4F570032BD2B /* AnchorMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorMicroView.h; sourceTree = "<group>"; };
9B0086C927BA4F570032BD2B /* AnchorMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorMicroView.m; sourceTree = "<group>"; };
9B0E1C5726E77022005D4442 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = "<group>"; }; 9B0E1C5726E77022005D4442 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = "<group>"; };
9B0E1C5826E77022005D4442 /* BaseNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNavigationController.m; sourceTree = "<group>"; }; 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNavigationController.m; sourceTree = "<group>"; };
9B7D80482753783D003DAC0C /* SessionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionViewController.h; sourceTree = "<group>"; }; 9B7D80482753783D003DAC0C /* SessionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionViewController.h; sourceTree = "<group>"; };
@@ -1911,6 +1917,15 @@
path = Protocol; path = Protocol;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
9B0086C727BA4F4A0032BD2B /* Anchor */ = {
isa = PBXGroup;
children = (
9B0086C827BA4F570032BD2B /* AnchorMicroView.h */,
9B0086C927BA4F570032BD2B /* AnchorMicroView.m */,
);
path = Anchor;
sourceTree = "<group>";
};
9B7D804727537819003DAC0C /* Session */ = { 9B7D804727537819003DAC0C /* Session */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -2540,6 +2555,7 @@
E8680707271959090024F48F /* MicroView */ = { E8680707271959090024F48F /* MicroView */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9B0086C727BA4F4A0032BD2B /* Anchor */,
E8899C7C27853B46007944BE /* Dating */, E8899C7C27853B46007944BE /* Dating */,
180806DA27297269001FD836 /* MicroViewProtocol.h */, 180806DA27297269001FD836 /* MicroViewProtocol.h */,
E8680716271967B00024F48F /* MicroView.h */, E8680716271967B00024F48F /* MicroView.h */,
@@ -3073,6 +3089,8 @@
181D7F202727D9DB00B7C059 /* SocialStageView.m */, 181D7F202727D9DB00B7C059 /* SocialStageView.m */,
E877A7E92783E24700EFACED /* DatingStageView.h */, E877A7E92783E24700EFACED /* DatingStageView.h */,
E877A7EA2783E24700EFACED /* DatingStageView.m */, E877A7EA2783E24700EFACED /* DatingStageView.m */,
9B0086C427BA392B0032BD2B /* AnchorStageView.h */,
9B0086C527BA392B0032BD2B /* AnchorStageView.m */,
); );
path = StageView; path = StageView;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -3748,6 +3766,7 @@
E8E70D8926F2F58F00F03460 /* XPMineMatchTableViewCell.m in Sources */, E8E70D8926F2F58F00F03460 /* XPMineMatchTableViewCell.m in Sources */,
E88B5CA826FB089C00DA9178 /* XPMineTeenagePwdViewController.m in Sources */, E88B5CA826FB089C00DA9178 /* XPMineTeenagePwdViewController.m in Sources */,
E81C1B2F277071670020D1E4 /* XPArrangeMicInfoModel.m in Sources */, E81C1B2F277071670020D1E4 /* XPArrangeMicInfoModel.m in Sources */,
9B0086CA27BA4F570032BD2B /* AnchorMicroView.m in Sources */,
E81C279626EB39CC0031E639 /* LoginForgetPasswordPresent.m in Sources */, E81C279626EB39CC0031E639 /* LoginForgetPasswordPresent.m in Sources */,
18EE3FF42750FA3700A452BF /* UIView+NIM.m in Sources */, 18EE3FF42750FA3700A452BF /* UIView+NIM.m in Sources */,
E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */, E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */,
@@ -4019,6 +4038,7 @@
E88B5CB826FB325200DA9178 /* XPMineTeenagerPwdPresenter.m in Sources */, E88B5CB826FB325200DA9178 /* XPMineTeenagerPwdPresenter.m in Sources */,
E84B0E462727EF9D008818C6 /* XPRoomMessageParser.m in Sources */, E84B0E462727EF9D008818C6 /* XPRoomMessageParser.m in Sources */,
E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */, E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */,
9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */,
E874B88827215D39003954B9 /* MicroStateModel.m in Sources */, E874B88827215D39003954B9 /* MicroStateModel.m in Sources */,
E877A7F427842EF800EFACED /* XPRoomDatingVipUpMicView.m in Sources */, E877A7F427842EF800EFACED /* XPRoomDatingVipUpMicView.m in Sources */,
E896EF9F2771AE7B00AD2CC1 /* XPMineAttentionViewController.m in Sources */, E896EF9F2771AE7B00AD2CC1 /* XPMineAttentionViewController.m in Sources */,
@@ -4178,7 +4198,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 4.1.0; MARKETING_VERSION = 4.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.yinyou.enterprise.ios; PRODUCT_BUNDLE_IDENTIFIER = com.yinyou.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1; TARGETED_DEVICE_FAMILY = 1;
@@ -4208,7 +4228,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 4.1.0; MARKETING_VERSION = 4.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.yinyou.enterprise.ios; PRODUCT_BUNDLE_IDENTIFIER = com.yinyou.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1; TARGETED_DEVICE_FAMILY = 1;

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_game_position_boss@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_game_position_boss@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -42,6 +42,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_RoomPlay_Dating = 72, CustomMessageType_RoomPlay_Dating = 72,
///首充奖励 ///首充奖励
CustomMessageType_First_Recharge_Reward = 76, CustomMessageType_First_Recharge_Reward = 76,
///个播房观众点击空坑位,房主收到请求上麦提示
Custom_Noti_Header_AnchorRoom_AudienceUpMic = 86,
}; };

View File

@@ -10,7 +10,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, RoomType) { typedef NS_ENUM(NSInteger, RoomType) {
RoomType_Game = 3, RoomType_Game = 3,
RoomType_Anchor = 6 // 个播房
}; };
typedef NS_ENUM(NSInteger, RoomModeType){ typedef NS_ENUM(NSInteger, RoomModeType){

View File

@@ -68,7 +68,7 @@
if (isCreator || isManager) { if (isCreator || isManager) {
if (roomInfo.canOpenBlindDate) { if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor) {
[array addObject:dating]; [array addObject:dating];
} }
[array addObject:messageScreen]; [array addObject:messageScreen];

View File

@@ -0,0 +1,16 @@
//
// AnchorStageView.h
// xplan-ios
//
// Created by GreenLand on 2022/2/14.
//
#import "StageView.h"
NS_ASSUME_NONNULL_BEGIN
@interface AnchorStageView : StageView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,241 @@
//
// AnchorStageView.m
// xplan-ios
//
// Created by GreenLand on 2022/2/14.
//
#import "AnchorStageView.h"
///Third
#import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h>
///Tool
#import "AccountInfoStorage.h"
#import "XCHudTool.h"
#import "XPMacro.h"
#import "TTPopup.h"
#import "Api+Room.h"
///Model
#import "RoomInfoModel.h"
#import "MicroExtModel.h"
#import "XPUserCardInfoModel.h"
#import "AttachmentModel.h"
///View
#import "AnchorMicroView.h"
#import "XPUserCardViewController.h"
#import "XPRoomInviteUserViewController.h"
// 150 + 5
#define ownerWidth (150 + 5)
// 12 6
#define ownerHeight (ownerWidth + 6 + 12)
// 3 40 + 5
#define mcWidth (40 + 5)
#define mcHeight (mcWidth + 6 + 12)
// padding 20
#define paddingH 20
//
#define marginV2 15
@implementation AnchorStageView
- (NSInteger)countOfMircoView {
return 4;
}
- (UIView<MicroViewProtocol> *)microViewForIndex:(NSInteger)index {
UIView<MicroViewProtocol> * microView = [super microViewForIndex:index];
if (microView) {
return microView;
}
return [[AnchorMicroView alloc]init];
}
/**
* | | * 150 + 5
* | 20 20 | * padding 20
* | 15 | * 15
* | | * 3 40 + 5
* * 12 6
*/
- (CGRect)rectForViewAtIndex:(NSInteger)index {
if (index == 0) {
return CGRectMake(KScreenWidth / 2 - ownerWidth / 2, (360 - ownerWidth) * 0.5, ownerWidth, ownerHeight);
}
if (index >= 1 && index <= 3) {
CGFloat firstMarginTop = (360 - marginV2 * 2 - mcHeight * 3) * 0.5;
return CGRectMake(KScreenWidth - mcWidth - paddingH, firstMarginTop + (index - 1) * (mcHeight + marginV2), mcWidth, mcHeight);
}
return [super rectForViewAtIndex:index];
}
- (CGFloat)hightForStageView {
return 360;
}
- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid {
NSInteger index = [self getIndexByUid:uid];
CGPoint point = CGPointZero;
if (index == 0) {
point = CGPointMake(KScreenWidth / 2, ownerWidth / 2 - 10);
}
if (index >= 1 && index <= 3) {
CGFloat firstMarginTop = (360 - 15 * 2 - mcHeight * 3) * 0.5;
point = CGPointMake(KScreenWidth - mcWidth * 0.5 - paddingH, firstMarginTop + (index - 1) * mcHeight - 10);
}
point = [self convertPoint:point toView:nil];
return point;
}
- (void)onRoomEntered {
[super onRoomEntered];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self autoUpMicAtIndex:-1];
});
}
- (void)autoUpMicAtIndex:(NSInteger)index {
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
request.key = [NSString stringWithFormat:@"%zd", index];
UserInfoModel* userInfo = self.hostDelegate.getUserInfo;
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
if (roomInfo.uid != [[AccountInfoStorage instance].getUid integerValue]) {
return;
}
NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
request.value = [[self userInfoToQueueExt:userInfo] toJSONString];
request.roomId = roomId;
request.transient = YES;
[[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) {
}];
}
/**
* index
*/
- (void)didSelectAtIndex:(NSInteger)index {
MicroQueueModel* micModel = [self.getMicroQueue objectForKey:[self indexToPosition:index]];
UserInfoModel* userInfo = self.hostDelegate.getUserInfo;
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
NSString* position = [self indexToPosition:index];
NSString* uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
// 1.
NSString * targetUid;
if (roomInfo.leaveMode && [position isEqualToString:@"-1"]) {
targetUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
}
if (micModel.userInfo && micModel.userInfo.uid > 0) {
targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid];
}
if (targetUid && targetUid.length > 0) {
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
model.uid = targetUid;
model.position = position;
model.posState = micModel.microState.posState;
model.micState = micModel.microState.micState;
model.nick = userInfo.nick;
model.roomInfo = roomInfo;
model.micQueue = self.getMicroQueue;
model.delegate = self.hostDelegate;
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
return;
}
// 2.
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = roomId;
request.userIds = @[uid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
NIMChatroomMember * member = members.firstObject;
if (!member) return;
// 2.1
if (member.type == NIMTeamMemberTypeOwner) {
// 2.1.2 /
NSString * lockTitle;
if (roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || roomInfo.roomModeType == RoomModeType_Open_Blind) {
lockTitle = micModel.microState.posState == MicroPosStateType_Free ? @"切换为排麦" : @"切换为自由麦";
} else {
lockTitle = micModel.microState.posState == MicroPosStateType_Free ? @"锁麦" : @"解锁";
}
TTActionSheetConfig *lockMic = [TTActionSheetConfig normalTitle:lockTitle clickAction:^{
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
NSString * state = micModel.microState.posState == MicroPosStateType_Free ? @"1" : @"0";
NSString * ticket = [[AccountInfoStorage instance] getTicket];
NSString * uid = [[AccountInfoStorage instance] getUid];
[Api microLockCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
} roomUid:roomUid state:state position:position ticket:ticket uid:uid];
}];
// 2.1.3 /
NSString * muteTitle = micModel.microState.micState == MicroMicStateType_Open ? @"闭麦" : @"开麦";
TTActionSheetConfig *muteMic = [TTActionSheetConfig normalTitle:muteTitle clickAction:^{
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
NSString * state = micModel.microState.micState == MicroMicStateType_Open ? @"1" : @"0";
NSString * ticket = [[AccountInfoStorage instance] getTicket];
NSString * uid = [[AccountInfoStorage instance] getUid];
[Api microMuteCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
} roomUid:roomUid state:state position:position ticket:ticket uid:uid];
}];
// Ta
TTActionSheetConfig *inviteMic = [TTActionSheetConfig normalTitle:@"抱Ta上麦" clickAction:^{
XPRoomInviteUserViewController * inviteUserMicVC = [[XPRoomInviteUserViewController alloc] init];
inviteUserMicVC.roomId = roomId;
inviteUserMicVC.position = position;
inviteUserMicVC.blindDateVipUid = roomInfo.blindDateVipUid;
[self.hostDelegate.getCurrentNav pushViewController:inviteUserMicVC animated:YES];
}];
[TTPopup actionSheetWithItems:@[inviteMic, lockMic, muteMic]];
} else {
// 2.2
NSString* selfUid = [NSString stringWithFormat:@"%ld", (long)self.hostDelegate.getUserInfo.uid];
UIView* microView = [self findMicroViewByUid:selfUid];
if (microView) {
[XCHUDTool showErrorWithMessage:@"你已经在麦上了喔"];
} else {
[XCHUDTool showErrorWithMessage:@"让主播抱你上麦进行更多互动吧~"];
[self sendMessageToRoomOwnerWithUserModel:self.hostDelegate.getUserInfo];
}
}
}];
}
- (void)sendMessageToRoomOwnerWithUserModel:(UserInfoModel *)userInfo {
NIMMessage * message = [[NIMMessage alloc] init];
AttachmentModel * attachMent = [[AttachmentModel alloc] init];
attachMent.first = Custom_Noti_Header_AnchorRoom_AudienceUpMic;
attachMent.data = [userInfo model2dictionary];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachMent;
message.messageObject = object;
//
NSString * sessionId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
}
#pragma mark - private utils function
/**
*
*/
- (NSDictionary *)userInfoToQueueExt:(UserInfoModel *)userInfo {
MicroExtModel * extModel = [[MicroExtModel alloc] init];
extModel.gender = userInfo.gender;
extModel.avatar = userInfo.avatar;
extModel.uid = userInfo.uid;
extModel.nick = userInfo.nick;
extModel.headWearUrl = userInfo.headwearEffect.length > 0 ? userInfo.headwearEffect : userInfo.headwearPic;
return [extModel model2dictionary];
}
@end

View File

@@ -0,0 +1,16 @@
//
// AnchorMicroView.h
// xplan-ios
//
// Created by GreenLand on 2022/2/14.
//
#import "MicroView.h"
NS_ASSUME_NONNULL_BEGIN
@interface AnchorMicroView : MicroView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,56 @@
//
// AnchorMicroView.m
// xplan-ios
//
// Created by GreenLand on 2022/2/14.
//
#import "AnchorMicroView.h"
///Third
#import <Masonry/Masonry.h>
@implementation AnchorMicroView
#pragma mark - MicroViewProtocol
- (void)showGiftValueMode:(BOOL)isGiftValue {
self.giftValueView.hidden = YES;
}
- (void)showLeaveMode:(BOOL)isLeaveMode {
}
- (void)configMicroView:(MicroQueueModel *)model {
[super configMicroView:model];
UserInfoModel * userInfo = model.userInfo;
int position = model.microState.position;
if (position != -1 && userInfo == nil) {
self.nickLabel.text = @"号嘉宾";
}
if (position == 0) {
UIImage *image = [UIImage imageNamed:@"room_game_position_boss"];
CGSize scaledToSize = CGSizeMake(self.frame.size.width, self.frame.size.width);
UIGraphicsBeginImageContextWithOptions(scaledToSize, false, 0.0);
// 1
[image drawInRect:CGRectMake(1, 1, scaledToSize.width - 2, scaledToSize.height - 2)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.avatarImageView.backgroundColor = [UIColor colorWithPatternImage:newImage];
}
///
if (userInfo) {
if ([self.subviews containsObject:self.leaveLabel]) {
[self.leaveLabel removeFromSuperview];
}
} else {
if (![self.subviews containsObject:self.leaveLabel]) {
[self insertSubview:self.leaveLabel belowSubview:self.giftValueView];
[self.leaveLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.avatarImageView);
}];
self.leaveLabel.layer.cornerRadius = 150 * 0.5;
self.leaveLabel.layer.masksToBounds = YES;
}
}
}
@end

View File

@@ -9,6 +9,9 @@
#import <YYImage/YYAnimatedImageView.h> #import <YYImage/YYAnimatedImageView.h>
#import "MicroViewProtocol.h" #import "MicroViewProtocol.h"
#import "NetImageView.h" #import "NetImageView.h"
#import "MicroGiftValueView.h"
@class MicroGiftValueView;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface MicroView : UIView<MicroViewProtocol> @interface MicroView : UIView<MicroViewProtocol>
///头像 ///头像
@@ -19,6 +22,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong, readonly) UILabel *nickLabel; @property (nonatomic,strong, readonly) UILabel *nickLabel;
///头饰 ///头饰
@property (nonatomic,strong, readonly) YYAnimatedImageView *headWearImageView; @property (nonatomic,strong, readonly) YYAnimatedImageView *headWearImageView;
///礼物值
@property (nonatomic,strong, readonly) MicroGiftValueView *giftValueView;
///离开模式
@property (nonatomic,strong) UILabel *leaveLabel;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -11,7 +11,6 @@
///View ///View
#import "MicroWaveView.h" #import "MicroWaveView.h"
#import "MicroGiftValueView.h"
#import "NetImageView.h" #import "NetImageView.h"
#import "XPHtmlUrl.h" #import "XPHtmlUrl.h"
@@ -34,8 +33,6 @@
@property (nonatomic,strong) UILabel *nickLabel; @property (nonatomic,strong) UILabel *nickLabel;
/// ///
@property (nonatomic,strong) MicroWaveView *animationView; @property (nonatomic,strong) MicroWaveView *animationView;
///
@property (nonatomic,strong) UILabel *leaveLabel;
/// ///
@property (nonatomic,strong) MicroGiftValueView *giftValueView; @property (nonatomic,strong) MicroGiftValueView *giftValueView;
/// ///

View File

@@ -193,6 +193,9 @@
if (member.type == NIMTeamMemberTypeOwner || member.type == NIMChatroomMemberTypeManager) { if (member.type == NIMTeamMemberTypeOwner || member.type == NIMChatroomMemberTypeManager) {
if (userInfo.roomInfo.leaveMode && userInfo.uid.integerValue == userInfo.roomInfo.uid && [userInfo.position isEqualToString:@"-1"]) { if (userInfo.roomInfo.leaveMode && userInfo.uid.integerValue == userInfo.roomInfo.uid && [userInfo.position isEqualToString:@"-1"]) {
[array addObject:muteItem]; [array addObject:muteItem];
if (userInfo.roomInfo.type != RoomType_Anchor) {//
[array addObject:upDownItem];
}
[array addObject:lockItem]; [array addObject:lockItem];
} else { } else {
if (userInfo.position.length > 0) { if (userInfo.position.length > 0) {
@@ -228,7 +231,9 @@
[array addObject:muteItem]; [array addObject:muteItem];
[array addObject:upDownItem]; [array addObject:upDownItem];
[array addObject:lockItem]; [array addObject:lockItem];
[array addObject:giftValueItem]; if (userInfo.roomInfo.type != RoomType_Anchor) {//
[array addObject:giftValueItem];
}
} }
} else { } else {
[array addObject:upDownItem]; [array addObject:upDownItem];
@@ -255,7 +260,9 @@
[array addObject:muteItem]; [array addObject:muteItem];
[array addObject:upDownItem]; [array addObject:upDownItem];
[array addObject:lockItem]; [array addObject:lockItem];
[array addObject:giftValueItem]; if (userInfo.roomInfo.type != RoomType_Anchor) {//
[array addObject:giftValueItem];
}
} }
} else { } else {
[array addObject:upDownItem]; [array addObject:upDownItem];

View File

@@ -32,6 +32,7 @@
#import "RoomHeaderView.h" #import "RoomHeaderView.h"
#import "SocialStageView.h" #import "SocialStageView.h"
#import "DatingStageView.h" #import "DatingStageView.h"
#import "AnchorStageView.h"
#import "XPRoomAnimationView.h" #import "XPRoomAnimationView.h"
#import "XPRoomFunctionContainerView.h" #import "XPRoomFunctionContainerView.h"
#import "XPArrangeMicViewController.h" #import "XPArrangeMicViewController.h"
@@ -220,7 +221,13 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
self.stageView = nil; self.stageView = nil;
self.stageView = [[SocialStageView alloc] initWithDelegate:self]; self.stageView = [[SocialStageView alloc] initWithDelegate:self];
} else { } else {
return; if (self.roomInfo.type == RoomType_Anchor) {
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[AnchorStageView alloc] initWithDelegate:self];
} else {
return;
}
} }
if (!self.stageView.superview) { if (!self.stageView.superview) {
[self.view insertSubview:self.stageView aboveSubview:self.roomHeaderView]; [self.view insertSubview:self.stageView aboveSubview:self.roomHeaderView];