房间玩法切换游戏

This commit is contained in:
fengshuo
2022-01-24 11:39:01 +08:00
committed by chenguilong
parent fed928c8e9
commit 4e3721a6e6
16 changed files with 492 additions and 23 deletions

View File

@@ -293,6 +293,8 @@
E82D5C7D276B343300858D6D /* YYAnimatedImageView+ImageShow.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */; };
E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */ = {isa = PBXBuildFile; fileRef = E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */; };
E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */; };
E836DBCD279BF2F10056F7DD /* XPRoomLittleGameListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E836DBCC279BF2F10056F7DD /* XPRoomLittleGameListView.m */; };
E836DBD0279BF5150056F7DD /* XPLittleGameTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E836DBCF279BF5150056F7DD /* XPLittleGameTableViewCell.m */; };
E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */; };
E83953222769F33B00CF2F24 /* XPRoomFunctionContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E83953212769F33B00CF2F24 /* XPRoomFunctionContainerView.m */; };
E839532A276A002800CF2F24 /* XPMineDressUpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8395329276A002800CF2F24 /* XPMineDressUpViewController.m */; };
@@ -1155,6 +1157,10 @@
E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserPrivacyView.m; sourceTree = "<group>"; };
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPKickUserModel.h; sourceTree = "<group>"; };
E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPKickUserModel.m; sourceTree = "<group>"; };
E836DBCB279BF2F10056F7DD /* XPRoomLittleGameListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomLittleGameListView.h; sourceTree = "<group>"; };
E836DBCC279BF2F10056F7DD /* XPRoomLittleGameListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomLittleGameListView.m; sourceTree = "<group>"; };
E836DBCE279BF5150056F7DD /* XPLittleGameTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPLittleGameTableViewCell.h; sourceTree = "<group>"; };
E836DBCF279BF5150056F7DD /* XPLittleGameTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPLittleGameTableViewCell.m; sourceTree = "<group>"; };
E838D99E275E1BF60079E0B5 /* XPRoomAnimationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomAnimationView.h; sourceTree = "<group>"; };
E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomAnimationView.m; sourceTree = "<group>"; };
E83953202769F33B00CF2F24 /* XPRoomFunctionContainerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomFunctionContainerView.h; sourceTree = "<group>"; };
@@ -3136,6 +3142,8 @@
E81EF6DD279AB7AD00FF3EDE /* Cell */,
E81EF6DA279AB5CC00FF3EDE /* XPLittleGameRoomOpenView.h */,
E81EF6DB279AB5CC00FF3EDE /* XPLittleGameRoomOpenView.m */,
E836DBCB279BF2F10056F7DD /* XPRoomLittleGameListView.h */,
E836DBCC279BF2F10056F7DD /* XPRoomLittleGameListView.m */,
);
path = LittleGame;
sourceTree = "<group>";
@@ -3145,6 +3153,8 @@
children = (
E81EF6DE279AB7D900FF3EDE /* XPCreateLittleGameCollectionViewCell.h */,
E81EF6DF279AB7D900FF3EDE /* XPCreateLittleGameCollectionViewCell.m */,
E836DBCE279BF5150056F7DD /* XPLittleGameTableViewCell.h */,
E836DBCF279BF5150056F7DD /* XPLittleGameTableViewCell.m */,
);
path = Cell;
sourceTree = "<group>";
@@ -5026,6 +5036,7 @@
E824545C26F5EEBA00BE8163 /* XPMineVerifIdentityPresenter.m in Sources */,
9B92A3562798096000AD168F /* XPSkillCardPresenter.m in Sources */,
E8A1E44E2761F98600B294CA /* XPCandyTreeViewController.m in Sources */,
E836DBCD279BF2F10056F7DD /* XPRoomLittleGameListView.m in Sources */,
E8899C852785CC69007944BE /* XPRoomDatingAnimationView.m in Sources */,
E84BF7D4277C383700EF8877 /* XPRoomSettingInputView.m in Sources */,
E8AC723726F49982007D6E91 /* XPMineNotificaProtocol.h in Sources */,
@@ -5492,6 +5503,7 @@
E896EF9F2771AE7B00AD2CC1 /* XPMineAttentionViewController.m in Sources */,
9B2A12E127845DD300CED41B /* XPNobleCenterMyNobleView.m in Sources */,
E89D60C1271D64B9001F8895 /* RoomInfoModel.m in Sources */,
E836DBD0279BF5150056F7DD /* XPLittleGameTableViewCell.m in Sources */,
E89DA66727006443008483C1 /* RechargeStorage.m in Sources */,
189DD53F26DE255600AB55B1 /* main.m in Sources */,
E8A03DF927634A590098D9EA /* CandyTreeResultModel.m in Sources */,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

