新增 Turbo Mode Tips 功能,包含 XPTurboModeTipsManager 和 XPTurboModeTipsView 类,用于在房间中监测卡顿并显示提示。同时,更新 XPRoomViewController 以启动提示监听,并添加测试按钮以手动触发提示显示,提升用户体验和代码可维护性。

This commit is contained in:
edwinQQQ
2025-09-03 19:10:06 +08:00
parent f15d229ae1
commit 0147800f75
9 changed files with 488 additions and 82 deletions

View File

@@ -510,6 +510,8 @@
4C44BD5D2D151B5C00F321FA /* RoomSideMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C44BD5C2D151B5C00F321FA /* RoomSideMenu.m */; };
4C45C1A52E6825F300E73A44 /* XPTurboModeConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */; };
4C45C1A92E6837BF00E73A44 /* TurboModeStateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C45C1A72E6837BF00E73A44 /* TurboModeStateManager.m */; };
4C45C1AC2E68545E00E73A44 /* XPTurboModeTipsView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C45C1AB2E68545E00E73A44 /* XPTurboModeTipsView.m */; };
4C45C1AF2E6855F600E73A44 /* XPTurboModeTipsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C45C1AE2E6855F600E73A44 /* XPTurboModeTipsManager.m */; };
4C4707A52D53430300C8CD24 /* NSData+GZIP.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4707A42D53430300C8CD24 /* NSData+GZIP.m */; };
4C51B09C2DA3B4C600D8DFB5 /* LudoGameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C51B09B2DA3B4C600D8DFB5 /* LudoGameViewController.m */; };
4C51B09F2DA50FDA00D8DFB5 /* CPRelationshipChangeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C51B09E2DA50FDA00D8DFB5 /* CPRelationshipChangeView.m */; };
@@ -2687,6 +2689,10 @@
4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeConstants.m; sourceTree = "<group>"; };
4C45C1A62E6837BF00E73A44 /* TurboModeStateManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TurboModeStateManager.h; sourceTree = "<group>"; };
4C45C1A72E6837BF00E73A44 /* TurboModeStateManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TurboModeStateManager.m; sourceTree = "<group>"; };
4C45C1AA2E68545E00E73A44 /* XPTurboModeTipsView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeTipsView.h; sourceTree = "<group>"; };
4C45C1AB2E68545E00E73A44 /* XPTurboModeTipsView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeTipsView.m; sourceTree = "<group>"; };
4C45C1AD2E6855F600E73A44 /* XPTurboModeTipsManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeTipsManager.h; sourceTree = "<group>"; };
4C45C1AE2E6855F600E73A44 /* XPTurboModeTipsManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeTipsManager.m; sourceTree = "<group>"; };
4C4707A32D53430300C8CD24 /* NSData+GZIP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+GZIP.h"; sourceTree = "<group>"; };
4C4707A42D53430300C8CD24 /* NSData+GZIP.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+GZIP.m"; sourceTree = "<group>"; };
4C4DE6442E2513DA00122763 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
@@ -6806,6 +6812,8 @@
4C45C1A82E6837BF00E73A44 /* Manager */ = {
isa = PBXGroup;
children = (
4C45C1AD2E6855F600E73A44 /* XPTurboModeTipsManager.h */,
4C45C1AE2E6855F600E73A44 /* XPTurboModeTipsManager.m */,
4C45C1A62E6837BF00E73A44 /* TurboModeStateManager.h */,
4C45C1A72E6837BF00E73A44 /* TurboModeStateManager.m */,
);
@@ -11225,6 +11233,8 @@
E8DEC9992764A54C0078CB70 /* View */ = {
isa = PBXGroup;
children = (
4C45C1AA2E68545E00E73A44 /* XPTurboModeTipsView.h */,
4C45C1AB2E68545E00E73A44 /* XPTurboModeTipsView.m */,
4C4283F42E66C769006779B0 /* XPEffectPanelViewController.h */,
4C4283F52E66C769006779B0 /* XPEffectPanelViewController.m */,
E8DEC9A92764A6AF0078CB70 /* Cell */,
@@ -12380,6 +12390,7 @@
9BD63FB4277EF1B3006EB744 /* XPReleaseRadioModel.m in Sources */,
E80EC8C228ACF97A00D133C5 /* QEEmotionImageView.m in Sources */,
E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */,
4C45C1AC2E68545E00E73A44 /* XPTurboModeTipsView.m in Sources */,
180116F9279E8C4C00F2CBC0 /* PLTimeUtil.m in Sources */,
23CEFC502AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.m in Sources */,
E87E545429AA05EA00EBE52B /* XPFootPrintNavView.m in Sources */,
@@ -12425,6 +12436,7 @@
E8E20BEC2816A5B90033B688 /* XPMineBlackListViewController.m in Sources */,
E8AC722F26F49610007D6E91 /* XPMineNotificationItemModel.m in Sources */,
E85410352864155A005CFD9F /* XPMonentDetailPresenter.m in Sources */,
4C45C1AF2E6855F600E73A44 /* XPTurboModeTipsManager.m in Sources */,
54C9A11F2C3DA08000C6D970 /* XPMineGamePartnerInfoModel.m in Sources */,
2331C1B12A60F32D00E1D940 /* XPCandyTreeGiftView.m in Sources */,
9B1B72BC28003E06003FACE9 /* XPAnchorPKTableViewCell.m in Sources */,

View File

@@ -227,6 +227,14 @@
});
}
// 🔧 Turbo Mode Tips
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:@"BuglyManagerDidDetectLag"
object:nil
userInfo:@{@"duration": @(duration),
@"stackTrace": stackTrace ?: @""}];
});
// TODO:
// 1.
// 2.

