fix:1、添加H5
This commit is contained in:
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
File diff suppressed because one or more lines are too long
@@ -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
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e5d2cff218e24bf6bd34828099eca28
|
||||
guid: 1b43d66d9c8984ca1a3924f009d4c36a
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -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
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbcfa9c4a568b4b96ba1642c6b2530cf
|
||||
guid: 28c1880c4078743b3bd5f156cd333dc5
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -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: a57e9f721637f45e3b91560bb3109e8d
|
||||
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: bae16123af2c54a149033212f8aa3010
|
||||
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: 94df62a8ca85d4dcab85736b4b2b15cb
|
||||
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: 05350365173dc4b3baeeeb95280539f0
|
||||
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:
|
||||
@@ -1,18 +0,0 @@
|
||||
#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
|
||||
@@ -1,78 +0,0 @@
|
||||
#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 = @"13355";
|
||||
config.configureURL = @"https://yu.frozenarena.top";
|
||||
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:DataEyeEventTypeAppStart |//APP 启动事件,记录 APP 启动或从后台恢复
|
||||
DataEyeEventTypeAppInstall |//APP 安装,记录 APP 被安装的日志
|
||||
DataEyeEventTypeAppEnd |//APP 关闭事件,记录 APP 调入后台
|
||||
DataEyeEventTypeAppViewScreen |//APP 浏览页面事件
|
||||
DataEyeEventTypeAppClick |//APP 点击控件事件
|
||||
DataEyeEventTypeAppViewCrash];//APP 崩溃事件
|
||||
|
||||
// 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];
|
||||
//}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
@@ -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: 8500e5bab3b934a6bb042461aa05d860
|
||||
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: 4be3087d48fb741b893adfa614aa6e2b
|
||||
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:
|
||||
@@ -19,71 +19,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)ShezhiACT:(bool)act
|
||||
{
|
||||
if(act){
|
||||
UIWindow *keyWindow = nil;
|
||||
for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
|
||||
if (windowScene.activationState == UISceneActivationStateForegroundActive) {
|
||||
keyWindow = windowScene.windows.firstObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UIView *rootView = keyWindow.rootViewController.view;
|
||||
|
||||
for (UIView *subview in rootView.subviews) {
|
||||
if ([NSStringFromClass([subview class]) isEqualToString:@"WKWebView"]) {
|
||||
[self enableUserInteractionForView:subview];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
UIWindow *keyWindow = nil;
|
||||
for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
|
||||
if (windowScene.activationState == UISceneActivationStateForegroundActive) {
|
||||
keyWindow = windowScene.windows.firstObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UIView *rootView = keyWindow.rootViewController.view;
|
||||
|
||||
for (UIView *subview in rootView.subviews) {
|
||||
if ([NSStringFromClass([subview class]) isEqualToString:@"WKWebView"]) {
|
||||
|
||||
[self disableUserInteractionForView:subview];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ (void)enableUserInteractionForView:(UIView *)view {
|
||||
view.userInteractionEnabled = YES;
|
||||
for (UIView *subview in view.subviews) {
|
||||
[self enableUserInteractionForView:subview];
|
||||
for (UIGestureRecognizer *gesture in subview.gestureRecognizers) {
|
||||
if ([gesture isKindOfClass:[UITapGestureRecognizer class]]) {
|
||||
gesture.enabled = YES; // 禁用手势识别器
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)disableUserInteractionForView:(UIView *)view {
|
||||
view.userInteractionEnabled = NO;
|
||||
for (UIView *subview in view.subviews) {
|
||||
[self disableUserInteractionForView:subview]; // 递归禁用所有子视图的交互
|
||||
for (UIGestureRecognizer *gesture in subview.gestureRecognizers) {
|
||||
// 仅禁用非 UITapGestureRecognizer 类型的手势识别器
|
||||
if ([gesture isKindOfClass:[UITapGestureRecognizer class]]) {
|
||||
gesture.enabled = NO; // 禁用手势识别器
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 为了让Unity能够找到这个方法,我们需要提供一个C风格的函数入口点
|
||||
extern "C"
|
||||
@@ -102,24 +37,5 @@ extern "C"
|
||||
[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
|
||||
|
||||
@@ -1,25 +1,13 @@
|
||||
//#import <Photos/Photos.h>
|
||||
extern "C" {
|
||||
#import "UnityAppController.h"
|
||||
#import "iOSBridgePlugin.h"
|
||||
//#import <DataEyeSDK.h>
|
||||
#import "UnityAppController.h"
|
||||
#import "iOSBridgePlugin.h"
|
||||
#include "H5View.h"
|
||||
|
||||
NSString *stringFromChar(const char *input) {
|
||||
return [NSString stringWithUTF8String: input];
|
||||
}
|
||||
|
||||
void ShezhiACT(bool act){
|
||||
// [iOSBridgePlugin ShezhiACT:act];
|
||||
}
|
||||
void DakaiACT(){
|
||||
// NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
// GetAppController().myUtil = [[Winter alloc] init];
|
||||
// [GetAppController().myUtil i:GetAppController().rootView];
|
||||
// [GetAppController().myUtil set:version];
|
||||
// [GetAppController().myUtil getData];
|
||||
// [GetAppController().myUtil get5ac];
|
||||
|
||||
}
|
||||
|
||||
// 保存视频到相册并设置自定义创建日期
|
||||
void SaveVideoWithCustomDate(const char* videoPathCStr)
|
||||
{
|
||||
@@ -69,22 +57,83 @@ extern "C" {
|
||||
// }
|
||||
}
|
||||
void TrackProduct(const char *eventName, const char *dictionaryJson)
|
||||
{
|
||||
// NSString *keyStr = [NSString stringWithCString:eventName encoding:NSUTF8StringEncoding];
|
||||
// NSString *str = [NSString stringWithCString:dictionaryJson encoding:NSUTF8StringEncoding];
|
||||
// NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
|
||||
// NSError *error = nil;
|
||||
// NSDictionary *eventProperties = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error: &error];
|
||||
// NSLog(@"barry trackProduct-------%@---%@",keyStr,eventProperties);
|
||||
// if(error)
|
||||
// {
|
||||
//
|
||||
// [[DataEyeSDK sharedInstance] track:keyStr properties:[NSDictionary dictionary]];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// [[DataEyeSDK sharedInstance] track:keyStr properties:eventProperties];
|
||||
// }
|
||||
}
|
||||
{
|
||||
// NSString *keyStr = [NSString stringWithCString:eventName encoding:NSUTF8StringEncoding];
|
||||
// NSString *str = [NSString stringWithCString:dictionaryJson encoding:NSUTF8StringEncoding];
|
||||
// NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
|
||||
// NSError *error = nil;
|
||||
// NSDictionary *eventProperties = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error: &error];
|
||||
// NSLog(@"barry trackProduct-------%@---%@",keyStr,eventProperties);
|
||||
// if(error)
|
||||
// {
|
||||
//
|
||||
// [[DataEyeSDK sharedInstance] track:keyStr properties:[NSDictionary dictionary]];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// [[DataEyeSDK sharedInstance] track:keyStr properties:eventProperties];
|
||||
// }
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user