View File

@@ -0,0 +1,18 @@
//
// XPLittleGameTableViewCell.h
// xplan-ios
//
// Created by 冯硕 on 2022/1/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class LittleGameInfoModel;
@interface XPLittleGameTableViewCell : UITableViewCell
///游戏的信息
@property (nonatomic, strong) LittleGameInfoModel *info;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,74 @@
//
// XPLittleGameTableViewCell.m
// xplan-ios
//
// Created by on 2022/1/22.
//
#import "XPLittleGameTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
///Model
#import "LittleGameInfoModel.h"
@interface XPLittleGameTableViewCell ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIView *devideView;
@end
@implementation XPLittleGameTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self initViews];
[self initConstraints];
}
return self;
}
- (void)initViews {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = [UIColor clearColor];
self.contentView.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.devideView];
}
- (void)initConstraints {
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.left.mas_equalTo(8);
}];
[self.devideView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self).inset(8);
make.top.mas_equalTo(0);
make.height.mas_equalTo(1);
}];
}
- (void)setInfo:(LittleGameInfoModel *)info {
self.titleLabel.text = info.name;
}
#pragma mark - Getters And Setters
- (UILabel *)titleLabel {
if (_titleLabel == nil) {
_titleLabel = [[UILabel alloc]init];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont systemFontOfSize:12];
_titleLabel.userInteractionEnabled = YES;
}
return _titleLabel;
}
- (UIView *)devideView {
if (!_devideView) {
_devideView = [[UIView alloc] init];
_devideView.backgroundColor = [ThemeColor dividerColor];
}
return _devideView;
}
@end

View File

