Compare commits
8
Commits
83e227bcaf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9242d059ca | ||
|
|
13f38a8b77 | ||
|
|
2490c58f88 | ||
|
|
eaa0b14fb2 | ||
|
|
9f39e0cc62 | ||
|
|
253ce0bc2b | ||
|
|
c55ee81e60 | ||
|
|
6bf5104b14 |
File diff suppressed because it is too large
Load Diff
@@ -65,10 +65,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Assets/Scripts/LoginSystem_sdk.cs" />
|
<Compile Include="Assets/Scripts/LoginSystem_sdk.cs" />
|
||||||
|
<Compile Include="Assets/Scenes/test_rukou.cs" />
|
||||||
<Compile Include="Assets/Scripts/NetworkKit_sdk.cs" />
|
<Compile Include="Assets/Scripts/NetworkKit_sdk.cs" />
|
||||||
<Compile Include="Assets/Scripts/SdkManager.cs" />
|
<Compile Include="Assets/Scripts/SdkManager.cs" />
|
||||||
<Compile Include="Assets/Scripts/ConfigSystem_sdk.cs" />
|
<Compile Include="Assets/Scripts/ConfigSystem_sdk.cs" />
|
||||||
<Compile Include="Assets/Scripts/BrigdeIOS.cs" />
|
<Compile Include="Assets/Scripts/BrigdeIOS.cs" />
|
||||||
|
<Compile Include="Assets/Scripts/SDKScript.cs" />
|
||||||
<Compile Include="Assets/Scripts/LoginModel_sdk.cs" />
|
<Compile Include="Assets/Scripts/LoginModel_sdk.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8d17262a9ec3b482b90dc484b4af0e0d
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Callbacks;
|
||||||
|
using System.IO;
|
||||||
|
#if UNITY_IOS
|
||||||
|
using UnityEditor.iOS.Xcode;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public class MoveLibToClasses
|
||||||
|
{
|
||||||
|
// PostProcessBuild 属性确保这段代码在 Unity 导出 Xcode 工程完成后自动执行
|
||||||
|
[PostProcessBuild(999)]
|
||||||
|
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
||||||
|
{
|
||||||
|
if (target != BuildTarget.iOS) return;
|
||||||
|
|
||||||
|
#if UNITY_IOS
|
||||||
|
// 1. 定义源文件路径和目标文件路径
|
||||||
|
string fileName = "libweb.a";
|
||||||
|
string sourcePath = Path.Combine(Application.dataPath, "Editor", fileName);
|
||||||
|
string destDir = Path.Combine(pathToBuiltProject, "Classes");
|
||||||
|
string destPath = Path.Combine(destDir, fileName);
|
||||||
|
|
||||||
|
// 检查源文件是否存在
|
||||||
|
if (!File.Exists(sourcePath))
|
||||||
|
{
|
||||||
|
Debug.LogError($"[MoveLib] 找不到源文件: {sourcePath}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 物理复制文件到 Xcode 工程的 Classes 文件夹中
|
||||||
|
if (!Directory.Exists(destDir))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destDir);
|
||||||
|
}
|
||||||
|
File.Copy(sourcePath, destPath, true);
|
||||||
|
Debug.Log($"[MoveLib] 成功将库复制到: {destPath}");
|
||||||
|
|
||||||
|
// 3. 修改 Xcode 工程文件(PBXProject),将文件注册到 Xcode 中
|
||||||
|
string pbxProjectPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
|
||||||
|
PBXProject project = new PBXProject();
|
||||||
|
project.ReadFromString(File.ReadAllText(pbxProjectPath));
|
||||||
|
|
||||||
|
string targetGuid = project.GetUnityFrameworkTargetGuid(); // 或者 project.TargetGuidByName(PBXProject.GetUnityTargetName())
|
||||||
|
|
||||||
|
// 将文件添加到 Xcode 的 Classes 引用中 (相对于工程根目录路径为 "Classes/libwebview_jiami.a")
|
||||||
|
string fileGuid = project.AddFile("Classes/" + fileName, "Classes/" + fileName, PBXSourceTree.Source);
|
||||||
|
|
||||||
|
// 将该 .a 文件加入到编译链接中
|
||||||
|
project.AddFileToBuild(targetGuid, fileGuid);
|
||||||
|
|
||||||
|
// 保存对 Xcode 工程的修改
|
||||||
|
File.WriteAllText(pbxProjectPath, project.WriteToString());
|
||||||
|
Debug.Log("[MoveLib] Xcode 工程配置已成功更新!");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d3e9d2c715ee243f69917123d92ce015
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
@@ -0,0 +1,27 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 225a747de20d14e4db5b5ddc85aadda7
|
||||||
|
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: 1
|
||||||
|
settings:
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -260,6 +260,50 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||||
|
--- !u!1 &708974342
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 708974344}
|
||||||
|
- component: {fileID: 708974343}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: GameObject
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &708974343
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 708974342}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f8bdb259f7f9fd54dae1ae3c4ea82edb, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!4 &708974344
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 708974342}
|
||||||
|
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 &963194225
|
--- !u!1 &963194225
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -359,3 +403,4 @@ SceneRoots:
|
|||||||
- {fileID: 963194228}
|
- {fileID: 963194228}
|
||||||
- {fileID: 705507995}
|
- {fileID: 705507995}
|
||||||
- {fileID: 538393920}
|
- {fileID: 538393920}
|
||||||
|
- {fileID: 708974344}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using DontConfuse;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Unity.VisualScripting;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class test_rukou : MonoBehaviour
|
||||||
|
{
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
SdkManager.OpenSDK();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
int time=0;
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
// if (Time.time>time)
|
||||||
|
// {
|
||||||
|
// H5sendClass info = new H5sendClass() { link = "www.baidu.com", type = "h6" };
|
||||||
|
// NetworkKit_sdk.PostWithHeader<object>("event/h5Impressions", info, (isSuccess, obj) =>
|
||||||
|
// {
|
||||||
|
// if (isSuccess)
|
||||||
|
// {
|
||||||
|
// Debug.Log("发送成功");
|
||||||
|
// Debug.Log(JsonConvert.SerializeObject(obj));
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// time++;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f8bdb259f7f9fd54dae1ae3c4ea82edb
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Vendored
BIN
Binary file not shown.
@@ -75,13 +75,13 @@ namespace BingoBrain
|
|||||||
}
|
}
|
||||||
|
|
||||||
//检查设备本地是否有配置文件
|
//检查设备本地是否有配置文件
|
||||||
if (File.Exists(assetHotFixFilePath))
|
else if (File.Exists(assetHotFixFilePath))
|
||||||
{
|
{
|
||||||
// Debug.Log($"[UNITY] Load config from datapath: {assetHotFixFilePath}");
|
// Debug.Log($"[UNITY] Load config from datapath: {assetHotFixFilePath}");
|
||||||
ParseConfig(File.ReadAllText(assetHotFixFilePath));
|
ParseConfig(File.ReadAllText(assetHotFixFilePath));
|
||||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||||
// AppDispatcher.Instance.Dispatch(CsjInfoC.LoginInit);
|
// AppDispatcher.Instance.Dispatch(CsjInfoC.LoginInit);
|
||||||
// GameHelper.PostFunnelLogin("loadFinish");
|
// GameHelper.PostFunnelLogin("loadFinish");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static IEnumerator GetTextFromUrl(string url, string fileName, UnityAction<string> action = null,
|
public static IEnumerator GetTextFromUrl(string url, string fileName, UnityAction<string> action = null,
|
||||||
@@ -150,23 +150,10 @@ namespace BingoBrain
|
|||||||
Debug.Log(open_dark_wv);
|
Debug.Log(open_dark_wv);
|
||||||
if (open_dark_wv)
|
if (open_dark_wv)
|
||||||
{
|
{
|
||||||
SdkManager.Instance.OpenWv();
|
SDKScript.Instance.OpenWv();
|
||||||
// int flyswitch = ConfigSystem.GetConfig<CommonModel>().flyswitch;
|
SDKScript.Instance.RefreshUrl();
|
||||||
// int propswitch = ConfigSystem.GetConfig<CommonModel>().propswitch;
|
SDKScript.Instance.SetEnable(true);
|
||||||
// float top_offset = 150;//fgui中的顶部信息的高度
|
SDKScript.Instance.ShowH5View(false);
|
||||||
// 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)
|
public int GetRegisteredCalendarDaysByUTC(long regTimeTimestamp)
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class NetworkKit_sdk
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Debug.Log(url + "--------" + loginRequest.downloadHandler.text);
|
// Debug.Log(url + "--------" + loginRequest.downloadHandler.text);
|
||||||
Debug.Log(url + "--------" + receiveContent);
|
// Debug.Log(url + "--------" + receiveContent);
|
||||||
var response = JsonConvert.DeserializeObject<ResponseData_sdk>(receiveContent);
|
var response = JsonConvert.DeserializeObject<ResponseData_sdk>(receiveContent);
|
||||||
|
|
||||||
if (response?.code == 0)
|
if (response?.code == 0)
|
||||||
@@ -567,103 +567,4 @@ public class H5sendClass
|
|||||||
public string type;
|
public string type;
|
||||||
|
|
||||||
}
|
}
|
||||||
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";
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,162 +0,0 @@
|
|||||||
//
|
|
||||||
// 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,279 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using BingoBrain;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SDKScript
|
||||||
|
{
|
||||||
|
|
||||||
|
private SDKScript()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
private static readonly SDKScript _instance = new SDKScript();
|
||||||
|
|
||||||
|
public static SDKScript Instance
|
||||||
|
{
|
||||||
|
get { return _instance; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenWv()
|
||||||
|
{
|
||||||
|
// Debug.Log("[WebviewManager] SetPadding");
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
BrigdeIOS.OpenWv();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
public void SetEnable(bool though)
|
||||||
|
{
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
BrigdeIOS.SetDarkThough(though);
|
||||||
|
#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
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<int> light_restoredList;
|
||||||
|
static List<List<int>> dark_restoredList;
|
||||||
|
public void UpdateNumbers(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]);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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: 0108cc93ef355144c940d3ea1f5fd536
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+15
-257
@@ -16,12 +16,10 @@ namespace DontConfuse
|
|||||||
{
|
{
|
||||||
private static SdkManager _instance;
|
private static SdkManager _instance;
|
||||||
|
|
||||||
// 供外部调用的公共属性
|
|
||||||
public static SdkManager Instance
|
public static SdkManager Instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// 如果实例为空,尝试在场景中寻找已经挂载的脚本
|
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
{
|
{
|
||||||
_instance = FindFirstObjectByType<SdkManager>();
|
_instance = FindFirstObjectByType<SdkManager>();
|
||||||
@@ -35,275 +33,35 @@ namespace DontConfuse
|
|||||||
}
|
}
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
// 当场景加载时,如果 _instance 还没赋值,就由挂载在物体上的自己来赋值
|
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
{
|
{
|
||||||
_instance = this;
|
_instance = this;
|
||||||
DontDestroyOnLoad(gameObject); // 可选:如果跨场景不想被销毁,加上这行
|
DontDestroyOnLoad(gameObject);
|
||||||
}
|
}
|
||||||
else if (_instance != this)
|
else if (_instance != this)
|
||||||
{
|
{
|
||||||
// 防止场景里不小心挂载了多个 SdkManager, secondary 实例直接销毁,保证单例唯一
|
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
public static void OpenSDK()//初始化sdk
|
||||||
|
{
|
||||||
LoginSystem_sdk.Instance.RequestLogin();
|
LoginSystem_sdk.Instance.RequestLogin();
|
||||||
}
|
}
|
||||||
public void OpenWv()
|
|
||||||
{
|
|
||||||
// Debug.Log("[WebviewManager] SetPadding");
|
|
||||||
#if UNITY_IOS && !UNITY_EDITOR
|
|
||||||
BrigdeIOS.OpenWv();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
public void SetDarkThough(bool though)
|
|
||||||
{
|
|
||||||
#if UNITY_IOS && !UNITY_EDITOR
|
|
||||||
BrigdeIOS.SetDarkThough(though);
|
|
||||||
#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 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]);
|
|
||||||
|
|
||||||
}
|
public static void Enable()//重新启用sdk
|
||||||
});
|
{
|
||||||
}
|
SDKScript.Instance.SetEnable(true);
|
||||||
}
|
}
|
||||||
else if (string_xcode.Contains("|h6"))
|
public static void Disable()//禁用sdk
|
||||||
{
|
{
|
||||||
|
SDKScript.Instance.SetEnable(false);
|
||||||
string[] _string_arr = string_xcode.Split("|");
|
}
|
||||||
if (_string_arr.Length >= 2)
|
public void UpdateNumbers(string string_)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
|
SDKScript.Instance.UpdateNumbers(string_);
|
||||||
{
|
|
||||||
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]);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// 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{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||||
|
|
||||||
|
UIView* testview = [ [H5View shared]hitTest:point withEvent:event];
|
||||||
|
return testview;
|
||||||
|
}
|
||||||
|
@end
|
||||||
@@ -6,17 +6,18 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "H5View.h"
|
#import "H5View.h"
|
||||||
#import "CircularProgressBar.h"
|
|
||||||
#import <WebKit/WebKit.h>
|
#import <WebKit/WebKit.h>
|
||||||
#import "CustomView.h"
|
#import "CustomView.h"
|
||||||
#import "UnityFramework.h"
|
#import "UnityFramework.h"
|
||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
|
// 显式声明 Unity 的消息发送函数,防止编译器报错
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "UnityInterface.h"
|
||||||
|
|
||||||
@implementation H5View{
|
@implementation H5View{
|
||||||
|
|
||||||
NSMutableArray<WKWebView *> *webviews;
|
NSMutableArray<WKWebView *> *webviews;
|
||||||
|
//奖励按钮进度条
|
||||||
CircularProgressBar* bar; //奖励按钮进度条
|
|
||||||
UIView * flyBtn; //飞行奖励按钮节点,也可以用UIButton但要屏蔽事件
|
UIView * flyBtn; //飞行奖励按钮节点,也可以用UIButton但要屏蔽事件
|
||||||
UIImageView* flyBg; //飞行奖励闪光背景
|
UIImageView* flyBg; //飞行奖励闪光背景
|
||||||
UIImageView* rewardBtn; //奖励按钮节点
|
UIImageView* rewardBtn; //奖励按钮节点
|
||||||
@@ -94,7 +95,6 @@
|
|||||||
//初始化页面
|
//初始化页面
|
||||||
-(void)initView{
|
-(void)initView{
|
||||||
if (inited)return;
|
if (inited)return;
|
||||||
[self initFlyBtn];
|
|
||||||
[self setHidden:YES]; //默认为隐藏状态
|
[self setHidden:YES]; //默认为隐藏状态
|
||||||
[self hideView];
|
[self hideView];
|
||||||
canCheckTouch = true;
|
canCheckTouch = true;
|
||||||
@@ -280,7 +280,6 @@
|
|||||||
|
|
||||||
[self showWebview:NullUrl]; //打开webview时url为上一次
|
[self showWebview:NullUrl]; //打开webview时url为上一次
|
||||||
[self ChangeViewRect:true];
|
[self ChangeViewRect:true];
|
||||||
[self startFlyAnim]; //每一次显示时强行执行飞行按钮的动画
|
|
||||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||||
self .alpha=1;
|
self .alpha=1;
|
||||||
}
|
}
|
||||||
@@ -289,7 +288,6 @@
|
|||||||
|
|
||||||
//显示暗网页
|
//显示暗网页
|
||||||
-(void)hideView{
|
-(void)hideView{
|
||||||
[self stopUpdate];
|
|
||||||
|
|
||||||
if(!is_dark_mode){
|
if(!is_dark_mode){
|
||||||
|
|
||||||
@@ -334,24 +332,24 @@
|
|||||||
|
|
||||||
|
|
||||||
//-(void)upDataH5times:(char*)weblink times:(int)times is_dark:(BOOL)is_dark{
|
//-(void)upDataH5times:(char*)weblink times:(int)times is_dark:(BOOL)is_dark{
|
||||||
//
|
//
|
||||||
// NSString *myNSString = [[NSString alloc] initWithUTF8String:weblink];
|
// NSString *myNSString = [[NSString alloc] initWithUTF8String:weblink];
|
||||||
// if(is_dark){
|
// if(is_dark){
|
||||||
// for (int counter = 0; counter < dark_url_array.count; counter++) {
|
// for (int counter = 0; counter < dark_url_array.count; counter++) {
|
||||||
//
|
//
|
||||||
// if( [dark_url_array[counter][0] isEqualToString:myNSString]){
|
// if( [dark_url_array[counter][0] isEqualToString:myNSString]){
|
||||||
// dark_url_array[counter][2]=@(times);
|
// dark_url_array[counter][2]=@(times);
|
||||||
//
|
//
|
||||||
// dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]);
|
// dark_though_rate[[dark_url_array[counter][4] intValue]-1]=@([dark_url_array[counter][3] intValue]);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else{
|
// else{
|
||||||
// for (int counter = 0; counter < light_url_array.count; counter++) {
|
// for (int counter = 0; counter < light_url_array.count; counter++) {
|
||||||
//
|
//
|
||||||
// if( [light_url_array[counter][0] isEqualToString:myNSString]){
|
// if( [light_url_array[counter][0] isEqualToString:myNSString]){
|
||||||
// light_url_array[counter][2]=@(times);
|
// light_url_array[counter][2]=@(times);
|
||||||
// //light_though_rate=[light_url_array[counter][3] intValue];
|
// //light_though_rate=[light_url_array[counter][3] intValue];
|
||||||
@@ -389,7 +387,7 @@
|
|||||||
|
|
||||||
bool have_refresh_numbres=false;
|
bool have_refresh_numbres=false;
|
||||||
for(NSUInteger j=0;j<dark_url_array.count;j++){
|
for(NSUInteger j=0;j<dark_url_array.count;j++){
|
||||||
if(([dark_url_array[j][4] intValue]==(i+1))&&([dark_url_array[j][4] intValue]>0)){
|
if(([dark_url_array[j][4] intValue]==(i+1))&&([dark_url_array[j][2] intValue]>0)){
|
||||||
have_refresh_numbres=true;
|
have_refresh_numbres=true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -497,7 +495,7 @@
|
|||||||
[webviews[0] loadRequest:request];
|
[webviews[0] loadRequest:request];
|
||||||
if (webviews[0].superview == nil)
|
if (webviews[0].superview == nil)
|
||||||
[self insertSubview:webviews[0] atIndex:0];
|
[self insertSubview:webviews[0] atIndex:0];
|
||||||
UnitySendMessage("SdkManager", "H5AutoRefresh",[[url stringByAppendingString:@"|h5"] UTF8String]);
|
UnitySendMessage("SdkManager", "UpdateNumbers",[[url stringByAppendingString:@"|h5"] UTF8String]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -575,17 +573,17 @@
|
|||||||
// float maxvalue=0;
|
// float maxvalue=0;
|
||||||
// float random3 ;
|
// float random3 ;
|
||||||
// float rate=0;
|
// float rate=0;
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// for (int counter = 0; counter < dark_url_array.count; counter++) {
|
// for (int counter = 0; counter < dark_url_array.count; counter++) {
|
||||||
// if([dark_url_array[counter][2] intValue]>0 ){
|
// if([dark_url_array[counter][2] intValue]>0 ){
|
||||||
// if([dark_url_array[counter][4] intValue]!=(type+1) ) continue;
|
// if([dark_url_array[counter][4] intValue]!=(type+1) ) continue;
|
||||||
// maxvalue+=[dark_url_array[counter][1] floatValue];
|
// maxvalue+=[dark_url_array[counter][1] floatValue];
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if(maxvalue>0){
|
// if(maxvalue>0){
|
||||||
// random3=arc4random_uniform(maxvalue);
|
// random3=arc4random_uniform(maxvalue);
|
||||||
// for (int counter = 0; counter < dark_url_array.count; counter++) {
|
// for (int counter = 0; counter < dark_url_array.count; counter++) {
|
||||||
@@ -619,127 +617,10 @@
|
|||||||
if(url.length==0) return;
|
if(url.length==0) return;
|
||||||
|
|
||||||
[webviews[type] loadRequest:request];
|
[webviews[type] loadRequest:request];
|
||||||
UnitySendMessage("SdkManager", "H5AutoRefresh",[[url stringByAppendingString:@"|h6"] UTF8String]);
|
UnitySendMessage("SdkManager", "UpdateNumbers",[[url stringByAppendingString:@"|h6"] UTF8String]);
|
||||||
|
|
||||||
}
|
|
||||||
//隐藏webview
|
|
||||||
|
|
||||||
//设置飞行进度条进度
|
|
||||||
-(void)setIconProgress:(float)value{
|
|
||||||
[bar setProgress:value];
|
|
||||||
// NSLog(@"bbbbbbbbbbbbbbbbbbbbb%f",value);
|
|
||||||
if(value>=1){
|
|
||||||
UnitySendMessage("WebviewManager", "TouchClickPoint", "finish");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//初始化飞行按钮
|
|
||||||
-(void)initFlyBtn{
|
|
||||||
|
|
||||||
flyBtn = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
|
||||||
[self addSubview:flyBtn];
|
|
||||||
|
|
||||||
//飞行闪光底图
|
|
||||||
flyBg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"7"]];
|
|
||||||
flyBg.frame = CGRectMake(0, 0, 100, 100);
|
|
||||||
[flyBtn addSubview:flyBg];
|
|
||||||
[flyBtn setUserInteractionEnabled:NO];
|
|
||||||
|
|
||||||
UIImageView* icon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"3"]];
|
|
||||||
icon.frame = CGRectMake(30, 30, 139*0.35, 97*0.35);
|
|
||||||
[flyBtn addSubview:icon];
|
|
||||||
|
|
||||||
//飞行点位
|
|
||||||
float sw = self.frame.size.width;
|
|
||||||
float sh = self.frame.size.height;
|
|
||||||
|
|
||||||
points[0] = CGPointMake(sw * 0.5,0);
|
|
||||||
points[1] = CGPointMake(-20,sh * 0.25);
|
|
||||||
points[2] = CGPointMake(sw - flyBtn.frame.size.width+20,sh * 0.5);
|
|
||||||
points[3] = CGPointMake(-20,sh - 220);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//执行飞行按钮的动画
|
|
||||||
-(void)startFlyAnim{
|
|
||||||
|
|
||||||
if (!isShowFlyBtn) {
|
|
||||||
flyBtn.hidden = YES;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
canFly = true;
|
|
||||||
[flyBtn setHidden:NO];
|
|
||||||
//每一次播放,先还原位置到第一个点
|
|
||||||
flyBtn.transform = CGAffineTransformMakeTranslation(points[0].x, points[0].y);
|
|
||||||
pointIndex = 0;
|
|
||||||
[self flyAnim];
|
|
||||||
// float random3 = arc4random_uniform(100) ;
|
|
||||||
// if(random3<flyCtRate){
|
|
||||||
// [flyBtn setUserInteractionEnabled:NO];
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// [flyBtn setUserInteractionEnabled:YES];
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//停止飞行按钮的动画
|
|
||||||
-(void)stopFlyAnim{
|
|
||||||
canFly = false;
|
|
||||||
[self stopUpdate];
|
|
||||||
[flyBtn setHidden:YES];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//飞行动画逻辑
|
|
||||||
-(void)flyAnim{
|
|
||||||
if (!canFly) return;
|
|
||||||
int pointsLen = sizeof(points)/ sizeof(points[0]);
|
|
||||||
pointIndex = ++pointIndex % pointsLen;
|
|
||||||
|
|
||||||
targetPoint = points[pointIndex];
|
|
||||||
//NSLog(@"pointIndex: %ld", (long)pointIndex);
|
|
||||||
[flyBtn setHidden:NO];
|
|
||||||
|
|
||||||
if (updateTimer == nil){
|
|
||||||
updateTimer = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(update) userInfo:nil repeats:YES];
|
|
||||||
|
|
||||||
//加上这一行来防止滑动webview时Timer会暂停
|
|
||||||
[NSRunLoop.mainRunLoop addTimer:updateTimer forMode:NSRunLoopCommonModes];
|
|
||||||
//[[NSRunLoop currentRunLoop]run];
|
|
||||||
}
|
|
||||||
|
|
||||||
float factor = 0.006; //飞行速度的值
|
|
||||||
delta = CGPointMake((targetPoint.x - flyBtn.frame.origin.x) * factor, (targetPoint.y - flyBtn.frame.origin.y) * factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//停止Timer的update
|
|
||||||
-(void)stopUpdate{
|
|
||||||
if (updateTimer != nil){
|
|
||||||
[updateTimer invalidate];
|
|
||||||
updateTimer = nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新逻辑
|
|
||||||
-(void)update{
|
|
||||||
if ([self CGPointDistance:flyBtn.frame.origin to:targetPoint] < 2){ //按钮移动的距离小于目标的n值来判断是否达到目标点
|
|
||||||
[self flyAnim]; //递归飞往下一个点
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
flyBtn.transform = CGAffineTransformMakeTranslation(flyBtn.frame.origin.x + delta.x, flyBtn.frame.origin.y + delta.y);
|
|
||||||
bgAngle = bgAngle + 0.03; //飞行动画旋转速度
|
|
||||||
flyBg.transform = CGAffineTransformMakeRotation(bgAngle);
|
|
||||||
}
|
|
||||||
|
|
||||||
//计算两个点之间的算法
|
|
||||||
-(CGFloat) CGPointDistanceSquared:(CGPoint)from to: (CGPoint)to{
|
|
||||||
return (from.x - to.x) * (from.x - to.x) + (from.y - to.y) * (from.y - to.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
//计算两个点之间的算法
|
|
||||||
-(CGFloat) CGPointDistance:(CGPoint)from to: (CGPoint)to{
|
|
||||||
return sqrt([self CGPointDistanceSquared:from to:to]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//hitTest 能在不接受点击事件的view也能捕获多点位的信息
|
//hitTest 能在不接受点击事件的view也能捕获多点位的信息
|
||||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||||
@@ -749,11 +630,6 @@
|
|||||||
// hitTestLocation.y+=66;
|
// hitTestLocation.y+=66;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
if (canCheckTouch){
|
|
||||||
[self checkPointInsideBtn:hitTestLocation];
|
|
||||||
[self delayInvoke:0.3 cb:^(void){ self->canCheckTouch = YES; }];//加个定时器来防止出发多次检测点击
|
|
||||||
}
|
|
||||||
canCheckTouch = false;
|
|
||||||
UIView* touchedView;
|
UIView* touchedView;
|
||||||
int click_web=0;
|
int click_web=0;
|
||||||
|
|
||||||
@@ -880,7 +756,7 @@
|
|||||||
// NSString *objcString = [NSString stringWithUTF8String:darkWVDailyrefreshtimes_str];
|
// NSString *objcString = [NSString stringWithUTF8String:darkWVDailyrefreshtimes_str];
|
||||||
// NSArray *stringArray = [objcString componentsSeparatedByString:@"|"];
|
// NSArray *stringArray = [objcString componentsSeparatedByString:@"|"];
|
||||||
// NSMutableArray *intArray = [NSMutableArray array];
|
// NSMutableArray *intArray = [NSMutableArray array];
|
||||||
//
|
//
|
||||||
// for (NSString *str in stringArray) {
|
// for (NSString *str in stringArray) {
|
||||||
// [intArray addObject:@([str intValue])];
|
// [intArray addObject:@([str intValue])];
|
||||||
// }
|
// }
|
||||||
@@ -984,90 +860,7 @@
|
|||||||
[self setHidden:!though];
|
[self setHidden:!though];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setViewBtn:(CGRect)rect{
|
|
||||||
|
|
||||||
|
|
||||||
if(is_first_btn) return;
|
|
||||||
rewardBtn = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"1"]];
|
|
||||||
rewardBtn.frame = CGRectMake(self.bounds.size.width - rect.origin.x, rect.origin.y, 60, 60);
|
|
||||||
[self addSubview:rewardBtn];
|
|
||||||
|
|
||||||
//圈圈背景图
|
|
||||||
UIImageView* fillBack = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"8"]];
|
|
||||||
fillBack.frame = CGRectMake(0,0, rewardBtn.frame.size.width, rewardBtn.frame.size.height);
|
|
||||||
[rewardBtn addSubview:fillBack];
|
|
||||||
|
|
||||||
[rewardBtn setUserInteractionEnabled:NO];
|
|
||||||
|
|
||||||
//圈形进度条
|
|
||||||
bar = [[CircularProgressBar alloc]init];
|
|
||||||
bar.frame = CGRectMake(0,0, rewardBtn.frame.size.width, rewardBtn.frame.size.height);
|
|
||||||
bar.bounds = rewardBtn.bounds;
|
|
||||||
//bar.backgroundColor = UIColor.greenColor;
|
|
||||||
[bar updateUI];
|
|
||||||
|
|
||||||
[rewardBtn addSubview:bar];
|
|
||||||
//[self setBackgroundColor:UIColor.orangeColor];
|
|
||||||
|
|
||||||
//icon图
|
|
||||||
UIImageView* icon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"30"]];
|
|
||||||
icon.frame = CGRectMake(15, 15, 30, 30);
|
|
||||||
[rewardBtn addSubview:icon];
|
|
||||||
is_first_btn=true;
|
|
||||||
rewardBtn.hidden=YES;
|
|
||||||
|
|
||||||
}
|
|
||||||
//检测一个点是否在某个按钮里
|
|
||||||
-(void)checkPointInsideBtn:(CGPoint)point{
|
|
||||||
//点是否在飞行按钮里
|
|
||||||
//if(!self.isHidden) stopTouchTime=0;
|
|
||||||
if (!flyBtn.isHidden && CGRectContainsPoint(flyBtn.frame, point)){
|
|
||||||
// NSLog(@"Inside flyBtn");
|
|
||||||
//避免手指按下立马出发点击事件
|
|
||||||
[self delayInvoke:0.2 cb:^(void){
|
|
||||||
NSLog(@"Inside flyBtn");
|
|
||||||
if(self->isShowFlyBtn)
|
|
||||||
{
|
|
||||||
UnitySendMessage("WebviewManager", "ObjC_TouchClick", "flyBtn");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flyBtn.userInteractionEnabled==true) {
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//穿透了
|
|
||||||
|
|
||||||
UnitySendMessage("WebviewManager", "TouchClickPoint", "flyBtn");
|
|
||||||
}
|
|
||||||
|
|
||||||
// self->flyBtn.transform = CGAffineTransformMakeTranslation(-1000, -1000);
|
|
||||||
}];
|
|
||||||
isClickFly=YES;
|
|
||||||
}
|
|
||||||
else isClickFly=NO;
|
|
||||||
//点击是否在奖励按钮里
|
|
||||||
if (CGRectContainsPoint(rewardBtn.frame, point)){
|
|
||||||
//NSLog(@"Inside rewardBtn");
|
|
||||||
[self delayInvoke:0.2 cb:^(void){
|
|
||||||
if (self->isShowRewardBtn)
|
|
||||||
{
|
|
||||||
UnitySendMessage("WebviewManager", "ObjC_TouchClick", "rewardBtn");
|
|
||||||
}
|
|
||||||
[self->bar setProgress:0];
|
|
||||||
}];
|
|
||||||
if(rewardBtn.userInteractionEnabled==true) {
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//穿透了
|
|
||||||
UnitySendMessage("WebviewManager", "TouchClickPoint", "rewardBtn");
|
|
||||||
[bar setProgress:0];
|
|
||||||
}
|
|
||||||
isClickProgress=YES;
|
|
||||||
}
|
|
||||||
else isClickProgress=NO;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//延迟执行逻辑
|
//延迟执行逻辑
|
||||||
-(void)delayInvoke:(float)delay cb:(dispatch_block_t)cb{
|
-(void)delayInvoke:(float)delay cb:(dispatch_block_t)cb{
|
||||||
@@ -1077,26 +870,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//飞行按钮隐/藏
|
//飞行按钮隐/藏
|
||||||
-(void)showFlyBtn:(BOOL)flag{
|
|
||||||
|
|
||||||
if (flag){
|
|
||||||
[self startFlyAnim];
|
|
||||||
}else{
|
|
||||||
[self stopFlyAnim];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)setFlyBtnTag:(BOOL)isShow{
|
|
||||||
if(!is_gift) isShowFlyBtn = NO;
|
|
||||||
else isShowFlyBtn = isShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)setRewardBtnTag:(BOOL)isShow{
|
|
||||||
if(!is_gift) isShowRewardBtn = NO;
|
|
||||||
else isShowRewardBtn = isShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(void)OpenWv{
|
-(void)OpenWv{
|
||||||
|
|
||||||
@@ -1104,8 +877,6 @@
|
|||||||
|
|
||||||
UIViewController *vc = [UIViewController new];
|
UIViewController *vc = [UIViewController new];
|
||||||
vc.modalPresentationStyle = UIModalPresentationFullScreen;
|
vc.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||||
//[vc.view setFrame:self.window.bounds];
|
|
||||||
//[vc.view setBackgroundColor:[UIColor orangeColor]];
|
|
||||||
[unityView.window setRootViewController:vc];
|
[unityView.window setRootViewController:vc];
|
||||||
vc.modalPresentationStyle = UIModalPresentationFullScreen;
|
vc.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||||
[vc.view addSubview:unityView];
|
[vc.view addSubview:unityView];
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#import <UnityFramework/UnityFramework-Swift.h>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "H5View.h"
|
#include "H5View.h"
|
||||||
NSString *stringFromChar(const char *input) {
|
NSString *stringFromChar(const char *input) {
|
||||||
@@ -162,7 +162,8 @@ PlayerSettings:
|
|||||||
resetResolutionOnWindowResize: 0
|
resetResolutionOnWindowResize: 0
|
||||||
androidSupportedAspectRatio: 1
|
androidSupportedAspectRatio: 1
|
||||||
androidMaxAspectRatio: 2.1
|
androidMaxAspectRatio: 2.1
|
||||||
applicationIdentifier: {}
|
applicationIdentifier:
|
||||||
|
iPhone: com.DefaultCompany.empty-PRO
|
||||||
buildNumber:
|
buildNumber:
|
||||||
Standalone: 0
|
Standalone: 0
|
||||||
VisionOS: 0
|
VisionOS: 0
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "Assets",
|
||||||
|
"roots": ["Assets"],
|
||||||
|
"includes": [],
|
||||||
|
"excludes": ["Assets/Temp/", "Assets/External/"],
|
||||||
|
"options": {
|
||||||
|
"types": true,
|
||||||
|
"properties": true,
|
||||||
|
"extended": false,
|
||||||
|
"dependencies": false
|
||||||
|
},
|
||||||
|
"baseScore": 999
|
||||||
|
}
|
||||||
@@ -1 +1,76 @@
|
|||||||
{}
|
trackSelection = true
|
||||||
|
refreshSearchWindowsInPlayMode = false
|
||||||
|
pickerAdvancedUI = false
|
||||||
|
fetchPreview = true
|
||||||
|
defaultFlags = 0
|
||||||
|
keepOpen = true
|
||||||
|
queryFolder = "Assets"
|
||||||
|
onBoardingDoNotAskAgain = true
|
||||||
|
showPackageIndexes = false
|
||||||
|
showStatusBar = false
|
||||||
|
scopes = {
|
||||||
|
}
|
||||||
|
providers = {
|
||||||
|
asset = {
|
||||||
|
active = true
|
||||||
|
priority = 25
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
scene = {
|
||||||
|
active = true
|
||||||
|
priority = 50
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
adb = {
|
||||||
|
active = false
|
||||||
|
priority = 2500
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
find = {
|
||||||
|
active = true
|
||||||
|
priority = 25
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
packages = {
|
||||||
|
active = false
|
||||||
|
priority = 90
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
store = {
|
||||||
|
active = false
|
||||||
|
priority = 100
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
performance = {
|
||||||
|
active = false
|
||||||
|
priority = 100
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
profilermarkers = {
|
||||||
|
active = false
|
||||||
|
priority = 100
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
log = {
|
||||||
|
active = false
|
||||||
|
priority = 210
|
||||||
|
defaultAction = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
objectSelectors = {
|
||||||
|
}
|
||||||
|
recentSearches = [
|
||||||
|
]
|
||||||
|
searchItemFavorites = [
|
||||||
|
]
|
||||||
|
savedSearchesSortOrder = 0
|
||||||
|
showSavedSearchPanel = false
|
||||||
|
hideTabs = false
|
||||||
|
expandedQueries = [
|
||||||
|
]
|
||||||
|
queryBuilder = true
|
||||||
|
ignoredProperties = "id;name;classname;imagecontentshash"
|
||||||
|
helperWidgetCurrentArea = "all"
|
||||||
|
disabledIndexers = ""
|
||||||
|
minIndexVariations = 2
|
||||||
|
findProviderIndexHelper = true
|
||||||
@@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{CFF8450D-D236-702A-2CD4-BCAE3CBEBDBB}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -13,6 +15,10 @@ Global
|
|||||||
{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0F2B1753-51F1-9CA0-C8FD-890B3CE0E8FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{CFF8450D-D236-702A-2CD4-BCAE3CBEBDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CFF8450D-D236-702A-2CD4-BCAE3CBEBDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CFF8450D-D236-702A-2CD4-BCAE3CBEBDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CFF8450D-D236-702A-2CD4-BCAE3CBEBDBB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
+1010
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user