From 9899ec87a596404b039a824088f2233fd013e018 Mon Sep 17 00:00:00 2001 From: changyunjia <905640960@qq.com> Date: Fri, 29 May 2026 16:21:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9h5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/BingoSun/Scripts/WebviewManager.cs | 22 ++++++------ Assets/Plugins/iOS/H5View.m | 41 ++++++++++++----------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/Assets/BingoSun/Scripts/WebviewManager.cs b/Assets/BingoSun/Scripts/WebviewManager.cs index 9494a87..32c333e 100644 --- a/Assets/BingoSun/Scripts/WebviewManager.cs +++ b/Assets/BingoSun/Scripts/WebviewManager.cs @@ -574,18 +574,18 @@ namespace DontConfuse } EndLoop: Debug.Log(""); - // if (click_card) - // { - // if (orthoCamera == null) orthoCamera = GameObject.Find("GameCamera").GetComponent(); - // Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height)); - // RaycastHit hit; - // int layerMask = 1 << 6; + if (click_card) + { + if (orthoCamera == null) orthoCamera = GameObject.Find("GameCamera").GetComponent(); + Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height)); + RaycastHit hit; + int layerMask = 1 << 6; - // if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask)) - // { - // // GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name); - // } - // } + if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask)) + { + GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name); + } + } } } diff --git a/Assets/Plugins/iOS/H5View.m b/Assets/Plugins/iOS/H5View.m index a1bf5fa..e7a86e6 100644 --- a/Assets/Plugins/iOS/H5View.m +++ b/Assets/Plugins/iOS/H5View.m @@ -150,13 +150,13 @@ [self.window.rootViewController.view addSubview:custom]; - - UnityFramework *unityFramework = [UnityFramework getInstance]; - UnityAppController *appController = [unityFramework appController]; - - // 获取 Unity 根节点视图 - UIView *unityRootView = [appController rootView]; - unityRootView.alpha=0.2; +// +// UnityFramework *unityFramework = [UnityFramework getInstance]; +// UnityAppController *appController = [unityFramework appController]; +// +// // 获取 Unity 根节点视图 +// UIView *unityRootView = [appController rootView]; +// unityRootView.alpha=0.2; } -(void)initWebview:(int)type{ @@ -307,7 +307,7 @@ [self addSubview:webviews[type]]; webviews[type].allowsLinkPreview = NO; [self insertSubview:webviews[type] atIndex:0]; - webviews[type] .alpha=0.5; + // webviews[type] .alpha=0.5; // if(type==2){ // webview_1 = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration]; @@ -520,7 +520,7 @@ UnitySendMessage("WebviewManager", "H5AutoRefresh", [msg UTF8String]); Dark_stopRefeshTimes[i]=@(0); dark_webview_random_refresh_times[i]=@([dark_H5Refreshtime[i*2] intValue] + arc4random_uniform([dark_H5Refreshtime[i*2+1] intValue] - [dark_H5Refreshtime[i*2] intValue] + 1)); -// NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_webview_random_refresh_times[0] intValue]); + // NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_webview_random_refresh_times[0] intValue]); // @@ -1058,7 +1058,7 @@ // } // - if (canCheckTouch){ + if (canCheckTouch&&is_gift){ //NSLog(@"Hit point11111112 x: %f, y:%f", hitTestLocation.x, hitTestLocation.y); [self checkPointInsideBtn:hitTestLocation]; [self delayInvoke:0.3 cb:^(void){ self->canCheckTouch = YES; }];//加个定时器来防止出发多次检测点击 @@ -1067,7 +1067,7 @@ CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; NSString *jsCode = [NSString stringWithFormat:@"%f|%f",hitTestLocation.x/screenWidth, hitTestLocation.y/screenHeight]; if (dark_though){ - // NSLog(@"Hit point1111113 x: %f, y:%f", hitTestLocation.x, hitTestLocation.y); + // NSLog(@"Hit point1111113 x: %f, y:%f", hitTestLocation.x, hitTestLocation.y); UnitySendMessage("WebviewManager", "TouchClickPoint",[jsCode UTF8String]); } @@ -1090,13 +1090,14 @@ UIView* touchedView; int click_web=0; - if(!dark_though){ + if(!dark_though||!is_gift){ touchedView=[super hitTest:point withEvent:event]; } else{ // NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", web_through_array[0]); // NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", web_through_array[1]); // + // NSLog(@"[ggggggggggggggggggg21:"); float random_ = arc4random_uniform(100) ; int add_value=0; // random_=0;//zhushi @@ -1133,8 +1134,10 @@ // [self.webView2 addGestureRecognizer:tapGesture]; - - if(is_transparent&&dark_though){//暗穿透 + if(!is_gift){ + return nil; + } + else if(is_transparent&&dark_though){//暗穿透 float random3 = arc4random_uniform(100) ; // NSLog(@"eeeeeeeeeeeeeeeeeee%i",dark_though_rate); @@ -1320,12 +1323,12 @@ } // 打印所有随机结果 - NSLog(@"随机刷新时间数组: %@", dark_webview_random_refresh_times); + // NSLog(@"随机刷新时间数组: %@", dark_webview_random_refresh_times); } } if(strlen(darkWVDailyrefreshtimes_str) != 0){ - NSLog(@"每日刷新: %s", darkWVDailyrefreshtimes_str); + // NSLog(@"每日刷新: %s", darkWVDailyrefreshtimes_str); NSString *objcString = [NSString stringWithUTF8String:darkWVDailyrefreshtimes_str]; NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; NSMutableArray *intArray = [NSMutableArray array]; @@ -1365,7 +1368,7 @@ // [webviews addObject:[NSNull null]]; WKWebView *wv = [[WKWebView alloc] initWithFrame:CGRectZero]; [webviews addObject:wv]; - NSLog(@"hhhhhhhhhhhh添加了一次%d",type_); + // NSLog(@"hhhhhhhhhhhh添加了一次%d",type_); }//判断是否为多webview显示 } } @@ -1410,7 +1413,7 @@ //设置view的padding -(void)setViewPadding:(CGRect)rect{ CGRect screenRect = [[UIScreen mainScreen] bounds]; - NSLog(@"screenRect h:%f", screenRect.size.height); + // NSLog(@"screenRect h:%f", screenRect.size.height); float left = rect.origin.x; float top = rect.origin.y*screenRect.size.height; @@ -1498,7 +1501,7 @@ // NSLog(@"Inside flyBtn"); //避免手指按下立马出发点击事件 [self delayInvoke:0.2 cb:^(void){ - NSLog(@"Inside flyBtn"); + // NSLog(@"Inside flyBtn"); if(self->isShowFlyBtn) { UnitySendMessage("WebviewManager", "ObjC_TouchClick", "flyBtn");