修改小游戏坑位缩小的逻辑

This commit is contained in:
fengshuo
2022-02-14 14:22:03 +08:00
committed by chenguilong
parent 4e3721a6e6
commit 584697c874
22 changed files with 526 additions and 39 deletions

View File

@@ -293,7 +293,7 @@
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 */; };
E836DBCD279BF2F10056F7DD /* XPLittleGameRoomListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E836DBCC279BF2F10056F7DD /* XPLittleGameRoomListView.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 */; };
@@ -534,6 +534,9 @@
E8D48256278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D48255278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m */; };
E8DACCFB2766EDC60052092C /* MicroGiftValueView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */; };
E8DACCFE27673F870052092C /* GiftValueInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFD27673F870052092C /* GiftValueInfoModel.m */; };
E8DBB6F927B639A300AA285D /* LittleGameStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DBB6F827B639A300AA285D /* LittleGameStageView.m */; };
E8DBB6FD27B63CE000AA285D /* LittleGameMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DBB6FC27B63CE000AA285D /* LittleGameMicroView.m */; };
E8DBB70127B6501200AA285D /* XPLittleGameMiniStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DBB70027B6501200AA285D /* XPLittleGameMiniStageView.m */; };
E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8DEC98927637EA50078CB70 /* candyTree_open.svga */; };
E8DEC98C27637EA50078CB70 /* candyTree_transform.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8DEC98A27637EA50078CB70 /* candyTree_transform.svga */; };
E8DEC992276441AA0078CB70 /* XPCandyTreeAnimationModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC991276441AA0078CB70 /* XPCandyTreeAnimationModel.m */; };
@@ -1157,8 +1160,8 @@
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>"; };
E836DBCB279BF2F10056F7DD /* XPLittleGameRoomListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPLittleGameRoomListView.h; sourceTree = "<group>"; };
E836DBCC279BF2F10056F7DD /* XPLittleGameRoomListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPLittleGameRoomListView.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>"; };
@@ -1638,6 +1641,12 @@
E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroGiftValueView.m; sourceTree = "<group>"; };
E8DACCFC27673F870052092C /* GiftValueInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftValueInfoModel.h; sourceTree = "<group>"; };
E8DACCFD27673F870052092C /* GiftValueInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftValueInfoModel.m; sourceTree = "<group>"; };
E8DBB6F727B639A300AA285D /* LittleGameStageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LittleGameStageView.h; sourceTree = "<group>"; };
E8DBB6F827B639A300AA285D /* LittleGameStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LittleGameStageView.m; sourceTree = "<group>"; };
E8DBB6FB27B63CE000AA285D /* LittleGameMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LittleGameMicroView.h; sourceTree = "<group>"; };
E8DBB6FC27B63CE000AA285D /* LittleGameMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LittleGameMicroView.m; sourceTree = "<group>"; };
E8DBB6FF27B6501200AA285D /* XPLittleGameMiniStageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPLittleGameMiniStageView.h; sourceTree = "<group>"; };
E8DBB70027B6501200AA285D /* XPLittleGameMiniStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPLittleGameMiniStageView.m; sourceTree = "<group>"; };
E8DEC98927637EA50078CB70 /* candyTree_open.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = candyTree_open.svga; sourceTree = "<group>"; };
E8DEC98A27637EA50078CB70 /* candyTree_transform.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = candyTree_transform.svga; sourceTree = "<group>"; };
E8DEC990276441AA0078CB70 /* XPCandyTreeAnimationModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeAnimationModel.h; sourceTree = "<group>"; };
@@ -3137,13 +3146,9 @@
E81EF6D9279AB59100FF3EDE /* LittleGame */ = {
isa = PBXGroup;
children = (
E81EF6E5279AC20D00FF3EDE /* Api */,
E81EF6E1279AB90E00FF3EDE /* Model */,
E81EF6DD279AB7AD00FF3EDE /* Cell */,
E81EF6DA279AB5CC00FF3EDE /* XPLittleGameRoomOpenView.h */,
E81EF6DB279AB5CC00FF3EDE /* XPLittleGameRoomOpenView.m */,
E836DBCB279BF2F10056F7DD /* XPRoomLittleGameListView.h */,
E836DBCC279BF2F10056F7DD /* XPRoomLittleGameListView.m */,
E81EF6E5279AC20D00FF3EDE /* Api */,
E8DBB6FE27B64FC700AA285D /* View */,
);
path = LittleGame;
sourceTree = "<group>";
@@ -3623,6 +3628,7 @@
isa = PBXGroup;
children = (
9B0086C727BA4F4A0032BD2B /* Anchor */,
E8DBB6FA27B63CC300AA285D /* LittleGame */,
E8899C7C27853B46007944BE /* Dating */,
180806DA27297269001FD836 /* MicroViewProtocol.h */,
E8680716271967B00024F48F /* MicroView.h */,
@@ -4275,6 +4281,8 @@
E877A7EA2783E24700EFACED /* DatingStageView.m */,
9B0086C427BA392B0032BD2B /* AnchorStageView.h */,
9B0086C527BA392B0032BD2B /* AnchorStageView.m */,
E8DBB6F727B639A300AA285D /* LittleGameStageView.h */,
E8DBB6F827B639A300AA285D /* LittleGameStageView.m */,
);
path = StageView;
sourceTree = "<group>";
@@ -4552,6 +4560,29 @@
path = SubViews;
sourceTree = "<group>";
};
E8DBB6FA27B63CC300AA285D /* LittleGame */ = {
isa = PBXGroup;
children = (
E8DBB6FB27B63CE000AA285D /* LittleGameMicroView.h */,
E8DBB6FC27B63CE000AA285D /* LittleGameMicroView.m */,
);
path = LittleGame;
sourceTree = "<group>";
};
E8DBB6FE27B64FC700AA285D /* View */ = {
isa = PBXGroup;
children = (
E81EF6DD279AB7AD00FF3EDE /* Cell */,
E81EF6DA279AB5CC00FF3EDE /* XPLittleGameRoomOpenView.h */,
E81EF6DB279AB5CC00FF3EDE /* XPLittleGameRoomOpenView.m */,
E836DBCB279BF2F10056F7DD /* XPLittleGameRoomListView.h */,
E836DBCC279BF2F10056F7DD /* XPLittleGameRoomListView.m */,
E8DBB6FF27B6501200AA285D /* XPLittleGameMiniStageView.h */,
E8DBB70027B6501200AA285D /* XPLittleGameMiniStageView.m */,
);
path = View;
sourceTree = "<group>";
};
E8DEC9962764A51F0078CB70 /* MoreView */ = {
isa = PBXGroup;
children = (
@@ -5036,7 +5067,7 @@
E824545C26F5EEBA00BE8163 /* XPMineVerifIdentityPresenter.m in Sources */,
9B92A3562798096000AD168F /* XPSkillCardPresenter.m in Sources */,
E8A1E44E2761F98600B294CA /* XPCandyTreeViewController.m in Sources */,
E836DBCD279BF2F10056F7DD /* XPRoomLittleGameListView.m in Sources */,
E836DBCD279BF2F10056F7DD /* XPLittleGameRoomListView.m in Sources */,
E8899C852785CC69007944BE /* XPRoomDatingAnimationView.m in Sources */,
E84BF7D4277C383700EF8877 /* XPRoomSettingInputView.m in Sources */,
E8AC723726F49982007D6E91 /* XPMineNotificaProtocol.h in Sources */,
@@ -5263,6 +5294,7 @@
E81366F626F0C0DF0076364C /* LoginFullInfoPresenter.m in Sources */,
18A61BE8274F9CF000A09A54 /* SessionListViewController.m in Sources */,
E8C1CD6A27D8937800376F83 /* XPRoomFaceCollectionViewCell.m in Sources */,
E8DBB6F927B639A300AA285D /* LittleGameStageView.m in Sources */,
E811FFF72742367B00918544 /* XPGiftEmptyCollectionViewCell.m in Sources */,
189DD67E26E1FD8900AB55B1 /* UIImage+Utils.m in Sources */,
E824545626F5E51900BE8163 /* XPMineVerifIdentityViewController.m in Sources */,
@@ -5271,6 +5303,7 @@
186A534726FC6ED900D67B2C /* TTAlertConfig.m in Sources */,
18F403EE2758CF2F00A6C548 /* MessageContentImage.m in Sources */,
18E7B31E26F0984C0064BC9B /* UserLevelVo.m in Sources */,
E8DBB70127B6501200AA285D /* XPLittleGameMiniStageView.m in Sources */,
E880B3A9278BD82300A83B0D /* AcrossRoomPKInfoModel.m in Sources */,
E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */,
E874B88B27215EAF003954B9 /* MicroQueueModel.m in Sources */,
@@ -5334,6 +5367,7 @@
186A534A26FC6ED900D67B2C /* TTActionSheetConfig.m in Sources */,
9BBC028B2786E05A0007C24B /* XPNobleCenterEntranceView.m in Sources */,
E81C279326EB394D0031E639 /* LoginForgetPasswordViewController.m in Sources */,
E8DBB6FD27B63CE000AA285D /* LittleGameMicroView.m in Sources */,
E81C278D26EAFAF60031E639 /* DESEncrypt.m in Sources */,
E81366E726F0A49E0076364C /* NSString+Utils.m in Sources */,
E87A26F627587C48002DDC7A /* XPHomePartyContainerViewController.m in Sources */,

View File

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

View File

@@ -18,7 +18,7 @@ NSString * const kHomeMoreScrollPageKey = @"kHomeMoreScrollPageKey";
NSString * const kRoomReleaseRadioNotificationKey = @"kRoomReleaseRadioNotificationKey";
NSString * const kVisitorUnReadCountNotificationKey = @"kVisitorUnReadCountNotificationKey";
NSString * const kRoomNobleTrumpetNotificationKey = @"kRoomNobleTrumpetNotificationKey";
NSString * const kRoomRoomLittleGameMiniStageNotificationKey = @"kRoomRoomLittleGameMiniStageNotificationKey";///
///
NSString * const KeyWithType(KeyType type) {
BOOL isRelase = NO;

View File

@@ -44,7 +44,8 @@
#import "XPSendGiftView.h"
#import "XPUserCardViewController.h"
#import "XPRoomViewController.h"
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate>
#import "XPLittleGameMiniStageView.h"
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPLittleGameMiniStageViewDelegate>
///host
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
///
@@ -63,6 +64,8 @@
@property (nonatomic,strong) UIButton *editButton;
///pk
@property (nonatomic,strong) XPAcrpssRoomPKPanelView *acrossPKPanelView;
///
@property (nonatomic,strong) XPLittleGameMiniStageView *littleGameMiniView;
@end
@implementation XPRoomFunctionContainerView
@@ -95,7 +98,7 @@
- (void)initSubViewConstraints {
[self.contributionButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(-12);
make.top.mas_equalTo(statusbarHeight+57);
make.top.mas_equalTo(kNavigationHeight+4);
make.width.mas_equalTo(90);
make.height.mas_equalTo(26);
}];
@@ -147,6 +150,7 @@
[self.datingProgresButton removeFromSuperview];
}
}
if (roomInfo.type == RoomType_Anchor) {
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
self.anchorGiftValueView.hidden = !roomInfo.showGiftValue;
@@ -164,6 +168,7 @@
}];
}
[self updateRoomTopic];
[self showLittleGameMiniView:roomInfo.type];
}
- (void)onRoomEntered {
@@ -201,7 +206,25 @@
} roomUid:roomUid];
}
if (roomInfo.type == RoomType_Anchor) {
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
self.anchorGiftValueView.hidden = !roomInfo.showGiftValue;
if (!roomInfo.showGiftValue) {
self.anchorGiftValueView.giftValue = 0;
}
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(statusbarHeight+49);
}];
} else {
[self.contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
self.anchorGiftValueView.hidden = YES;
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(statusbarHeight+57);
}];
}
[self updateRoomTopic];
[self showLittleGameMiniView:roomInfo.type];
}
- (void)onMicroGiftValueUpdate:(NSDictionary *)data {
@@ -360,6 +383,35 @@
}
}
- (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
[self.littleGameMiniView needRefreshPosition:queue];
}
}
#pragma mark -
- (void)showLittleGameMiniView:(RoomType)type {
if (type == RoomType_MiniGame) {
if (!self.littleGameMiniView.superview) {
[self addSubview:self.littleGameMiniView];
[self.littleGameMiniView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(0);
make.top.mas_equalTo(kNavigationHeight + 4);
make.height.mas_equalTo(23);
}];
}
} else {
if (self.littleGameMiniView.superview) {
[self.littleGameMiniView removeFromSuperview];
}
}
}
- (void)XPLittleGameMiniStageView:(XPLittleGameMiniStageView *)view didClickFoldButton:(UIButton *)sender {
}
#pragma mark - XPAcrpssRoomPKPanelViewDelegate
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view onlookRoom:(NSString *)roomUid {
[self.delegate exitRoom];
@@ -458,7 +510,12 @@
} roomUserId:roomUid roundId:roundId];
} cancelHandler:^{
}];}
}];
}
- (void)foldButtonAction:(UIButton *)sender {
sender.selected = !sender.selected;
}
- (void)tapGiftValueRecognizer {
if (self.anchorGiftValueView.hidden) return;
@@ -696,4 +753,13 @@
return _acrossPKPanelView;
}
- (XPLittleGameMiniStageView *)littleGameMiniView {
if (!_littleGameMiniView) {
_littleGameMiniView = [[XPLittleGameMiniStageView alloc] init];
_littleGameMiniView.delegate = self;
}
return _littleGameMiniView;
}
@end

