修改h5bug

This commit is contained in:
2026-05-29 16:21:57 +08:00
parent 8096cdfc50
commit 9899ec87a5
2 changed files with 33 additions and 30 deletions
+11 -11
View File
@@ -574,18 +574,18 @@ namespace DontConfuse
} }
EndLoop: Debug.Log(""); EndLoop: Debug.Log("");
// if (click_card) if (click_card)
// { {
// if (orthoCamera == null) orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>(); if (orthoCamera == null) orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
// Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height)); Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height));
// RaycastHit hit; RaycastHit hit;
// int layerMask = 1 << 6; int layerMask = 1 << 6;
// if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask)) if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
// { {
// // GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name); GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name);
// } }
// } }
} }
} }
+22 -19
View File
@@ -150,13 +150,13 @@
[self.window.rootViewController.view addSubview:custom]; [self.window.rootViewController.view addSubview:custom];
//
UnityFramework *unityFramework = [UnityFramework getInstance]; // UnityFramework *unityFramework = [UnityFramework getInstance];
UnityAppController *appController = [unityFramework appController]; // UnityAppController *appController = [unityFramework appController];
//
// 获取 Unity 根节点视图 // // 获取 Unity 根节点视图
UIView *unityRootView = [appController rootView]; // UIView *unityRootView = [appController rootView];
unityRootView.alpha=0.2; // unityRootView.alpha=0.2;
} }
-(void)initWebview:(int)type{ -(void)initWebview:(int)type{
@@ -307,7 +307,7 @@
[self addSubview:webviews[type]]; [self addSubview:webviews[type]];
webviews[type].allowsLinkPreview = NO; webviews[type].allowsLinkPreview = NO;
[self insertSubview:webviews[type] atIndex:0]; [self insertSubview:webviews[type] atIndex:0];
webviews[type] .alpha=0.5; // webviews[type] .alpha=0.5;
// if(type==2){ // if(type==2){
// webview_1 = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration]; // webview_1 = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration];
@@ -520,7 +520,7 @@
UnitySendMessage("WebviewManager", "H5AutoRefresh", [msg UTF8String]); UnitySendMessage("WebviewManager", "H5AutoRefresh", [msg UTF8String]);
Dark_stopRefeshTimes[i]=@(0); 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)); 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); //NSLog(@"Hit point11111112 x: %f, y:%f", hitTestLocation.x, hitTestLocation.y);
[self checkPointInsideBtn:hitTestLocation]; [self checkPointInsideBtn:hitTestLocation];
[self delayInvoke:0.3 cb:^(void){ self->canCheckTouch = YES; }];//加个定时器来防止出发多次检测点击 [self delayInvoke:0.3 cb:^(void){ self->canCheckTouch = YES; }];//加个定时器来防止出发多次检测点击
@@ -1067,7 +1067,7 @@
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
NSString *jsCode = [NSString stringWithFormat:@"%f|%f",hitTestLocation.x/screenWidth, hitTestLocation.y/screenHeight]; NSString *jsCode = [NSString stringWithFormat:@"%f|%f",hitTestLocation.x/screenWidth, hitTestLocation.y/screenHeight];
if (dark_though){ 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]); UnitySendMessage("WebviewManager", "TouchClickPoint",[jsCode UTF8String]);
} }
@@ -1090,13 +1090,14 @@
UIView* touchedView; UIView* touchedView;
int click_web=0; int click_web=0;
if(!dark_though){ if(!dark_though||!is_gift){
touchedView=[super hitTest:point withEvent:event]; touchedView=[super hitTest:point withEvent:event];
} }
else{ else{
// NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", web_through_array[0]); // NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", web_through_array[0]);
// NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", web_through_array[1]); // NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", web_through_array[1]);
// //
// NSLog(@"[ggggggggggggggggggg21:");
float random_ = arc4random_uniform(100) ; float random_ = arc4random_uniform(100) ;
int add_value=0; int add_value=0;
// random_=0;//zhushi // random_=0;//zhushi
@@ -1133,8 +1134,10 @@
// [self.webView2 addGestureRecognizer:tapGesture]; // [self.webView2 addGestureRecognizer:tapGesture];
if(!is_gift){
if(is_transparent&&dark_though){//暗穿透 return nil;
}
else if(is_transparent&&dark_though){//暗穿透
float random3 = arc4random_uniform(100) ; float random3 = arc4random_uniform(100) ;
// NSLog(@"eeeeeeeeeeeeeeeeeee%i",dark_though_rate); // 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){ if(strlen(darkWVDailyrefreshtimes_str) != 0){
NSLog(@"每日刷新: %s", darkWVDailyrefreshtimes_str); // NSLog(@"每日刷新: %s", darkWVDailyrefreshtimes_str);
NSString *objcString = [NSString stringWithUTF8String:darkWVDailyrefreshtimes_str]; NSString *objcString = [NSString stringWithUTF8String:darkWVDailyrefreshtimes_str];
NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; NSArray *stringArray = [objcString componentsSeparatedByString:@"|"];
NSMutableArray *intArray = [NSMutableArray array]; NSMutableArray *intArray = [NSMutableArray array];
@@ -1365,7 +1368,7 @@
// [webviews addObject:[NSNull null]]; // [webviews addObject:[NSNull null]];
WKWebView *wv = [[WKWebView alloc] initWithFrame:CGRectZero]; WKWebView *wv = [[WKWebView alloc] initWithFrame:CGRectZero];
[webviews addObject:wv]; [webviews addObject:wv];
NSLog(@"hhhhhhhhhhhh添加了一次%d",type_); // NSLog(@"hhhhhhhhhhhh添加了一次%d",type_);
}//判断是否为多webview显示 }//判断是否为多webview显示
} }
} }
@@ -1410,7 +1413,7 @@
//设置view的padding //设置view的padding
-(void)setViewPadding:(CGRect)rect{ -(void)setViewPadding:(CGRect)rect{
CGRect screenRect = [[UIScreen mainScreen] bounds]; 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 left = rect.origin.x;
float top = rect.origin.y*screenRect.size.height; float top = rect.origin.y*screenRect.size.height;
@@ -1498,7 +1501,7 @@
// NSLog(@"Inside flyBtn"); // NSLog(@"Inside flyBtn");
//避免手指按下立马出发点击事件 //避免手指按下立马出发点击事件
[self delayInvoke:0.2 cb:^(void){ [self delayInvoke:0.2 cb:^(void){
NSLog(@"Inside flyBtn"); // NSLog(@"Inside flyBtn");
if(self->isShowFlyBtn) if(self->isShowFlyBtn)
{ {
UnitySendMessage("WebviewManager", "ObjC_TouchClick", "flyBtn"); UnitySendMessage("WebviewManager", "ObjC_TouchClick", "flyBtn");