公聊大厅

This commit is contained in:
liyuhua
2024-05-07 19:40:21 +08:00
parent 3be0f8bc74
commit ace27b7e91
40 changed files with 1508 additions and 85 deletions

View File

@@ -52,6 +52,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
@property (nonatomic, strong) WKUserContentController *ms_userContentController;
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
@property(nonatomic,strong) ActivityInfoModel *gameModel;
@property(nonatomic,strong) UIButton *backBtn;
@end
@implementation MSRoomGameWebVC
@@ -71,9 +72,16 @@ NSString * const kMSGameLoaded = @"gameLoaded";
- (void)viewDidLoad {
[super viewDidLoad];
[self installUI];
self.backBtn = [UIButton new];
[self.view addSubview:self.backBtn];
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
[self.backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside];
}
-(void)installUI{
self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
MSWeakWebViewScriptMessageDelegate *weakScriptMessageDelegate = [[MSWeakWebViewScriptMessageDelegate alloc] initWithDelegate:self];
_ms_userContentController = [[WKUserContentController alloc] init];
[_ms_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kMSGetConfig];
@@ -103,6 +111,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
[self.webview.scrollView setBackgroundColor:[UIColor clearColor]];
[self.webview setBackgroundColor:[UIColor clearColor]];
[self.webview setUIDelegate:self];
self.webview.navigationDelegate = self;
//
[self.webview setOpaque:NO];
//
@@ -199,7 +208,6 @@ NSString * const kMSGameLoaded = @"gameLoaded";
NSString *code = gameModel.code ?: @"";
NSString *roomId = [NSString stringWithFormat:@"%ld",roomInfo.uid];
NSString *gameMode = gameModel.gameMode ?: @"";
NSString *language = gameModel.language ?: @"";
NSDictionary *gameConfig = gameModel.gameConfig ?: @{};
int gsp = gameModel.gsp;
// APP
@@ -240,7 +248,19 @@ NSString * const kMSGameLoaded = @"gameLoaded";
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
}
-(void)backBtnAction{
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.message = YMLocalizedString(@"MSRoomGameWebVC0");
config.actionStyle = TTAlertActionBothStyle;
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
[self willMoveToParentViewController:nil]; //1
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
} cancelHandler:^{
}];
}
//
- (void) gameRecharge:(NSDictionary*)args
{
@@ -257,14 +277,22 @@ NSString * const kMSGameLoaded = @"gameLoaded";
}];
}
//
- (void) gameLoaded:(NSDictionary*)args
{
NSLog(@"BSGAME %s","游戏调⽤gameLoaded");
// TODO
[self.backBtn removeFromSuperview];
}
//
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
//progressView
}
//
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
//progressView
}
@end