View File

@@ -0,0 +1,29 @@
//
// XPTurboModeTipsManager.h
// YuMi
//
// Created by AI Assistant
// Copyright © 2024 YuMi. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "XPTurboModeTipsView.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPTurboModeTipsManager : NSObject <XPTurboModeTipsViewDelegate>
+ (instancetype)sharedManager;
// 在房间中启动 Tips 监听
- (void)startTipsMonitoringInRoom;
// 停止 Tips 监听
- (void)stopTipsMonitoring;
// 手动显示 Tips用于测试
- (void)showTipsManually;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,168 @@
//
// XPTurboModeTipsManager.m
// YuMi
//
// Created by AI Assistant
// Copyright © 2024 YuMi. All rights reserved.
//
#import "XPTurboModeTipsManager.h"
#import "XPTurboModeTipsView.h"
@interface XPTurboModeTipsManager ()
@property (nonatomic, strong) XPTurboModeTipsView *currentTipsView;
@property (nonatomic, assign) BOOL isMonitoring;
@property (nonatomic, assign) BOOL hasShownTipsInCurrentSession;
@end
@implementation XPTurboModeTipsManager
#pragma mark - Singleton
+ (instancetype)sharedManager {
static XPTurboModeTipsManager *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[XPTurboModeTipsManager alloc] init];
});
return instance;
}
- (instancetype)init {
self = [super init];
if (self) {
_isMonitoring = NO;
_hasShownTipsInCurrentSession = NO;
[self setupNotifications];
}
return self;
}
#pragma mark - Public Methods
- (void)startTipsMonitoringInRoom {
if (self.isMonitoring) {
NSLog(@"🎮 XPTurboModeTipsManager 已经在监听中");
return;
}
self.isMonitoring = YES;
self.hasShownTipsInCurrentSession = NO;
NSLog(@"🎮 XPTurboModeTipsManager 开始在房间中监听卡顿");
}
- (void)stopTipsMonitoring {
if (!self.isMonitoring) {
return;
}
self.isMonitoring = NO;
NSLog(@"🎮 XPTurboModeTipsManager 停止监听卡顿");
}
- (void)showTipsManually {
[self showTipsWithReason:@"手动触发"];
}
#pragma mark - Private Methods
- (void)setupNotifications {
//
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleLagDetection:)
name:@"BuglyManagerDidDetectLag"
object:nil];
// 退
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleRoomExit:)
name:@"RoomDidExit"
object:nil];
}
- (void)handleLagDetection:(NSNotification *)notification {
if (!self.isMonitoring) {
NSLog(@"🎮 XPTurboModeTipsManager 未在监听状态,跳过卡顿处理");
return;
}
if (self.hasShownTipsInCurrentSession) {
NSLog(@"🎮 XPTurboModeTipsManager 当前会话已显示过 Tips跳过");
return;
}
NSDictionary *userInfo = notification.userInfo;
NSTimeInterval duration = [userInfo[@"duration"] doubleValue];
NSString *stackTrace = userInfo[@"stackTrace"];
NSLog(@"🎮 XPTurboModeTipsManager 收到卡顿通知 - 持续时间: %.2f秒", duration);
// Tips
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self showTipsWithReason:[NSString stringWithFormat:@"检测到卡顿 (%.1fs)", duration]];
});
}
- (void)handleRoomExit:(NSNotification *)notification {
NSLog(@"🎮 XPTurboModeTipsManager 房间退出,停止监听");
[self stopTipsMonitoring];
// Tips
if (self.currentTipsView) {
[self.currentTipsView dismiss];
self.currentTipsView = nil;
}
}
- (void)showTipsWithReason:(NSString *)reason {
NSLog(@"🎮 XPTurboModeTipsManager 显示 Tips - 原因: %@", reason);
//
UIWindow *window = [UIApplication sharedApplication].keyWindow;
if (!window) {
//
NSArray *windows = [UIApplication sharedApplication].windows;
for (UIWindow *w in windows) {
if (w.isKeyWindow) {
window = w;
break;
}
}
}
if (!window) {
NSLog(@"🎮 XPTurboModeTipsManager 无法获取窗口Tips 弹窗显示失败");
return;
}
// Tips
self.currentTipsView = [XPTurboModeTipsView showInView:window];
self.currentTipsView.delegate = self;
//
self.hasShownTipsInCurrentSession = YES;
NSLog(@"🎮 Tips 弹窗创建成功,已添加到窗口");
}
#pragma mark - XPTurboModeTipsViewDelegate
- (void)turboModeTipsViewDidTapUnderstand {
NSLog(@"🎮 XPTurboModeTipsManager 用户点击了 'I understand' 按钮");
// Tips
if (self.currentTipsView) {
[self.currentTipsView dismiss];
self.currentTipsView = nil;
}
}
#pragma mark - Dealloc
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end