@@ -0,0 +1,29 @@
//
// XPRoomLittleGameListView.h
// xplan-ios
//
// Created by 冯硕 on 2022/1/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class LittleGameInfoModel, XPRoomLittleGameListView;
@protocol XPRoomLittleGameListViewDelegate <NSObject>
///选择了礼物
- (void)xPRoomLittleGameListView:(XPRoomLittleGameListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo;
@end
@interface XPRoomLittleGameListView : UIView
///代理
@property (nonatomic,weak) id<XPRoomLittleGameListViewDelegate> delegate;
///当前的mgId
@property (nonatomic,copy) NSString *mgId;
///列表
@property (nonatomic,strong,readonly) UITableView *tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,207 @@
//
// XPRoomLittleGameListView.m
// xplan-ios
//
// Created by on 2022/1/22.
//
#import "XPRoomLittleGameListView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "Api+LittleGame.h"
#import "XPMacro.h"
///Model
#import "LittleGameInfoModel.h"
#import "XPLittleGameTableViewCell.h"
@interface XPRoomLittleGameListView ()<UITableViewDelegate, UITableViewDataSource>
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) UIButton *gamePlayButton;
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSArray *gameList;
///
@property (nonatomic,strong) NSArray *datasource;
///
@property (nonatomic,strong) LittleGameInfoModel *gameInfo;
@end
@implementation XPRoomLittleGameListView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.layer.cornerRadius = 12.5;
self.layer.masksToBounds = YES;
self.layer.borderWidth = 0.5;
self.layer.borderColor = UIColorRGBAlpha(0xffffff, 0.6).CGColor;
self.backgroundColor = UIColorRGBAlpha(0x000000, 0.2);
[self addSubview:self.stackView];
[self.stackView addArrangedSubview:self.gamePlayButton];
[self.stackView addArrangedSubview:self.tableView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(72 * kScreenScale);
make.bottom.mas_equalTo(self.stackView.mas_bottom);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self);
}];
[self.gamePlayButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(25 * kScreenScale);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(25 * kScreenScale);
}];
}
- (NSArray *)handleGameListData:(NSArray *)array {
NSMutableArray * dataArray= [NSMutableArray array];
for (int i = 0; i<array.count; i++) {
LittleGameInfoModel *info = [array objectAtIndex:i];
if ([info.mgId isEqualToString:self.mgId]) {
self.gameInfo = info;
} else {
if (info.mgId.length < 2 && self.mgId.length < 1) {
[dataArray insertObject:info atIndex:0];
} else {
[dataArray addObject:info];
}
}
}
return [dataArray copy];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
XPLittleGameTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])];
if (cell == nil) {
cell = [[XPLittleGameTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])];
}
cell.info = [self.datasource objectAtIndex:indexPath.row];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 25 * kScreenScale;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
self.tableView.hidden = YES;
self.gamePlayButton.selected = NO;
LittleGameInfoModel *info = [self.datasource objectAtIndex:indexPath.row];
if (info.mgId.integerValue != self.mgId.integerValue) {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomLittleGameListView:didSelectItem:)]) {
[self.delegate xPRoomLittleGameListView:self didSelectItem:info];
}
}
}
}
#pragma mark - Event Response
- (void)gamePlayButtonAction:(UIButton *)sender {
sender.selected = !sender.selected;
self.tableView.hidden = !sender.selected;
}
#pragma mark - Getters And Setters
- (void)setMgId:(NSString *)mgId {
_mgId = mgId;
if (self.gameList.count > 0) {
self.datasource = [self handleGameListData:self.gameList];
[self.gamePlayButton setTitle:self.gameInfo.name forState:UIControlStateNormal];
} else {
[Api getLittleGameList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray * array = [LittleGameInfoModel modelsWithArray:data.data];
LittleGameInfoModel * gameInfo = [[LittleGameInfoModel alloc] init];
gameInfo.mgId = @"-1";
gameInfo.name = @"扩列交友";
NSMutableArray * dataArray = [NSMutableArray array];
[dataArray addObjectsFromArray:array];
[dataArray addObject:gameInfo];
self.gameList = [dataArray copy];
self.datasource = [self handleGameListData:self.gameList];
[self.gamePlayButton setTitle:self.gameInfo.name forState:UIControlStateNormal];
}
}];
}
}
- (void)setDatasource:(NSArray *)datasource {
_datasource = datasource;
[self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(25 * kScreenScale * self.datasource.count);
}];
[self.tableView reloadData];
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 0;
}
return _stackView;
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.hidden = YES;
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPLittleGameTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])];
}
return _tableView;
}
- (UIButton *)gamePlayButton {
if (!_gamePlayButton) {
_gamePlayButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_gamePlayButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_gamePlayButton setImage:[UIImage imageNamed:@"room_info_little_game_down_arrow"] forState:UIControlStateNormal];
[_gamePlayButton setImage:[UIImage imageNamed:@"room_info_little_game_up_arrow"] forState:UIControlStateSelected];
_gamePlayButton.titleLabel.font = [UIFont systemFontOfSize:12];
[_gamePlayButton setTitle:@"扩列交友" forState:UIControlStateNormal];
_gamePlayButton.selected = NO;
[_gamePlayButton addTarget:self action:@selector(gamePlayButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_gamePlayButton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
_gamePlayButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
}
return _gamePlayButton;
}
@end

View File

@@ -23,18 +23,23 @@
#import "ApiHost.h"
#import "AccountInfoStorage.h"
#import "HttpRequestHelper.h"
#import "DESEncrypt.h"
#import "XPConstant.h"
#import "Api+Room.h"
#import "Api+RoomSetting.h"
///Model
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
#import "AttachmentModel.h"
#import "AttachMentModel.h"
#import "LittleGameInfoModel.h"
///View
#import "XPShareView.h"
#import "XPRoomLittleGameListView.h"
///VC
#import "XPWebViewcontroller.h"
#import "XPRoomOnLineViewController.h"
@interface RoomHeaderView ()<XCShareViewDelegate>
@interface RoomHeaderView ()<XCShareViewDelegate, XPRoomLittleGameListViewDelegate>
///
@property (nonatomic,strong) UIButton *backButton;
///
@@ -59,6 +64,8 @@
@property (nonatomic,strong) UIButton *shareButton;
///
@property (nonatomic,strong) UIButton *settingButton;
///
@property (nonatomic,strong) XPRoomLittleGameListView *gameListView;
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
@@ -76,6 +83,14 @@
return self;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
//tabbar
CGPoint newP = [self convertPoint:point toView:self.gameListView.tableView];
if ([self.gameListView.tableView pointInside:newP withEvent:event]) {
return self.gameListView.tableView;
}
return [super hitTest:point withEvent:event];
}
#pragma mark - Event Response
- (void)backButtonAction:(UIButton *)sender {
[self.hostDelegate miniRoom];
@@ -104,7 +119,6 @@
XPRoomOnLineViewController * onlineVC = [[XPRoomOnLineViewController alloc] initWithDelegate:self.hostDelegate];
[self.hostDelegate.getCurrentNav pushViewController:onlineVC animated:YES];
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backButton];
@@ -173,6 +187,25 @@
}];
}
- (void)configLittleGameState {
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
if (roomInfo.isPermitRoom != PermitRoomType_Licnese && roomInfo.roomModeType != RoomModeType_Open_Blind && roomInfo.roomModeType != RoomModeType_Open_PK_Mode && roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode && roomInfo.roomModeType != RoomModeType_Open_Micro_Mode && !roomInfo.leaveMode && roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
if (!self.gameListView.superview) {
[self addSubview:self.gameListView];
[self.gameListView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.shareButton.mas_left).offset(-3);
make.top.mas_equalTo(self.shareButton);
}];
}
self.gameListView.mgId = roomInfo.mgId.integerValue > 0 ? roomInfo.mgId : @"-1";
} else {
if (self.gameListView.superview) {
[self.gameListView removeFromSuperview];
}
}
}
#pragma mark - RoomGuestDelegate
- (void)onRoomEntered {
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
///
@@ -198,19 +231,57 @@
}
- (void)onRoomUpdate {
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
if (roomInfo) {
self.titleLabel.text = roomInfo.title;
self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%ld %ld人在线", (long)roomInfo.erbanNo, (long)(roomInfo.onlineNum > 0 ? roomInfo.onlineNum : 0)];
self.giftEffectImageView.hidden = roomInfo.hasAnimationEffect;
if (roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
self.collectButton.hidden = YES;
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
self.titleLabel.text = roomInfo.title;
self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%ld %ld人在线", (long)roomInfo.erbanNo, (long)(roomInfo.onlineNum > 0 ? roomInfo.onlineNum : 0)];
self.giftEffectImageView.hidden = roomInfo.hasAnimationEffect;
if (roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
self.collectButton.hidden = YES;
} else {
self.collectButton.hidden = NO;
self.collectButton.selected = roomInfo.isRoomFans;
}
self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0;
[self configLittleGameState];
}
#pragma mark - XPRoomLittleGameListViewDelegate
- (void)xPRoomLittleGameListView:(XPRoomLittleGameListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo {
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
NSMutableDictionary * params = [NSMutableDictionary dictionary];
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[params setObject:ticket forKey:@"ticket"];
[params setObject:uid forKey:@"uid"];
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.uid] forKey:@"roomUid"];
if (roomInfo.title.length > 0) {
[params setObject:roomInfo.title forKey:@"title"];
}
if (roomInfo.roomPwd.length > 0) {
NSString *pwdDes = [DESEncrypt encryptUseDES:roomInfo.roomPwd key:KeyWithType(KeyType_PasswordEncode)];
[params setObject:pwdDes forKey:@"roomPwd"];
} else{
[params setObject:@"" forKey:@"roomPwd"];
}
if (roomInfo.tagId > 0) {
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.tagId] forKey:@"tagId"];
}
if ([itemInfo.mgId isEqualToString:@"-1"]) {
[params setObject:@(RoomType_Game) forKey:@"type"];
} else {
[params setObject:@(RoomType_MiniGame) forKey:@"type"];
[params setObject:itemInfo.mgId forKey:@"mgId"];
}
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
} else {
self.collectButton.hidden = NO;
self.collectButton.selected = roomInfo.isRoomFans;
[XCHUDTool showErrorWithMessage:msg];
}
self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0;
}
} params:params];
}
#pragma mark - Event Response
- (void)showSharePanel {
@@ -465,4 +536,13 @@
return _idLabel;
}
- (XPRoomLittleGameListView *)gameListView {
if (!_gameListView) {
_gameListView = [[XPRoomLittleGameListView alloc] init];
_gameListView.delegate = self;
}
return _gameListView;
}
@end