View File

@@ -0,0 +1,24 @@
//
// XPLittleGameMiniStageView.h
// xplan-ios
//
// Created by 冯硕 on 2022/2/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class XPLittleGameMiniStageView;
@protocol XPLittleGameMiniStageViewDelegate <NSObject>
- (void)XPLittleGameMiniStageView:(XPLittleGameMiniStageView *)view didClickFoldButton:(UIButton *)sender;
@end
@interface XPLittleGameMiniStageView : UIView
- (void)needRefreshPosition:(NSMutableDictionary *)micQueue;
///代理
@property (nonatomic,weak) id<XPLittleGameMiniStageViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,148 @@
//
// XPLittleGameMiniStageView.m
// xplan-ios
//
// Created by on 2022/2/11.
//
#import "XPLittleGameMiniStageView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
///Model
#import "UserInfoModel.h"
#import "MicroQueueModel.h"
UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
@interface XPLittleGameMiniStageView ()
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) UIButton *foldButton;
///
@property (nonatomic,strong) UIStackView *stageStackView;
@end
@implementation XPLittleGameMiniStageView
- (void)drawRect:(CGRect)rect {
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii:CGSizeMake(11.5, 11.5)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.path = path.CGPath;
self.layer.mask = maskLayer;
}
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
- (void)initSubViews {
self.backgroundColor = UIColorRGBAlpha(0x000000, 0.2);
[self addSubview:self.stackView];
[self.stackView addArrangedSubview:self.foldButton];
[self.stackView addArrangedSubview:self.stageStackView];
CGFloat width = 16;
for (int i = 0; i<6; i++) {
NetImageView *imageView = [[NetImageView alloc] init];
imageView.layer.masksToBounds = YES;
imageView.layer.cornerRadius = width / 2;
imageView.image = [UIImage imageNamed:@"room_position_normal"];
[self.stageStackView addArrangedSubview:imageView];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width);
make.height.mas_equalTo(width);
}];
}
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAvatarRecognizer)];
[self addGestureRecognizer:tap];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.stackView).offset(6);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(6);
make.top.bottom.mas_equalTo(self);
}];
[self.stageStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(23);
}];
[self.foldButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.width.mas_equalTo(16);
}];
}
- (void)needRefreshPosition:(NSMutableDictionary *)micQueue {
for (int i = 0; i<self.stageStackView.subviews.count; i++) {
NSString *position = [NSString stringWithFormat:@"%d",i-1];
NetImageView *imageView = [self.stageStackView.subviews objectAtIndex:i];
imageView.image = [UIImage imageNamed:@"room_position_normal"];
MicroQueueModel *micModel = [micQueue objectForKey:position];
if (micModel.userInfo && micModel.userInfo.uid > 0) {
imageView.imageUrl = micModel.userInfo.avatar;
}
}
}
#pragma mark - Event Response
- (void)tapAvatarRecognizer {
self.foldButton.selected = !self.foldButton.selected;
self.stageStackView.hidden = !self.foldButton.selected;
[self setNeedsDisplay];
[UIView animateWithDuration:0.2 animations:^{
if (self.foldButton.selected) {
self.foldButton.transform = CGAffineTransformMakeRotation(M_PI);
} else {
self.foldButton.transform = CGAffineTransformIdentity;
}
}];
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomRoomLittleGameMiniStageNotificationKey object:@{@"isMini": @(!self.foldButton.selected)}];
}
#pragma mark - Getters And Setters
- (UIButton *)foldButton {
if (!_foldButton) {
_foldButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_foldButton setImage:[UIImage imageNamed:@"room_position_little_game_right_arrow"] forState:UIControlStateNormal];
[_foldButton setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
_foldButton.userInteractionEnabled = NO;
}
return _foldButton;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisHorizontal;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentCenter;
_stackView.spacing = 6;
}
return _stackView;
}
- (UIStackView *)stageStackView {
if (!_stageStackView) {
_stageStackView = [[UIStackView alloc] init];
_stageStackView.axis = UILayoutConstraintAxisHorizontal;
_stageStackView.distribution = UIStackViewDistributionFill;
_stageStackView.alignment = UIStackViewAlignmentCenter;
_stageStackView.spacing = 2;
_stageStackView.hidden =YES;
}
return _stageStackView;
}
@end

