h5跳转房间打开礼物面板
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 158 KiB |
@@ -128,13 +128,13 @@
|
|||||||
#pragma mark - Event Response
|
#pragma mark - Event Response
|
||||||
- (void)sendButtonAction:(UIButton *)sender {
|
- (void)sendButtonAction:(UIButton *)sender {
|
||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCardTableViewCellSendDress:dressId:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCardTableViewCellSendDress:dressId:)]) {
|
||||||
[self.delegate xPDressUpShopCardTableViewCellSendDress:self dressId:self.nobleCardModel.dressId];
|
[self.delegate xPDressUpShopCardTableViewCellSendDress:self dressId:self.nobleCardModel.dressUpId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)useButtonAction:(UIButton *)sender {
|
- (void)useButtonAction:(UIButton *)sender {
|
||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCardTableViewCellBuyDress:dressId:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCardTableViewCellBuyDress:dressId:)]) {
|
||||||
[self.delegate xPDressUpShopCardTableViewCellBuyDress:self dressId:self.nobleCardModel.dressId];
|
[self.delegate xPDressUpShopCardTableViewCellBuyDress:self dressId:self.nobleCardModel.dressUpId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,9 +68,10 @@
|
|||||||
make.height.mas_equalTo(92);
|
make.height.mas_equalTo(92);
|
||||||
make.left.top.right.mas_equalTo(0);
|
make.left.top.right.mas_equalTo(0);
|
||||||
}];
|
}];
|
||||||
|
CGFloat dressImageW = (KScreenWidth - 42) *0.5;
|
||||||
[self.dressUpImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.dressUpImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.size.mas_equalTo(CGSizeMake(80, 45));
|
make.size.mas_equalTo(CGSizeMake(dressImageW * 0.8, 70));
|
||||||
make.top.mas_equalTo(22);
|
make.top.mas_equalTo(11);
|
||||||
make.centerX.mas_equalTo(self.userCardBackView);
|
make.centerX.mas_equalTo(self.userCardBackView);
|
||||||
}];
|
}];
|
||||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
@@ -115,13 +116,13 @@
|
|||||||
#pragma mark - Event Response
|
#pragma mark - Event Response
|
||||||
- (void)sendButtonAction:(UIButton *)sender {
|
- (void)sendButtonAction:(UIButton *)sender {
|
||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCollectionViewCellSendDress:dressId:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCollectionViewCellSendDress:dressId:)]) {
|
||||||
[self.delegate xPDressUpShopCollectionViewCellSendDress:self dressId:self.dressUpModel.dressId];
|
[self.delegate xPDressUpShopCollectionViewCellSendDress:self dressId:self.dressUpModel.dressUpId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)useButtonAction:(UIButton *)sender {
|
- (void)useButtonAction:(UIButton *)sender {
|
||||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCollectionViewCellBuyDress:dressId:)]) {
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPDressUpShopCollectionViewCellBuyDress:dressId:)]) {
|
||||||
[self.delegate xPDressUpShopCollectionViewCellBuyDress:self dressId:self.dressUpModel.dressId];
|
[self.delegate xPDressUpShopCollectionViewCellBuyDress:self dressId:self.dressUpModel.dressUpId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,6 +52,8 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
|
|||||||
///当前用户贵族等级
|
///当前用户贵族等级
|
||||||
@property (nonatomic, assign) NSInteger curUserNobleLevel;
|
@property (nonatomic, assign) NSInteger curUserNobleLevel;
|
||||||
|
|
||||||
|
@property (nonatomic, copy) NSString *defaultSelectGiftId;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -69,6 +69,8 @@
|
|||||||
@property (nonatomic,assign) GiftSegmentType segmentType;
|
@property (nonatomic,assign) GiftSegmentType segmentType;
|
||||||
///最后一次选中的礼物
|
///最后一次选中的礼物
|
||||||
@property (nonatomic,strong) GiftInfoModel *lastSelectGift;
|
@property (nonatomic,strong) GiftInfoModel *lastSelectGift;
|
||||||
|
|
||||||
|
@property (nonatomic, assign) NSInteger selectIndex;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XPGiftInfoView
|
@implementation XPGiftInfoView
|
||||||
@@ -351,8 +353,17 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (self.datasource.count > 0) {
|
if (self.datasource.count > 0) {
|
||||||
GiftInfoModel * gift = [self.datasource firstObject];
|
if (self.defaultSelectGiftId.length) {
|
||||||
[self dealSelectGift:gift];
|
for (GiftInfoModel * gift in self.datasource) {
|
||||||
|
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||||
|
[self dealSelectGift:gift];
|
||||||
|
self.selectIndex = [self.datasource indexOfObject:gift];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GiftInfoModel * gift = [self.datasource firstObject];
|
||||||
|
[self dealSelectGift:gift];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.playRuleButton.hidden = YES;
|
self.playRuleButton.hidden = YES;
|
||||||
}
|
}
|
||||||
@@ -393,7 +404,34 @@
|
|||||||
self.giftLuckyArray = luckyArray;
|
self.giftLuckyArray = luckyArray;
|
||||||
self.giftNobleArray = nobleArray;
|
self.giftNobleArray = nobleArray;
|
||||||
self.giftWeekStarArray = weekStarArray;
|
self.giftWeekStarArray = weekStarArray;
|
||||||
self.segmentType = GiftSegmentType_Normal;
|
if (self.defaultSelectGiftId.length) {
|
||||||
|
for (GiftInfoModel *gift in self.normalOriginArray) {
|
||||||
|
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||||
|
self.segmentType = GiftSegmentType_Normal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (GiftInfoModel *gift in self.giftLuckyArray) {
|
||||||
|
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||||
|
self.segmentType = GiftSegmentType_Lucky;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (GiftInfoModel *gift in self.giftNobleArray) {
|
||||||
|
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||||
|
self.segmentType = GiftSegmentType_Noble;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (GiftInfoModel *gift in self.giftWeekStarArray) {
|
||||||
|
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||||
|
self.segmentType = GiftSegmentType_WeekStar;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.segmentType = GiftSegmentType_Normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setPackOriginArray:(NSArray *)packOriginArray {
|
- (void)setPackOriginArray:(NSArray *)packOriginArray {
|
||||||
@@ -413,6 +451,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setDefaultSelectGiftId:(NSString *)defaultSelectGiftId {
|
||||||
|
_defaultSelectGiftId = defaultSelectGiftId;
|
||||||
|
}
|
||||||
|
|
||||||
- (UIStackView *)segmentStackView {
|
- (UIStackView *)segmentStackView {
|
||||||
if (!_segmentStackView) {
|
if (!_segmentStackView) {
|
||||||
_segmentStackView = [[UIStackView alloc] init];
|
_segmentStackView = [[UIStackView alloc] init];
|
||||||
|
@@ -31,6 +31,9 @@ typedef NS_ENUM(NSInteger, SendGiftType) {
|
|||||||
///完全封闭的一个组件
|
///完全封闭的一个组件
|
||||||
- (void)configGiftUsers:(NSArray<XPGiftUserInfoModel *> *)users;
|
- (void)configGiftUsers:(NSArray<XPGiftUserInfoModel *> *)users;
|
||||||
|
|
||||||
|
///选中的礼物id
|
||||||
|
@property (nonatomic, copy) NSString *selectGiftId;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -487,6 +487,11 @@
|
|||||||
self.giftInfoView.usingplaceType = _usingplaceType;
|
self.giftInfoView.usingplaceType = _usingplaceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setSelectGiftId:(NSString *)selectGiftId {
|
||||||
|
_selectGiftId = selectGiftId;
|
||||||
|
self.giftInfoView.defaultSelectGiftId = selectGiftId;
|
||||||
|
}
|
||||||
|
|
||||||
- (UIView *)topView {
|
- (UIView *)topView {
|
||||||
if (!_topView) {
|
if (!_topView) {
|
||||||
_topView = [[UIView alloc] init];
|
_topView = [[UIView alloc] init];
|
||||||
|
@@ -70,6 +70,7 @@
|
|||||||
self.delegate = delegate;
|
self.delegate = delegate;
|
||||||
[self initSubViews];
|
[self initSubViews];
|
||||||
[self initSubViewConstraints];
|
[self initSubViewConstraints];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showGiftView:) name:@"kShowGiftView" object:nil];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -173,6 +174,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - notification
|
||||||
|
- (void)showGiftView:(NSNotification *)noti {
|
||||||
|
NSDictionary *dict = noti.object;
|
||||||
|
NSString *giftId = dict[@"giftId"];
|
||||||
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
|
||||||
|
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
|
||||||
|
giftView.delegate = self.delegate;
|
||||||
|
NSArray * giftUses = [self configGiftUsers:[self.delegate getMicroQueue]];
|
||||||
|
[giftView configGiftUsers:giftUses];
|
||||||
|
giftView.selectGiftId = giftId;
|
||||||
|
[self.delegate.getCurrentNav presentViewController:giftView animated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)initSubViews {
|
- (void)initSubViews {
|
||||||
[self addSubview:self.scrollView];
|
[self addSubview:self.scrollView];
|
||||||
|
@@ -39,6 +39,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*/
|
*/
|
||||||
+ (BOOL)openRoom:(NSString*)roomUid mgId:(NSString *)mgId viewController:(UIViewController*)viewController;
|
+ (BOOL)openRoom:(NSString*)roomUid mgId:(NSString *)mgId viewController:(UIViewController*)viewController;
|
||||||
|
|
||||||
|
/// h5进房并弹出礼物面板
|
||||||
|
/// @param roomUid 房主Uid
|
||||||
|
/// @param giftId 礼物id
|
||||||
|
/// @param viewController 启动方
|
||||||
|
+ (BOOL)openRoom:(NSString *)roomUid giftId:(NSString *)giftId viewController:(UIViewController *)viewController;
|
||||||
|
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
+ (instancetype)new NS_UNAVAILABLE;
|
+ (instancetype)new NS_UNAVAILABLE;
|
||||||
- (id)copy NS_UNAVAILABLE;
|
- (id)copy NS_UNAVAILABLE;
|
||||||
|
@@ -90,6 +90,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
@property (nonatomic,copy) NSString * roomUid;
|
@property (nonatomic,copy) NSString * roomUid;
|
||||||
///小游戏的id
|
///小游戏的id
|
||||||
@property (nonatomic,copy) NSString *mgId;
|
@property (nonatomic,copy) NSString *mgId;
|
||||||
|
///礼物id
|
||||||
|
@property (nonatomic, copy) NSString *giftId;
|
||||||
///用户信息
|
///用户信息
|
||||||
@property (nonatomic,strong) UserInfoModel *userInfo;
|
@property (nonatomic,strong) UserInfoModel *userInfo;
|
||||||
///房间信息
|
///房间信息
|
||||||
@@ -158,6 +160,20 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// h5进房并弹出礼物面板
|
||||||
|
/// @param roomUid 房主Uid
|
||||||
|
/// @param giftId 礼物id
|
||||||
|
/// @param viewController 启动方
|
||||||
|
+ (BOOL)openRoom:(NSString *)roomUid giftId:(NSString *)giftId viewController:(UIViewController *)viewController {
|
||||||
|
XPRoomViewController * roomVC = [[self alloc] init];
|
||||||
|
roomVC.roomUid = roomUid;
|
||||||
|
roomVC.giftId = giftId;
|
||||||
|
BaseNavigationController * baseNav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
|
||||||
|
baseNav.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||||
|
[viewController presentViewController:baseNav animated:YES completion:nil];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
#warning to dox - 时刻注意这个方法 功能做完的时候删除此方法
|
#warning to dox - 时刻注意这个方法 功能做完的时候删除此方法
|
||||||
NSLog(@"房间销毁了");
|
NSLog(@"房间销毁了");
|
||||||
@@ -737,6 +753,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
if (self.roomInfo != nil) {
|
if (self.roomInfo != nil) {
|
||||||
[self.presenter reportUserInterRoom:[NSString stringWithFormat:@"%zd", self.roomInfo.uid]];
|
[self.presenter reportUserInterRoom:[NSString stringWithFormat:@"%zd", self.roomInfo.uid]];
|
||||||
}
|
}
|
||||||
|
if (self.giftId.length) {
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"kShowGiftView" object:@{@"giftId": self.giftId}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)enterRoomFail:(NSInteger)code {
|
- (void)enterRoomFail:(NSInteger)code {
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#import "XPMineDressUpViewController.h"
|
#import "XPMineDressUpViewController.h"
|
||||||
#import "XPDressUpShopViewController.h"
|
#import "XPDressUpShopViewController.h"
|
||||||
#import "XPRoomViewController.h"
|
#import "XPRoomViewController.h"
|
||||||
|
#import "RoomHostDelegate.h"
|
||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, RightNavigationPushType){
|
typedef NS_ENUM(NSUInteger, RightNavigationPushType){
|
||||||
///跳转h5页面
|
///跳转h5页面
|
||||||
@@ -294,6 +295,23 @@ NSString * const kJSOpenRoomForGiftId = @"openRoomForGiftId";
|
|||||||
NSString *str = (NSString *)message.body;
|
NSString *str = (NSString *)message.body;
|
||||||
bodyDict = [str toJSONObject];
|
bodyDict = [str toJSONObject];
|
||||||
}
|
}
|
||||||
|
//房间页 传参:uid
|
||||||
|
NSString *uid = [NSString stringWithFormat:@"%@", bodyDict[@"uid"]];
|
||||||
|
NSString *giftId = [NSString stringWithFormat:@"%@", bodyDict[@"giftId"]];
|
||||||
|
if (uid.length) {
|
||||||
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
|
if ([obj isKindOfClass:[XPRoomViewController class]]) {
|
||||||
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController popToRootViewControllerAnimated:NO];
|
||||||
|
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
|
||||||
|
[rooomVC exitRoom];
|
||||||
|
*stop = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
[XPRoomViewController openRoom:uid giftId:giftId viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
Reference in New Issue
Block a user