View File

@@ -1,55 +0,0 @@
//
// XPTurboModeConstants.h
// YuMi
//
// Created by P on 2025/1/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// MARK: - 缓存 Key 生成函数
/**
* 生成礼物特效开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGiftEffectsEnabledKey(NSString *roomId);
/**
* 生成全局礼物屏幕开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId);
/**
* 生成全局游戏屏幕开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId);
// MARK: - 通知名称常量
/**
* 礼物特效开关状态改变通知
*/
extern NSString *const kTurboGiftEffectsEnabledChanged;
/**
* 全局礼物屏幕开关状态改变通知
*/
extern NSString *const kTurboGlobalGiftScreenEnabledChanged;
/**
* 全局游戏屏幕开关状态改变通知
*/
extern NSString *const kTurboGlobalGameScreenEnabledChanged;
/**
* Turbo Mode 按钮状态改变通知
*/
extern NSString *const kTurboModeButtonStateChanged;
NS_ASSUME_NONNULL_END

View File

@@ -1,27 +0,0 @@
//
// XPTurboModeConstants.m
// YuMi
//
// Created by P on 2025/1/13.
//
#import "XPTurboModeConstants.h"
// MARK: - Key
NSString *kTurboGiftEffectsEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGiftEffects_%@", roomId];
}
NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGlobalGiftScreen_%@", roomId];
}
NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGlobalGameScreen_%@", roomId];
}
// MARK: -
NSString *const kTurboGiftEffectsEnabledChanged = @"kTurboGiftEffectsEnabledChanged";
NSString *const kTurboGlobalGiftScreenEnabledChanged = @"kTurboGlobalGiftScreenEnabledChanged";
NSString *const kTurboGlobalGameScreenEnabledChanged = @"kTurboGlobalGameScreenEnabledChanged";
NSString *const kTurboModeButtonStateChanged = @"kTurboModeButtonStateChanged";

View File