View File

@@ -8,15 +8,15 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class LittleGameInfoModel, XPRoomLittleGameListView;
@class LittleGameInfoModel, XPLittleGameRoomListView;
@protocol XPRoomLittleGameListViewDelegate <NSObject>
///选择了礼物
- (void)xPRoomLittleGameListView:(XPRoomLittleGameListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo;
- (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo;
@end
@interface XPRoomLittleGameListView : UIView
@interface XPLittleGameRoomListView : UIView
///代理
@property (nonatomic,weak) id<XPRoomLittleGameListViewDelegate> delegate;
///当前的mgId

View File

@@ -5,7 +5,7 @@
// Created by on 2022/1/22.
//
#import "XPRoomLittleGameListView.h"
#import "XPLittleGameRoomListView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
@@ -15,7 +15,7 @@
///Model
#import "LittleGameInfoModel.h"
#import "XPLittleGameTableViewCell.h"
@interface XPRoomLittleGameListView ()<UITableViewDelegate, UITableViewDataSource>
@interface XPLittleGameRoomListView ()<UITableViewDelegate, UITableViewDataSource>
///
@property (nonatomic,strong) UIStackView *stackView;
///
@@ -30,7 +30,7 @@
@property (nonatomic,strong) LittleGameInfoModel *gameInfo;
@end
@implementation XPRoomLittleGameListView
@implementation XPLittleGameRoomListView
- (instancetype)initWithFrame:(CGRect)frame
{

View File

@@ -34,7 +34,7 @@
#import "LittleGameInfoModel.h"
///View
#import "XPShareView.h"
#import "XPRoomLittleGameListView.h"
#import "XPLittleGameRoomListView.h"
///VC
#import "XPWebViewcontroller.h"
#import "XPRoomOnLineViewController.h"
@@ -65,7 +65,7 @@
///
@property (nonatomic,strong) UIButton *settingButton;
///
@property (nonatomic,strong) XPRoomLittleGameListView *gameListView;
@property (nonatomic,strong) XPLittleGameRoomListView *gameListView;
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
@@ -246,7 +246,7 @@
}
#pragma mark - XPRoomLittleGameListViewDelegate
- (void)xPRoomLittleGameListView:(XPRoomLittleGameListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo {
- (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo {
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
NSMutableDictionary * params = [NSMutableDictionary dictionary];
NSString * uid = [AccountInfoStorage instance].getUid;
@@ -536,9 +536,9 @@
return _idLabel;
}
- (XPRoomLittleGameListView *)gameListView {
- (XPLittleGameRoomListView *)gameListView {
if (!_gameListView) {
_gameListView = [[XPRoomLittleGameListView alloc] init];
_gameListView = [[XPLittleGameRoomListView alloc] init];
_gameListView.delegate = self;
}
return _gameListView;

View File

@@ -0,0 +1,16 @@
//
// LittleGameStageView.h
// xplan-ios
//
// Created by 冯硕 on 2022/2/11.
//
#import "StageView.h"
NS_ASSUME_NONNULL_BEGIN
@interface LittleGameStageView : StageView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,85 @@
//
// LittleGameStageView.m
// xplan-ios
//
// Created by on 2022/2/11.
//
#import "LittleGameStageView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
///View
#import "LittleGameMicroView.h"
UIKIT_EXTERN NSString * const kRoomRoomLittleGameMiniStageNotificationKey;
// 8 55 + 5
#define mcWidth (45 + 5) * kScreenScale
#define mcHeight (mcWidth + 10 + 12)
// padding 12
#define paddingH 12 * kScreenScale
#define foldButtonHeight 23
#define marginV1 4
//
#define firstRowTop (foldButtonHeight + marginV1 + marginV1)
@interface LittleGameStageView ()
///
@property (nonatomic,strong) UIButton *foldButton;
@end
@implementation LittleGameStageView
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
if (self = [super initWithDelegate:delegate]) {
[self addSubview:self.foldButton];
[self.foldButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(26);
make.height.mas_equalTo(foldButtonHeight);
make.right.mas_equalTo(self);
make.top.mas_equalTo(self).offset(marginV1);
}];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeViewState:) name:kRoomRoomLittleGameMiniStageNotificationKey object:nil];
}
return self;
}
- (NSInteger)countOfMircoView {
return 6;
}
- (UIView<MicroViewProtocol> *)microViewForIndex:(NSInteger)index {
UIView<MicroViewProtocol> * microView = [super microViewForIndex:index];
if (microView) {
return microView;
}
return [[LittleGameMicroView alloc]init];
}
/**
*/
- (CGRect)rectForViewAtIndex:(NSInteger)index {
CGFloat spaceWidth = (KScreenWidth - mcWidth * 6 - paddingH * 2) / 5;
return CGRectMake(paddingH + index * (mcWidth + spaceWidth), firstRowTop, mcWidth, mcHeight);
}
- (CGFloat)hightForStageView {
return firstRowTop + mcHeight + marginV1;
}
#pragma mark -
- (void)changeViewState:(NSNotification *)notification {
NSDictionary * dic = notification.object;
self.hidden = ![[dic objectForKey:@"isMini"] boolValue];
}
@end

View File

@@ -0,0 +1,16 @@
//
// LittleGameMicroView.h
// xplan-ios
//
// Created by 冯硕 on 2022/2/11.
//
#import "MicroView.h"
NS_ASSUME_NONNULL_BEGIN
@interface LittleGameMicroView : MicroView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,53 @@
//
// LittleGameMicroView.m
// xplan-ios
//
// Created by on 2022/2/11.
//
#import "LittleGameMicroView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
@interface LittleGameMicroView ()
///
@property (nonatomic,strong) UIButton *stateButton;
@end
@implementation LittleGameMicroView
- (void)initSubViews {
[super initSubViews];
[self addSubview:self.stateButton];
}
- (void)initSubViewConstraints {
[super initSubViewConstraints];
[self.stateButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(40);
make.height.mas_equalTo(16);
make.centerX.mas_equalTo(self);
make.bottom.mas_equalTo(self.avatarImageView.mas_bottom);
}];
}
#pragma mark - Getters And Setters
- (UIButton *)stateButton {
if (!_stateButton) {
_stateButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_stateButton setTitle:@"未准备" forState:UIControlStateNormal];
[_stateButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_stateButton.titleLabel.font = [UIFont systemFontOfSize:10];
[_stateButton setBackgroundColor:UIColorFromRGB(0xFFA936)];
_stateButton.layer.masksToBounds = YES;
_stateButton.layer.cornerRadius = 8;
_stateButton.layer.borderColor = UIColor.whiteColor.CGColor;
_stateButton.layer.borderWidth = 1;
}
return _stateButton;
}
@end

View File

@@ -35,6 +35,7 @@
#import "SocialStageView.h"
#import "DatingStageView.h"
#import "AnchorStageView.h"
#import "LittleGameStageView.h"
#import "XPRoomAnimationView.h"
#import "XPRoomFunctionContainerView.h"
#import "XPArrangeMicViewController.h"
@@ -265,13 +266,18 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[AnchorStageView alloc] initWithDelegate:self];
} else if(self.roomInfo.hadChangeRoomType && ![self.stageView isKindOfClass:[SocialStageView class]]) {
} else if(self.roomInfo.type == RoomType_MiniGame && ![self.stageView isKindOfClass:[LittleGameStageView class]]) {
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[LittleGameStageView alloc] initWithDelegate:self];
}else if(self.roomInfo.hadChangeRoomType && ![self.stageView isKindOfClass:[SocialStageView class]]) {
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[SocialStageView alloc] initWithDelegate:self];
} else {
return;
}
if (!self.stageView.superview) {
[self.view insertSubview:self.stageView aboveSubview:self.roomHeaderView];
}
@@ -281,19 +287,35 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
make.height.mas_equalTo(self.stageView.hightForStageView);
}];
[self.messageContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.stageView.mas_bottom);
make.bottom.equalTo(self.menuContainerView.mas_top).offset(-5);
make.left.equalTo(self.view);
make.right.equalTo(self.activityContainerView.mas_left).offset(-10);
}];
if (self.roomInfo.type == RoomType_MiniGame) {
[self.messageContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(50);
make.bottom.mas_equalTo(self.menuContainerView.mas_top).offset(-5);
make.left.mas_equalTo(self.view);
make.right.mas_equalTo(self.activityContainerView.mas_left).offset(-10);
}];
[self.activityContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.messageContainerView);
make.right.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.menuContainerView.mas_top).offset(-5);
make.width.mas_equalTo(80);
}];
[self.activityContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.messageContainerView);
make.right.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.menuContainerView.mas_top).offset(-5);
make.width.mas_equalTo(80);
}];
} else {
[self.messageContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.stageView.mas_bottom);
make.bottom.mas_equalTo(self.menuContainerView.mas_top).offset(-5);
make.left.mas_equalTo(self.view);
make.right.mas_equalTo(self.activityContainerView.mas_left).offset(-10);
}];
[self.activityContainerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.messageContainerView);
make.right.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.menuContainerView.mas_top).offset(-5);
make.width.mas_equalTo(80);
}];
}
}
- (void)cancelRoomArrangeMic {
@@ -687,6 +709,7 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
- (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
[self.menuContainerView onMicroQueueUpdate:queue];
[self.functionView onRoomUpdate];
[self.functionView onMicroQueueUpdate:queue];
}
- (void)onMicroGiftValueUpdate:(NSDictionary *)data {