This commit is contained in:
2026-07-15 14:24:29 +08:00
parent b4fc8e6ee8
commit bcfb244b0f
46 changed files with 3659 additions and 294 deletions
@@ -125,7 +125,7 @@ namespace ScrewsMaster
public static void ShowInterstitial(string key)
{
#if !UNITY_EDITOR
#if !UNITY_EDITOR
//if(Random.Range(0, 100)>ConfigSystem.GetConfig<CommonModel>().interstitialtype) return;
MaxADKit.ShowInterstitial(key, isSuccess =>
{
@@ -1100,18 +1100,27 @@ namespace ScrewsMaster
public static void AddInterAdNumber()
{
look_interad_numbers++;
if (IsGiftSwitch() && !SaveData.GetSaveobject().is_get_removead && look_interad_numbers >= ConfigSystem.GetConfig<CommonModel>().playtimes)
if (IsGiftSwitch() && look_interad_numbers >= ConfigSystem.GetConfig<CommonModel>().playtimes)
{
look_interad_numbers = 0;
if (Random.Range(0, 100) < ConfigSystem.GetConfig<CommonModel>().interstitialtype)
{
if (UIManager.Instance.IsExistUI(UIConst.H5UI))
GameHelper.ShowInterstitial("interstitial_h5reward");
else
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.AdcomingUI_Open);
}
}
// if (IsGiftSwitch() && !SaveData.GetSaveobject().is_get_removead && look_interad_numbers >= ConfigSystem.GetConfig<CommonModel>().playtimes)
// {
// look_interad_numbers = 0;
// if (Random.Range(0, 100) < ConfigSystem.GetConfig<CommonModel>().interstitialtype)
// {
// if (UIManager.Instance.IsExistUI(UIConst.H5UI))
// GameHelper.ShowInterstitial("interstitial_h5reward");
// else
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.AdcomingUI_Open);
// }
// }
}
public static Dictionary<string, bool> statusDic = new Dictionary<string, bool>();
@@ -1346,7 +1355,7 @@ namespace ScrewsMaster
m_gameTimes = 0;
PlayerPrefs.SetInt("game_times", m_gameTimes);
Debug.Log("fasongshichang");
Debug.Log("fasongshichang");
NetworkKit.PostWithHeader<RespGameTimeEventData>("event/gameTime", respData, (isSuccess, obj) =>
{
Debug.Log($"PlayGameTimeEvent==== {m_gameTimes}");
+5 -4
View File
@@ -87,10 +87,10 @@ namespace ScrewsMaster
SaveingPotHelper.CheckSaveingPot();
SaveingPotHelper.TestingClearTime();
if (GameHelper.IsGiftSwitch())
{
WebviewManager.Instance.openWebview();
}
// if (GameHelper.IsGiftSwitch())
// {
// WebviewManager.Instance.openWebview();
// }
});
}
@@ -98,6 +98,7 @@ namespace ScrewsMaster
private void ShowScene()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameLoginUI_Open);
LoginSystem_sdk.Instance.RequestLogin();
}
public override void Dispose()
@@ -10,6 +10,7 @@ using FGUI.G009_video;
using Newtonsoft.Json;
using Roy.Datas;
using Random = UnityEngine.Random;
using DontConfuse;
namespace ScrewsMaster
{
@@ -55,7 +56,7 @@ namespace ScrewsMaster
closeCallback?.Invoke();
if (_settlementData != null && _settlementData.is_h5_reward)
{
WebviewManager.Instance.ShowH5View(true);
SdkManager.Instance.ShowH5View(true);
GameDispatcher.Instance.Dispatch(GameMsg.resetH5progress);
}
@@ -87,7 +88,7 @@ namespace ScrewsMaster
if (_settlementData.is_h5_reward)
{
WebviewManager.Instance.ShowH5View(false);
SdkManager.Instance.ShowH5View(false);
}
_isTaskReward = false;
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using DontConfuse;
using FGUI.G004_webview;
using Roy.Datas;
using UnityEngine;
@@ -111,7 +112,7 @@ namespace ScrewsMaster
{
_flySwitch = GameHelper.GetCommonModel().flyswitch == 1;
_propSwitch = GameHelper.GetCommonModel().propswitch == 1;
WebviewManager.Instance.ShowFlyBtn(true);
SdkManager.Instance.ShowFlyBtn(true);
// HallManager.Instance.SetInH5(true);
model.show102 = GameHelper.Get102();
@@ -195,7 +196,7 @@ namespace ScrewsMaster
float amount = (float)iconTime / ConfigSystem.GetConfig<CommonModel>().ThroughRewardCD;
WebviewManager.Instance.SetIconProgress(amount);
SdkManager.Instance.SetIconProgress(amount);
if (!_propSwitch)
{
@@ -319,8 +320,7 @@ namespace ScrewsMaster
{
GameHelper.showGameUI = true;
WebviewManager.Instance.setInH5View(false);
WebviewManager.Instance.ShowH5View(false);
SdkManager.Instance.ShowH5View(false);
// WebThroughUtil.WebThroughDisable(H5WebThroughType.OnlineH5, ui.btn_icon);
StopFly();
countDownKit?.OnDestroy();
@@ -343,8 +343,7 @@ namespace ScrewsMaster
// ui.TopBox.y += Screen.safeArea.y;
}
WebviewManager.Instance.setInH5View(true);
WebviewManager.Instance.ShowH5View(true);
SdkManager.Instance.ShowH5View(true);
makeupTaskData_saveing = SaveData.GetSaveobject().saveingpot_history[SaveData.GetSaveobject().saveingpot_history.Count - 1];
InitData();
InitView();
@@ -406,7 +405,7 @@ namespace ScrewsMaster
// ui.com_fly.visible = leftTime <= 0;
if (leftTime > 0)
{
WebviewManager.Instance.ShowFlyBtn(false);
SdkManager.Instance.ShowFlyBtn(false);
isFlyShow = false;
StopFlyCountdown();
@@ -414,7 +413,7 @@ namespace ScrewsMaster
}
else
{
if (!isFlyShow) WebviewManager.Instance.ShowFlyBtn(true);
if (!isFlyShow) SdkManager.Instance.ShowFlyBtn(true);
isFlyShow = true;
StartFly();
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using FGUI.A000_common;
using FGUI.G018_GameHome;
using DontConfuse;
namespace ScrewsMaster
{
@@ -51,7 +52,7 @@ namespace ScrewsMaster
HallManager.Instance.UpdateSecondEvent -= updateSpeedCD;
GameHelper.showGameUI = true;
WebviewManager.Instance.SetDarkThough(true);
SdkManager.Instance.SetDarkThough(true);
gameDispatcher.Dispatch(GameMsg.MakeUpConfirmUIClosed);
}
@@ -66,7 +67,7 @@ namespace ScrewsMaster
userUid = GameHelper.GetLoginModel().uid;
ad_cool_down = ConfigSystem.GetConfig<CommonModel>().WithdrawalaccelerationCD;
//PreferencesMgr.Instance.MakeupTaskH5Time = 999999999;
WebviewManager.Instance.SetDarkThough(false);
SdkManager.Instance.SetDarkThough(false);
if (AppConst.isPt())
{
ui.lang.selectedIndex = com_confirm.Lang_pt;
@@ -1,5 +1,6 @@
namespace ScrewsMaster
{
using DontConfuse;
using FairyGUI;
using FGUI.G006_menu;
@@ -38,7 +39,7 @@ namespace ScrewsMaster
protected override void OnClose()
{
WebviewManager.Instance.SetDarkThough(true);
SdkManager.Instance.SetDarkThough(true);
CommonHelper.FadeOut(ui);
}
@@ -49,7 +50,7 @@ namespace ScrewsMaster
protected override void OnOpenBefore(object args)
{
WebviewManager.Instance.SetDarkThough(false);
SdkManager.Instance.SetDarkThough(false);
InitData();
InitView();
}
@@ -128,13 +128,13 @@ namespace ScrewsMaster
//初始化页面逻辑
private void InitView()
{
var addPrice = ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
var mergePrice = ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
var cleanPrice = ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
// var addPrice = ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
// var mergePrice = ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
// var cleanPrice = ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
_payBoxPrice = (int)ConfigSystem.GetConfig<CommonModel>().addspace;
if (type != 3)
{
_payBoxPrice = 1;
_payBoxPrice = ConfigSystem.GetConfig<CommonModel>().Purchaseprops;
}
@@ -221,7 +221,7 @@ namespace ScrewsMaster
else if (type == 2) GameHelper.AddItemNumber(ItemEnum.ClearHole, 1);
SetButtonsTouchable(false);
CtrlCloseUI();
ShowScrews.Instance.ShowToast("Successful purchase");
ShowScrews.Instance.ShowToast("Exchange successful");
}
else
{
@@ -249,7 +249,7 @@ namespace ScrewsMaster
ShowScrews.Instance.OnSuccessPayBox1(num);
SetButtonsTouchable(false);
CtrlCloseUI();
ShowScrews.Instance.ShowToast("Successful purchase");
ShowScrews.Instance.ShowToast("Exchange successful");
}
else
{
@@ -10,6 +10,7 @@ using UnityEngine.PlayerLoop;
using Spine.Unity;
using DG.Tweening;
using FGUI.G018_GameHome;
using DontConfuse;
namespace ScrewsMaster
{
@@ -49,7 +50,7 @@ namespace ScrewsMaster
{
HallManager.Instance.UpdateSecondEvent -= updateSpeedCD;
closeCallback?.Invoke();
WebviewManager.Instance.SetDarkThough(true);
SdkManager.Instance.SetDarkThough(true);
GameDispatcher.Instance.Dispatch(GameMsg.RefreshSaveingPot);
}
private SkeletonAnimation ske_pot;
@@ -67,7 +68,7 @@ namespace ScrewsMaster
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BuygoldUI_Close);
ske_pot = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_potparent, Fx_Type.fx_savepot, ref closeCallback);
ske_pot.state.SetAnimation(0, "edie", true);
WebviewManager.Instance.SetDarkThough(false);
SdkManager.Instance.SetDarkThough(false);
SaveingPotHelper.TestingClearTime();
makeupTaskData = SaveData.GetSaveobject().saveingpot_history[SaveData.GetSaveobject().saveingpot_history.Count - 1];
// makeupTaskData.H5Time = 99999999999999;
@@ -643,18 +643,18 @@ namespace ScrewsMaster
ui.btn_task.red.visible = SaveData.getRed();
if (!GameHelper.IsGiftSwitch()) return;
if ((!SaveData.GetSaveobject().is_get_packreward || !SaveData.GetSaveobject().is_get_removead) && !SaveData.GetSaveobject().is_autopack_show
&& GameHelper.showGameUI && (Time.time > (ConfigSystem.GetConfig<CommonModel>().Activetimes * 60)))
{
// if ((!SaveData.GetSaveobject().is_get_packreward || !SaveData.GetSaveobject().is_get_removead) && !SaveData.GetSaveobject().is_autopack_show
// && GameHelper.showGameUI && (Time.time > (ConfigSystem.GetConfig<CommonModel>().Activetimes * 60)))
// {
PackRewardData param = new PackRewardData();
param.isAutoPop = true;
param.isNeedScroll = false;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param);
SaveData.GetSaveobject().is_autopack_show = true;
SaveData.GetSaveobject().is_autopack_show_day = DateTime.Now.Day;
SaveData.saveDataFunc();
}
// PackRewardData param = new PackRewardData();
// param.isAutoPop = true;
// param.isNeedScroll = false;
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param);
// SaveData.GetSaveobject().is_autopack_show = true;
// SaveData.GetSaveobject().is_autopack_show_day = DateTime.Now.Day;
// SaveData.saveDataFunc();
// }
}
}
}
+18
View File
@@ -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: c9ce6d3a070acdf4394bf7556c953c27
guid: b2a448b036fdc7344a094869a27dea0f
PluginImporter:
externalObjects: {}
serializedVersion: 2
+59
View File
@@ -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: 4c2e3a62020ffae4998ebaa981d7c1e6
guid: 8d3e2c93e9a25ce4b92478115423e1cf
PluginImporter:
externalObjects: {}
serializedVersion: 2
+17
View File
@@ -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: ed5833ef2f42cda46b5c19f3d349a8cb
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:
+132
View File
@@ -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: 74b8531953e29c64ba40bc75cfa757ce
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:
+21
View File
@@ -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
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 8e95116484f503a41b9738e3a4219aea
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:
+162
View File
@@ -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
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 4103d2c7c9134ec41a226f6b8b794354
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:
+16 -62
View File
@@ -2,80 +2,34 @@ fileFormatVersion: 2
guid: 1c0d8a6c9b36440eaa4c01518670217f
labels:
- gvh
- gvh_version-10.6.0
- gvhp_exportpath-Plugins/iOS/GADUAdNetworkExtras.h
timeCreated: 1480838400
PluginImporter:
serializedVersion: 1
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
Android:
enabled: 0
settings:
CPU: AnyCPU
- first:
Any:
second:
enabled: 0
settings: {}
Editor:
enabled: 1
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
Linux:
- first:
iPhone: iOS
second:
enabled: 1
settings:
CPU: x86
Linux64:
enabled: 1
settings:
CPU: x86_64
LinuxUniversal:
enabled: 1
settings:
CPU: AnyCPU
OSXIntel:
enabled: 1
settings:
CPU: x86
OSXIntel64:
enabled: 1
settings:
CPU: x86_64
OSXUniversal:
enabled: 1
settings:
CPU: AnyCPU
Web:
enabled: 0
settings: {}
WebStreamed:
enabled: 0
settings: {}
Win:
enabled: 1
settings:
CPU: x86
Win64:
enabled: 1
settings:
CPU: x86_64
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
iOS:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
tvOS:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:
+32
View File
@@ -0,0 +1,32 @@
//
// 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)showView:(BOOL)show;
-(void)setIconProgress:(float)value;
-(void)setViewPadding:(CGRect)rect;
-(void)SetDarkThough:(BOOL)though;
-(void)setViewBtn:(CGRect)rect;
-(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)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)OpenWv;
@end
@interface H5View (WKNavigationDelegate) <WKNavigationDelegate>
@end
NS_ASSUME_NONNULL_END
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 803bcb50fbbc55041bdeb0bce53cadad
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
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 0d6ea760436ab504bb83f2ac764687d2
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,8 +0,0 @@
// HapticFeedbackManager.h
#import <Foundation/Foundation.h>
@interface HapticFeedbackManager : NSObject
+ (void)TriggerCustomHaptic:(float)intensity sharpness:(float)sharpness duration:(float)duration;
@end
@@ -1,95 +0,0 @@
// HapticFeedbackManager.m
#import "HapticFeedbackManager.h"
#import <CoreHaptics/CoreHaptics.h>
#import <AudioToolbox/AudioToolbox.h>
#import <UIKit/UIKit.h>
@implementation HapticFeedbackManager
static CHHapticEngine *hapticEngine;
+ (void)initializeHapticEngine {
if (!hapticEngine) {
NSError *error = nil;
hapticEngine = [[CHHapticEngine alloc] initAndReturnError:&error];
if (error) {
NSLog(@"Failed to create haptic engine: %@", error.localizedDescription);
} else {
[hapticEngine startWithCompletionHandler:^(NSError * _Nullable error) {
if (error) {
NSLog(@"Failed to start haptic engine: %@", error.localizedDescription);
}
}];
}
}
}
+ (void)TriggerCustomHaptic:(float)intensity sharpness:(float)sharpness duration:(float)duration {
if (@available(iOS 13.0, *)) {
if (![CHHapticEngine capabilitiesForHardware].supportsHaptics) {
NSLog(@"Haptic feedback is not supported on this device.");
[self triggerFallbackHaptic];
return;
}
[self initializeHapticEngine];
NSError *error = nil;
CHHapticEventParameter *intensityParameter = [[CHHapticEventParameter alloc] initWithParameterID:CHHapticEventParameterIDHapticIntensity value:intensity];
CHHapticEventParameter *sharpnessParameter = [[CHHapticEventParameter alloc] initWithParameterID:CHHapticEventParameterIDHapticSharpness value:sharpness];
CHHapticEvent *event = [[CHHapticEvent alloc] initWithEventType:CHHapticEventTypeHapticContinuous parameters:@[intensityParameter, sharpnessParameter] relativeTime:0 duration:duration];
CHHapticPattern *pattern = [[CHHapticPattern alloc] initWithEvents:@[event] parameters:@[] error:&error];
if (error) {
NSLog(@"Failed to create haptic pattern: %@", error.localizedDescription);
return;
}
id<CHHapticPatternPlayer> player = [hapticEngine createPlayerWithPattern:pattern error:&error];
if (error) {
NSLog(@"Failed to create haptic player: %@", error.localizedDescription);
return;
}
[player startAtTime:CHHapticTimeImmediate error:&error];
if (error) {
NSLog(@"Failed to start haptic player: %@", error.localizedDescription);
}
} else {
NSLog(@"Core Haptics is not available on this version of iOS.");
}
}
+ (void)triggerFallbackHaptic {
// 使
// UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc]
// initWithStyle:UIImpactFeedbackStyleLight];
// [generator prepare];
// [generator impactOccurred];
// UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc]
// initWithStyle:UIImpactFeedbackStyleHeavy];
// [generator prepare];
// [generator impactOccurred];
// 使 UINotificationFeedbackGenerator
// UINotificationFeedbackGenerator *generator = [[UINotificationFeedbackGenerator alloc] init];
// [generator prepare];
// [generator notificationOccurred:UINotificationFeedbackTypeSuccess];
// 使
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
#ifdef __cplusplus
extern "C" {
#endif
void TriggerCustomHaptic(float intensity, float sharpness, float duration) { [HapticFeedbackManager TriggerCustomHaptic:intensity sharpness:sharpness duration:duration];
}
#ifdef __cplusplus
}
#endif
@end
@@ -0,0 +1,200 @@
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
#import <QuartzCore/QuartzCore.h>
extern UIView *UnityGetGLView(void);
@interface UIApplication (UnityTouchHook)
- (void)ut_sendEvent:(UIEvent *)event;
@end
@implementation UIApplication (UnityTouchHook)
// ==========================================
// 【实装优化】:将 Ivar、Class 提取为静态全局变量,在 +load 中一次性缓存
static CFTimeInterval g_lastMovedTime = 0;
static Class g_touchClass = Nil;
static Ivar g_ivarView = NULL;
static Ivar g_ivarLocation = NULL;
static Ivar g_ivarPrevLocation = NULL;
// ==========================================
+ (void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class cls = [UIApplication class];
Method original = class_getInstanceMethod(cls, @selector(sendEvent:));
Method swizzled = class_getInstanceMethod(cls, @selector(ut_sendEvent:));
if (original && swizzled) {
method_exchangeImplementations(original, swizzled);
}
// ==========================================
// 【实装优化】:在 +load 时集中初始化,彻底消灭每帧的 Runtime 检索开销
g_touchClass = [UITouch class];
g_ivarView = class_getInstanceVariable(g_touchClass, "_view");
g_ivarLocation = class_getInstanceVariable(g_touchClass, "_locationInWindow");
g_ivarPrevLocation = class_getInstanceVariable(g_touchClass, "_previousLocationInWindow");
// ==========================================
});
}
- (void)ut_sendEvent:(UIEvent *)event
{
// 1. 让系统和 WebView 先走正常响应
[self ut_sendEvent:event];
if (event.type != UIEventTypeTouches)
return;
UIView *unityView = UnityGetGLView();
if (!unityView)
return;
NSSet *touches = event.allTouches;
UITouch *touch = [touches anyObject];
if (!touch)
return;
// 2. 拦截所有来自 WebView 或非 UnityView 的点击
if (touch.view != unityView && ![touch.view isDescendantOfView:unityView]) {
UITouchPhase phase = touch.phase;
if (phase == UITouchPhaseMoved) {
CFTimeInterval currentTime = CACurrentMediaTime();
if (currentTime - g_lastMovedTime < 0.016) {
return;
}
g_lastMovedTime = currentTime;
}
// 【优化成果】:直接使用 self 获取 keyWindow
UIWindow *window = self.keyWindow;
if (!window && unityView.window) {
window = unityView.window;
}
// ==========================================
// 【实装优化】:window == nil 时提前返回,防止后续无意义计算与 KVC 崩溃风险
if (!window) {
return;
}
// ==========================================
// 【优化成果】:提取 locationInView 只计算一次
CGPoint pointInWindow = [touch locationInView:window];
CGPoint pointPrevWindow = [touch previousLocationInView:window];
CGPoint originalLocationStruct = pointInWindow;
CGPoint originalPrevLocationStruct = pointPrevWindow;
// 【优化成果】:砍掉 convertPoint:fromView: 的矩阵计算
CGPoint pointInUnity = pointInWindow;
CGRect unityFrame = unityView.frame;
if (unityFrame.origin.x != 0 || unityFrame.origin.y != 0) {
pointInUnity.x -= unityFrame.origin.x;
pointInUnity.y -= unityFrame.origin.y;
}
// 【优化安全加固】:保留最后一道防线,防御极端情况下的 NaN / Inf
if (isnan(pointInUnity.x) || isinf(pointInUnity.x)) pointInUnity.x = 0;
if (isnan(pointInUnity.y) || isinf(pointInUnity.y)) pointInUnity.y = 0;
// 【优化成果】:在栈上缓存一次 bounds 结构体
CGRect bounds = unityView.bounds;
CGFloat viewWidth = bounds.size.width <= 0 ? 375 : bounds.size.width;
CGFloat viewHeight = bounds.size.height <= 0 ? 812 : bounds.size.height;
// 【优化成果】:改用利于 CPU 分支预测的 if-else 约束范围
if (pointInUnity.x < 0) {
pointInUnity.x = 0;
} else if (pointInUnity.x > viewWidth) {
pointInUnity.x = viewWidth;
}
if (pointInUnity.y < 0) {
pointInUnity.y = 0;
} else if (pointInUnity.y > viewHeight) {
pointInUnity.y = viewHeight;
}
CGPoint finalInjectPoint = pointInUnity;
// 3. 备份原始值(后续无需重复获取 Ivar,直接使用静态全局变量)
UIView *originalView = touch.view;
NSValue *originalLocation = nil;
NSValue *originalPrevLocation = nil;
if (g_ivarLocation) {
originalLocation = [touch valueForKey:@"locationInWindow"];
}
if (g_ivarPrevLocation) {
originalPrevLocation = [touch valueForKey:@"previousLocationInWindow"];
}
// 4. 【强制临时修改】重写原生 touch
if (g_ivarView) {
object_setIvar(touch, g_ivarView, unityView);
} else {
[touch setValue:unityView forKey:@"view"];
}
if (g_ivarLocation) object_setIvar(touch, g_ivarLocation, [NSValue valueWithCGPoint:finalInjectPoint]);
// 计算 Moved 阶段的伪造历史坐标
if (phase == UITouchPhaseMoved && originalLocation && originalPrevLocation) {
CGPoint offset = CGPointMake(originalLocationStruct.x - originalPrevLocationStruct.x, originalLocationStruct.y - originalPrevLocationStruct.y);
CGPoint fakePrevPoint = CGPointMake(finalInjectPoint.x - offset.x, finalInjectPoint.y - offset.y);
if (isnan(fakePrevPoint.x) || isinf(fakePrevPoint.x)) fakePrevPoint.x = finalInjectPoint.x;
if (isnan(fakePrevPoint.y) || isinf(fakePrevPoint.y)) fakePrevPoint.y = finalInjectPoint.y;
if (fakePrevPoint.x < 0) {
fakePrevPoint.x = 0;
} else if (fakePrevPoint.x > viewWidth) {
fakePrevPoint.x = viewWidth;
}
if (fakePrevPoint.y < 0) {
fakePrevPoint.y = 0;
} else if (fakePrevPoint.y > viewHeight) {
fakePrevPoint.y = viewHeight;
}
if (g_ivarPrevLocation) object_setIvar(touch, g_ivarPrevLocation, [NSValue valueWithCGPoint:fakePrevPoint]);
} else {
if (g_ivarPrevLocation) object_setIvar(touch, g_ivarPrevLocation, [NSValue valueWithCGPoint:finalInjectPoint]);
}
[touch setValue:[NSValue valueWithCGPoint:finalInjectPoint] forKey:@"locationInWindow"];
// 5. 将清洗干净的事件丢给 UnityView 通道
switch (phase) {
case UITouchPhaseBegan: [unityView touchesBegan:touches withEvent:event]; break;
case UITouchPhaseMoved: [unityView touchesMoved:touches withEvent:event]; break;
case UITouchPhaseEnded: [unityView touchesEnded:touches withEvent:event]; break;
case UITouchPhaseCancelled: [unityView touchesCancelled:touches withEvent:event]; break;
default: break;
}
// 6. 立刻恢复现场
if (g_ivarView) {
object_setIvar(touch, g_ivarView, originalView);
} else {
[touch setValue:originalView forKey:@"view"];
}
if (g_ivarLocation && originalLocation) {
object_setIvar(touch, g_ivarLocation, originalLocation);
[touch setValue:originalLocation forKey:@"locationInWindow"];
}
if (g_ivarPrevLocation && originalPrevLocation) {
object_setIvar(touch, g_ivarPrevLocation, originalPrevLocation);
}
}
}
@end
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 4b4b8d72a37ba3f40aef9216b44dbe37
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:
+7
View File
@@ -42,6 +42,13 @@ extern "C"
// 调用trackProduct方法并传递两个参数
[[EventMark sharedEventMark] trackProduct:eventNameString dictionaryJson:jsonString];
}
void copyText(const char* text)
{
NSLog(@"copyText----: %s", text);
// 将C风格的字符串转换为NSString,并调用openURL方法
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = [NSString stringWithUTF8String:text];
}
}
- (void)initDataEyeSDK
{
+32 -10
View File
@@ -1,20 +1,42 @@
#import <UnityFramework/UnityFramework-Swift.h>
extern "C" {
#import "UnityAppController.h"
#include "H5View.h"
NSString *stringFromChar(const char *input) {
return [NSString stringWithUTF8String: input];
}
void SetDarkThough(bool though){
void ShowH5View(bool flag){//显示明或暗网页
[[H5View shared] showView:flag];
}
void openWebview(bool though){
}
void showGameA(bool flag){//显示游戏a
[NativeUIManager showMainMenu];
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 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 SetIconProgress(float val){
[[H5View shared] setIconProgress:val];
}
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 OpenWv (bool show) {
[[H5View shared] OpenWv];
}
}
+16 -62
View File
@@ -2,80 +2,34 @@ fileFormatVersion: 2
guid: 52c76a20e90b4b26b396c50aea983ab5
labels:
- gvh
- gvh_version-10.6.0
- gvhp_exportpath-Plugins/iOS/unity-plugin-library.a
timeCreated: 1480838400
PluginImporter:
serializedVersion: 1
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
Android:
enabled: 0
settings:
CPU: AnyCPU
- first:
Any:
second:
enabled: 0
settings: {}
Editor:
enabled: 1
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
Linux:
- first:
iPhone: iOS
second:
enabled: 1
settings:
CPU: x86
Linux64:
enabled: 1
settings:
CPU: x86_64
LinuxUniversal:
enabled: 1
settings:
CPU: AnyCPU
OSXIntel:
enabled: 1
settings:
CPU: x86
OSXIntel64:
enabled: 1
settings:
CPU: x86_64
OSXUniversal:
enabled: 1
settings:
CPU: AnyCPU
Web:
enabled: 0
settings: {}
WebStreamed:
enabled: 0
settings: {}
Win:
enabled: 1
settings:
CPU: x86
Win64:
enabled: 1
settings:
CPU: x86_64
WindowsStoreApps:
enabled: 0
settings:
CPU: AnyCPU
iOS:
enabled: 1
settings:
CompileFlags:
FrameworkDependencies:
tvOS:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
AddToEmbeddedBinaries: true
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -25,7 +25,7 @@ public class FGUIClickDetection : MonoBehaviour
// 最后将转换后的坐标传递给 FairyGUI 的本地坐标系
// Vector2 fguiPos = GRoot.inst.GlobalToLocal(fguiScreenPos);
WebviewManager.Instance.HandleUIElements(fguiScreenPos);
// WebviewManager.Instance.HandleUIElements(fguiScreenPos);
// GetInteractiveObjectAtScreenPosition(screenPosition);
// 将屏幕坐标转换为FGUI坐标
// Vector2 localPos = GRoot.inst.GlobalToLocal(screenPosition);
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 16df66f027fdbc2408c47c53e75d559f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,277 @@
using System;
using System.IO;
using UnityEngine;
using System.Collections.Generic;
using Newtonsoft.Json;
using BingoBrain;
using System.Linq;
using System.Text;
using DontConfuse;
using UnityEngine.Networking;
using UnityEngine.Events;
using System.Collections;
using ScrewsMaster;
using FairyGUI;
namespace BingoBrain
{
public class ConfigSystem_sdk
{
private ConfigSystem_sdk()
{
}
private static readonly ConfigSystem_sdk _instance = new ConfigSystem_sdk();
public static ConfigSystem_sdk Instance
{
get { return _instance; }
}
private static Dictionary<Type, object> configData = new();
public void OnRequestGetConfig()
{
var loginData = LoginModel_sdk.Instance;
var configFileName = "Json";
var configFileSavePath = $"{Application.persistentDataPath}/sdkConfig/";
var assetHotFixFilePath = $"{configFileSavePath}{configFileName}.txt";
var configFileNameKey = "sdkconfigFileName";
var CDNConfigFileName = loginData.setting;
string savedCfgName = PlayerPrefs.GetString(configFileNameKey);
bool needDownloadConfigFile = false;
if (!string.IsNullOrEmpty(CDNConfigFileName))
{
//如果本地Player Prefs里没有保存配置文件名
if (string.IsNullOrEmpty(savedCfgName))
{
// Debug.Log("[UNITY] No config file name saved.");
needDownloadConfigFile = true;
}
else
{
// Debug.Log($"[UNITY] Saved config name: {savedCfgName}, CDN config name: {CDNConfigFileName}");
//与CDN上的对比名称
if (!savedCfgName.Equals(CDNConfigFileName))
{
needDownloadConfigFile = true;
}
}
}
//Debug.Log($"[UNITY] needDownloadConfigFile: {needDownloadConfigFile}");
//默默地拉去新配置
// Debug.Log("kkkkkkkkkkkkkkkkkkkkkk" + needDownloadConfigFile);
// Debug.Log("kkkkkkkkkkkkkkkkkkkkkk" + savedCfgName);
if (needDownloadConfigFile || !File.Exists(assetHotFixFilePath))
{
SdkManager.Instance.StartCoroutine(GetTextFromUrl($"{loginData.cdn_url}/config/{CDNConfigFileName}",
configFileName, (content) =>
{
PlayerPrefs.SetString(configFileNameKey, CDNConfigFileName);
ParseConfig(content);
//CtrlDispatcher.Instance.Dispatch(CtrlMsg.NewConfigRead);
}, configFileSavePath));
}
else if (File.Exists(assetHotFixFilePath))
{
// Debug.Log($"[UNITY] Load config from datapath: {assetHotFixFilePath}");
ParseConfig(File.ReadAllText(assetHotFixFilePath));
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
// GameHelper.PostFunnelLogin("loadFinish");
}
//检查设备本地是否有配置文件
}
public static IEnumerator GetTextFromUrl(string url, string fileName, UnityAction<string> action = null,
string savePath = null)
{
var unityWebRequest = UnityWebRequest.Get(url);
yield return unityWebRequest.SendWebRequest();
if (unityWebRequest.result is UnityWebRequest.Result.ConnectionError
or UnityWebRequest.Result.ProtocolError)
{
Debug.LogError($"加载 [ {fileName} ] 文本文件失败 {unityWebRequest.error} [ url: {url} ]");
action?.Invoke(default);
yield break;
}
var content = unityWebRequest.downloadHandler.text;
SaveTextFile(content, savePath, fileName);
action?.Invoke(content);
}
private static void SaveTextFile(string content, string filePath, string fileName)
{
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
File.WriteAllText($"{filePath}{fileName}.txt", content);
}
private void ParseConfig(string json)
{
Debug.Log("sdk--------json" + json);
if (json == null)
{
return;
}
if (!json.StartsWith("{"))
{
json = Encoding.UTF8.GetString(Base64Kit_sdk.Decrypt(Encoding.UTF8.GetBytes(json),
NetworkManager.packName));
}
Debug.Log("转化后的json" + json);
SetConfig(json);
Debug.Log(LoginModel_sdk.Instance.reg_time);
Debug.Log(GetRegisteredCalendarDaysByUTC(LoginModel_sdk.Instance.reg_time));
SdkManager.Instance.OpenWv();
int flyswitch = ConfigSystem.GetConfig<CommonModel>().flyswitch;
int propswitch = ConfigSystem.GetConfig<CommonModel>().propswitch;
float top_offset = 150;//fgui中的顶部信息的高度
float buttom_offset = 0;
if (Screen.safeArea.y != 0)
{//刘海屏
top_offset += Screen.safeArea.y;
}
SdkManager.Instance.setFlyBtnTag(flyswitch == 1);
SdkManager.Instance.setRewardBtnTag(propswitch == 1);
SdkManager.Instance.SetBtn(ConfigSystem.GetConfig<CommonModel>().propCoord[0], ConfigSystem.GetConfig<CommonModel>().propCoord[1], 60, 60);
SdkManager.Instance.SetPadding(0, top_offset / GRoot.inst.height, 0, buttom_offset / GRoot.inst.height);
SdkManager.Instance.SetDarkThough(true);
SdkManager.Instance.RefreshUrl();
SdkManager.Instance.ShowH5View(false);
}
public int GetRegisteredCalendarDaysByUTC(long regTimeTimestamp)
{
// 1. 转换为 0时区 的日期部分(抹去具体时分秒,变成 00:00:00)
DateTime regDateUtc = DateTimeOffset.FromUnixTimeSeconds(regTimeTimestamp).UtcDateTime.Date;
// 2. 获取当前 0时区 的日期部分
DateTime nowDateUtc = DateTimeOffset.UtcNow.UtcDateTime.Date;
// 3. 两个 0时区的日期直接相减
TimeSpan difference = nowDateUtc - regDateUtc;
int days = difference.Days;
return days < 0 ? 0 : days;
}
public RootObject SDKConfig;
private void SetConfig(string json_)
{
SDKConfig = JsonConvert.DeserializeObject<RootObject>(json_);
for (int i = 0; i < SDKConfig.h5Conf.links.Count; i++)
{
if (SDKConfig.h5Conf.links[i].maxF5Times < 0)
{
SDKConfig.h5Conf.links[i].maxF5Times = 99999;
}
}
for (int i = 0; i < SDKConfig.h6Conf.layerConfList.Count; i++)
{
for (int j = 0; j < SDKConfig.h6Conf.layerConfList[i].links.Count; j++)
{
if (SDKConfig.h6Conf.layerConfList[i].links[j].maxF5Times < 0)
{
SDKConfig.h6Conf.layerConfList[i].links[j].maxF5Times = 99999;
}
}
}
}
}
public class RootObject
{
public string bid;
public H5Conf h5Conf;
public H6Conf h6Conf;
}
public class H5Conf
{
public F5Interval f5Interval;//自动刷新间隔
public List<H5Link> links; // H5 的 Link
}
public class F5Interval
{
public int min;
public int max;
}
public class H5Link
{
public int id;
public string url;
public int weight;
public int maxF5Times;
}
public class H6Conf
{
public int layers;//层数总数
public ADClickF5Delay ADClickF5Delay;//延长时间
public SwitchCondition switchCondition;//开启条件
public List<LayerConfList> layerConfList;
}
public class ADClickF5Delay
{
public int min;
public int max;
}
public class SwitchCondition//开启条件
{
public List<RetentionConf> retentionConf; // 已经实例化为具体类型
}
public class RetentionConf//开启条件
{
public Days days;
public int prob;
}
public class Days
{
public int min;
public int max;
}
public class LayerConfList
{
public int layerId;//第几层
public int weight;//显示权重
public F5Interval f5Interval;//自动刷新间隔
public int offset;
public List<H6Link> links; // H6 内部图层的 Link
}
public class H6Link
{
public int id;
public string url;
public int weight;
public int maxF5Times;//刷新上限
public int ctProb;
public int ctProb2;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c8538a57a3c527342a227adf0c5c9f20
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
public class LoginModel_sdk
{
public static LoginModel_sdk _instance = new LoginModel_sdk();
private LoginModel_sdk()
{
}
public static LoginModel_sdk Instance
{
get { return _instance; }
}
public long uid;
public bool new_player;
public string token;
public long expires_at;
public string country;
public bool is_magic;
public string invite_code;
public string invite_url;
public long last_login_time;
public string play_data;
public string setting;
public string cdn_url;
public long login_time;
public long reg_time;
public bool debug_log = true;
public int enwp;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e0aea1b60e9976e4293e8a33deb1c488
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,174 @@
using UnityEngine;
using Newtonsoft.Json;
using BingoBrain;
using DG.Tweening;
using System;
using ScrewsMaster;
using AppLovinMax.Scripts.IntegrationManager.Editor;
public class LoginSystem_sdk
{
//is debug test (LoginCountLimit 应该为 5 测试改为2)
private const int LoginCountLimit = 5;
public int loginCount = 0;
private LoginSystem_sdk()
{
}
private static readonly LoginSystem_sdk _instance = new LoginSystem_sdk();
public static LoginSystem_sdk Instance
{
get { return _instance; }
}
public void RequestLogin()
{
var requestLoginData = new RequestLoginData_sdk
{
device_id = SystemInfo.deviceUniqueIdentifier,
// device_id ="E742FE8B-C32E-56A7-8F8A-6B3BC0F3169",
pack_name = NetworkManager.packName,
app_version = Application.version,
// channel = BingoBea.Instance.attribution,
// sim = WebviewManager.haveSimCard
};
Debug.Log(JsonConvert.SerializeObject(requestLoginData));
Debug.Log(SystemInfo.deviceUniqueIdentifier);
Debug.Log(JsonConvert.SerializeObject(requestLoginData));
NetworkKit_sdk.Post<LoginModel_sdk>("login", requestLoginData, (isSuccess, loginData) =>
{
if (isSuccess)
{
Debug.Log("Login_sdk" + "-------------------" + JsonConvert.SerializeObject(loginData));
LoginModel_sdk loginModel = LoginModel_sdk.Instance;
loginModel.cdn_url = loginData.cdn_url;
loginModel.setting = loginData.setting;
loginModel.play_data = loginData.play_data;
loginModel.token = loginData.token;
loginModel.uid = loginData.uid;
loginModel.country = loginData.country;
loginModel.expires_at = loginData.expires_at;
loginModel.is_magic = loginData.is_magic;
loginModel.invite_code = loginData.invite_code;
loginModel.invite_url = loginData.invite_url;
loginModel.last_login_time = loginData.last_login_time;
loginModel.login_time = loginData.login_time;
loginModel.reg_time = loginData.reg_time;
loginModel.new_player = loginData.new_player;
loginModel.debug_log = loginData.debug_log;
loginModel.enwp = loginData.enwp;
// if (loginData.is_magic)
// {
// if (PlayerPrefs.GetInt("is_gift") != 1)
// {
// AppDispatcher.Instance.Dispatch(CsjInfoC.UI_DisplayLoadingUI);
// UICtrlDispatcher.Instance.Dispatch(SkinInfo.LoginAUI_Close);
// }
// PlayerPrefs.SetInt("is_gift", 1);
// }
// else
// {
// return;
// }
NetworkKit_sdk.CDNUrl = $"{loginData.cdn_url}/";
NetworkKit_sdk.SetCacheToken(loginData.token);
// DateTimeBoardk.Instance.SetServerCurrTimestamp(loginData.login_time);
// Sequence mLoopSequence = DOTween.Sequence();
// mLoopSequence.AppendCallback(() =>
// {
// RequestHeart();
// GameHelper.PostFunnelLogin("loginRecv", true);
ConfigSystem_sdk.Instance.OnRequestGetConfig();
// if (GameHelper.IsGiftSwitch())
// {
// // GameObject.Find("MainCameraRoot").SetActive(false);
// }
}
else
{
Debug.Log(JsonConvert.SerializeObject(loginData));
//UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
Debug.Log("登陆请求失败");
float times = loginCount == 0 ? 0 : 5f;
DOVirtual.DelayedCall(times, () =>
{
if (loginCount < LoginCountLimit)
{
loginCount++;
RequestLogin();
}
else
{
loginCount = 0;
Action _OnFail = () =>
{
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
};
}
});
}
});
}
private void RequestHeart()
{
NetworkKit.PostWithHeader("user/health");
}
private void OnRequestLogin(object obj = null)
{
RequestLogin();
}
}
public partial class NetworkMsg_sdk
{
private static uint MsgRootLogic = 100000;
public static uint GetConfig = ++MsgRootLogic;
public static uint Reconnect = ++MsgRootLogic;
public static uint Login = ++MsgRootLogic;
public static uint SavePlayData = ++MsgRootLogic;
public static uint GetPlayData = ++MsgRootLogic;
public static uint SendInviteCode = ++MsgRootLogic;
public static uint GetInviteData = ++MsgRootLogic;
public static uint UpdateCheckInviteData = ++MsgRootLogic;
public static string Identifier = "com.interactivegames.bingotornado";
public static uint Start = ++MsgRootLogic;
public static uint NotNetwork = ++MsgRootLogic;
}
public class RequestLoginData_sdk
{
public string device_id;
public string pack_name;
public string app_version;
public string channel;
public bool sim;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b0e15557430f65f449b5b9a4fa39bb1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+570
View File
@@ -0,0 +1,570 @@
using System.Text;
using UnityEngine;
using System.Collections;
using UnityEngine.Events;
using UnityEngine.Networking;
using System.Collections.Generic;
using Newtonsoft.Json;
using BingoBrain;
using System;
using DontConfuse;
using System.Linq;
using System.Security.Cryptography;
public class NetworkKit_sdk
{
public const string JarvisToken_SDK = "JarvisToken_SDK";
public static string CDNUrl;
public static string GetCacheToken()
{
string token = null;
if (PlayerPrefs.HasKey(JarvisToken_SDK))
{
token = PlayerPrefs.GetString(JarvisToken_SDK, string.Empty);
}
return token;
}
public static void SetCacheToken(string token)
{
PlayerPrefs.SetString(JarvisToken_SDK, token);
}
public const string DomainDebugUrl = @"https://sdkapi.jsoncompare.online/api/";
public static readonly string DomainReleaseUrl = $"https://bingotornado.top/api/";
private static IEnumerator PostInternal<T>(string url, object requestData, UnityAction<bool, T> onCompleted,
Dictionary<string, string> header = null)
{
string requestJson = JsonConvert.SerializeObject(requestData);
string url2 = url;
#if BingoBrainRelease
url2 = Base64Kit_sdk.Encode(url);
requestJson = Base64Kit_sdk.Encode(requestJson);
#endif
byte[] bytes = Encoding.UTF8.GetBytes(requestJson);
string url1 = DomainDebugUrl + url2;
//Debug.Log($"Url: {url1}");
UnityWebRequest loginRequest = new UnityWebRequest(url1, UnityWebRequest.kHttpVerbPOST)
{
uploadHandler = new UploadHandlerRaw(bytes),
downloadHandler = new DownloadHandlerBuffer()
};
if (header != null)
{
foreach (var keyValuePair in header)
{
loginRequest.SetRequestHeader(keyValuePair.Key, keyValuePair.Value);
}
}
SetRequestContentType(loginRequest);
yield return loginRequest.SendWebRequest();
if (loginRequest.result is not UnityWebRequest.Result.Success)
{
onCompleted?.Invoke(false, default);
}
else
{
string receiveContent = loginRequest.downloadHandler.text;
#if BingoBrainRelease
if (!receiveContent.IsNullOrWhiteSpace())
{
receiveContent = receiveContent.Substring(0, receiveContent.Length - 1);
receiveContent = receiveContent.Substring(1);
receiveContent = Base64Kit_sdk.Decode(receiveContent);
}
#endif
// Debug.Log(url + "--------" + loginRequest.downloadHandler.text);
Debug.Log(url + "--------" + receiveContent);
var response = JsonConvert.DeserializeObject<ResponseData_sdk>(receiveContent);
if (response?.code == 0)
{
var responseData = JsonConvert.DeserializeObject<T>(response.data.ToString());
onCompleted?.Invoke(true, responseData);
}
else
{
if (response?.code == 1005)
{
ReLoginGetToken();
}
onCompleted?.Invoke(false, default);
}
}
loginRequest.Dispose();
}
public static void SetRequestContentType(UnityWebRequest request)
{
request.SetRequestHeader("Content-Type", "application/json;charset=utf-8");
}
public static void Post<T>(string url, object requestData, UnityAction<bool, T> onCompleted)
{
SdkManager.Instance.StartCoroutine(PostInternal(url, requestData, onCompleted));
}
public static void Post(string url, object requestData, UnityAction<bool, object> onCompleted = null)
{
SdkManager.Instance.StartCoroutine(PostInternal(url, requestData, onCompleted));
}
public static void PostWithHeader<T>(string url, object requestData = null,
UnityAction<bool, T> onCompleted = null)
{
ReSetToken();
var headers = new Dictionary<string, string> { { "x-token", GetCacheToken() } };
SdkManager.Instance.StartCoroutine(PostInternal(url, requestData, onCompleted, headers));
}
public static void PostWithHeader<T>(string url, UnityAction<bool, T> onCompleted)
{
if (onCompleted != null)
{
PostWithHeader<T>(url, null, (isSuccess, obj) => { onCompleted.Invoke(isSuccess, obj); });
}
else
{
PostWithHeader<T>(url);
}
}
public static void PostWithHeader(string url, object requestData = null, UnityAction<bool> onCompleted = null)
{
if (onCompleted != null)
{
PostWithHeader<object>(url, requestData, (isSuccess, obj) => { onCompleted?.Invoke(isSuccess); });
}
else
{
PostWithHeader<object>(url, requestData);
}
}
public static void Get(string url, UnityAction<string> onCompleted)
{
SdkManager.Instance.StartCoroutine(GetInternal(url, onCompleted));
}
public static IEnumerator GetInternal(string url, UnityAction<string> onCompleted)
{
var request = UnityWebRequest.Get(url);
yield return request.SendWebRequest();
if (request.result is not UnityWebRequest.Result.Success)
{
onCompleted?.Invoke(default);
}
else
{
var receiveContent = request.downloadHandler.text;
var json = Json_StringFormat(receiveContent);
onCompleted?.Invoke(receiveContent);
}
request.Dispose();
}
public static string Json_StringFormat(string sourceJson)
{
sourceJson += " ";
var index = 0;
var newJson = new StringBuilder();
for (int i = 0; i < sourceJson.Length - 1; i++)
{
if (sourceJson[i] == '{' || sourceJson[i] == '[')
{
index++;
newJson.Append(sourceJson[i]);
newJson.Append("\n");
for (var a = 0; a < index; a++)
{
newJson.Append("\t");
}
}
else if ((sourceJson[i] == '}' || sourceJson[i] == ']'))
{
index--;
newJson.Append("\n");
for (var a = 0; a < index; a++)
{
newJson.Append("\t");
}
newJson.Append(sourceJson[i]);
newJson.Append(sourceJson[i + 1] == ',' ? "," : "");
newJson.Append("\n");
if (sourceJson[i + 1] == ',') i++;
for (int a = 0; a < index; a++)
{
newJson.Append("\t");
}
}
else if (sourceJson[i] != '}' && sourceJson[i] != ']' && sourceJson[i + 1] == ',')
{
newJson.Append(sourceJson[i]);
newJson.Append(sourceJson[i + 1]);
newJson.Append("\n");
i++;
for (var a = 0; a < index; a++)
{
newJson.Append("\t");
}
}
else
{
newJson.Append(sourceJson[i]);
}
}
return newJson.ToString();
}
// public static void BuriedPoint(string eventname, string eventproperty, int integer)
// {
// if (eventname == BuriedPointEvent.Apple_AD_event || eventname == BuriedPointEvent.Apple_pay_event)
// {
// eventname = GameHelper.IsAdModelOfPay() ? BuriedPointEvent.Apple_AD_event : BuriedPointEvent.Apple_pay_event;
// }
// buriedPointObject.@event = eventname;
// buriedPointObject.property = eventproperty;
// buriedPointObject.n = integer;
// PostWithHeader<BuriedPointObject>("/event/incrN", buriedPointObject, (isSuccess, obj) =>
// {
// // Debug.Log(isSuccess);
// // Debug.Log(eventproperty);
// //Debug.Log(JsonUtility.ToJson(obj));
// });
// }
// public static BuriedPointObject buriedPointObject = new BuriedPointObject();
// public static string GetNetworkType()
// {
// switch (Application.internetReachability)
// {
// case NetworkReachability.ReachableViaCarrierDataNetwork:
// return NetworkType.mobile;
// case NetworkReachability.ReachableViaLocalAreaNetwork:
// return NetworkType.wifi;
// case NetworkReachability.NotReachable:
// return NetworkType.notConnected;
// default:
// return NetworkType.notConnected;
// }
// }
private static bool isReqToken = false;
public static void ReSetToken()
{
if (isReqToken) return;
// var nowTimes = GameHelper.GetNowTime();
// var passtime = GameHelper.GetLoginModel().expires_at;
// // Debug.Log($"ReSetToken nowTimes:{nowTimes} passtime:{passtime}");
// if (passtime == 0 || passtime - nowTimes > 3600) return;
// isReqToken = true;
// var headers = new Dictionary<string, string> { { "x-token", GetCacheToken() } };
// IsfvKit.StartCoroutine(PostInternal<ResquestTokenData>("tokenRefresh", null, (isSuccess, tokenData) =>
// {
// if (isSuccess)
// {
// LoginModel loginModel = GameHelper.GetLoginModel();
// loginModel.token = tokenData.token;
// loginModel.expires_at = tokenData.expires_at;
// SetCacheToken(tokenData.token);
// }
// isReqToken = false;
// }, headers));
}
private static bool isReqToken1 = false;
public static void ReLoginGetToken()
{
// if (isReqToken1) return;
// var requestLoginData = new RequestLoginData
// {
// device_id = SystemInfo.deviceUniqueIdentifier,
// pack_name = NetworkMsg.Identifier,
// app_version = Application.version,
// channel = BingoBea.Instance.attribution,
// sim = WebviewManager.haveSimCard
// };
// isReqToken1 = true;
// Post<LoginModel>("login", requestLoginData, (isSuccess, loginData) =>
// {
// if (isSuccess)
// {
// LoginModel loginModel = GameHelper.GetLoginModel();
// loginModel.token = loginData.token;
// loginModel.expires_at = loginData.expires_at;
// SetCacheToken(loginData.token);
// }
// isReqToken1 = false;
// });
}
}
public class Base64Kit_sdk
{
// public static string Base64Encode(string source)
// {
// byte[] bytes = Encoding.UTF8.GetBytes(source);
// string encode = Convert.ToBase64String(bytes);
// return encode;
// }
// public static string Encode(string data, bool is_apple_pay = false)
// {
// var key = BingoBrain.Network.DomainRelease;
// //if (is_apple_pay) key = "com.leisuregames.crazygourmet";
// var keyMD5 = MD5Kit.MD5String1(key);
// //UnityEngine.Debug.Log("Base64 Encode Key: " + keyMD5);
// var str = Base64EncodeUtil.Base64Encode(data + keyMD5);
// var bytes = Encoding.UTF8.GetBytes(str);
// for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
// {
// if (i % 2 == 0)
// {
// (bytes[i], bytes[j]) = (bytes[j], bytes[i]);
// }
// }
// var loginData = Encoding.UTF8.GetString(bytes);
// return loginData;
// }
// public static string Decode(string data)
// {
// var bytes = Encoding.UTF8.GetBytes(data);
// for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
// {
// if (i % 2 == 0)
// {
// (bytes[i], bytes[j]) = (bytes[j], bytes[i]);
// }
// }
// var str = Encoding.UTF8.GetString(bytes);
// var str1 = Base64EncodeUtil.Base64Decode(str);
// var key = BingoBrain.Network.DomainRelease;
// var keyMD5 = MD5Kit.MD5String1(key);
// // Debug.Log("Base64 Decode Key: " + keyMD5);
// // Debug.Log("Base64 Decode str1: " + str1);
// var result = str1.Replace(keyMD5, string.Empty);
// return result;
// }
// public static string Decode(string data, string key)
// {
// var bytes = Encoding.UTF8.GetBytes(data);
// for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
// {
// if (i % 2 == 0)
// {
// (bytes[i], bytes[j]) = (bytes[j], bytes[i]);
// }
// }
// var str = Encoding.UTF8.GetString(bytes);
// var str1 = Base64EncodeUtil.Base64Decode(str);
// // var key = NetworkManager.DomainRelease;
// var keyMD5 = MD5Kit.MD5String1(key);
// var result = str1.Replace(keyMD5, string.Empty);
// return result;
// }
private static byte[] GenerateKey(string secret)
{
using var sha256 = SHA256.Create();
return sha256.ComputeHash(Encoding.UTF8.GetBytes(secret));
}
internal static byte[] Encrypt(byte[] plainText, string secret)
{
if (plainText == null || plainText.Length == 0) return plainText;
var key = GenerateKey(secret);
using var aes = Aes.Create();
aes.Key = key;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.None;
aes.GenerateIV();
var iv = aes.IV;
var blockSize = aes.BlockSize / 8;
var padding = blockSize - plainText.Length % blockSize;
var padded = new byte[plainText.Length + padding];
Buffer.BlockCopy(plainText, 0, padded, 0, plainText.Length);
for (var i = plainText.Length; i < padded.Length; i++) padded[i] = (byte)padding;
using var encryptor = aes.CreateEncryptor();
var encrypted = encryptor.TransformFinalBlock(padded, 0, padded.Length);
var result = new byte[iv.Length + encrypted.Length];
Buffer.BlockCopy(iv, 0, result, 0, iv.Length);
Buffer.BlockCopy(encrypted, 0, result, iv.Length, encrypted.Length);
return ToUrlSafeBase64(result);
}
internal static byte[] Decrypt(byte[] encryptedBase64, string secret)
{
if (encryptedBase64 == null || encryptedBase64.Length == 0) return encryptedBase64;
var key = GenerateKey(secret);
var fullCipher = FromUrlSafeBase64(encryptedBase64);
if (fullCipher.Length < 16) throw new Exception("Invalid cipher data");
var iv = fullCipher.Take(16).ToArray();
var cipherText = fullCipher.Skip(16).ToArray();
using var aes = Aes.Create();
aes.Key = key;
aes.IV = iv;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.None;
using var decryptor = aes.CreateDecryptor();
var decrypted = decryptor.TransformFinalBlock(cipherText, 0, cipherText.Length);
int pad = decrypted[^1];
if (pad <= 0 || pad > decrypted.Length) throw new Exception("Invalid padding");
var result = decrypted.Take(decrypted.Length - pad).ToArray();
return result;
}
// 用双引号包裹字节数组
private static byte[] QuoteBytes(byte[] input)
{
var result = new byte[input.Length + 2];
result[0] = (byte)'"';
Buffer.BlockCopy(input, 0, result, 1, input.Length);
result[result.Length - 1] = (byte)'"';
return result;
}
// 去除双引号(如果存在)
internal static byte[] UnquoteBytes(byte[] input)
{
if (input.Length >= 2 && input[0] == (byte)'"' && input[input.Length - 1] == (byte)'"')
{
var result = new byte[input.Length - 2];
Buffer.BlockCopy(input, 1, result, 0, result.Length);
return result;
}
return input;
}
private static byte[] ToUrlSafeBase64(byte[] data)
{
var base64 = Convert.ToBase64String(data);
var urlSafe = base64.Replace('+', '-').Replace('/', '_');
return Encoding.UTF8.GetBytes(urlSafe);
}
private static byte[] FromUrlSafeBase64(byte[] urlSafe)
{
var base64 = Encoding.UTF8.GetString(urlSafe).Replace('-', '+').Replace('_', '/');
return Convert.FromBase64String(base64);
}
}
public class ResquestTokenData_sdk
{
public string token;
public long expires_at;
}
public class NetworkType_sdk
{
public static string mobile = "Mobile Data";
public static string wifi = "Wi-Fi";
public static string notConnected = "Not Connected";
}
public static class Base64EncodeUtil_sdk
{
public static string Base64Encode(string source)
{
return Base64Encode(Encoding.UTF8, source);
}
public static string Base64Decode(string result)
{
return Base64Decode(Encoding.UTF8, result);
}
public static string Base64Encode(Encoding encoding, string source)
{
byte[] bytes = encoding.GetBytes(source);
string encode = Convert.ToBase64String(bytes);
return encode;
}
public static string Base64Decode(Encoding encoding, string result)
{
byte[] bytes = Convert.FromBase64String(result);
string decode = encoding.GetString(bytes);
return decode;
}
public static string Base64EncodeString(byte[] source)
{
return Convert.ToBase64String(source);
}
public static byte[] Base64DecodeBytes(string result)
{
return Convert.FromBase64String(result);
}
}
public class ResponseData_sdk
{
public int code;
public string msg;
public object data;
}
public class BuriedPointObject_sdk
{
public string @event;
public string property;
public int n;
}
public class H5sendClass
{
public string link;
public string type;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5bc692f6af350864d89381f7546552fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+411
View File
@@ -0,0 +1,411 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FairyGUI;
using UnityEngine;
using UnityEngine.EventSystems;
using BingoBrain;
using DG.Tweening;
using BingoBrain;
using Unity.VisualScripting.FullSerializer;
using Unity.VisualScripting;
using Newtonsoft.Json;
using System.Collections;
using ScrewsMaster;
namespace DontConfuse
{
public class SdkManager : MonoBehaviour
{
private static SdkManager _instance;
// 供外部调用的公共属性
public static SdkManager Instance
{
get
{
// 如果实例为空,尝试在场景中寻找已经挂载的脚本
if (_instance == null)
{
_instance = FindFirstObjectByType<SdkManager>();
if (_instance == null)
{
Debug.LogError("场景中没有找到挂载 SdkManager 的物体!请确保场景中有一个 GameObject 挂载了该脚本。");
}
}
return _instance;
}
}
private void Awake()
{
// 当场景加载时,如果 _instance 还没赋值,就由挂载在物体上的自己来赋值
if (_instance == null)
{
_instance = this;
DontDestroyOnLoad(gameObject); // 可选:如果跨场景不想被销毁,加上这行
}
else if (_instance != this)
{
// 防止场景里不小心挂载了多个 SdkManager secondary 实例直接销毁,保证单例唯一
Destroy(gameObject);
}
}
public void OpenWv()
{
// Debug.Log("[WebviewManager] SetPadding");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.OpenWv();
#endif
}
public void SetPadding(float left, float top, float right, float bottom)
{
// Debug.Log("[WebviewManager] SetPadding");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.SetPadding(left, top, right, bottom);
#endif
}
public void SetDarkThough(bool though)
{
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.SetDarkThough(though);
#endif
}
public void SetBtn(int left, int top, int right, int bottom)
{
// Debug.Log("[WebviewManager] SetBtn");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.SetBtn(left, top, right, bottom);
#endif
}
public void addH5Field(int field1, int field2, int field3, int field4, int field5, string field6, string field7, string dark_url, string light_url, bool is_gift, string web_through_str, string click_add_time)
{
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.addH5Field(field1,field2,field3,field4,field5,field6,field7,dark_url,light_url,is_gift,web_through_str,click_add_time);
#endif
}
public void ShowH5View(bool flag)
{
// Debug.Log("[WebviewManager] SetCTEnable");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.ShowH5View(flag);
#endif
}
public void SetIconProgress(float val)
{
// Debug.Log("[WebviewManager] SetCTEnable");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.SetIconProgress(val);
#endif
}
public void ShowFlyBtn(bool flag)
{
// Debug.Log("[WebviewManager] SetCTEnable");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.ShowFlyBtn(flag);
#endif
}
public void setFlyBtnTag(bool flag)
{
// Debug.Log($"[WebviewManager] setFlyBtnTag ---{flag}");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.setFlyBtnTag(flag);
#endif
}
public void setRewardBtnTag(bool flag)
{
// Debug.Log($"[WebviewManager] setRewardBtnTag--- {flag}");
#if UNITY_IOS && !UNITY_EDITOR
BrigdeIOS.setRewardBtnTag(flag);
#endif
}
public void ObjC_TouchClick(string name)
{
// Debug.Log("Touch click: " + name);
GameDispatcher.Instance.Dispatch(GameMsg.H5ViewClickBtn, name);
}
public void H5AutoRefresh(string string_xcode)
{
if (string_xcode.Contains("|h5"))
{
string[] _string_arr = string_xcode.Split("|");
if (_string_arr.Length >= 2)
{
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count; i++)
{
if (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].url == _string_arr[0])
{
light_restoredList[i]++;
string str = string.Join(",", light_restoredList);
PlayerPrefs.SetString("Dailyrefreshnum", str);
break;
}
}
H5sendClass info = new H5sendClass() { link = _string_arr[0], type = "h5" };
NetworkKit_sdk.PostWithHeader<object>("event/h5Impressions", info, (isSuccess, obj) =>
{
if (isSuccess)
{
Debug.Log("发送成功" + _string_arr[0]);
}
});
}
}
else if (string_xcode.Contains("|h6"))
{
string[] _string_arr = string_xcode.Split("|");
if (_string_arr.Length >= 2)
{
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
{
for (int j = 0; j < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count; j++)
{
if (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].url == _string_arr[0])
{
dark_restoredList[i][j]++;
PlayerPrefs.SetString("Darkrefreshnum", string.Join(";", dark_restoredList.Select(row => string.Join(",", row))));
break;
}
}
}
H5sendClass info = new H5sendClass() { link = _string_arr[0], type = "h6" };
NetworkKit_sdk.PostWithHeader<object>("event/h5Impressions", info, (isSuccess, obj) =>
{
if (isSuccess)
{
Debug.Log("发送成功" + _string_arr[0]);
}
});
}
}
}
private GList select_glist;
private float select_glist_y;
public void TouchClickPoint(string name)
{
// Debug.Log("TouchClickPoint" + name);
if (name == null) return;
if (name == "flyBtn")
{
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.fly_ct_number, 1);
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.fly_ct_people,1);
}
if (name == "rewardBtn")
{
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_ct_number, 1);
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.annular_ct_people,1);
}
if (name == "finish")
{
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_finish_number, 1);
}
}
List<int> light_restoredList;
List<List<int>> dark_restoredList;
public void RefreshUrl()
{
string Dailyrefresh_reamain = "";
int last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
DateTime today = DateTime.Now;
int newDays = today.Day;
string light_refresh_str = PlayerPrefs.GetString("Dailyrefreshnum", "");
if (string.IsNullOrEmpty(light_refresh_str))
{
light_restoredList = new List<int>();
}
else
{
light_restoredList = light_refresh_str.Split(',').Select(int.Parse).ToList();
}
if (light_restoredList.Count < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count)
{
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count;
for (int i = light_restoredList.Count; i < targetCount; i++)
{
light_restoredList.Add(0);
}
}
if (last_time == newDays)
{
}
else
{
for (int i = 0; i < light_restoredList.Count; i++)
{
light_restoredList[i] = 0;
}
string str = string.Join(",", light_restoredList);
PlayerPrefs.SetString("Dailyrefreshnum", str);
PlayerPrefs.SetInt("Dayreftimes", newDays);
}
int dark_last_time = PlayerPrefs.GetInt("dark_refreshDay", 0);
string darkWVDailyrefreshtimes_str = "";
string dark_refresh_str = PlayerPrefs.GetString("Darkrefreshnum", "");
if (string.IsNullOrEmpty(dark_refresh_str))
{
dark_restoredList = new List<List<int>>();
}
else
{
dark_restoredList = dark_refresh_str.Split(';').Select(row => row.Split(',').Select(int.Parse).ToList()).ToList();
}
if (dark_restoredList.Count < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count)
{
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count;
for (int i = dark_restoredList.Count; i < targetCount; i++)
{
dark_restoredList.Add(new List<int>());
}
}
for (int i = 0; i < dark_restoredList.Count; i++)
{
if (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count > i)
{
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count;
if (dark_restoredList[i].Count < targetCount)
{
for (int j = dark_restoredList[i].Count; j < targetCount; j++)
{
dark_restoredList[i].Add(0);
}
}
}
}
if (dark_last_time == newDays)
{
}
else
{
for (int i = 0; i < dark_restoredList.Count; i++)
{
for (int j = 0; j < dark_restoredList[i].Count; j++)
{
dark_restoredList[i][j] = 0;
}
}
PlayerPrefs.SetInt("dark_refreshDay", newDays);
PlayerPrefs.SetString("Darkrefreshnum", string.Join(";", dark_restoredList.Select(row => string.Join(",", row))));
}
string light_str = "";
string dark_str = "";
int can_refresh_numbners = 0;
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count; i++)
{
if (i != 0)
{
light_str += "|";
}
light_str += ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].url + "#" + ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].weight + "#" + (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].maxF5Times - light_restoredList[i]);
}
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
{
for (int j = 0; j < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count; j++)
{
if (i != 0 || j != 0)
{
dark_str += "|";
}
dark_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].url + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].weight + "#" + (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].maxF5Times - dark_restoredList[i][j]) +
"#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].ctProb + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].layerId + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].offset;
}
}
string darkWVRefreshtime_str = "";
string add_time = "";
string layer_click_probability = "";
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
{
if (i != 0)
{
darkWVRefreshtime_str += "|";
add_time += "|";
layer_click_probability += "|";
}
darkWVRefreshtime_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].f5Interval.min;
darkWVRefreshtime_str += "|";
darkWVRefreshtime_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].f5Interval.max;
add_time += UnityEngine.Random.Range(ConfigSystem_sdk.Instance.SDKConfig.h6Conf.ADClickF5Delay.min, ConfigSystem_sdk.Instance.SDKConfig.h6Conf.ADClickF5Delay.max + 1);
layer_click_probability += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].weight;
}
Debug.Log("|||||||||||||||||||||--------------------------------");
Debug.Log(darkWVRefreshtime_str);
Debug.Log(dark_str);
Debug.Log(light_str);
Debug.Log(layer_click_probability);
Debug.Log(add_time);
int reg_days = ConfigSystem_sdk.Instance.GetRegisteredCalendarDaysByUTC(LoginModel_sdk.Instance.reg_time);
bool open_dark_wv = true;
if (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition != null)
{
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf.Count; i++)
{
if ((reg_days >= ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf[i].days.min) &&
(reg_days <= ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf[i].days.max))
{
if (UnityEngine.Random.Range(0, 100) >= ConfigSystem_sdk.Instance.SDKConfig.h6Conf.switchCondition.retentionConf[i].prob)
{
open_dark_wv = false;
}
break;
}
}
}
Debug.Log(open_dark_wv);
addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
UnityEngine.Random.Range(ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.min, ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.max + 1), -1, -1
, darkWVRefreshtime_str, "", dark_str, light_str, open_dark_wv, layer_click_probability, add_time);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f320161c7337dbf46989861b4ea8d8b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -26,7 +26,7 @@ namespace DontConfuse
string[] a = str.Split("##");
if (a.Length >= 2)
{
WebviewManager.Instance.TouchClickPoint(a[0] + "|" + a[1]);
// WebviewManager.Instance.TouchClickPoint(a[0] + "|" + a[1]);
}
}