@@ -0,0 +1,29 @@
//
// XPTurboModeTipsView.h
// YuMi
//
// Created by AI Assistant
// Copyright © 2024 YuMi. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol XPTurboModeTipsViewDelegate <NSObject>
@optional
- (void)turboModeTipsViewDidTapUnderstand;
@end
@interface XPTurboModeTipsView : UIView
@property (nonatomic, weak) id<XPTurboModeTipsViewDelegate> delegate;
+ (instancetype)showInView:(UIView *)parentView;
- (void)dismiss;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,193 @@
//
// XPTurboModeTipsView.m
// YuMi
//
// Created by AI Assistant
// Copyright © 2024 YuMi. All rights reserved.
//
#import "XPTurboModeTipsView.h"
@interface XPTurboModeTipsView ()
@property (nonatomic, strong) UIView *backgroundView;
@property (nonatomic, strong) UIView *contentView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *contentLabel;
@property (nonatomic, strong) UIButton *understandButton;
@property (nonatomic, strong) UIView *parentView;
@end
@implementation XPTurboModeTipsView
#pragma mark - Public Methods
+ (instancetype)showInView:(UIView *)parentView {
XPTurboModeTipsView *tipsView = [[XPTurboModeTipsView alloc] init];
tipsView.parentView = parentView;
[tipsView setupUI];
[tipsView showWithAnimation];
return tipsView;
}
- (void)dismiss {
[self dismissWithAnimation];
}
#pragma mark - Private Methods
- (void)setupUI {
//
self.frame = self.parentView.bounds;
self.backgroundColor = [UIColor clearColor];
//
[self setupBackgroundView];
//
[self setupContentView];
//
[self setupTitleLabel];
//
[self setupContentLabel];
//
[self setupUnderstandButton];
//
[self setupConstraints];
}
- (void)setupBackgroundView {
self.backgroundView = [[UIView alloc] init];
self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
[self addSubview:self.backgroundView];
//
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped)];
[self.backgroundView addGestureRecognizer:tapGesture];
}
- (void)setupContentView {
self.contentView = [[UIView alloc] init];
self.contentView.backgroundColor = [UIColor whiteColor];
self.contentView.layer.cornerRadius = 16.0;
self.contentView.layer.shadowColor = [UIColor blackColor].CGColor;
self.contentView.layer.shadowOffset = CGSizeMake(0, 4);
self.contentView.layer.shadowOpacity = 0.15;
self.contentView.layer.shadowRadius = 8.0;
[self addSubview:self.contentView];
}
- (void)setupTitleLabel {
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.text = @"Tips";
self.titleLabel.font = [UIFont boldSystemFontOfSize:20.0];
self.titleLabel.textColor = [UIColor blackColor];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.titleLabel];
}
- (void)setupContentLabel {
self.contentLabel = [[UILabel alloc] init];
self.contentLabel.text = @"Enabling Turbo mode can make the app run smoother.\n\nTurbo mode: Turns off room gift animations, in-room broadcasts, CP displays, and other animated effects.\n\nTo make the app run smoother, it has automatically switched to Turbo mode for you (Turbo mode: Automatically turns off gift animations, headwear effects, and merges gift messages in the public chat). You can turn off this mode in the room settings.";
self.contentLabel.font = [UIFont systemFontOfSize:16.0];
self.contentLabel.textColor = [UIColor darkGrayColor];
self.contentLabel.numberOfLines = 0;
self.contentLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:self.contentLabel];
}
- (void)setupUnderstandButton {
self.understandButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.understandButton setTitle:@"I understand" forState:UIControlStateNormal];
[self.understandButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.understandButton.titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
self.understandButton.backgroundColor = [UIColor colorWithRed:1.0 green:0.5 blue:0.0 alpha:1.0]; //
self.understandButton.layer.cornerRadius = 22.0;
[self.understandButton addTarget:self action:@selector(understandButtonTapped) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.understandButton];
}
- (void)setupConstraints {
[self.backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self);
make.width.equalTo(@320);
make.height.lessThanOrEqualTo(@500);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView).offset(24);
make.left.right.equalTo(self.contentView).insets(UIEdgeInsetsMake(0, 24, 0, 24));
make.height.equalTo(@30);
}];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(16);
make.left.right.equalTo(self.contentView).insets(UIEdgeInsetsMake(0, 24, 0, 24));
}];
[self.understandButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentLabel.mas_bottom).offset(24);
make.centerX.equalTo(self.contentView);
make.width.equalTo(@200);
make.height.equalTo(@44);
make.bottom.equalTo(self.contentView).offset(-24);
}];
}
#pragma mark - Actions
- (void)backgroundTapped {
//
}
- (void)understandButtonTapped {
NSLog(@"🎮 用户点击了 'I understand' 按钮");
if (self.delegate && [self.delegate respondsToSelector:@selector(turboModeTipsViewDidTapUnderstand)]) {
[self.delegate turboModeTipsViewDidTapUnderstand];
}
[self dismiss];
}
#pragma mark - Animation
- (void)showWithAnimation {
[self.parentView addSubview:self];
//
self.backgroundView.alpha = 0;
self.contentView.transform = CGAffineTransformMakeScale(0.8, 0.8);
self.contentView.alpha = 0;
//
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:0.6 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.backgroundView.alpha = 1;
self.contentView.transform = CGAffineTransformIdentity;
self.contentView.alpha = 1;
} completion:nil];
NSLog(@"🎮 Tips 弹窗已添加到父视图,动画开始");
}
- (void)dismissWithAnimation {
[UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.backgroundView.alpha = 0;
self.contentView.transform = CGAffineTransformMakeScale(0.8, 0.8);
self.contentView.alpha = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
NSLog(@"🎮 Tips 弹窗已从父视图移除");
}];
}
@end

