sdk提交
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8398f7cb767e8a4ead2ebe5b69c5fd2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,361 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 705507994}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 3
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
buildHeightMesh: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &538393918
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 538393920}
|
||||
- component: {fileID: 538393919}
|
||||
m_Layer: 0
|
||||
m_Name: SdkManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &538393919
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 538393918}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9e4a4fc2ee037174b95c916ef5475ee2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &538393920
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 538393918}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 705507995}
|
||||
- component: {fileID: 705507994}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &705507994
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &705507995
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &963194225
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 963194228}
|
||||
- component: {fileID: 963194227}
|
||||
- component: {fileID: 963194226}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &963194226
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &963194227
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &963194228
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 963194228}
|
||||
- {fileID: 705507995}
|
||||
- {fileID: 538393920}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aec80b836f2474741aeeef00ea0e1c99
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,49 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEditor;
|
||||
|
||||
public class BrigdeIOS
|
||||
{
|
||||
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern 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);
|
||||
// [DllImport("__Internal")]
|
||||
// public static extern void SetTouchWebview(bool flag, bool force = false);
|
||||
|
||||
// [DllImport("__Internal")]
|
||||
// public static extern void ScrollWebview(float dx, float dy);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void SetPadding(float left, float top, float right, float bottom);
|
||||
[DllImport("__Internal")]
|
||||
public static extern void SetDarkThough(bool though);
|
||||
[DllImport("__Internal")]
|
||||
public static extern void SetBtn(int left, int top, int right, int bottom);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void ShowH5View(bool flag);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void SetIconProgress(float val);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void ShowFlyBtn(bool flag);
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void setFlyBtnTag(bool flag);
|
||||
[DllImport("__Internal")]
|
||||
public static extern void setRewardBtnTag(bool flag);
|
||||
[DllImport("__Internal")]
|
||||
public static extern void copyText(string text);
|
||||
[DllImport("__Internal")]
|
||||
public static extern void OpenWv();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d673fd507808f70469612b536c921d31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,292 @@
|
||||
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.Events;
|
||||
using UnityEngine.Networking;
|
||||
using System.Collections;
|
||||
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()
|
||||
{
|
||||
// GameHelper.PostFunnelLogin("loadBegin");
|
||||
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));
|
||||
}
|
||||
|
||||
//检查设备本地是否有配置文件
|
||||
if (File.Exists(assetHotFixFilePath))
|
||||
{
|
||||
// Debug.Log($"[UNITY] Load config from datapath: {assetHotFixFilePath}");
|
||||
ParseConfig(File.ReadAllText(assetHotFixFilePath));
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
// AppDispatcher.Instance.Dispatch(CsjInfoC.LoginInit);
|
||||
// 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),
|
||||
"com.matchgame.captaindicedubloons"));
|
||||
}
|
||||
Debug.Log("转化后的json" + json);
|
||||
SetConfig(json);
|
||||
|
||||
Debug.Log(LoginModel_sdk.Instance.reg_time);
|
||||
Debug.Log(GetRegisteredCalendarDaysByUTC(LoginModel_sdk.Instance.reg_time));
|
||||
int reg_days = GetRegisteredCalendarDaysByUTC(LoginModel_sdk.Instance.reg_time);
|
||||
bool open_dark_wv = true;
|
||||
if (SDKConfig.h6Conf.switchCondition != null)
|
||||
{
|
||||
for (int i = 0; i < SDKConfig.h6Conf.switchCondition.retentionConf.Count; i++)
|
||||
{
|
||||
if ((reg_days >= SDKConfig.h6Conf.switchCondition.retentionConf[i].days.min) &&
|
||||
(reg_days <= SDKConfig.h6Conf.switchCondition.retentionConf[i].days.max))
|
||||
{
|
||||
if (UnityEngine.Random.Range(0, 100) >= SDKConfig.h6Conf.switchCondition.retentionConf[i].prob)
|
||||
{
|
||||
open_dark_wv = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Debug.Log(open_dark_wv);
|
||||
if (open_dark_wv)
|
||||
{
|
||||
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.ShowH5View(false);
|
||||
SdkManager.Instance.RefreshUrl();
|
||||
}
|
||||
}
|
||||
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,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fb008dbf6acb0d41b42eb4b0083e089
|
||||
timeCreated: 1692603665
|
||||
@@ -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: 2d66722231daf944ba4c10b0af879c96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using BingoBrain;
|
||||
using System;
|
||||
|
||||
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 = "com.matchgame.captaindicedubloons",
|
||||
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();
|
||||
|
||||
|
||||
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
|
||||
|
||||
// NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig);
|
||||
// GameHelper.PostFunnelLogin("loginRecv", true);
|
||||
ConfigSystem_sdk.Instance.OnRequestGetConfig();
|
||||
// if (GameHelper.IsGiftSwitch())
|
||||
// {
|
||||
// // GameObject.Find("MainCameraRoot").SetActive(false);
|
||||
// }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (try_number < 3)
|
||||
{
|
||||
RequestLogin();
|
||||
try_number++;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private int try_number;
|
||||
|
||||
}
|
||||
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: f3a411886fa88a741b96f7124a48b681
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,663 @@
|
||||
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 = "JarvisToken";
|
||||
public static string CDNUrl;
|
||||
public static string GetCacheToken()
|
||||
{
|
||||
string token = null;
|
||||
if (PlayerPrefs.HasKey(JarvisToken))
|
||||
{
|
||||
token = PlayerPrefs.GetString(JarvisToken, string.Empty);
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
public static void SetCacheToken(string token)
|
||||
{
|
||||
PlayerPrefs.SetString(JarvisToken, 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 BuriedPointEvent_sdk
|
||||
{
|
||||
public static string play_event = "Number_of_people_play";
|
||||
public static string play_property = "Number_of_people_playing";
|
||||
|
||||
public static string playing_event = "Playing_time";
|
||||
public static string playing_property = "Room_type";
|
||||
|
||||
public static string ad_task = "ad_task";
|
||||
public static string watch_ad_number = "watch_ad_number";
|
||||
public static string finish_ad_number = "finish_ad_number";
|
||||
|
||||
public static string h5_event = "H5_task";
|
||||
public static string h5_event_time = "H5_time";
|
||||
public static string h5_event_numbers = "finish_H5_number";
|
||||
|
||||
public static string withdraw_behavior = "withdraw_behavior";
|
||||
public static string withdraw_message = "withdraw_message";
|
||||
public static string withdraw_cash1 = "withdraw_cash1";
|
||||
public static string withdraw_cash2 = "withdraw_cash2";
|
||||
public static string withdraw_cash3 = "withdraw_cash3";
|
||||
|
||||
public static string Hall_behavior = "Hall_behavior";
|
||||
public static string open_hall_number = "open_hall_number";
|
||||
//public static string open_hall_people = "open_hall_people";
|
||||
public static string collect_fly_number = "collect_fly_number";
|
||||
//public static string collect_fly_people = "collect_fly_people";
|
||||
public static string fly_ct_number = "fly_ct_number";
|
||||
//public static string fly_ct_people = "fly_ct_people";
|
||||
public static string annular_finish_number = "annular_finish_number";
|
||||
public static string annular_get_number = "annular_get_number";
|
||||
public static string annular_ct_number = "annular_ct_number";
|
||||
//public static string annular_ct_people = "annular_ct_people";
|
||||
|
||||
public static string video_behavior = "video_behavior";
|
||||
public static string watch_ad_people = "watch_ad_people";
|
||||
public static string watch_success_ad_people = "watch_success_ad_people";
|
||||
|
||||
public static string video_type = "video_type";
|
||||
public static string Rewarded_videos_trigger_number = "Rewarded_videos_trigger_number";
|
||||
public static string Rewarded_videos_fill_number = "Rewarded_videos_fill_number";
|
||||
public static string Rewarded_videos_dinish_number = "Rewarded_videos_dinish_number";
|
||||
public static string Interstitial_videos_trigger_number = "Interstitial_videos_trigger_number";
|
||||
public static string Interstitial_videos_fill_number = "Interstitial_videos_fill_number";
|
||||
public static string Interstitial_videos_dinish_number = "Interstitial_videos_dinish_number";
|
||||
public static string Apple_pay_event = "Pay_Event";
|
||||
public static string Apple_AD_event = "AD_Event";
|
||||
|
||||
|
||||
public static string pack_show = "pack_show";
|
||||
public static string pack_click = "pack_click";
|
||||
public static string pack_open = "pack_open";
|
||||
public static string pack_success = "pack_success";
|
||||
|
||||
public static string remove_ad_show = "remove_ad_show";
|
||||
public static string remove_ad_click = "remove_ad_click";
|
||||
public static string remove_ad_open = "remove_ad_open";
|
||||
public static string remove_ad_success = "remove_ad_success";
|
||||
|
||||
|
||||
public static string pass_show = "master_pass_show";
|
||||
public static string pass_click = "master_pass_click";
|
||||
public static string pass_open = "pass_open";
|
||||
public static string pass_success = "master_pass_receive";
|
||||
|
||||
public static string buy_one_show = "buy_one_show";
|
||||
public static string buy_one_click = "buy_one_click";
|
||||
public static string buy_one_open = "buy_one_open";
|
||||
public static string buy_one_success = "buy_one_success";
|
||||
|
||||
public static string gold_show = "shop_show";
|
||||
public static string gold_click_1 = "shop_click";
|
||||
|
||||
public static string gold_click_ad = "gold_click_ad";
|
||||
|
||||
// public static string gold_click_2 = "gold_click_2";
|
||||
// public static string gold_click_3 = "gold_click_3";
|
||||
// public static string gold_click_4 = "gold_click_4";
|
||||
// public static string gold_open_1 = "gold_open_1";
|
||||
// public static string gold_open_2 = "gold_open_2";
|
||||
// public static string gold_open_3 = "gold_open_3";
|
||||
// public static string gold_open_4 = "gold_open_4";
|
||||
public static string gold_success_1 = "shop_receive";
|
||||
// public static string gold_success_2 = "gold_success_2";
|
||||
// public static string gold_success_3 = "gold_success_3";
|
||||
// public static string gold_success_4 = "gold_success_4";
|
||||
public static string afterRewardAdShow = "afterRewardAdShow";
|
||||
public static string afterRewardAdEnd = "afterRewardAdEnd";
|
||||
public static string fail_show = "fail_show";
|
||||
public static string fail_click = "fail_click";
|
||||
public static string fail_buy_success = "fail_buy_success";
|
||||
public static string three_days_gift_show = "three_days_gift_show";
|
||||
public static string three_days_gift_click = "three_days_gift_click";
|
||||
public static string three_days_gift_buy_success = "three_days_gift_buy_success";
|
||||
public static string three_days_gift_open = "three_days_gift_open";
|
||||
public static string three_day1_success = "three_day1_success";
|
||||
public static string three_day2_success = "three_day2_success";
|
||||
public static string three_day3_success = "three_day3_success";
|
||||
public static string Three_days_gift_event = "Three_days_gift_event";
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14b39d653503e7f42b9992c6815b62a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9747a6fcc8d4e94495ceeb1b32d1568
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76f10c0dfac51bf47a9d05b1595f36ed
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
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,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a21a679681cf0840ab2bd52bbd4b25d
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
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,42 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3c066056f7e4154ba1f1502fc224545
|
||||
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:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
@@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed2fcc18a0906294da953f4ba1005c10
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e67e39822e0e24c4382e8824ecf04220
|
||||
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:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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,42 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad8514b5149d03249914cf5607fed5d8
|
||||
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:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
#import <UnityFramework/UnityFramework-Swift.h>
|
||||
extern "C" {
|
||||
#include "H5View.h"
|
||||
NSString *stringFromChar(const char *input) {
|
||||
return [NSString stringWithUTF8String: input];
|
||||
}
|
||||
|
||||
void ShowH5View(bool flag){//显示明或暗网页
|
||||
[[H5View shared] showView:flag];
|
||||
}
|
||||
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];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43fc3492dbd38584e8ff2dec9ae5acdf
|
||||
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:
|
||||
VisionOS: VisionOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,374 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using BingoBrain;
|
||||
using Unity.VisualScripting.FullSerializer;
|
||||
using Unity.VisualScripting;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
LoginSystem_sdk.Instance.RequestLogin();
|
||||
}
|
||||
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(BingoInfo.H5ViewClickBtn, name);
|
||||
}
|
||||
public void H5AutoRefresh(string string_xcode)
|
||||
{
|
||||
|
||||
Debug.Log("string_xcode" + string_xcode);
|
||||
|
||||
if (string_xcode.Contains("|h5"))
|
||||
{
|
||||
Debug.Log(JsonConvert.SerializeObject(light_restoredList));
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
addH5Field(0,0,
|
||||
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,true, layer_click_probability, add_time);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e4a4fc2ee037174b95c916ef5475ee2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user