View File

@@ -6,6 +6,7 @@
//
#import "BaseMvpPresenter.h"
#import "RoomInfoModel.h"
#import "XPRoomSettingItemModel.h"
NS_ASSUME_NONNULL_BEGIN
@class RoomInfoModel;
@@ -44,6 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param hasAnimationEffect 是否开启房间特效
/// @param roomUid 房间uid
/// @param roomId 群聊的id
/// @param type 房间类型
/// @param itemType 更新的类型
- (void)updateRoomInfo:(NSString *)title
roomPwd:(NSString *)roomPwd
@@ -51,6 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
hasAnimationEffect:(BOOL)hasAnimationEffect
roomUid:(NSString *)roomUid
roomId:(NSString *)roomId
type:(RoomType)type
itemType:(RoomSettingItemType)itemType;
@end

View File

@@ -247,7 +247,7 @@
/// @param hasAnimationEffect
/// @param roomUid uid
/// @param roomId id
- (void)updateRoomInfo:(NSString *)title roomPwd:(NSString *)roomPwd tagId:(NSString *)tagId hasAnimationEffect:(BOOL)hasAnimationEffect roomUid:(NSString *)roomUid roomId:(NSString *)roomId itemType:(RoomSettingItemType)itemType{
- (void)updateRoomInfo:(NSString *)title roomPwd:(NSString *)roomPwd tagId:(NSString *)tagId hasAnimationEffect:(BOOL)hasAnimationEffect roomUid:(NSString *)roomUid roomId:(NSString *)roomId type:(RoomType)type itemType:(RoomSettingItemType)itemType{
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSMutableDictionary * params = [NSMutableDictionary dictionary];
@@ -267,6 +267,8 @@
if (tagId.length > 0) {
[params setObject:tagId forKey:@"tagId"];
}
[params setObject:@(type) forKey:@"type"];
[params setObject:@(hasAnimationEffect) forKey:@"hasAnimationEffect"];
///
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];

View File

@@ -198,7 +198,7 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
@kWeakify(self);
roomTagVC.completion = ^(NSString * _Nonnull tag) {
@kStrongify(self)
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:tag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId itemType:itemModel.type];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:tag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type];
};
[self.navigationController presentViewController:roomTagVC animated:YES completion:nil];
}
@@ -254,9 +254,9 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
NSString * roomTag = [NSString stringWithFormat:@"%ld", self.roomInfo.tagId];
if (type == RoomSettingInputType_Pwd) {
NSString *pwdDes = [DESEncrypt encryptUseDES:text key:KeyWithType(KeyType_PasswordEncode)];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:pwdDes tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId itemType:RoomSettingItemType_Pwd];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:pwdDes tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:RoomSettingItemType_Pwd];
} else if(type == RoomSettingInputType_Title) {
[self.presenter updateRoomInfo:text roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId itemType:RoomSettingItemType_Title];
[self.presenter updateRoomInfo:text roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:RoomSettingItemType_Title];
}
}
@@ -317,14 +317,14 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
titleView.type = RoomSettingInputType_Pwd;
[TTPopup popupView:titleView style:TTPopupStyleAlert];
} else {
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:@"" tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId itemType:itemModel.type];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:@"" tagId:roomTag hasAnimationEffect:self.roomInfo.hasAnimationEffect roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type];
}
}
break;
case RoomSettingItemType_Gift_Effect:
{
if (isOn) {
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:YES roomUid:roomUid roomId:roomId itemType:itemModel.type];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:YES roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type];
return;
}
TTAlertConfig *config = [[TTAlertConfig alloc] init];
@@ -333,7 +333,7 @@ XPRoomSettingItemModel * itemModel = [[self.datasource objectAtIndex:indexPath.s
config.shouldDismissOnBackgroundTouch = NO;
[TTPopup alertWithConfig:config confirmHandler:^{
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:NO roomUid:roomUid roomId:roomId itemType:itemModel.type];
[self.presenter updateRoomInfo:self.roomInfo.title roomPwd:self.roomInfo.roomPwd tagId:roomTag hasAnimationEffect:NO roomUid:roomUid roomId:roomId type:self.roomInfo.type itemType:itemModel.type];
} cancelHandler:^{
}];

View File

@@ -159,12 +159,12 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.backContainerView];
[self.view addSubview:self.roomHeaderView];
[self.view addSubview:self.backContainerView];
[self.view addSubview:self.stageView];
[self.view addSubview:self.messageContainerView];
[self.view addSubview:self.menuContainerView];
[self.view addSubview:self.activityContainerView];
[self.view addSubview:self.roomHeaderView];
[self.view addSubview:self.functionView];
[self.view addSubview:self.animationView];
}