From de79f5760a855c2e892e134418e3c6cac761ab1f Mon Sep 17 00:00:00 2001 From: changyunjia <905640960@qq.com> Date: Thu, 28 May 2026 18:03:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9h5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Plugins/iOS/H5View.m | 1336 +++++++++-------- .../Manager/UnityManager/WebviewManager.cs | 215 ++- Assets/Scripts/SavaData/SaveData.cs | 2 +- .../Define/Model/Config/Game/GameUrlsModel.cs | 4 + 4 files changed, 889 insertions(+), 668 deletions(-) diff --git a/Assets/Plugins/iOS/H5View.m b/Assets/Plugins/iOS/H5View.m index 9a6d883..a1bf5fa 100644 --- a/Assets/Plugins/iOS/H5View.m +++ b/Assets/Plugins/iOS/H5View.m @@ -13,8 +13,10 @@ #import @implementation H5View{ - WKWebView * webview; - WKWebView * webview_1; + // WKWebView * webview; + // WKWebView * webview_1; + NSMutableArray *webviews; + CircularProgressBar* bar; //奖励按钮进度条 UIView * flyBtn; //飞行奖励按钮节点,也可以用UIButton但要屏蔽事件 UIImageView* flyBg; //飞行奖励闪光背景 @@ -34,19 +36,19 @@ BOOL is_first_btn; //是否是第一次生成网页按钮 int flyCtRate;//飞行按钮穿透概率 float stopTouchTime; - + int otherH5switch; //是否自动刷h5界面 int H5Refreshtime; //h5刷新默认间隔时间 int Dailyrefreshtimes; //每天h5剩余刷新次数 UIScrollView *scrollView; BOOL is_transparent; BOOL dark_though; - NSMutableArray * dark_though_rate; - NSMutableArray * dark_though_rate_1; - float Dark_stopRefeshTime; - float Dark_stopRefeshTime_1; + // float Dark_stopRefeshTime; + // float Dark_stopRefeshTime_1; + NSMutableArray *Dark_stopRefeshTimes; + NSMutableArray *dark_H5Refreshtime; //h5刷新默认间隔时间 NSMutableArray *dark_Dailyrefreshtimes; //每天h5剩余刷新次数 NSMutableArray *dark_url_array; @@ -62,16 +64,16 @@ BOOL isShowFlyBtn; BOOL isShowRewardBtn; - BOOL isMultiView; + int isMultiView; float top_; float height_; BOOL is_gift; - int offset_y; - int offset_y1; - -// UITapGestureRecognizer *tapGesture; -// UITapGestureRecognizer *tapGesture_1; + // int offset_y; + // int offset_y1; + NSMutableArray *offset_y; + // UITapGestureRecognizer *tapGesture; + // UITapGestureRecognizer *tapGesture_1; BOOL in_game; NSMutableArray *web_through_array; @@ -84,19 +86,16 @@ BOOL webview_1_IsCLickAd; -// float web_1_through_time; -// float web_2_through_time; + // float web_1_through_time; + // float web_2_through_time; + NSMutableArray *web_through_times; + // int dark_webview1_random_refresh_time; + // int dark_webview2_random_refresh_time; + NSMutableArray *dark_webview_random_refresh_times; - int dark_webview1_random_refresh_time; - int dark_webview2_random_refresh_time; - - BOOL webview_state; - BOOL webview_1_state; - - - -// float web_1_disable_time; -// float web_2_disable_time; + // float web_1_disable_time; + // float web_2_disable_time; + NSMutableArray *web_disable_times; } @@ -105,168 +104,187 @@ +(id) shared{ static H5View *view = nil; static dispatch_once_t onceToken; - + dispatch_once(&onceToken, ^{view = [[self alloc] init];}); - + return view; } //初始化页面 -(void)initView{ if (inited)return; - - + + [self initFlyBtn]; [self setHidden:YES]; //默认为隐藏状态 [self hideView]; canCheckTouch = true; inited = true; - Dark_stopRefeshTime=0; - Dark_stopRefeshTime_1=0; + // Dark_stopRefeshTime=0; + // Dark_stopRefeshTime_1=0; dark_though_rate= [NSMutableArray array]; - dark_though_rate_1= [NSMutableArray array]; - [dark_though_rate addObject:@0]; - [dark_though_rate addObject:@0]; - [dark_though_rate_1 addObject:@0]; - [dark_though_rate_1 addObject:@0]; -// NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.1 -// target:self -// selector:@selector(timerAction:) -// userInfo:nil -// repeats:YES]; - NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1 + dark_webview_random_refresh_times = [NSMutableArray array]; + web_through_times= [NSMutableArray array]; + web_disable_times= [NSMutableArray array]; + Dark_stopRefeshTimes= [NSMutableArray array]; + webviews= [NSMutableArray array]; + offset_y=[NSMutableArray array]; + // NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.1 + // target:self + // selector:@selector(timerAction:) + // userInfo:nil + // repeats:YES]; + NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(timerAction:) userInfo:nil repeats:YES]; - + // 将 timer 添加到 NSRunLoopCommonModes 模式 [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; - + CustomView *custom = [[CustomView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)]; custom.backgroundColor = [UIColor clearColor]; custom.userInteractionEnabled=YES; - + [self.window.rootViewController.view addSubview:custom]; - + UnityFramework *unityFramework = [UnityFramework getInstance]; UnityAppController *appController = [unityFramework appController]; - + // 获取 Unity 根节点视图 -// UIView *unityRootView = [appController rootView]; -// unityRootView.alpha=0.2; + UIView *unityRootView = [appController rootView]; + unityRootView.alpha=0.2; } -(void)initWebview:(int)type{ - NSLog(@"kkkkkkkkkkkkkkkkkkkkkk%d",type); - if(type==2&&!isMultiView) return; - if (webview != nil) { - // 移除WebView的委托 - if(type==1){ - webview.navigationDelegate = nil; - - // 停止加载和清理缓存 - [webview stopLoading]; - [webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; - [NSURLCache.sharedURLCache removeAllCachedResponses]; - - // 从视图层次结构中移除WebView - [webview removeFromSuperview]; - webview = nil; - } - - } - if (webview_1 != nil) { - // 移除WebView的委托 - if(type==2){ - webview_1.navigationDelegate = nil; - - // 停止加载和清理缓存 - [webview_1 stopLoading]; - [webview_1 loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; - [NSURLCache.sharedURLCache removeAllCachedResponses]; - - // 从视图层次结构中移除WebView - [webview_1 removeFromSuperview]; - webview_1 = nil; - } - +// NSLog(@"kkkkkkkkkkkkkkkkkkkkkk%d",type); + // if(type==2&&!isMultiView) return; + // if (webview != nil) { // 移除WebView的委托 + // if(type==1){ + // webview.navigationDelegate = nil; + // + // // 停止加载和清理缓存 + // [webview stopLoading]; + // [webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; + // [NSURLCache.sharedURLCache removeAllCachedResponses]; + // + // // 从视图层次结构中移除WebView + // [webview removeFromSuperview]; + // webview = nil; + // } + // + // } + + if( webviews[type]!=nil){ + webviews[type].navigationDelegate = nil; + + // 停止加载和清理缓存 + [webviews[type] stopLoading]; + [webviews[type] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; + [NSURLCache.sharedURLCache removeAllCachedResponses]; + + // 从视图层次结构中移除WebView + [webviews[type] removeFromSuperview]; + webviews[type] = [NSNull null]; + //webviews[type] = nil; } + + // [webviews removeObjectAtIndex:type]; + + + // if (webview_1 != nil) { + // // 移除WebView的委托 + // if(type==2){ + // webview_1.navigationDelegate = nil; + // + // // 停止加载和清理缓存 + // [webview_1 stopLoading]; + // [webview_1 loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; + // [NSURLCache.sharedURLCache removeAllCachedResponses]; + // + // // 从视图层次结构中移除WebView + // [webview_1 removeFromSuperview]; + // webview_1 = nil; + // } + // + // } WKWebViewConfiguration *webViewConfiguration = [[WKWebViewConfiguration alloc] init]; - + if(is_transparent){ webViewConfiguration.allowsInlineMediaPlayback = YES; webViewConfiguration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll; - NSString *css = @"body { -webkit-user-select: none;user-select: none; }"; - NSString *jsCSS = [NSString stringWithFormat:@"var style = document.createElement('style'); style.innerHTML = '%@'; document.head.appendChild(style);", css]; -// NSString *js = -// @"(function() { " -// "var elements = document.querySelectorAll('input, textarea, select'); " -// "elements.forEach(function(element) { " -// "element.disabled = true; " -// "}); " -// "})();" -// " document.addEventListener('touchstart', function(event) {" -// " const target = event.target;" -// " if (target.matches('.ad-class') || target.closest('.ad-class')) {" // 替换 '.ad-class' 为广告元素的实际类名 -// " setTimeout(function() {" -// " const touchCancelEvent = new TouchEvent('touchcancel', {" -// " bubbles: true," -// " cancelable: true," -// " touches: []," -// " targetTouches: []," -// " changedTouches: event.changedTouches," -// " shiftKey: event.shiftKey" -// " });" -// " target.dispatchEvent(touchCancelEvent);" -// " }, 1000);" -// " event.preventDefault();" // 禁用默认触摸事件 -// " }" -// "}, { passive: false });"; + NSString *css = @"body { -webkit-user-select: none; user-select: none; }"; + NSString *jsCSS = [NSString stringWithFormat: + @"var style = document.createElement('style'); " + "style.innerHTML = '%@'; " + "document.head.appendChild(style);", css]; + NSString *js = @"(function() { " - // 禁用所有表单元素 - "var elements = document.querySelectorAll('input, textarea, select'); " - "elements.forEach(function(element) { " - " element.disabled = true; " - "}); " + // 禁用所有表单元素 + "var elements = document.querySelectorAll('input, textarea, select'); " + "elements.forEach(function(element) { " + " element.disabled = true; " + " element.setAttribute('readonly', 'true'); " + "}); " - // 禁用所有音频和视频 - "document.querySelectorAll('audio, video').forEach(function(el) { " - " el.muted = true; " - " el.pause(); " - "}); " + // 拦截 focus,强制失焦,防止输入法弹出 + "document.addEventListener('focusin', function(event) { " + " if (event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA' || event.target.tagName === 'SELECT') { " + " event.target.blur(); " + " } " + "}); " + + // 禁用所有音频和视频 + "document.querySelectorAll('audio, video').forEach(function(el) { " + " el.muted = true; " + " el.pause(); " + "}); " + + // 处理触摸事件,阻止广告类元素的触摸 + "document.addEventListener('touchstart', function(event) { " + " const target = event.target; " + " if (target.matches('.ad-class') || target.closest('.ad-class')) { " + " setTimeout(function() { " + " const touchCancelEvent = new TouchEvent('touchcancel', { " + " bubbles: true, " + " cancelable: true, " + " touches: [], " + " targetTouches: [], " + " changedTouches: event.changedTouches, " + " shiftKey: event.shiftKey " + " }); " + " target.dispatchEvent(touchCancelEvent); " + " }, 1000); " + " event.preventDefault(); " + " } " + "}, { passive: false }); " + + // 监控 DOM 变化,禁用新插入的输入框 + "new MutationObserver(function(mutations) { " + " mutations.forEach(function(mutation) { " + " mutation.addedNodes.forEach(function(node) { " + " if (node.tagName === 'INPUT' || node.tagName === 'TEXTAREA' || node.tagName === 'SELECT') { " + " node.disabled = true; " + " node.setAttribute('readonly', 'true'); " + " node.blur(); " + " } " + " }); " + " }); " + "}).observe(document.body, { childList: true, subtree: true }); " - // 处理触摸事件,阻止广告类元素的触摸 - "document.addEventListener('touchstart', function(event) {" - " const target = event.target;" - " if (target.matches('.ad-class') || target.closest('.ad-class')) {" // 替换 '.ad-class' 为广告元素的实际类名 - " setTimeout(function() {" - " const touchCancelEvent = new TouchEvent('touchcancel', {" - " bubbles: true," - " cancelable: true," - " touches: []," - " targetTouches: []," - " changedTouches: event.changedTouches," - " shiftKey: event.shiftKey" - " });" - " target.dispatchEvent(touchCancelEvent);" - " }, 1000);" - " event.preventDefault();" // 禁用默认触摸事件 - " }" - "}, { passive: false });" "})();"; NSString *combinedJS = [NSString stringWithFormat:@"%@ %@", jsCSS, js]; + + + + - - - - - WKUserScript *userScript = [[WKUserScript alloc] initWithSource:combinedJS injectionTime:WKUserScriptInjectionTimeAtDocumentEnd @@ -275,38 +293,51 @@ [webViewConfiguration.userContentController addUserScript:userScript]; } - - - if(type==1) { - webview = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration]; - [self addSubview:webview]; - webview.allowsLinkPreview = NO; - [self insertSubview:webview atIndex:0]; -// webview .alpha=0.5; + + + // if(type==1) { + // webview = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration]; + // [self addSubview:webview]; + // webview.allowsLinkPreview = NO; + // [self insertSubview:webview atIndex:0]; + // // webview .alpha=0.5; + // } + + webviews[type] = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration]; + [self addSubview:webviews[type]]; + webviews[type].allowsLinkPreview = NO; + [self insertSubview:webviews[type] atIndex:0]; + webviews[type] .alpha=0.5; + + // if(type==2){ + // webview_1 = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration]; + // [self addSubview:webview_1]; + // webview_1.allowsLinkPreview = NO; + // [self insertSubview:webview_1 atIndex:0]; + // } + + for (NSInteger i = 0; i < webviews.count; i++) { + webviews[i].navigationDelegate=self; + webviews[i].UIDelegate = self; } - if(type==2){ - webview_1 = [[WKWebView alloc] initWithFrame:self.frame configuration:webViewConfiguration]; - [self addSubview:webview_1]; - webview_1.allowsLinkPreview = NO; - [self insertSubview:webview_1 atIndex:0]; - } - webview.navigationDelegate=self; - webview_1.navigationDelegate=self; -// webview.tag = 1; -// webview_1.tag = 2; - webview.UIDelegate=self; - webview_1.UIDelegate=self; + + // webviews[type].navigationDelegate=self; + // webview_1.navigationDelegate=self; + // webview.tag = 1; + // webview_1.tag = 2; + // webviews[type].UIDelegate=self; + // webview_1.UIDelegate=self; // 将WebView添加到当前视图的最后面 - // [self insertSubview:webview atIndex:0]; + // [self insertSubview:webview atIndex:0]; // 将WebView添加到当前视图的最后面 //[self insertSubview:webview_1 atIndex:1]; - - + + // if (webview.superview == nil) // [self ChangeViewRect:!is_transparent]; - // [self showWebview:@"https://baidu.com"]; - + // [self showWebview:@"https://baidu.com"]; + } //- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message { @@ -331,27 +362,27 @@ //当前view的显/隐 -(void)showView:(BOOL)show{ - + if (!show){ [self hideView]; }else{ //[self setHidden:NO]; - - // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu1----%d", inH5ui); + + // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu1----%d", inH5ui); if(!inH5ui) return; - // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu2----%d", show); + // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu2----%d", show); if(is_transparent){ - webview.hidden=YES; + webviews[0].hidden=YES; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@""] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; - [webview loadRequest:request]; + [webviews[0] loadRequest:request]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayShowH5) object:nil]; [self performSelector:@selector(delayShowH5) withObject:nil afterDelay:1.5]; } - - + + [self.superview bringSubviewToFront:self]; - + is_transparent=NO; if (isShowRewardBtn) { [rewardBtn setHidden:NO]; @@ -364,47 +395,65 @@ [self startFlyAnim]; //每一次显示时强行执行飞行按钮的动画 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { self .alpha=1; - } + } } } //隐藏view -(void)hideView{ [self stopUpdate]; - + if(!is_transparent){ - webview.hidden=YES; - webview_1.hidden=YES; + + // webview.hidden=YES; + // webview_1.hidden=YES; + + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@""] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; - [webview loadRequest:request]; - [webview_1 loadRequest:request]; + // [webview loadRequest:request]; + // [webview_1 loadRequest:request]; + for (NSInteger i = 0; i < webviews.count; i++) { + webviews[i].hidden = YES; + [ webviews[i] loadRequest:request]; + } [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayShowH5) object:nil]; [self performSelector:@selector(delayShowH5) withObject:nil afterDelay:0.5]; } is_transparent=YES; - + [self.superview sendSubviewToBack:self]; - + self.userInteractionEnabled=TRUE; [flyBtn setHidden:YES]; [rewardBtn setHidden:YES]; - Dark_stopRefeshTime=0; - Dark_stopRefeshTime_1=0; - [self showDarkWebview:1]; - [self showDarkWebview:2]; + // Dark_stopRefeshTime=0; + // Dark_stopRefeshTime_1=0; + for (NSInteger i = 0; i < Dark_stopRefeshTimes.count; i++) { + Dark_stopRefeshTimes[i]=@(0); + } + + + for (NSInteger i = 0; i < webviews.count; i++) { + [self showDarkWebview:i]; + } + // [self showDarkWebview:1]; + // [self showDarkWebview:2]; + [self ChangeViewRect:false]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { self .alpha=0; - } - + } } -(void)delayShowH5{ - webview.hidden=NO; - webview_1.hidden=NO; + // webview.hidden=NO; + // webview_1.hidden=NO; + for (NSInteger i = 0; i < webviews.count; i++) { + webviews[i].hidden=NO; + } } -(void)setInH5View:(BOOL)flag{ - // NSLog(@"aaaaaaaaaaaaaaaaaa%d",flag); + // NSLog(@"aaaaaaaaaaaaaaaaaa%d",flag); inH5ui=flag; } @@ -418,9 +467,9 @@ if( [dark_url_array[counter][0] isEqualToString:myNSString]){ dark_url_array[counter][2]=@(times); - // dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + - break; } } @@ -431,13 +480,13 @@ if( [light_url_array[counter][0] isEqualToString:myNSString]){ light_url_array[counter][2]=@(times); light_though_rate=[light_url_array[counter][3] intValue]; - // NSLog(@"[uuuuuuuuuuuuuuuuu: %s剩余的可刷新次数%u", weblink, times); + // NSLog(@"[uuuuuuuuuuuuuuuuu: %s剩余的可刷新次数%u", weblink, times); break; } } } - - + + } @@ -445,35 +494,63 @@ - (void)timerAction:(NSTimer *)timer { // 定时器触发时执行的操作 - - stopTouchTime+=1; - Dark_stopRefeshTime+=1; - Dark_stopRefeshTime_1+=1; - - + // web_1_through_time+=0.1; + // web_2_through_time+=0.1; + for (NSUInteger i = 0; i < web_through_times.count; i++) { + web_through_times[i] = @([web_through_times[i] floatValue] + 0.1f); + // NSLog(@"[uuuuuuuuuuuuuuuuu未穿透时间: %f",[web_through_times[i] floatValue]); + } + + + stopTouchTime+=0.1; + for (NSInteger i = 0; i < Dark_stopRefeshTimes.count; i++) { + Dark_stopRefeshTimes[i]=@([Dark_stopRefeshTimes[i ] floatValue ] +0.1f); + } + + // Dark_stopRefeshTime+=0.1; + // Dark_stopRefeshTime_1+=0.1; + + if(is_transparent){ + for(NSUInteger i=0;i0&&[Dark_stopRefeshTimes[i] floatValue]>[dark_webview_random_refresh_times[i]intValue]){ + dark_Dailyrefreshtimes[i]=@([dark_Dailyrefreshtimes[i] intValue]-1); + // UnitySendMessage("WebviewManager", "H5AutoRefresh","dark_Dailyrefreshtimes|"+i ); + NSString *msg = [NSString stringWithFormat:@"dark_Dailyrefreshtimes|%d", i]; + 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]); +// - - if([dark_Dailyrefreshtimes[0] intValue]>0&&Dark_stopRefeshTime>dark_webview1_random_refresh_time){ - dark_Dailyrefreshtimes[0]=@([dark_Dailyrefreshtimes[0] intValue]-1); - UnitySendMessage("WebviewManager", "H5AutoRefresh","dark_Dailyrefreshtimes|0" ); - Dark_stopRefeshTime=0; - dark_webview1_random_refresh_time=[dark_H5Refreshtime[0] intValue] + arc4random_uniform([dark_H5Refreshtime[1] intValue] - [dark_H5Refreshtime[0] intValue] + 1); - NSLog(@"hhhhhhhhhhhh3333333kkkk%d",dark_webview1_random_refresh_time); - [self showDarkWebview:1]; - [self ChangeViewRect:false]; + [self showDarkWebview:i]; + [self ChangeViewRect:false]; + } } - if([dark_Dailyrefreshtimes[1] intValue]>0&&Dark_stopRefeshTime_1>dark_webview2_random_refresh_time){ - dark_Dailyrefreshtimes[1]=@([dark_Dailyrefreshtimes[1] intValue]-1); - UnitySendMessage("WebviewManager", "H5AutoRefresh","dark_Dailyrefreshtimes|1" ); - Dark_stopRefeshTime_1=0; - dark_webview2_random_refresh_time=[dark_H5Refreshtime[2] intValue] + arc4random_uniform([dark_H5Refreshtime[3] intValue] - [dark_H5Refreshtime[2] intValue] + 1); - NSLog(@"hhhhhhhhhhhh3333333kkkk%d",dark_webview2_random_refresh_time); - [self showDarkWebview:2]; - [self ChangeViewRect:false]; - } + // if([dark_Dailyrefreshtimes[0]intValue]>0&&Dark_stopRefeshTime>[dark_webview_random_refresh_times [0]intValue]){ + // dark_Dailyrefreshtimes[0]=@([dark_Dailyrefreshtimes[0] intValue]-1); + // UnitySendMessage("WebviewManager", "H5AutoRefresh","dark_Dailyrefreshtimes|0" ); + // Dark_stopRefeshTime=0; + // dark_webview_random_refresh_times[0]=@([dark_H5Refreshtime[0] intValue] + arc4random_uniform([dark_H5Refreshtime[1] intValue] - [dark_H5Refreshtime[0] intValue] + 1)); + // NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_webview_random_refresh_times[0] intValue]); + // + // [self showDarkWebview:0]; + // [self ChangeViewRect:false]; + // } + // + // if([dark_Dailyrefreshtimes[1] intValue]>0&&Dark_stopRefeshTime_1>[dark_webview_random_refresh_times [1]intValue]){ + // dark_Dailyrefreshtimes[1]=@([dark_Dailyrefreshtimes[1] intValue]-1); + // UnitySendMessage("WebviewManager", "H5AutoRefresh","dark_Dailyrefreshtimes|1" ); + // Dark_stopRefeshTime_1=0; + // dark_webview_random_refresh_times[1]=@([dark_H5Refreshtime[2] intValue] + arc4random_uniform([dark_H5Refreshtime[3] intValue] - [dark_H5Refreshtime[2] intValue] + 1)); + // NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_webview_random_refresh_times[1] intValue]); + // [self showDarkWebview:1]; + // [self ChangeViewRect:false]; + // } + + } else{ if(otherH5switch!=1 ) return; @@ -486,7 +563,7 @@ Dailyrefreshtimes--; } } - + } @@ -511,22 +588,22 @@ - (void)yourMethodToCall { if(!is_transparent) { - webview.hidden=NO; + webviews[0].hidden=NO; } - + } //显示webview -(void)showWebview:(NSString*)url{ if (is_transparent) return; //view在隐藏状态下不显示webview,因为目前只需要处理明webview 的显示。 - // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu3----%d"); - [self initWebview:1]; + // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu3----%d"); + [self initWebview:0]; float maxvalue=0; for (int counter = 0; counter < light_url_array.count; counter++) { if([light_url_array[counter][2] intValue]>0 ){ maxvalue+=[light_url_array[counter][1] floatValue]; } - + } float random3 ; float rate=0; @@ -556,16 +633,17 @@ } } } - // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu3----%@",url); + // NSLog(@"xianshimingchuantouuuuuuuuuuuuuu3----%@",url); UnitySendMessage("WebviewManager", "SendH5Event", "test"); stopTouchTime=0; //@"https://tool.lu/timestamp/?ivk_sa=1023231z"@"https://fanyi.baidu.com/ - if(url.length==0) return; + if(url.length!=0) webview_url=url; + else return; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] ]; - [webview loadRequest:request]; + [webviews[0] loadRequest:request]; webview_IsCLickAd=YES; - if (webview.superview == nil) - [self insertSubview:webview atIndex:0]; + if (webviews[0].superview == nil) + [self insertSubview:webviews[0] atIndex:0]; UnitySendMessage("WebviewManager", "H5AutoRefresh",[[url stringByAppendingString:@"|h5"] UTF8String]); } @@ -578,127 +656,167 @@ float maxvalue=0; float random3 ; float rate=0; - if(type==1){ - - for (int counter = 0; counter < dark_url_array.count; counter++) { - if([dark_url_array[counter][2] intValue]>0 ){ - if([dark_url_array[counter][4] intValue]!=1 ) continue; - maxvalue+=[dark_url_array[counter][1] floatValue]; - } - + + + + for (int counter = 0; counter < dark_url_array.count; counter++) { + if([dark_url_array[counter][2] intValue]>0 ){ + if([dark_url_array[counter][4] intValue]!=(type+1) ) continue; + maxvalue+=[dark_url_array[counter][1] floatValue]; } - - if(maxvalue>0){ - random3=arc4random_uniform(maxvalue); - for (int counter = 0; counter < dark_url_array.count; counter++) { - if([dark_url_array[counter][2] intValue]<=0) continue; - if([dark_url_array[counter][4] intValue]!=1 ) continue; - float myFloat = [dark_url_array[counter][1] floatValue]; - - dark_though_rate[0]=@([dark_url_array[counter][3] intValue]); - dark_though_rate[1]=@([dark_url_array[counter][5] intValue]); - rate+=myFloat; - if(random3<=rate){ - url=dark_url_array[counter][0]; - dark_url_array[counter][2]=@([dark_url_array[counter][2] floatValue]-1); - break; - } - } - } - else{ - random3=arc4random_uniform(100); - for (int counter = 0; counter < dark_url_array.count; counter++) { - if([dark_url_array[counter][4] intValue]!=1 ) continue; - float myFloat = [dark_url_array[counter][1] floatValue]; - dark_though_rate[0]=@([dark_url_array[counter][3] intValue]); - dark_though_rate[1]=@([dark_url_array[counter][5] intValue]); - rate+=myFloat; - if(random3<=rate){ - url=dark_url_array[counter][0]; - break; - } - } - } - //url=@"https://wing0107.minigame.vip/";//zhushi - if(url.length!=0) webview_url=url; - else return; - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; - webview_IsCLickAd=NO; - webview_state=!webview_state; - NSLog(@"33333333333333333%d",webview_state); - [webview loadRequest:request]; - - } - else if(type==2){ - if(!isMultiView) return; + + if(maxvalue>0){ + random3=arc4random_uniform(maxvalue); for (int counter = 0; counter < dark_url_array.count; counter++) { - if([dark_url_array[counter][2] intValue]>0 ){ - if([dark_url_array[counter][4] intValue]!=2 ) continue; - maxvalue+=[dark_url_array[counter][1] floatValue]; - } - - } - - rate=0; - if(maxvalue>0){ - random3=arc4random_uniform(maxvalue); - for (int counter = 0; counter < dark_url_array.count; counter++) { - if([dark_url_array[counter][2] intValue]<=0) continue; - if([dark_url_array[counter][4] intValue]!=2 ) continue; - float myFloat = [dark_url_array[counter][1] floatValue]; -// dark_though_rate=[dark_url_array[counter][3] intValue]; - // dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); - dark_though_rate_1[0]=@([dark_url_array[counter][3] intValue]); - dark_though_rate_1[1]=@([dark_url_array[counter][5] intValue]); - - rate+=myFloat; - if(random3<=rate){ - url=dark_url_array[counter][0]; - dark_url_array[counter][2]=@([dark_url_array[counter][2] floatValue]-1); - break; - } + if([dark_url_array[counter][2] intValue]<=0) continue; + if([dark_url_array[counter][4] intValue]!=(type+1) ) continue; + float myFloat = [dark_url_array[counter][1] floatValue]; + dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + rate+=myFloat; + if(random3<=rate){ + url=dark_url_array[counter][0]; + dark_url_array[counter][2]=@([dark_url_array[counter][2] floatValue]-1); + break; } } - else{ - random3=arc4random_uniform(100); - for (int counter = 0; counter < dark_url_array.count; counter++) { - if([dark_url_array[counter][4] intValue]!=2 ) continue; - float myFloat = [dark_url_array[counter][1] floatValue]; - // dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); - dark_though_rate_1[0]=@([dark_url_array[counter][3] intValue]); - dark_though_rate_1[1]=@([dark_url_array[counter][5] intValue]); - rate+=myFloat; - if(random3<=rate){ - url=dark_url_array[counter][0]; - break; - } - } - } - - - if(url.length!=0) webview_1_url=url; - else return; - NSMutableURLRequest *request_1 = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] ]; - webview_1_IsCLickAd=NO; - webview_1_state=!webview_1_state; - [webview_1 loadRequest:request_1]; - // NSLog(@"333333333333333331%@",url); } - + else{ + random3=arc4random_uniform(100); + for (int counter = 0; counter < dark_url_array.count; counter++) { + if([dark_url_array[counter][4] intValue]!=(type+1) ) continue; + float myFloat = [dark_url_array[counter][1] floatValue]; + dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + rate+=myFloat; + if(random3<=rate){ + url=dark_url_array[counter][0]; + break; + } + } + } + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; + if(url.length!=0) webview_url=url; + else return; + // NSLog(@"33333333333333333%@",url); + webview_IsCLickAd=NO; + [webviews[type] loadRequest:request]; + + + + + + // + // if(type==1){ + // + // for (int counter = 0; counter < dark_url_array.count; counter++) { + // if([dark_url_array[counter][2] intValue]>0 ){ + // if([dark_url_array[counter][4] intValue]!=1 ) continue; + // maxvalue+=[dark_url_array[counter][1] floatValue]; + // } + // + // } + // + // if(maxvalue>0){ + // random3=arc4random_uniform(maxvalue); + // for (int counter = 0; counter < dark_url_array.count; counter++) { + // if([dark_url_array[counter][2] intValue]<=0) continue; + // if([dark_url_array[counter][4] intValue]!=1 ) continue; + // float myFloat = [dark_url_array[counter][1] floatValue]; + // dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + // rate+=myFloat; + // if(random3<=rate){ + // url=dark_url_array[counter][0]; + // dark_url_array[counter][2]=@([dark_url_array[counter][2] floatValue]-1); + // break; + // } + // } + // } + // else{ + // random3=arc4random_uniform(100); + // for (int counter = 0; counter < dark_url_array.count; counter++) { + // if([dark_url_array[counter][4] intValue]!=1 ) continue; + // float myFloat = [dark_url_array[counter][1] floatValue]; + // dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + // rate+=myFloat; + // if(random3<=rate){ + // url=dark_url_array[counter][0]; + // break; + // } + // } + // } + // NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; + // if(url.length!=0) webview_url=url; + // else return; + // // NSLog(@"33333333333333333%@",url); + // webview_IsCLickAd=NO; + // [webview loadRequest:request]; + // + // + // + // } + // else if(type==2){ + // // if(!isMultiView) return; + // for (int counter = 0; counter < dark_url_array.count; counter++) { + // if([dark_url_array[counter][2] intValue]>0 ){ + // if([dark_url_array[counter][4] intValue]!=2 ) continue; + // maxvalue+=[dark_url_array[counter][1] floatValue]; + // } + // + // } + // + // rate=0; + // if(maxvalue>0){ + // random3=arc4random_uniform(maxvalue); + // for (int counter = 0; counter < dark_url_array.count; counter++) { + // if([dark_url_array[counter][2] intValue]<=0) continue; + // if([dark_url_array[counter][4] intValue]!=2 ) continue; + // float myFloat = [dark_url_array[counter][1] floatValue]; + // // dark_though_rate=[dark_url_array[counter][3] intValue]; + // dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + // rate+=myFloat; + // if(random3<=rate){ + // url=dark_url_array[counter][0]; + // dark_url_array[counter][2]=@([dark_url_array[counter][2] floatValue]-1); + // break; + // } + // } + // } + // else{ + // random3=arc4random_uniform(100); + // for (int counter = 0; counter < dark_url_array.count; counter++) { + // if([dark_url_array[counter][4] intValue]!=2 ) continue; + // float myFloat = [dark_url_array[counter][1] floatValue]; + // dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]); + // rate+=myFloat; + // if(random3<=rate){ + // url=dark_url_array[counter][0]; + // break; + // } + // } + // } + // + // + // if(url.length!=0) webview_1_url=url; + // else return; + // NSMutableURLRequest *request_1 = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] ]; + // webview_1_IsCLickAd=NO; + // [webview_1 loadRequest:request_1]; + // // NSLog(@"333333333333333331%@",url); + // } + UnitySendMessage("WebviewManager", "H5AutoRefresh",[[url stringByAppendingString:@"|h6"] UTF8String]); } //隐藏webview -(void)hideWebview{ - [webview removeFromSuperview]; + [webviews[0] removeFromSuperview]; } //设置飞行进度条进度 -(void)setIconProgress:(float)value{ [bar setProgress:value]; - // NSLog(@"bbbbbbbbbbbbbbbbbbbbb%f",value); + // NSLog(@"bbbbbbbbbbbbbbbbbbbbb%f",value); if(value>=1){ UnitySendMessage("WebviewManager", "TouchClickPoint", "finish"); } @@ -727,7 +845,7 @@ points[1] = CGPointMake(-20,sh * 0.25); points[2] = CGPointMake(sw - flyBtn.frame.size.width+20,sh * 0.5); points[3] = CGPointMake(-20,sh - 220); - + } //执行飞行按钮的动画 @@ -743,13 +861,13 @@ flyBtn.transform = CGAffineTransformMakeTranslation(points[0].x, points[0].y); pointIndex = 0; [self flyAnim]; -// float random3 = arc4random_uniform(100) ; -// if(random31) + { + + if(random3< [dark_though_rate[click_web] intValue]){ + // NSLog(@"触发点击:%f",web_1_through_time); + // NSLog(@"eeeeeeeeeeeeeeeeeee:%f",web_1_disable_time); + if ([web_through_times[click_web] floatValue] < 0) { + // NSLog(@"触发点击,时间小于0:%f",web_1_through_time); + return touchedView; } - else{ - if(random3< [dark_though_rate[1] intValue]){ - return touchedView; - } - else return nil; + else if([web_through_times[click_web] floatValue] <[web_disable_times[click_web] floatValue] ){ + // NSLog(@"触发点击,时间小于停用时间:%f",web_1_through_time); + // webview.userInteractionEnabled = NO; + // [self delayInvoke:0.2 cb:^(void){ webview.userInteractionEnabled = YES; }]; + + return nil; + } + else { + // web_1_disable_time=[ClickAddtime[0] floatValue] + ([ClickAddtime[1] floatValue] - [ClickAddtime[0] floatValue]) * drand48(); + web_disable_times[click_web]=@([ClickAddtime[click_web] floatValue]); + web_through_times[click_web] =@(-0.05); + // NSLog(@"触发点击,时间设置为-0.5:%f",web_1_through_time); + return touchedView; } - - } - else{ - if(webview_1_state){ - if(random3< [dark_though_rate_1[0] intValue]){ - return touchedView; - - } - else return nil; - } - else{ - if(random3< [dark_though_rate_1[1] intValue]){ - return touchedView; - - } - else return nil; - } - } + else return nil; + + + + + // if(click_web==1){ + // if(random3< [dark_though_rate[0] intValue]){ + // // NSLog(@"触发点击:%f",web_1_through_time); + // // NSLog(@"eeeeeeeeeeeeeeeeeee:%f",web_1_disable_time); + // if(web_1_through_time<0){ + // // NSLog(@"触发点击,时间小于0:%f",web_1_through_time); + // return touchedView; + // } + // else if(web_1_through_time100||([urlString rangeOfString:@"adclick" options:NSCaseInsensitiveSearch].location != NSNotFound || - [urlString rangeOfString:@"googleads" options:NSCaseInsensitiveSearch].location != NSNotFound))){ - if(!webview_IsCLickAd) { - NSLog(@"网页开始加载: %@", webView.URL.absoluteString); - NSLog(@"网页开始加载: %@", webview_url); - Dark_stopRefeshTime-=[self randomValueBetween]; - webview_IsCLickAd=YES; - UnitySendMessage("WebviewManager", "ClickAdEvent", [[webview_url stringByAppendingString:@"|h6"] UTF8String]); - } - } - - - - } else if (webView == webview_1) { - BOOL isSameDomain1 = [self areDomainsSameForURL:webview_1_url url2:urlString]; - if(!isSameDomain1&&([urlString length]>100||([urlString rangeOfString:@"adclick" options:NSCaseInsensitiveSearch].location != NSNotFound || - [urlString rangeOfString:@"googleads" options:NSCaseInsensitiveSearch].location != NSNotFound))){ - if(!webview_1_IsCLickAd) { - NSLog(@"网页开始加载-1: %@", webView.URL.absoluteString); - NSLog(@"网页开始加载-1: %@",webview_1_url); - Dark_stopRefeshTime_1-=[self randomValueBetween]; - webview_1_IsCLickAd=YES; - UnitySendMessage("WebviewManager", "ClickAdEvent", [[webview_1_url stringByAppendingString:@"|h6"] UTF8String]); - } - } +- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { + if (navigationAction.navigationType == WKNavigationTypeLinkActivated && !navigationAction.targetFrame.isMainFrame) { + decisionHandler(WKNavigationActionPolicyCancel); + [webView loadRequest:navigationAction.request]; + } else { + decisionHandler(WKNavigationActionPolicyAllow); } - } -- (BOOL)areDomainsSameForURL:(NSString *)urlString1 url2:(NSString *)urlString2 { - NSURL *url1 = [NSURL URLWithString:urlString1]; - NSURL *url2 = [NSURL URLWithString:urlString2]; - - if (!url1 || !url2) { - return NO; // 如果 URL 无效,返回 NO - } - // 提取主域名部分 - NSString *host1 = [url1 host]; - NSString *host2 = [url2 host]; - - // 去掉 "www." 前缀(如果有的话),确保比较时一致 - host1 = [host1 hasPrefix:@"www."] ? [host1 substringFromIndex:4] : host1; - host2 = [host2 hasPrefix:@"www."] ? [host2 substringFromIndex:4] : host2; - - // 提取域名部分 - NSString *mainDomain1 = [self extractMainDomainFromHost:host1]; - NSString *mainDomain2 = [self extractMainDomainFromHost:host2]; - - if(![mainDomain1 isEqualToString:mainDomain2]){ - NSLog(@"网页开始加载-1: %@", mainDomain1); - NSLog(@"网页开始加载-1: %@",mainDomain2); - } - return [mainDomain1 isEqualToString:mainDomain2]; -} -- (NSString *)extractMainDomainFromHost:(NSString *)host { - NSArray *hostComponents = [host componentsSeparatedByString:@"."]; - - if (hostComponents.count >= 2) { - // 获取最后两个部分作为主域名(如 baidu.com) - return [NSString stringWithFormat:@"%@.%@", hostComponents[hostComponents.count - 2], hostComponents[hostComponents.count - 1]]; - } - - return host; // 如果没有有效的主域名,返回原始主机名 -} -//- (BOOL)areDomainsSameForURL:(NSString *)urlString1 url2:(NSString *)urlString2 { -// NSURL *url1 = [NSURL URLWithString:urlString1]; -// NSURL *url2 = [NSURL URLWithString:urlString2]; -// -// // 提取主域名部分 -// NSString *host1 = [url1 host]; -// NSString *host2 = [url2 host]; -// -// // 去掉 "www." 前缀(如果有的话),确保比较时一致 -// host1 = [host1 hasPrefix:@"www."] ? [host1 substringFromIndex:4] : host1; -// host2 = [host2 hasPrefix:@"www."] ? [host2 substringFromIndex:4] : host2; -// -// return [host1 isEqualToString:host2]; -//} - -- (void)addH5Field:(int)field1 field2:(int)field2 field3:(int)field3 field4:(int)field4 field5:(int)field5 field6:(char* )field6 field7:(char* )field7 dark_url:(char*)dark_url light_url:(char*)light_url field8:(BOOL )field8 web_through_probability:(char*)web_through_probability click_add_time:(char*)click_add_time{ +- (void)addH5Field:(int)field1 field2:(int)field2 field3:(int)field3 field4:(int)field4 field5:(int)field5 field6:(char* )darkWVRefreshtime_str field7:(char* )darkWVDailyrefreshtimes_str dark_url:(char*)dark_url light_url:(char*)light_url field8:(BOOL )field8 web_through_probability:(char*)web_through_probability click_add_time:(char*)click_add_time{ // 在这里实现方法 flyCtRate=field1;//飞行道具的穿透概率 otherH5switch=field2; @@ -1198,31 +1281,55 @@ is_gift=field8; //dark_though_rate=field5; -// dark_H5Refreshtime=field6; -// dark_Dailyrefreshtimes=field7; -// NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", dark_H5Refreshtime[0]); - if(strlen(field6) != 0){ - NSString *objcString = [NSString stringWithUTF8String:field6]; - NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; - //NSLog(@"hhhhhhhhhhhh%@",objcString); - NSMutableArray *intArray = [NSMutableArray array]; - - for (NSString *str in stringArray) { - [intArray addObject:@([str intValue])]; + // dark_H5Refreshtime=field6; + // dark_Dailyrefreshtimes=field7; + // NSLog(@"[ggggggggggggggggggg21: %@剩余的可刷新次数", dark_H5Refreshtime[0]); + if(strlen(darkWVRefreshtime_str) != 0){ + // NSString *objcString = [NSString stringWithUTF8String:darkWVRefreshtime_str]; + // NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; + // //NSLog(@"hhhhhhhhhhhh%@",objcString); + // NSMutableArray *intArray = [NSMutableArray array]; + // + // for (NSString *str in stringArray) { + // [intArray addObject:@([str intValue])]; + // } + // + // dark_H5Refreshtime=intArray; + // NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_H5Refreshtime[0] intValue]); + // NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_H5Refreshtime[1] intValue]); + // dark_webview1_random_refresh_time=[dark_H5Refreshtime[0] intValue] + arc4random_uniform([dark_H5Refreshtime[1] intValue] - [dark_H5Refreshtime[0] intValue] + 1); + // dark_webview2_random_refresh_time=[dark_H5Refreshtime[2] intValue] + arc4random_uniform([dark_H5Refreshtime[3] intValue] - [dark_H5Refreshtime[2] intValue] + 1); + // + if (strlen(darkWVRefreshtime_str) != 0) { + NSString *objcString = [NSString stringWithUTF8String:darkWVRefreshtime_str]; + NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; + NSMutableArray *intArray = [NSMutableArray array]; + + for (NSString *str in stringArray) { + [intArray addObject:@([str intValue])]; + } + + dark_H5Refreshtime = intArray; + + // 每两个元素表示一个区间 [low, high] + for (NSInteger i = 0; i + 1 < dark_H5Refreshtime.count; i += 2) { + int low = [dark_H5Refreshtime[i] intValue]; + int high = [dark_H5Refreshtime[i+1] intValue]; + int randomValue = low + arc4random_uniform(high - low + 1); + [dark_webview_random_refresh_times addObject:@(randomValue)]; + } + + // 打印所有随机结果 + NSLog(@"随机刷新时间数组: %@", dark_webview_random_refresh_times); } - - dark_H5Refreshtime=intArray; - NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_H5Refreshtime[0] intValue]); - NSLog(@"hhhhhhhhhhhh3333333kkkk%d",[dark_H5Refreshtime[1] intValue]); - dark_webview1_random_refresh_time=[dark_H5Refreshtime[0] intValue] + arc4random_uniform([dark_H5Refreshtime[1] intValue] - [dark_H5Refreshtime[0] intValue] + 1); - dark_webview2_random_refresh_time=[dark_H5Refreshtime[2] intValue] + arc4random_uniform([dark_H5Refreshtime[3] intValue] - [dark_H5Refreshtime[2] intValue] + 1); - } - if(strlen(field7) != 0){ - NSString *objcString = [NSString stringWithUTF8String:field7]; + if(strlen(darkWVDailyrefreshtimes_str) != 0){ + + NSLog(@"每日刷新: %s", darkWVDailyrefreshtimes_str); + NSString *objcString = [NSString stringWithUTF8String:darkWVDailyrefreshtimes_str]; NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; NSMutableArray *intArray = [NSMutableArray array]; - + for (NSString *str in stringArray) { [intArray addObject:@([str intValue])]; } @@ -1231,22 +1338,36 @@ if(strlen(dark_url) != 0){ NSString *objcString = [NSString stringWithUTF8String:dark_url]; NSMutableArray *dynamicArray = [NSMutableArray array]; - // NSLog(@"hhhhhhhhhhhh%@",objcString); + // NSLog(@"hhhhhhhhhhhh%@",objcString); NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; for (NSUInteger i = 0; i < [stringArray count]; i++) { //NSLog(@"hhhhhhhhhhhh%@",stringArray[i]); NSArray *stringArray_child = [stringArray[i] componentsSeparatedByString:@"#"]; - + [dynamicArray addObject:stringArray_child]; } dark_url_array=dynamicArray; - - for (int counter = 0; counter < dark_url_array.count; counter++) { - - if([dark_url_array[counter][4] intValue]!=1 ) { - isMultiView=YES; - - }//判断是否为多webview显示 + int type_=-1; + + if(webviews.count<=0){ + isMultiView=0; + for (int counter = 0; counter < dark_url_array.count; counter++) { + + if([dark_url_array[counter][4] intValue]!=type_ ) { + isMultiView++; + type_=[dark_url_array[counter][4] intValue]; + [dark_though_rate addObject:@0]; + + [web_through_times addObject:@0]; + [web_disable_times addObject:@0]; + [Dark_stopRefeshTimes addObject:@0]; + [offset_y addObject:@([dark_url_array[counter][5] intValue])]; + // [webviews addObject:[NSNull null]]; + WKWebView *wv = [[WKWebView alloc] initWithFrame:CGRectZero]; + [webviews addObject:wv]; + NSLog(@"hhhhhhhhhhhh添加了一次%d",type_); + }//判断是否为多webview显示 + } } } if(strlen(light_url) != 0){ @@ -1257,7 +1378,7 @@ for (NSUInteger i = 0; i < [stringArray count]; i++) { //NSLog(@"hhhhhhhhhhhh%@",stringArray[i]); NSArray *stringArray_child = [stringArray[i] componentsSeparatedByString:@"#"]; - + [dynamicArray addObject:stringArray_child]; } light_url_array=dynamicArray; @@ -1266,25 +1387,24 @@ NSString *objcString = [NSString stringWithUTF8String:web_through_probability]; NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; NSMutableArray *intArray = [NSMutableArray array]; - + for (NSString *str in stringArray) { [intArray addObject:@([str intValue])]; } web_through_array=intArray; } if(strlen(click_add_time) != 0){ - NSLog(@"aaaaaaaaaaaaaaaaaattttttt%c",click_add_time); + // NSLog(@"aaaaaaaaaaaaaaaaaattttttt%c",click_add_time); NSString *objcString = [NSString stringWithUTF8String:click_add_time]; NSArray *stringArray = [objcString componentsSeparatedByString:@"|"]; NSMutableArray *intArray = [NSMutableArray array]; - + for (NSString *str in stringArray) { [intArray addObject:@([str floatValue])]; } ClickAddtime=intArray; } - } //设置view的padding @@ -1295,7 +1415,7 @@ float top = rect.origin.y*screenRect.size.height; - // float right = screenRect.size.width - rect.size.width; + // float right = screenRect.size.width - rect.size.width; float bottom = rect.size.height*screenRect.size.height; @@ -1304,25 +1424,31 @@ self.frame = CGRectMake(0, 0,screenRect.size.width, screenRect.size.height); top_=top; height_=h; -// webview.frame = CGRectMake(0, 0, self.frame.size.width/2, self.frame.size.height); -// webview_1.frame = CGRectMake(self.frame.size.width/2, 0, self.frame.size.width/2, self.frame.size.height); + // webview.frame = CGRectMake(0, 0, self.frame.size.width/2, self.frame.size.height); + // webview_1.frame = CGRectMake(self.frame.size.width/2, 0, self.frame.size.width/2, self.frame.size.height); } -(void)ChangeViewRect:(BOOL)is_light{ if(is_light){ - webview.frame = CGRectMake(0, top_, self.frame.size.width, height_); - webview_1.frame = CGRectMake(0, 0,0, 0); + webviews[0].frame = CGRectMake(0, top_, self.frame.size.width, height_); + for(NSUInteger i=1;i1){ + // webview.frame = CGRectMake(0, offset_y, self.frame.size.width, self.frame.size.height); + // webview_1.frame = CGRectMake(0,offset_y1, self.frame.size.width, self.frame.size.height); + // // webview.frame = CGRectMake(0, offset_y, self.frame.size.width-100, self.frame.size.height); + // // webview_1.frame = CGRectMake(100,offset_y1, self.frame.size.width-100, self.frame.size.height); + // } + // else{ + // webview.frame = CGRectMake(0,offset_y, self.frame.size.width, self.frame.size.height); + // webview_1.frame = CGRectMake(0, offset_y1,0, 0); + // } } } @@ -1332,7 +1458,7 @@ } -(void)setViewBtn:(CGRect)rect{ - + if(is_first_btn) return; rewardBtn = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"1"]]; @@ -1352,7 +1478,7 @@ bar.bounds = rewardBtn.bounds; //bar.backgroundColor = UIColor.greenColor; [bar updateUI]; - + [rewardBtn addSubview:bar]; //[self setBackgroundColor:UIColor.orangeColor]; @@ -1362,14 +1488,14 @@ [rewardBtn addSubview:icon]; is_first_btn=true; rewardBtn.hidden=YES; - + } //检测一个点是否在某个按钮里 -(void)checkPointInsideBtn:(CGPoint)point{ //点是否在飞行按钮里 //if(!self.isHidden) stopTouchTime=0; if (!flyBtn.isHidden && CGRectContainsPoint(flyBtn.frame, point)){ - // NSLog(@"Inside flyBtn"); + // NSLog(@"Inside flyBtn"); //避免手指按下立马出发点击事件 [self delayInvoke:0.2 cb:^(void){ NSLog(@"Inside flyBtn"); @@ -1379,7 +1505,7 @@ } if(flyBtn.userInteractionEnabled==true) { - + } else { //穿透了 @@ -1387,7 +1513,7 @@ UnitySendMessage("WebviewManager", "TouchClickPoint", "flyBtn"); } - // self->flyBtn.transform = CGAffineTransformMakeTranslation(-1000, -1000); + // self->flyBtn.transform = CGAffineTransformMakeTranslation(-1000, -1000); }]; isClickFly=YES; } @@ -1398,15 +1524,15 @@ [self delayInvoke:0.2 cb:^(void){ if (self->isShowRewardBtn) { - UnitySendMessage("WebviewManager", "ObjC_TouchClick", "rewardBtn"); + UnitySendMessage("WebviewManager", "ObjC_TouchClick", "rewardBtn"); } [self->bar setProgress:0]; }]; if(rewardBtn.userInteractionEnabled==true) { - + } else { - //穿透了 + //穿透了 UnitySendMessage("WebviewManager", "TouchClickPoint", "rewardBtn"); [bar setProgress:0]; } @@ -1420,7 +1546,7 @@ //设置可穿透字段 -(void)enableCT:(BOOL)flag{ - // NSLog(@"Native enableCT: %d",flag); + // NSLog(@"Native enableCT: %d",flag); canCT = flag; [rewardBtn setUserInteractionEnabled:!flag]; //[flyBtn setUserInteractionEnabled:!flag]; @@ -1428,15 +1554,15 @@ -(void)setClickView{ - + in_game=YES; } //延迟执行逻辑 -(void)delayInvoke:(float)delay cb:(dispatch_block_t)cb{ NSTimeInterval delayInSeconds = delay; - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), cb); + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); + dispatch_after(popTime, dispatch_get_main_queue(), cb); } //飞行按钮隐/藏 @@ -1452,7 +1578,7 @@ -(void)setFlyBtnTag:(BOOL)isShow{ if(!is_gift) isShowFlyBtn = NO; - else isShowFlyBtn = isShow; + else isShowFlyBtn = isShow; } -(void)setRewardBtnTag:(BOOL)isShow{ @@ -1463,8 +1589,8 @@ -(void)SetOffset:(int)offsety offset_y1:(int)offsety1 { // NSLog(@"barry ChangeViewRect-==== %d, %d",offset_y,offset_y1); - offset_y = offsety; - offset_y1 = offsety1; + // offset_y = offsety; + // offset_y1 = offsety1; } diff --git a/Assets/Scripts/Manager/UnityManager/WebviewManager.cs b/Assets/Scripts/Manager/UnityManager/WebviewManager.cs index dd49275..34414f6 100644 --- a/Assets/Scripts/Manager/UnityManager/WebviewManager.cs +++ b/Assets/Scripts/Manager/UnityManager/WebviewManager.cs @@ -196,11 +196,10 @@ namespace IgnoreOPS { if (times == "") return; DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); - newDate = newDate.AddSeconds(GameHelper.GetNowTime()); + newDate = newDate.AddSeconds(GameHelper.GetNowTime(true)); var newDays = newDate.Day; - if (times == "Dailyrefreshtimes") { var last_time = PlayerPrefs.GetInt("Dayreftimes", 0); @@ -219,21 +218,49 @@ namespace IgnoreOPS string darkWVRefreshtime_str = ""; string darkWVDailyrefreshtimes_str = ""; - for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime.Length; i++) + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime.Length; i++) + // { + // if (i != 0) darkWVRefreshtime_str += "|"; + // darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime[i].ToString(); + // } + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime2.Length; i++) + // { + // darkWVRefreshtime_str += "|"; + // darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime2[i].ToString(); + // } + + int dark_type = -1; + for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++) { - if (i != 0) darkWVRefreshtime_str += "|"; - darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime[i].ToString(); + if (dark_type != ConfigSystem.dark_weblist[i].wvType) + { + if (i != 0) darkWVRefreshtime_str += "|"; + darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[0]; + darkWVRefreshtime_str += "|"; + darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[1]; + dark_type = ConfigSystem.dark_weblist[i].wvType; + } } - for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime2.Length; i++) + + + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) + // { + // if (i != 0) darkWVDailyrefreshtimes_str += "|"; + // darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i].ToString(); + // } + + dark_type = -1; + for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++) { - darkWVRefreshtime_str += "|"; - darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime2[i].ToString(); - } - for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) - { - if (i != 0) darkWVDailyrefreshtimes_str += "|"; - darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i].ToString(); + if (dark_type != ConfigSystem.dark_weblist[i].wvType) + { + if (i != 0) darkWVDailyrefreshtimes_str += "|"; + darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes; + dark_type = ConfigSystem.dark_weblist[i].wvType; + } } + + WebviewManager.Instance.addH5Field(ConfigSystem.GetConfig().flyCtRate, ConfigSystem.GetConfig().otherH5switch, ConfigSystem.GetConfig().H5Refreshtime, ConfigSystem.GetConfig().Dailyrefreshtimes, ConfigSystem.GetConfig().darkThoughProbability, darkWVRefreshtime_str, darkWVDailyrefreshtimes_str, "", "", GameHelper.IsGiftSwitch(), "", ""); @@ -268,20 +295,43 @@ namespace IgnoreOPS string darkWVRefreshtime_str = ""; string darkWVDailyrefreshtimes_str = ""; - for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime.Length; i++) + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime.Length; i++) + // { + // if (i != 0) darkWVRefreshtime_str += "|"; + // darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime[i].ToString(); + // } + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime2.Length; i++) + // { + // darkWVRefreshtime_str += "|"; + // darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime2[i].ToString(); + // } + int dark_type = -1; + for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++) { - if (i != 0) darkWVRefreshtime_str += "|"; - darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime[i].ToString(); + if (dark_type != ConfigSystem.dark_weblist[i].wvType) + { + if (i != 0) darkWVRefreshtime_str += "|"; + darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[0]; + darkWVRefreshtime_str += "|"; + darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[1]; + dark_type = ConfigSystem.dark_weblist[i].wvType; + } } - for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime2.Length; i++) + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) + // { + // if (i != 0) darkWVDailyrefreshtimes_str += "|"; + // darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i].ToString(); + // } + + dark_type = -1; + for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++) { - darkWVRefreshtime_str += "|"; - darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime2[i].ToString(); - } - for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) - { - if (i != 0) darkWVDailyrefreshtimes_str += "|"; - darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i].ToString(); + if (dark_type != ConfigSystem.dark_weblist[i].wvType) + { + if (i != 0) darkWVDailyrefreshtimes_str += "|"; + darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes; + dark_type = ConfigSystem.dark_weblist[i].wvType; + } } WebviewManager.Instance.addH5Field(ConfigSystem.GetConfig().flyCtRate, ConfigSystem.GetConfig().otherH5switch, ConfigSystem.GetConfig().H5Refreshtime, ConfigSystem.GetConfig().Dailyrefreshtimes, ConfigSystem.GetConfig().darkThoughProbability, darkWVRefreshtime_str, @@ -382,9 +432,8 @@ namespace IgnoreOPS Vector2 fguiScreenPos = new(x * GRoot.inst.width, y * GRoot.inst.height); - Debug.Log(a[0] + "mmmmmmmmmmmmmmmmmm" + a[1]); - Debug.Log(fguiScreenPos[0] + "mmmmmmmmmmmmmmmmmm" + fguiScreenPos[1]); - // Debug.Log("mmmmmmmmmmmmmmmmmm" + a[1]); + // Debug.Log("mmmmmmmmmmmmmmmmmm" + a[0]); + // Debug.Log("mmmmmmmmmmmmmmmmmm" + a[1]); // if (AppConst.DeviceLangue == "pt") // { // fguiScreenPos = new Vector2((float.Parse(a[0]) * GRoot.inst.width) / 1000000.0f, @@ -518,18 +567,18 @@ namespace IgnoreOPS } 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); + // } + // } } } @@ -582,39 +631,59 @@ namespace IgnoreOPS if (SaveData.GetSaveobject().dark_Dayref == null) { - SaveData.GetSaveobject().dark_Dayref = new int[2]; + SaveData.GetSaveobject().dark_Dayref = new List() { 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0,0}; } if (dark_last_time == dark_newDays) { // dark_Dailyrefresh_reamain = ConfigSystem.GetConfig().darkWVDailyrefreshtimes[Int32.Parse(webview_index) - 1] - // PlayerPrefs.GetInt("dark_Dayref", 0); - for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) + // { + + // if (i != 0) darkWVDailyrefreshtimes_str += "|"; + // darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i] - SaveData.GetSaveobject().dark_Dayref[i]; + + // } + int dark_type_ = -1; + for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++) { - - if (i != 0) darkWVDailyrefreshtimes_str += "|"; - darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i] - SaveData.GetSaveobject().dark_Dayref[i]; - + if (dark_type_ != ConfigSystem.dark_weblist[i].wvType) + { + dark_type_ = ConfigSystem.dark_weblist[i].wvType; + if (i != 0) darkWVDailyrefreshtimes_str += "|"; + Debug.Log(dark_type_); + darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes - SaveData.GetSaveobject().dark_Dayref[dark_type_ - 1]; + } } } else { // PlayerPrefs.SetInt("dark_Dayref", 0); - for (int i = 0; i < SaveData.GetSaveobject().dark_Dayref.Length; i++) + for (int i = 0; i < SaveData.GetSaveobject().dark_Dayref.Count; i++) { SaveData.GetSaveobject().dark_Dayref[i] = 0; } SaveData.saveDataFunc(); // dark_Dailyrefresh_reamain = ConfigSystem.GetConfig().darkWVDailyrefreshtimes[Int32.Parse(webview_index)]; - for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVDailyrefreshtimes.Length; i++) + // { + + // if (i != 0) darkWVDailyrefreshtimes_str += "|"; + // darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i]; + + // } + int dark_type_ = -1; + for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++) { - - if (i != 0) darkWVDailyrefreshtimes_str += "|"; - darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig().darkWVDailyrefreshtimes[i]; - + if (dark_type_ != ConfigSystem.dark_weblist[i].wvType) + { + dark_type_ = ConfigSystem.dark_weblist[i].wvType; + if (i != 0) darkWVDailyrefreshtimes_str += "|"; + darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes; + } } - PlayerPrefs.SetInt("dark_refreshDay", dark_newDays); } @@ -666,29 +735,50 @@ namespace IgnoreOPS dark_str += "|"; } - dark_str += ConfigSystem.dark_weblist[i].webLink + "#" + ConfigSystem.dark_weblist[i].probability + "#" + can_refresh_numbners + "#" + ConfigSystem.dark_weblist[i].darkWebTimesCT + "#" + ConfigSystem.dark_weblist[i].wvType + "#" + ConfigSystem.dark_weblist[i].darkWebTimesCT2; + dark_str += ConfigSystem.dark_weblist[i].webLink + "#" + ConfigSystem.dark_weblist[i].probability + "#" + can_refresh_numbners + "#" + ConfigSystem.dark_weblist[i].darkWebTimesCT + "#" + ConfigSystem.dark_weblist[i].wvType + "#" + ConfigSystem.dark_weblist[i].WVOffset ; } string darkWVRefreshtime_str = ""; - for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime.Length; i++) + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime.Length; i++) + // { + // if (i != 0) darkWVRefreshtime_str += "|"; + // darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime[i].ToString(); + // } + // for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime2.Length; i++) + // { + // darkWVRefreshtime_str += "|"; + // darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime2[i].ToString(); + // } + int dark_type = -1; + string add_time = ""; + for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++) { - if (i != 0) darkWVRefreshtime_str += "|"; - darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime[i].ToString(); + if (dark_type != ConfigSystem.dark_weblist[i].wvType) + { + if (i != 0) + { + darkWVRefreshtime_str += "|"; + add_time += "|"; + } + darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[0]; + darkWVRefreshtime_str += "|"; + darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[1]; + dark_type = ConfigSystem.dark_weblist[i].wvType; + add_time += ConfigSystem.dark_weblist[i].WVClickAddTime; + } } - for (int i = 0; i < ConfigSystem.GetConfig().darkWVRefreshtime2.Length; i++) - { - darkWVRefreshtime_str += "|"; - darkWVRefreshtime_str += ConfigSystem.GetConfig().darkWVRefreshtime2[i].ToString(); - } - Debug.Log("--------------------------------"); - string add_time = ConfigSystem.GetConfig().WVClickAddTime[0] + "|" + ConfigSystem.GetConfig().WVClickAddTime[1]; + // add_time+= ConfigSystem.GetConfig().WVClickAddTime[0] + "|" + ConfigSystem.GetConfig().WVClickAddTime[1]; Debug.Log(add_time); + Debug.Log(darkWVRefreshtime_str); + Debug.Log(darkWVDailyrefreshtimes_str); + Debug.Log(dark_str); + Debug.Log(ConfigSystem.web_through_str); WebviewManager.Instance.addH5Field(ConfigSystem.GetConfig().flyCtRate, ConfigSystem.GetConfig().otherH5switch, ConfigSystem.GetConfig().H5Refreshtime, Dailyrefresh_reamain, ConfigSystem.GetConfig().darkThoughProbability , darkWVRefreshtime_str, darkWVDailyrefreshtimes_str, dark_str, light_str, GameHelper.IsGiftSwitch(), ConfigSystem.web_through_str, add_time); @@ -697,6 +787,7 @@ namespace IgnoreOPS //WebviewManager.Instance.setFlyCtRate(ConfigSystem.GetConfig().flyCtRate); // RefreshDataCT(isTop, gameUrlInfo); } + public void ClickAdEvent(string ad_msg) { string[] temp_array = ad_msg.Split("|"); diff --git a/Assets/Scripts/SavaData/SaveData.cs b/Assets/Scripts/SavaData/SaveData.cs index bf62715..b1bfa04 100644 --- a/Assets/Scripts/SavaData/SaveData.cs +++ b/Assets/Scripts/SavaData/SaveData.cs @@ -177,7 +177,7 @@ namespace ZooMatch public int this_time_cardtype; - public int[] dark_Dayref; + public List dark_Dayref; public MaxPayClass max_pay_object; public List saveingpot_history = new List(); diff --git a/Assets/ZooMatch/Define/Model/Config/Game/GameUrlsModel.cs b/Assets/ZooMatch/Define/Model/Config/Game/GameUrlsModel.cs index 9825990..6f309df 100644 --- a/Assets/ZooMatch/Define/Model/Config/Game/GameUrlsModel.cs +++ b/Assets/ZooMatch/Define/Model/Config/Game/GameUrlsModel.cs @@ -19,5 +19,9 @@ namespace ZooMatch public int wvType; public int wvthrough; public int isMagic; + public int[] darkWVRefreshtime; + public int darkWVDailyrefreshtimes; + public int WVClickAddTime; + public int WVOffset; } } \ No newline at end of file