View File

@@ -94,6 +94,9 @@
#import "RoomResourceManager.h"
#import "LuckyPackageLogicManager.h"
// 🔧 Turbo Mode Tips
#import "XPTurboModeTipsManager.h"
//#import "XPMineHallAnchorIncomeStatisViewController.h"
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
@@ -378,6 +381,9 @@ XPCandyTreeInsufficientBalanceViewDelegate>
[self handleGiftComboCallBack];
[self setupStageViewManager];
// 🔧 Turbo Mode Tips
[[XPTurboModeTipsManager sharedManager] startTipsMonitoringInRoom];
}
//- (void)test {
@@ -613,6 +619,9 @@ XPCandyTreeInsufficientBalanceViewDelegate>
[self.view addSubview:self.roomHeaderView];
[self.view addSubview:self.functionView];
[self.view addSubview:self.animationView];
// 🔧 Turbo Mode Tips
[self addTestButton];
}
- (void)__layoutTwentyMicStage {
@@ -3351,4 +3360,44 @@ XPCandyTreeInsufficientBalanceViewDelegate>
NSLog(@" - stageView.class: %@", NSStringFromClass([self.stageView class]));
}
#pragma mark -
- (void)addTestButton {
//
UIButton *testButton = [UIButton buttonWithType:UIButtonTypeSystem];
[testButton setTitle:@"🧪 Test Tips" forState:UIControlStateNormal];
[testButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
testButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.6 blue:0.8 alpha:0.9];
testButton.layer.cornerRadius = 15.0;
testButton.layer.borderWidth = 1.0;
testButton.layer.borderColor = [UIColor whiteColor].CGColor;
//
[testButton addTarget:self action:@selector(testButtonTapped) forControlEvents:UIControlEventTouchUpInside];
//
[self.view addSubview:testButton];
// -
[testButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(100); //
make.trailing.equalTo(self.view).offset(-20);
make.width.equalTo(@120);
make.height.equalTo(@35);
}];
NSLog(@"🎮 测试按钮已添加到房间界面 - 位置右上角距离顶部100距离右边20");
}
- (void)testButtonTapped {
NSLog(@"🎮 测试按钮被点击,准备显示 Turbo Mode Tips 弹窗");
NSLog(@"🎮 当前时间:%@", [NSDate date]);
NSLog(@"🎮 房间状态:%@", self.roomInfo ? @"已进入" : @"未进入");
// Tips Manager
[[XPTurboModeTipsManager sharedManager] showTipsManually];
NSLog(@"🎮 Tips 弹窗显示请求已发送");
}
@end