bingo 项目提交
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// CircularProgressBar.h
|
||||
// TestGameWeb
|
||||
//
|
||||
// Created by Mac on 2024/1/30.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CircularProgressBar : UIView
|
||||
-(void)updateUI;
|
||||
-(void)animateCircleWithStrokeEnd:(float)end;
|
||||
-(void)setProgress:(float)value;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 401c653728b324d80ad80177e7b651d9
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// CircularProgressBar.m
|
||||
// TestGameWeb
|
||||
//
|
||||
// Created by Mac on 2024/1/30.
|
||||
//
|
||||
|
||||
#import "CircularProgressBar.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@implementation CircularProgressBar
|
||||
{
|
||||
UIImageView* imageView;
|
||||
CAShapeLayer* maskLayer;
|
||||
float currentValue;
|
||||
}
|
||||
|
||||
-(void)updateUI{
|
||||
[self makeGradient];
|
||||
[self setUpMask];
|
||||
}
|
||||
-(void)animateCircleWithStrokeEnd:(float)end{
|
||||
// let oldStrokeEnd = maskLayer.strokeEnd
|
||||
// maskLayer.strokeEnd = strokeEnd
|
||||
//
|
||||
// //override strokeEnd implicit animation
|
||||
// let animation = CABasicAnimation(keyPath: "strokeEnd")
|
||||
// animation.duration = 0.5
|
||||
// animation.fromValue = oldStrokeEnd
|
||||
// animation.toValue = strokeEnd
|
||||
// animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
|
||||
// maskLayer.add(animation, forKey: "animateCircle")
|
||||
//
|
||||
// currentValue = strokeEnd
|
||||
}
|
||||
-(void)setProgress:(float)value{
|
||||
maskLayer.strokeEnd = value;
|
||||
}
|
||||
|
||||
-(void)makeGradient{
|
||||
imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"12"]];
|
||||
imageView.frame = CGRectMake(0,0,self.frame.size.width, self.frame.size.height);
|
||||
imageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:imageView];
|
||||
}
|
||||
|
||||
-(void)setUpMask{
|
||||
UIBezierPath*circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.frame.size.width / 2.0,self.frame.size.height / 2.0) radius:(self.frame.size.width - 10)/2 startAngle:-M_PI/2 endAngle:M_PI*1.5 clockwise:YES];
|
||||
maskLayer = [CAShapeLayer layer];
|
||||
[maskLayer setPath: circlePath.CGPath];
|
||||
maskLayer.fillColor = UIColor.clearColor.CGColor;
|
||||
maskLayer.strokeColor = UIColor.redColor.CGColor;
|
||||
maskLayer.lineWidth = 8.0;
|
||||
maskLayer.strokeEnd = 0;
|
||||
maskLayer.lineCap = kCALineCapButt;// CAShapeLayerLineCap;
|
||||
imageView.layer.mask = maskLayer;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04828e5b563ce4632aa47ccddfa54560
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
////
|
||||
//// CustomAppController.h
|
||||
//// UnityFramework
|
||||
////
|
||||
//// Created by Mac on 2024/1/17.
|
||||
////
|
||||
//
|
||||
//#import <UnityFramework/UnityFramework.h>
|
||||
//
|
||||
//NS_ASSUME_NONNULL_BEGIN
|
||||
//
|
||||
//@interface CustomAppController : UnityAppController
|
||||
//
|
||||
//@end
|
||||
//IMPL_APP_CONTROLLER_SUBCLASS(CustomAppController)
|
||||
//
|
||||
//NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc223686fd5104500a48f5ad02663355
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// CustomAppController.m
|
||||
// UnityFramework
|
||||
//
|
||||
// Created by Mac on 2024/1/17.
|
||||
//
|
||||
//#import "CustomAppController.h"
|
||||
//#import "H5View.h"
|
||||
//
|
||||
//#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
||||
//#import <CoreTelephony/CTCarrier.h>
|
||||
//@interface CustomAppController ()
|
||||
//
|
||||
//@property(nonatomic, strong) WKWebView *webView;
|
||||
//
|
||||
//@end
|
||||
|
||||
//@implementation CustomAppController {
|
||||
// UIButton *btn;
|
||||
// H5View *hview;
|
||||
//}
|
||||
//- (void)startUnity:(UIApplication *)application {
|
||||
// [super startUnity:application];
|
||||
//
|
||||
// UIView* unityView = UnityGetGLView();
|
||||
//
|
||||
// UIViewController *vc = [UIViewController new];
|
||||
// vc.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
// //[vc.view setFrame:self.window.bounds];
|
||||
// //[vc.view setBackgroundColor:[UIColor orangeColor]];
|
||||
// [self.window setRootViewController:vc];
|
||||
//
|
||||
// [vc.view addSubview:unityView];
|
||||
//
|
||||
// hview = [H5View shared];
|
||||
// [vc.view addSubview:hview];
|
||||
//
|
||||
// [hview setFrame:self.window.bounds];
|
||||
// [hview initView];
|
||||
//
|
||||
// CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
|
||||
//
|
||||
// if (@available(iOS 12.0, *)) {
|
||||
// NSDictionary *ctDict = networkInfo.serviceSubscriberCellularProviders;
|
||||
// if ([ctDict allKeys].count > 1) {
|
||||
// NSArray *keys = [ctDict allKeys];
|
||||
// CTCarrier *carrier1 = [ctDict objectForKey:[keys firstObject]];
|
||||
// CTCarrier *carrier2 = [ctDict objectForKey:[keys lastObject]];
|
||||
// if (carrier1.mobileCountryCode.length && carrier2.mobileCountryCode.length) {
|
||||
// UnitySendMessage("NetworkManager", "diaoyongtest", "TRUE");
|
||||
//
|
||||
// }else if (!carrier1.mobileCountryCode.length && !carrier2.mobileCountryCode.length) {
|
||||
// UnitySendMessage("NetworkManager", "diaoyongtest", "FALSE");
|
||||
//
|
||||
// }else {
|
||||
// UnitySendMessage("NetworkManager", "diaoyongtest", "TRUE");
|
||||
// }
|
||||
// }else if ([ctDict allKeys].count == 1) {
|
||||
// NSArray *keys = [ctDict allKeys];
|
||||
// CTCarrier *carrier1 = [ctDict objectForKey:[keys firstObject]];
|
||||
// if (carrier1.mobileCountryCode.length) {
|
||||
// UnitySendMessage("NetworkManager", "diaoyongtest", "TRUE");
|
||||
// }else {
|
||||
// UnitySendMessage("NetworkManager", "diaoyongtest", "FALSE");
|
||||
// }
|
||||
// }else {
|
||||
// UnitySendMessage("NetworkManager", "diaoyongtest", "FALSE");
|
||||
// }
|
||||
// }
|
||||
// NSArray *preferredLanguages = [NSLocale preferredLanguages];
|
||||
// NSString *firstLanguage = preferredLanguages.firstObject;
|
||||
//
|
||||
// if ([firstLanguage hasPrefix:@"pt"]) {
|
||||
// // 设备设置为葡萄牙语
|
||||
// UnitySendMessage("UIManager", "setLangguage", "pt");
|
||||
// } else {
|
||||
// // 设备未设置为葡萄牙语
|
||||
// UnitySendMessage("UIManager", "setLangguage", "en");
|
||||
// }
|
||||
//
|
||||
|
||||
// customView = [CustomView shared];
|
||||
// [vc.view addSubview:customView];
|
||||
|
||||
// [customView setFrame:self.window.bounds];
|
||||
// [customView initView];
|
||||
|
||||
// [customView addSubview:unityView];
|
||||
//unityView.userInteractionEnabled = false;
|
||||
|
||||
|
||||
|
||||
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(:) name:@"OpenWebview" object:nil];
|
||||
|
||||
// UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
// [button setTitle:@"show Webview" forState:UIControlStateNormal];
|
||||
// [button sizeToFit];
|
||||
// [button addTarget:self action:@selector(showWebview:)
|
||||
// forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
// // Set a new (x,y) point for the button's center
|
||||
// button.center = CGPointMake(100, 80);
|
||||
|
||||
// [customView addSubview:button];
|
||||
|
||||
// UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
// [button2 setTitle:@"hide Webview" forState:UIControlStateNormal];
|
||||
// [button2 sizeToFit];
|
||||
// [button2 addTarget:self action:@selector(hideWebview:)
|
||||
// forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
// // Set a new (x,y) point for the button's center
|
||||
// button2.center = CGPointMake(100, 120);
|
||||
|
||||
// [customView addSubview:button2];
|
||||
//}
|
||||
|
||||
//- (void)notificationFired:(NSNotification *)notification {
|
||||
// customView showWebview:<#(nonnull NSString *)#>
|
||||
//}
|
||||
|
||||
// -(void)showWebview:(UIButton *)button{
|
||||
// [[CustomView shared] showWebview:@"https://baidu.com"];
|
||||
// }
|
||||
|
||||
// -(void)hideWebview:(UIButton *)button{
|
||||
// [customView hideWebview];
|
||||
// }
|
||||
|
||||
|
||||
//@end
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bcc02d08d5694f24af51ceb979658f7
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// CustomView.h
|
||||
// UnityFramework
|
||||
//
|
||||
// Created by Mac on 2024/1/19.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <WebKit/WebKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CustomView : UIView<WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler>
|
||||
+(id) shared;
|
||||
-(void)initView;
|
||||
//-(void)setConfig:(ViewCfg)cfg;
|
||||
-(void)userContentController:(WKUserContentController*) userContentController didReceiveScriptMessage:(WKScriptMessage*)message;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 672a7b6ad9ba34c40afb06bc19d7d0ca
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// CustomView.m
|
||||
// UnityFramework
|
||||
//
|
||||
// Created by Mac on 2024/1/19.
|
||||
//
|
||||
|
||||
#import "CustomView.h"
|
||||
#import "H5View.h"
|
||||
@implementation CustomView
|
||||
{
|
||||
// WKWebView *webview;
|
||||
// UIView* unityView;
|
||||
// //ViewCfg config;
|
||||
// CGPoint hitTestLocation;
|
||||
// BOOL isTouchWebView;
|
||||
// BOOL isWebviewOpen;
|
||||
// BOOL canCT;
|
||||
int test;
|
||||
}
|
||||
+(id) shared{
|
||||
static CustomView *view = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
dispatch_once(&onceToken, ^{view = [[self alloc] init];});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
-(void)initView{
|
||||
// Initialize a WKWebViewConfiguration object.
|
||||
|
||||
|
||||
// UITapGestureRecognizer *gest = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
|
||||
// [unityView addGestureRecognizer:gest];
|
||||
// [gest setDelegate:self];
|
||||
// CustomGestureDelegate *deleg = [[CustomGestureDelegate alloc] init];
|
||||
// [gest setDelegate:deleg];
|
||||
// gest.cancelsTouchesInView = false; // to recieve touchesBegan callback even if gesture is recognized
|
||||
// gest.delaysTouchesBegan = false; // to not delay touchesBegan callback
|
||||
// gest.delaysTouchesEnded = false; // to not delay touchesEnded callback
|
||||
// CustomGestureDelegate *deleg = [[CustomGestureDelegate alloc] init];
|
||||
// [gest setDelegate:deleg];
|
||||
// NSTimeInterval delayInSeconds = 7;
|
||||
// dispatch_time_t popTime2 = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
||||
// dispatch_after(popTime2, dispatch_get_main_queue(), ^(void){
|
||||
//
|
||||
// [self loop];
|
||||
// });
|
||||
// [self setWebviewPadding:CGRectMake(0, 120, 0, 180)];
|
||||
}
|
||||
|
||||
|
||||
//-(void)setConfig:(ViewCfg)cfg{
|
||||
// config = cfg;
|
||||
//
|
||||
// webview.frame = config.rect;
|
||||
// // webview.frame = CGRectMake(0, 100, self.bounds.size.width, 500);
|
||||
// //canCT = YES;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
// -(void)handleTap:(UITapGestureRecognizer*) gest{
|
||||
// CGPoint pt = [gest locationInView:webview];
|
||||
// // NSLog(@"GestureRecognizer x:%f, y:%f", pt.x, pt.y);
|
||||
// // if (gest.state == UIGestureRecognizerStateBegan){
|
||||
// // NSLog(@"Begin x:%f, y:%f", pt.x, pt.y);
|
||||
// // }
|
||||
// if (gest.state == UIGestureRecognizerStateEnded){
|
||||
// NSLog(@"GestureRecognizer End x:%f, y:%f", pt.x, pt.y);
|
||||
// }
|
||||
// }
|
||||
// //- (void) touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event{
|
||||
// // UITouch *touch = [[event allTouches] anyObject];
|
||||
// //
|
||||
// // CGPoint location = [touch locationInView:self];
|
||||
// // beginTouches = touches;
|
||||
// // beginEvent = event;
|
||||
// // NSLog(@"Touch Began CustomView");
|
||||
// //}
|
||||
// //
|
||||
// //- (void) touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event{
|
||||
// // UITouch *touch = [[event allTouches] anyObject];
|
||||
// //
|
||||
// // CGPoint location = [touch locationInView:self];
|
||||
// // beginTouches = touches;
|
||||
// // beginEvent = event;
|
||||
// // NSLog(@"Touch Ended CustomView");
|
||||
// //}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||
|
||||
//UIView* touchedView = [super hitTest:point withEvent:event];
|
||||
// if([[H5View shared] isDarkThough]){
|
||||
// NSLog(@"Point coordinates: x = %f, y = %f", point.x, point.y);
|
||||
// NSLog(@"Point coordinates: max = %f,",self.bounds.size.width);
|
||||
UIView* testview = [ [H5View shared]hitTest:point withEvent:event];
|
||||
return testview;
|
||||
// }
|
||||
// else
|
||||
// return touchedView;
|
||||
}
|
||||
|
||||
// -(void)showWebview:(NSString*)url{
|
||||
// // NSLog(@"Native showWebview: %@", url);
|
||||
// NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0];
|
||||
// [webview loadRequest:request];
|
||||
// if (webview.superview == nil)
|
||||
// [self insertSubview:webview atIndex:0];
|
||||
// isWebviewOpen = YES;
|
||||
// }
|
||||
|
||||
// -(void)hideWebview{
|
||||
// // NSLog(@"Native hideWebview");
|
||||
// [webview removeFromSuperview];
|
||||
// isWebviewOpen = NO;
|
||||
// }
|
||||
|
||||
// -(void)scrollWebview:(CGPoint)offset{
|
||||
// CGPoint pt = [webview.scrollView contentOffset];
|
||||
// if (offset.y < 0 && pt.y <= 0) return;
|
||||
// float val = pt.y + offset.y*0.5;
|
||||
// if (val<0) val = 0;
|
||||
// [webview.scrollView setContentOffset:CGPointMake(0, val)];
|
||||
// }
|
||||
|
||||
// -(void)setTouchWebview:(BOOL)flag forceCT:(BOOL)force{
|
||||
// if (!isWebviewOpen) return;
|
||||
// isTouchWebView = flag;
|
||||
// //unityView.userInteractionEnabled = !flag;
|
||||
|
||||
// if (canCT || force){
|
||||
// if (!CGRectContainsPoint(webview.bounds, hitTestLocation))
|
||||
// return;
|
||||
// [self doCT];
|
||||
// }
|
||||
// }
|
||||
|
||||
// -(void)tapWithPoint:(CGPoint)zspoint{
|
||||
// [Helpers helpAt:1 AtPoint:zspoint withTouchPhase:UITouchPhaseBegan];
|
||||
// [Helpers helpAt:1 AtPoint:zspoint withTouchPhase:UITouchPhaseEnded];
|
||||
// }
|
||||
|
||||
|
||||
// -(void)enableCT:(BOOL)flag{
|
||||
// // NSLog(@"Native enableCT: %d",flag);
|
||||
// canCT = flag;
|
||||
// }
|
||||
|
||||
// -(void)doCT{
|
||||
// NSTimeInterval delayInSeconds = 0.1;
|
||||
// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
||||
// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
||||
// // NSLog(@"CT x:%f, y:%f", self->hitTestLocation.x, self->hitTestLocation.y);
|
||||
// self->unityView.userInteractionEnabled = false;
|
||||
// [self tapWithPoint:self->hitTestLocation];
|
||||
// self->unityView.userInteractionEnabled = true;
|
||||
// });
|
||||
// }
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cdb389af033b478f8273050f8b73d79
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// 如果 DataEyeSDK 是一个需要被引用的外部库或框架,确保已经正确导入
|
||||
// #import <DataEyeSDK/DataEyeSDK.h> // 或者使用正确的导入语句
|
||||
|
||||
@interface EventMark : NSObject
|
||||
|
||||
// 单例实例的类方法
|
||||
+ (instancetype)sharedEventMark;
|
||||
|
||||
// 初始化 DataEyeSDK 的方法(在单例的 init 方法中自动调用,外部无需直接调用)
|
||||
- (void)initDataEyeSDK;
|
||||
|
||||
// 追踪产品购买事件的方法
|
||||
- (void)trackProduct:(NSString *)eventName dictionaryJson:(NSString *)dictionaryJson ;
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 103ce1267127c4f91a6959ca7c63b1f1
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,88 @@
|
||||
#import "EventMark.h"
|
||||
#import <DataEyeSDK.h>
|
||||
|
||||
@interface EventMark ()
|
||||
|
||||
@property (nonatomic, strong) DataEyeSDK *dataEyeInstance;
|
||||
|
||||
@end
|
||||
|
||||
@implementation EventMark
|
||||
|
||||
// 静态实例变量
|
||||
static EventMark *sharedInstance = nil;
|
||||
|
||||
// 类方法,用于获取单例实例
|
||||
+ (instancetype)sharedEventMark {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[self alloc] init];
|
||||
});
|
||||
return sharedInstance;
|
||||
|
||||
}
|
||||
|
||||
// 初始化 DataEyeSDK 的方法
|
||||
- (void)initDataEyeSDK {
|
||||
|
||||
// NSLog(@"barry initDataEyeSDK-------");
|
||||
DEConfig *config = [[DEConfig alloc] init];
|
||||
config.appid = @"12730";
|
||||
config.configureURL = @"https://deapi.funsdata.com/v1/sdk/report";
|
||||
config.debugMode = DataEyeDebug;
|
||||
DataEyeSDK * instance = [DataEyeSDK startWithConfig:config];
|
||||
|
||||
NSDictionary *superProperties = @{
|
||||
@"channel": @"ta",
|
||||
@"age": @1,
|
||||
@"isSuccess": @YES,
|
||||
@"birthday": [NSDate date],
|
||||
@"object": @{
|
||||
@"key":@"value"
|
||||
},
|
||||
@"object_arr":@[
|
||||
@{
|
||||
@"key":@"value"
|
||||
}
|
||||
],
|
||||
@"arr": @[@"value"],
|
||||
};
|
||||
[instance setSuperProperties:superProperties];
|
||||
|
||||
[instance enableAutoTrack:DataEyeEventTypeAppInstall | DataEyeEventTypeAppStart | DataEyeEventTypeAppEnd];
|
||||
|
||||
// NSDictionary *eventProperties = @{@"new_head": @"100"};
|
||||
// [instance track:@"product_buy" properties:eventProperties];
|
||||
|
||||
NSString *device = [instance getDeviceId];
|
||||
// NSLog(@"barry initDataEyeSDK11-------%@",device);
|
||||
|
||||
// [self trackProduct: @"100"];
|
||||
}
|
||||
|
||||
// 追踪产品购买事件的方法
|
||||
//- (void)trackProduct:(NSString *) data_ {
|
||||
//
|
||||
// NSLog(@"barry trackProduct-------%@",data_);
|
||||
// NSDictionary *eventProperties = data_;
|
||||
// [self.dataEyeInstance track:@"test_event" properties:eventProperties];
|
||||
//}
|
||||
|
||||
-(void)trackProduct:(NSString *)eventName dictionaryJson:(NSString *)dictionaryJson;
|
||||
{
|
||||
// NSLog(@"barry trackProduct eventName=== %@",eventName);
|
||||
NSError *error;
|
||||
NSData *data = [dictionaryJson dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||
|
||||
|
||||
NSDictionary *eventProperties = dictionary;
|
||||
[self.dataEyeInstance track:eventName properties:eventProperties];
|
||||
|
||||
|
||||
|
||||
// 处理接收到的字典
|
||||
// NSLog(@"barry trackProduct dictionary=== %@", dictionary);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cefa74067602a4b33bf7092419ae52c8
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// H5View.h
|
||||
// TestGameWeb
|
||||
//
|
||||
// Created by Mac on 2024/1/30.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <WebKit/WebKit.h>
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface H5View : UIView<WKUIDelegate, WKNavigationDelegate,WKScriptMessageHandler>
|
||||
+(id) shared;
|
||||
-(void)initView;
|
||||
-(void)showWebview:(NSString*)url;
|
||||
-(void)showDarkWebview:(int)type;
|
||||
-(void)hideWebview;
|
||||
-(void)showView:(BOOL)show;
|
||||
-(void)setIconProgress:(float)value;
|
||||
-(void)setViewPadding:(CGRect)rect;
|
||||
-(void)SetDarkThough:(BOOL)though;
|
||||
-(void)setViewBtn:(CGRect)rect;
|
||||
-(void)setFullScreen;
|
||||
-(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)setClickView;
|
||||
-(void)enableCT:(BOOL)flag;
|
||||
-(void)showFlyBtn:(BOOL)flag;
|
||||
-(void)setInH5View:(BOOL)flag;
|
||||
-(void)upDataH5times:(char*)weblink times:(int)times is_dark:(BOOL)is_dark;
|
||||
-(void)setFlyBtnTag:(BOOL)isShow;
|
||||
-(void)setRewardBtnTag:(BOOL)isShow;
|
||||
-(void)SetOffset:(int)offsety offset_y1:(int)offsety1;
|
||||
|
||||
@end
|
||||
@interface H5View (WKNavigationDelegate) <WKNavigationDelegate>
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b81939315f9c4cd9bad890bebc3acd8
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0a15e7dc96084b68b1e4e3d7d74a932
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,286 @@
|
||||
|
||||
#import <WebKit/WKWebView.h>
|
||||
#import <WebKit/WKNavigationDelegate.h>
|
||||
#import <WebKit/WKNavigationAction.h>
|
||||
#import <WebKit/WKNavigationResponse.h>
|
||||
#import <WebKit/WKNavigation.h>
|
||||
#import <WebKit/WKUserContentController.h>
|
||||
#import <WebKit/WKScriptMessage.h>
|
||||
#import <WebKit/WKWebViewConfiguration.h>
|
||||
#import <WebKit/WKPreferences.h>
|
||||
#import <WebKit/WKScriptMessageHandler.h>
|
||||
#import <WebKit/WKUIDelegate.h>
|
||||
|
||||
@interface ULiteWebView : NSObject<WKNavigationDelegate,WKScriptMessageHandler>
|
||||
{
|
||||
WKWebView* _webView;
|
||||
NSString* _gameObjectName;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation ULiteWebView
|
||||
//注册webview
|
||||
- (void)init:(const char*)gameObjectName{
|
||||
_gameObjectName = [NSString stringWithUTF8String:gameObjectName];
|
||||
}
|
||||
|
||||
- (void)createWebView{
|
||||
if(_webView == nil){
|
||||
UIView* view = UnityGetGLViewController().view;
|
||||
_webView = [[WKWebView alloc] initWithFrame:view.frame];
|
||||
_webView.hidden = YES;
|
||||
_webView.navigationDelegate = self;
|
||||
// _webView.UIDelegate = self;
|
||||
[[_webView configuration].userContentController addScriptMessageHandler:self name:@"ULiteWebView"];
|
||||
|
||||
// //创建网页配置对象
|
||||
// WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
|
||||
//
|
||||
// // 创建设置对象
|
||||
// WKPreferences *preference = [[WKPreferences alloc]init];
|
||||
// //最小字体大小 当将javaScriptEnabled属性设置为NO时,可以看到明显的效果
|
||||
// preference.minimumFontSize = 0;
|
||||
// //设置是否支持javaScript 默认是支持的
|
||||
// preference.javaScriptEnabled = YES;
|
||||
// // 在iOS上默认为NO,表示是否允许不经过用户交互由javaScript自动打开窗口
|
||||
// preference.javaScriptCanOpenWindowsAutomatically = YES;
|
||||
// config.preferences = preference;
|
||||
//
|
||||
// // 是使用h5的视频播放器在线播放, 还是使用原生播放器全屏播放
|
||||
// config.allowsInlineMediaPlayback = YES;
|
||||
// //设置视频是否需要用户手动播放 设置为NO则会允许自动播放
|
||||
// config.requiresUserActionForMediaPlayback = YES;
|
||||
// //设置是否允许画中画技术 在特定设备上有效
|
||||
// config.allowsPictureInPictureMediaPlayback = YES;
|
||||
// //设置请求的User-Agent信息中应用程序名称 iOS9后可用
|
||||
// config.applicationNameForUserAgent = @"ChinaDailyForiPad";
|
||||
//
|
||||
// //这个类主要用来做native与JavaScript的交互管理
|
||||
// WKUserContentController * wkUController = [[WKUserContentController alloc] init];
|
||||
// //注册一个name为jsToOcNoPrams的js方法
|
||||
// [wkUController addScriptMessageHandler:self name:@"ULiteWebView"];
|
||||
// config.userContentController = wkUController;
|
||||
|
||||
|
||||
|
||||
[view addSubview:_webView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)disposeWebView{
|
||||
if(_webView != nil){
|
||||
[_webView removeFromSuperview];
|
||||
[[_webView configuration].userContentController removeScriptMessageHandlerForName:@"ULiteWebView"];
|
||||
_webView.navigationDelegate = nil;
|
||||
_webView.UIDelegate = nil;
|
||||
_webView = nil;
|
||||
}
|
||||
}
|
||||
|
||||
//显示webview
|
||||
- (void)show:(int)top bottom:(int)bottom left:(int)left right:(int)right {
|
||||
[self createWebView];
|
||||
UIView *view = UnityGetGLViewController().view;
|
||||
_webView.hidden = NO;
|
||||
CGRect frame = view.frame;
|
||||
CGFloat scale = view.contentScaleFactor;
|
||||
frame.size.width -= (left + right) / scale;
|
||||
frame.size.height -= (top + bottom) / scale;
|
||||
frame.origin.x += left / scale;
|
||||
frame.origin.y += top / scale;
|
||||
_webView.frame = frame;
|
||||
}
|
||||
|
||||
//加载页面
|
||||
- (void)loadUrl:(const char*)url{
|
||||
[self createWebView];
|
||||
NSString *urlStr = [NSString stringWithUTF8String:url];
|
||||
NSURL *nsurl = [NSURL URLWithString:urlStr];
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:nsurl];
|
||||
[_webView loadRequest:request];
|
||||
[_webView reload];
|
||||
}
|
||||
|
||||
//关闭webview窗口
|
||||
- (void)close{
|
||||
if(_webView == nil){
|
||||
return;
|
||||
}
|
||||
_webView.hidden = YES;
|
||||
[self disposeWebView];
|
||||
}
|
||||
|
||||
//调用JS
|
||||
- (void)callJS:(const char*)funName msg:(const char*)msg{
|
||||
if(_webView == nil){
|
||||
return;
|
||||
}
|
||||
|
||||
//OC调用JS completionHandler是异步回调block
|
||||
NSString *jsStr= [NSString stringWithFormat:@"%s(\"%s\")",funName,msg];
|
||||
[_webView evaluateJavaScript:jsStr completionHandler:^(id _Nullable data, NSError * _Nullable error) {
|
||||
NSLog(@"调用JS:%@", jsStr);
|
||||
}];
|
||||
}
|
||||
|
||||
//被JS调用
|
||||
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
|
||||
|
||||
NSLog(@"方法名:%@", message.name);
|
||||
NSString* content = message.body;
|
||||
NSLog(@"参数:%@", content);
|
||||
|
||||
|
||||
UnitySendMessage([_gameObjectName UTF8String], "OnJsCall", [content UTF8String]);
|
||||
}
|
||||
|
||||
//捕获链接请求
|
||||
//- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
|
||||
//{
|
||||
// NSString *url = [[request URL] absoluteString];
|
||||
//
|
||||
// UnitySendMessage([_gameObjectName UTF8String], "OnLoadingUrl", [url UTF8String]);
|
||||
//
|
||||
// NSRange range = [url rangeOfString:@"ulitewebview://"];
|
||||
// if(range.location != NSNotFound){
|
||||
// NSString *msg = [url substringFromIndex:range.length];
|
||||
// UnitySendMessage([_gameObjectName UTF8String], "OnJsCall", [msg UTF8String]);
|
||||
// return YES;
|
||||
// }
|
||||
// return YES;
|
||||
//}
|
||||
|
||||
// 页面开始加载时调用
|
||||
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
|
||||
|
||||
NSLog(@"页面开始加载: %@", webView.URL.absoluteString);
|
||||
UnitySendMessage([_gameObjectName UTF8String], "OnLoadingUrl", [webView.URL.absoluteString UTF8String]);
|
||||
}
|
||||
// 页面加载失败时调用
|
||||
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
|
||||
NSLog(@"页面加载失败");
|
||||
}
|
||||
|
||||
// 当内容开始返回时调用
|
||||
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
|
||||
NSLog(@"页面内容开始加载");
|
||||
}
|
||||
|
||||
// 页面加载完成之后调用
|
||||
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
|
||||
NSLog(@"页面内容加载完成");
|
||||
}
|
||||
//提交发生错误时调用
|
||||
- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error {
|
||||
NSLog(@"提交发生错误时调用");
|
||||
}
|
||||
// 接收到服务器跳转请求即服务重定向时之后调用
|
||||
- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
|
||||
|
||||
}
|
||||
// 根据WebView对于即将跳转的HTTP请求头信息和相关信息来决定是否跳转
|
||||
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
|
||||
|
||||
NSString * urlStr = navigationAction.request.URL.absoluteString;
|
||||
NSLog(@"发送跳转请求:%@",urlStr);
|
||||
//自己定义的协议头
|
||||
// NSString *htmlHeadString = @"github://";
|
||||
// if([urlStr hasPrefix:htmlHeadString]){
|
||||
// UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"通过截取URL调用OC" message:@"你想前往我的Github主页?" preferredStyle:UIAlertControllerStyleAlert];
|
||||
// [alertController addAction:([UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
||||
// }])];
|
||||
// [alertController addAction:([UIAlertAction actionWithTitle:@"打开" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
// NSURL * url = [NSURL URLWithString:[urlStr stringByReplacingOccurrencesOfString:@"github://callName_?" withString:@""]];
|
||||
// [[UIApplication sharedApplication] openURL:url];
|
||||
// }])];
|
||||
//
|
||||
// decisionHandler(WKNavigationActionPolicyCancel);
|
||||
// }else{
|
||||
// decisionHandler(WKNavigationActionPolicyAllow);
|
||||
// }
|
||||
|
||||
decisionHandler(WKNavigationActionPolicyAllow);
|
||||
}
|
||||
|
||||
// 根据客户端受到的服务器响应头以及response相关信息来决定是否可以跳转
|
||||
- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler{
|
||||
NSString * urlStr = navigationResponse.response.URL.absoluteString;
|
||||
NSLog(@"当前跳转地址:%@",urlStr);
|
||||
//允许跳转
|
||||
decisionHandler(WKNavigationResponsePolicyAllow);
|
||||
//不允许跳转
|
||||
// decisionHandler(WKNavigationResponsePolicyCancel);
|
||||
}
|
||||
|
||||
//需要响应身份验证时调用 同样在block中需要传入用户身份凭证
|
||||
//- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler{
|
||||
//
|
||||
//}
|
||||
//进程被终止时调用
|
||||
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView{
|
||||
NSLog(@"进程终止了");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void _registResponseGameObject(const char* gameObjectName);
|
||||
void _show(int top, int bottom, int left, int right);
|
||||
void _loadUrl(const char* url);
|
||||
void _close();
|
||||
void _callJS(const char* funName, const char* msg);
|
||||
|
||||
|
||||
static ULiteWebView *ulite;
|
||||
const char* gameObjectName;
|
||||
|
||||
void _registCallBackGameObjectName(const char* gameObjectName){
|
||||
if(ulite != nil){
|
||||
return;
|
||||
}
|
||||
|
||||
ulite = [ULiteWebView alloc];
|
||||
[ulite init:gameObjectName];
|
||||
// NSLog(@"_registResponseGameObject");
|
||||
}
|
||||
|
||||
void _show(int top, int bottom, int left, int right){
|
||||
if(ulite == nil){
|
||||
return;
|
||||
}
|
||||
|
||||
[ulite show:top bottom:bottom left:left right:right];
|
||||
// NSLog(@"_show");
|
||||
|
||||
}
|
||||
|
||||
void _loadUrl(const char* url){
|
||||
if(ulite == nil){
|
||||
return;
|
||||
}
|
||||
|
||||
[ulite loadUrl:url];
|
||||
// NSLog(@"_loadUrl");
|
||||
}
|
||||
|
||||
void _close(){
|
||||
if(ulite == nil){
|
||||
return;
|
||||
}
|
||||
|
||||
[ulite close];
|
||||
// NSLog(@"_close");
|
||||
}
|
||||
|
||||
void _callJS(const char* funName, const char* msg){
|
||||
if(ulite == nil){
|
||||
return;
|
||||
}
|
||||
|
||||
[ulite callJS:funName msg:msg];
|
||||
// NSLog(@"_callJS");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19195526b3cf94366bbaec87314b80fd
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface iOSBridgePlugin : NSObject
|
||||
|
||||
+ (void)openURL:(NSString *)url;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82b2667fe8b09c944987ed6db2e180e7
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
#import "iOSBridgePlugin.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <EventMark.h>
|
||||
|
||||
@implementation iOSBridgePlugin
|
||||
|
||||
+ (void)openURL:(NSString *)url1
|
||||
{
|
||||
// 使用UIApplication的openURL方法打开外部浏览器
|
||||
NSURL *url = [NSURL URLWithString:url1];
|
||||
if (url && [[UIApplication sharedApplication] canOpenURL:url]) {
|
||||
// 使用iOS 10及以上版本推荐的方法
|
||||
[[UIApplication sharedApplication] openURL:url
|
||||
options:@{}
|
||||
completionHandler:nil];
|
||||
} else {
|
||||
// URL无效或无法打开
|
||||
NSLog(@"Invalid URL or cannot open URL: %@", url1);
|
||||
}
|
||||
}
|
||||
|
||||
// 为了让Unity能够找到这个方法,我们需要提供一个C风格的函数入口点
|
||||
extern "C"
|
||||
{
|
||||
void _openURL(const char* url)
|
||||
{
|
||||
// 将C风格的字符串转换为NSString,并调用openURL方法
|
||||
[iOSBridgePlugin openURL:[NSString stringWithUTF8String:url]];
|
||||
}
|
||||
|
||||
void _dataEyeEvent(const char* dictionaryJson, const char* eventName)
|
||||
{
|
||||
// NSLog(@"barry _dataEyeEvent Json== %s", dictionaryJson);
|
||||
// NSLog(@"barry _dataEyeEvent eventName== %s", eventName);
|
||||
// 将C风格的字符串转换为NSString
|
||||
NSString *jsonString = [NSString stringWithUTF8String:dictionaryJson];
|
||||
NSString *eventNameString = [NSString stringWithUTF8String:eventName];
|
||||
|
||||
// NSLog(@"barry _dataEyeEvent Json== %@", jsonString);
|
||||
// NSLog(@"barry _dataEyeEvent eventName== %@", eventNameString);
|
||||
|
||||
// 调用trackProduct方法并传递两个参数
|
||||
[[EventMark sharedEventMark] trackProduct:eventNameString dictionaryJson:jsonString];
|
||||
}
|
||||
}
|
||||
- (void)initDataEyeSDK
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94732db9a2f13c54bbc7ba3645e39358
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,101 @@
|
||||
extern "C" {
|
||||
#include "H5View.h"
|
||||
NSString *stringFromChar(const char *input) {
|
||||
return [NSString stringWithUTF8String: input];
|
||||
}
|
||||
|
||||
// void OpenWebview(char* url) {
|
||||
// [[CustomView shared] showWebview:stringFromChar(url)];
|
||||
// }
|
||||
|
||||
// void CloseWebview(){
|
||||
// [[CustomView shared] hideWebview];
|
||||
// }
|
||||
|
||||
// void SetSize(float x, float y, float width, float height){
|
||||
// [[CustomView shared] setWebviewSize:CGRectMake(x, y, width, height)];
|
||||
// }
|
||||
|
||||
// void SetFullScreen(){
|
||||
// [[CustomView shared] setFullScreen];
|
||||
// }
|
||||
|
||||
// void SetTouchWebview(bool flag, bool force = false){
|
||||
// [[CustomView shared] setTouchWebview:flag forceCT:force];
|
||||
// }
|
||||
|
||||
// void ScrollWebview(float dx, float dy){
|
||||
// CGPoint pt = CGPointMake(dx, dy);
|
||||
// [[CustomView shared] scrollWebview:pt];
|
||||
// }
|
||||
|
||||
// void SetPadding(float left, float top, float right, float bottom){
|
||||
// [[CustomView shared] setWebviewPadding:CGRectMake(left, top, right, bottom)];
|
||||
// }
|
||||
|
||||
// void SetCTEnable(bool flag){
|
||||
// [[CustomView shared] enableCT:flag];
|
||||
// }
|
||||
|
||||
void ShowH5View(bool flag){//设置显隐
|
||||
[[H5View shared] showView:flag];
|
||||
}
|
||||
void setInH5View(bool flag){//设置是否在h5界面
|
||||
[[H5View shared] setInH5View:flag];
|
||||
}
|
||||
|
||||
void OpenWebview(char* url) {//显示明网页
|
||||
[[H5View shared] showWebview:stringFromChar(url)];
|
||||
}
|
||||
void showDarkWebview() {//显示暗网页
|
||||
[[H5View shared] showDarkWebview:1];
|
||||
}
|
||||
void CloseWebview(){//隐藏
|
||||
[[H5View shared] hideWebview];
|
||||
}
|
||||
|
||||
void SetFullScreen(){
|
||||
[[H5View shared] setFullScreen];
|
||||
}
|
||||
|
||||
void addH5Field(int field1 ,int field2,int field3,int field4,int field5 ,char* field6 ,char* field7 ,char* dark_url,char* light_url, bool field8 , char* web_through_probability, char* click_add_time){
|
||||
[[H5View shared] addH5Field:field1 field2:field2 field3:field3 field4:field4 field5:field5 field6:field6 field7:field7 dark_url:dark_url light_url:light_url field8:field8 web_through_probability:web_through_probability click_add_time:click_add_time];
|
||||
}
|
||||
void upDataH5times(char* weblink ,int times, bool is_dark){
|
||||
[[H5View shared] upDataH5times:weblink times:times is_dark:is_dark];
|
||||
}
|
||||
void SetPadding(float left, float top, float right, float bottom){
|
||||
[[H5View shared] setViewPadding:CGRectMake(left, top, right, bottom)];
|
||||
}
|
||||
void SetDarkThough(bool though){
|
||||
[[H5View shared] SetDarkThough:though];
|
||||
}
|
||||
void SetBtn(int left, int top, int right, int bottom){
|
||||
[[H5View shared] setViewBtn:CGRectMake(left, top, right, bottom)];
|
||||
}
|
||||
void SetCTEnable(bool flag){
|
||||
[[H5View shared] enableCT:flag];
|
||||
}
|
||||
|
||||
void SetIconProgress(float val){
|
||||
[[H5View shared] setIconProgress:val];
|
||||
}
|
||||
|
||||
void SetClickView(){
|
||||
[[H5View shared] setClickView];
|
||||
}
|
||||
|
||||
void ShowFlyBtn(bool show){
|
||||
[[H5View shared] showFlyBtn:show];
|
||||
}
|
||||
void setFlyBtnTag (bool show) {
|
||||
[[H5View shared] setFlyBtnTag: show];
|
||||
}
|
||||
void setRewardBtnTag (bool show) {
|
||||
[[H5View shared] setRewardBtnTag: show];
|
||||
}
|
||||
void SetOffset (int offset_y, int offset_y1) {
|
||||
[[H5View shared] SetOffset: offset_y offset_y1: offset_y1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39943910fcb56434382c48985fcd904b
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user