修正摩天轮玩法点击只能退出问题:

1. 针对混淆做了方法调用修改
2. 退出按钮增加移除时机
This commit is contained in:
eggmanQQQ
2024-06-10 16:10:15 +08:00
parent 8123b81811
commit 78b43c70dd
2 changed files with 19 additions and 19 deletions

View File

@@ -72,14 +72,18 @@ NSString * const kMSGameLoaded = @"gameLoaded";
- (void)viewDidLoad {
[super viewDidLoad];
[self installUI];
[self setupBackButton];
}
- (void)setupBackButton {
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];
@@ -149,12 +153,14 @@ NSString * const kMSGameLoaded = @"gameLoaded";
[self.webview evaluateJavaScript:jsMethods completionHandler:^(id
_Nullable resp, NSError * _Nullable error) {
NSLog(@"error = %@ , response = %@",error, resp);
[self.backBtn removeFromSuperview];
}];
} else {
NSString *jsMethods = [NSString stringWithFormat:@"%@({})", method];
[self.webview evaluateJavaScript:jsMethods completionHandler:^(id
_Nullable resp, NSError * _Nullable error) {
NSLog(@"error = %@ , response = %@",error, resp);
[self.backBtn removeFromSuperview];
}];
}
@@ -185,19 +191,22 @@ NSString * const kMSGameLoaded = @"gameLoaded";
{
NSString* method = [NSString stringWithFormat:@"%@:", message.name];
NSDictionary *dicBody = [self dictionaryWithJsonString:message.body];
SEL selector = NSSelectorFromString(method);
if([self respondsToSelector:selector]){
//使
[self performSelector:selector withObject:dicBody];
}else{
if ([message.name isEqualToString:kMSGetConfig]) {
[self getConfig:dicBody];
} else if ([message.name isEqualToString:kMSDestroy]) {
[self destroy:dicBody];
} else if ([message.name isEqualToString:kMSGameLoaded]) {
[self gameLoaded:dicBody];
} else if ([message.name isEqualToString:kMSGameRecharge]) {
[self gameRecharge:dicBody];
} else {
NSLog(@"未实现⽅法 : %@ --> %@", message.name, message.body);
}
}
//
- (void) getConfig:(NSDictionary*)args
{
NSLog(@"BSGAME %s","游戏调⽤getConfig");
NSString* method = [args objectForKey:@"jsCallback"];
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
@@ -283,16 +292,7 @@ NSString * const kMSGameLoaded = @"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