From 520ae2bd3df1e27fb6095cb1a483abdbad913175 Mon Sep 17 00:00:00 2001 From: changyunjia <905640960@qq.com> Date: Fri, 10 Jul 2026 10:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/BingoSun/Scripts/WebviewManager.cs | 4 +- Assets/Scripts/ConfigSystem_sdk.cs | 69 ++-- Assets/Scripts/NetworkKit_sdk.cs | 394 ++++++++-------------- Assets/Scripts/SdkManager.cs | 23 +- UserSettings/Layouts/default-2022.dwlt | 66 ++-- 5 files changed, 257 insertions(+), 299 deletions(-) diff --git a/Assets/BingoSun/Scripts/WebviewManager.cs b/Assets/BingoSun/Scripts/WebviewManager.cs index 1562d16..e99bc99 100644 --- a/Assets/BingoSun/Scripts/WebviewManager.cs +++ b/Assets/BingoSun/Scripts/WebviewManager.cs @@ -286,7 +286,7 @@ namespace DontConfuse { H5sendClass info = new H5sendClass() { link = temp_array[0], type = "h5" }; - NetworkKit.PostWithHeader("event/h5Impressions", info, (isSuccess, obj) => + NetworkKit_sdk.PostWithHeader("event/h5Impressions", info, (isSuccess, obj) => { if (isSuccess) { @@ -309,7 +309,7 @@ namespace DontConfuse else { H5sendClass info = new H5sendClass() { link = temp_array[0], type = "h6" }; - NetworkKit.PostWithHeader("event/h5Impressions", info, (isSuccess, obj) => + NetworkKit_sdk.PostWithHeader("event/h5Impressions", info, (isSuccess, obj) => { if (isSuccess) { diff --git a/Assets/Scripts/ConfigSystem_sdk.cs b/Assets/Scripts/ConfigSystem_sdk.cs index 1be7669..c805b13 100644 --- a/Assets/Scripts/ConfigSystem_sdk.cs +++ b/Assets/Scripts/ConfigSystem_sdk.cs @@ -10,6 +10,9 @@ using BingoBrain; using System.Linq; using System.Text; using DontConfuse; +using UnityEngine.Networking; +using UnityEngine.Events; +using System.Collections; namespace BingoBrain { public class ConfigSystem_sdk @@ -65,7 +68,7 @@ namespace BingoBrain if (needDownloadConfigFile || !File.Exists(assetHotFixFilePath)) { - IsfvKit.StartCoroutine(CachKit.GetTextFromUrl($"{loginData.cdn_url}/config/{CDNConfigFileName}", + SdkManager.Instance.StartCoroutine(GetTextFromUrl($"{loginData.cdn_url}/config/{CDNConfigFileName}", configFileName, (content) => { PlayerPrefs.SetString(configFileNameKey, CDNConfigFileName); @@ -73,7 +76,6 @@ namespace BingoBrain //CtrlDispatcher.Instance.Dispatch(CtrlMsg.NewConfigRead); }, configFileSavePath)); } - //检查设备本地是否有配置文件 if (File.Exists(assetHotFixFilePath)) { @@ -84,6 +86,35 @@ namespace BingoBrain GameHelper.PostFunnelLogin("loadFinish"); } } + public static IEnumerator GetTextFromUrl(string url, string fileName, UnityAction 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) { @@ -123,23 +154,23 @@ namespace BingoBrain Debug.Log(open_dark_wv); if (open_dark_wv) { - SdkManager.Instance.OpenWv(); - // int flyswitch = ConfigSystem.GetConfig().flyswitch; - // int propswitch = ConfigSystem.GetConfig().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().propCoord[0], ConfigSystem.GetConfig().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(); + SdkManager.Instance.OpenWv(); + // int flyswitch = ConfigSystem.GetConfig().flyswitch; + // int propswitch = ConfigSystem.GetConfig().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().propCoord[0], ConfigSystem.GetConfig().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) diff --git a/Assets/Scripts/NetworkKit_sdk.cs b/Assets/Scripts/NetworkKit_sdk.cs index b21bf9b..49eeea7 100644 --- a/Assets/Scripts/NetworkKit_sdk.cs +++ b/Assets/Scripts/NetworkKit_sdk.cs @@ -4,10 +4,7 @@ using System.Collections; using UnityEngine.Events; using UnityEngine.Networking; using System.Collections.Generic; -using MiniJSON; using Newtonsoft.Json; -using Json = Spine.Json; -using BingoBrain.Core; using BingoBrain; using System; using DontConfuse; @@ -18,13 +15,14 @@ using System.Security.Cryptography; public class NetworkKit_sdk { + public const string JarvisToken_SDK = "JarvisToken_SDK"; public static string CDNUrl; public static string GetCacheToken() { string token = null; - if (PlayerPrefsKit.HasKey(PrefsKeyConst.JarvisToken)) + if (PlayerPrefs.HasKey(JarvisToken_SDK)) { - token = PlayerPrefsKit.ReadString(PrefsKeyConst.JarvisToken); + token = PlayerPrefs.GetString(JarvisToken_SDK, string.Empty); } return token; @@ -32,7 +30,7 @@ public class NetworkKit_sdk public static void SetCacheToken(string token) { - PlayerPrefsKit.WriteString(PrefsKeyConst.JarvisToken, token); + PlayerPrefs.SetString(JarvisToken_SDK, token); } public const string DomainDebugUrl = @"https://sdkapi.jsoncompare.online/api/"; @@ -41,17 +39,17 @@ public class NetworkKit_sdk private static IEnumerator PostInternal(string url, object requestData, UnityAction onCompleted, Dictionary header = null) { - var requestJson = SerializeUtil.ToJsonIndented(requestData); + string requestJson = JsonConvert.SerializeObject(requestData); - var url2 = url; + string url2 = url; #if BingoBrainRelease url2 = Base64Kit_sdk.Encode(url); requestJson = Base64Kit_sdk.Encode(requestJson); #endif - var bytes = Encoding.UTF8.GetBytes(requestJson); - var url1 = DomainDebugUrl + url2; + byte[] bytes = Encoding.UTF8.GetBytes(requestJson); + string url1 = DomainDebugUrl + url2; //Debug.Log($"Url: {url1}"); - var loginRequest = new UnityWebRequest(url1, UnityWebRequest.kHttpVerbPOST) + UnityWebRequest loginRequest = new UnityWebRequest(url1, UnityWebRequest.kHttpVerbPOST) { uploadHandler = new UploadHandlerRaw(bytes), downloadHandler = new DownloadHandlerBuffer() @@ -73,7 +71,7 @@ public class NetworkKit_sdk } else { - var receiveContent = loginRequest.downloadHandler.text; + string receiveContent = loginRequest.downloadHandler.text; #if BingoBrainRelease if (!receiveContent.IsNullOrWhiteSpace()) { @@ -85,11 +83,11 @@ public class NetworkKit_sdk // Debug.Log(url + "--------" + loginRequest.downloadHandler.text); Debug.Log(url + "--------" + receiveContent); - var response = SerializeUtil.ToObject(receiveContent); + var response = JsonConvert.DeserializeObject(receiveContent); if (response?.code == 0) { - var responseData = SerializeUtil.ToObject(response.data.ToString()); + var responseData = JsonConvert.DeserializeObject(response.data.ToString()); onCompleted?.Invoke(true, responseData); } else @@ -115,11 +113,11 @@ public class NetworkKit_sdk public static void Post(string url, object requestData, UnityAction onCompleted) { - IsfvKit.StartCoroutine(PostInternal(url, requestData, onCompleted)); + SdkManager.Instance.StartCoroutine(PostInternal(url, requestData, onCompleted)); } public static void Post(string url, object requestData, UnityAction onCompleted = null) { - IsfvKit.StartCoroutine(PostInternal(url, requestData, onCompleted)); + SdkManager.Instance.StartCoroutine(PostInternal(url, requestData, onCompleted)); } public static void PostWithHeader(string url, object requestData = null, @@ -128,7 +126,7 @@ public class NetworkKit_sdk ReSetToken(); var headers = new Dictionary { { "x-token", GetCacheToken() } }; - IsfvKit.StartCoroutine(PostInternal(url, requestData, onCompleted, headers)); + SdkManager.Instance.StartCoroutine(PostInternal(url, requestData, onCompleted, headers)); } public static void PostWithHeader(string url, UnityAction onCompleted) @@ -157,7 +155,7 @@ public class NetworkKit_sdk public static void Get(string url, UnityAction onCompleted) { - IsfvKit.StartCoroutine(GetInternal(url, onCompleted)); + SdkManager.Instance.StartCoroutine(GetInternal(url, onCompleted)); } public static IEnumerator GetInternal(string url, UnityAction onCompleted) @@ -236,68 +234,68 @@ public class NetworkKit_sdk return newJson.ToString(); } - public static void BuriedPoint(string eventname, string eventproperty, int integer) - { + // 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; - } + // 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("/event/incrN", buriedPointObject, (isSuccess, obj) => - { - // Debug.Log(isSuccess); - // Debug.Log(eventproperty); - //Debug.Log(JsonUtility.ToJson(obj)); - }); - } - public static BuriedPointObject buriedPointObject = new BuriedPointObject(); + // buriedPointObject.@event = eventname; + // buriedPointObject.property = eventproperty; + // buriedPointObject.n = integer; + // PostWithHeader("/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; - } - } + // 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; + // 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; + // isReqToken = true; - var headers = new Dictionary { { "x-token", GetCacheToken() } }; + // var headers = new Dictionary { { "x-token", GetCacheToken() } }; - IsfvKit.StartCoroutine(PostInternal("tokenRefresh", null, (isSuccess, tokenData) => - { - if (isSuccess) - { - LoginModel loginModel = GameHelper.GetLoginModel(); - loginModel.token = tokenData.token; - loginModel.expires_at = tokenData.expires_at; + // IsfvKit.StartCoroutine(PostInternal("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; + // SetCacheToken(tokenData.token); + // } + // isReqToken = false; - }, headers)); + // }, headers)); } @@ -305,105 +303,105 @@ public class NetworkKit_sdk public static void ReLoginGetToken() { - if (isReqToken1) return; + // 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 + // 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; + // }; + // isReqToken1 = true; - Post("login", requestLoginData, (isSuccess, loginData) => - { - if (isSuccess) - { - LoginModel loginModel = GameHelper.GetLoginModel(); - loginModel.token = loginData.token; - loginModel.expires_at = loginData.expires_at; + // Post("login", requestLoginData, (isSuccess, loginData) => + // { + // if (isSuccess) + // { + // LoginModel loginModel = GameHelper.GetLoginModel(); + // loginModel.token = loginData.token; + // loginModel.expires_at = loginData.expires_at; - SetCacheToken(loginData.token); - } + // SetCacheToken(loginData.token); + // } - isReqToken1 = false; - }); + // 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"; + // 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 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 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; - } + // 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]); - } - } + // 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; - } + // 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]); - } - } + // 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; - } + // 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(); @@ -550,6 +548,7 @@ public static class Base64EncodeUtil_sdk return Convert.FromBase64String(result); } } + public class ResponseData_sdk { public int code; @@ -562,103 +561,10 @@ public class BuriedPointObject_sdk public string property; public int n; } -public class BuriedPointEvent_sdk +public class H5sendClass { - public static string play_event = "Number_of_people_play"; - public static string play_property = "Number_of_people_playing"; + public string link; + public string type; - 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"; } + diff --git a/Assets/Scripts/SdkManager.cs b/Assets/Scripts/SdkManager.cs index ef17814..f8a0ba0 100644 --- a/Assets/Scripts/SdkManager.cs +++ b/Assets/Scripts/SdkManager.cs @@ -14,6 +14,7 @@ using BingoBrain.HotFix; using Unity.VisualScripting.FullSerializer; using Unity.VisualScripting; using Newtonsoft.Json; +using System.Collections; namespace DontConfuse @@ -30,7 +31,7 @@ namespace DontConfuse // 如果实例为空,尝试在场景中寻找已经挂载的脚本 if (_instance == null) { - _instance = FindFirstObjectByType(); + _instance = FindFirstObjectByType(); if (_instance == null) { Debug.LogError("场景中没有找到挂载 SdkManager 的物体!请确保场景中有一个 GameObject 挂载了该脚本。"); @@ -38,6 +39,26 @@ namespace DontConfuse } return _instance; } + } + int time = 0; + void Update() + { + if (Time.time > time) + { + H5sendClass info = new H5sendClass() { link = "www.baidu.com", type = "h6" }; + NetworkKit_sdk.PostWithHeader("event/h5Impressions", info, (isSuccess, obj) => + { + if (isSuccess) + { + Debug.Log("发送成功"); + Debug.Log(JsonConvert.SerializeObject(obj)); + + } + }); + time++; + } + + } private void Awake() { diff --git a/UserSettings/Layouts/default-2022.dwlt b/UserSettings/Layouts/default-2022.dwlt index 5778a05..b30d952 100644 --- a/UserSettings/Layouts/default-2022.dwlt +++ b/UserSettings/Layouts/default-2022.dwlt @@ -14,8 +14,8 @@ MonoBehaviour: m_EditorClassIdentifier: m_PixelRect: serializedVersion: 2 - x: 0 - y: 43 + x: 1920 + y: 40 width: 1920 height: 989 m_ShowMode: 4 @@ -65,7 +65,7 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 673 + x: 671 y: 0 width: 485 height: 939 @@ -91,9 +91,9 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 1493 + x: 1491 y: 0 - width: 427 + width: 429 height: 939 m_MinSize: {x: 101, y: 121} m_MaxSize: {x: 4001, y: 4021} @@ -179,7 +179,7 @@ MonoBehaviour: m_MinSize: {x: 500, y: 50} m_MaxSize: {x: 40480, y: 8096} vertical: 0 - controlID: 129 + controlID: 139 draggingID: 0 --- !u!114 &8 MonoBehaviour: @@ -219,7 +219,7 @@ MonoBehaviour: serializedVersion: 2 x: 252 y: 0 - width: 421 + width: 419 height: 939 m_MinSize: {x: 202, y: 221} m_MaxSize: {x: 4002, y: 4021} @@ -244,7 +244,7 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 1158 + x: 1156 y: 0 width: 335 height: 939 @@ -275,9 +275,9 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1493 - y: 73 - width: 426 + x: 3411 + y: 70 + width: 428 height: 918 m_SerializedDataModeController: m_DataMode: 0 @@ -309,8 +309,8 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1158 - y: 73 + x: 3076 + y: 70 width: 333 height: 918 m_SerializedDataModeController: @@ -356,8 +356,8 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 673 - y: 73 + x: 2591 + y: 70 width: 483 height: 918 m_SerializedDataModeController: @@ -381,7 +381,7 @@ MonoBehaviour: m_SkipHidden: 0 m_SearchArea: 1 m_Folders: - - Assets/Scripts + - Assets/Plugins/iOS m_Globs: [] m_OriginalText: m_ImportLogFlags: 0 @@ -389,16 +389,16 @@ MonoBehaviour: m_ViewMode: 1 m_StartGridSize: 16 m_LastFolders: - - Assets/Scripts + - Assets/Plugins/iOS m_LastFoldersGridSize: -1 - m_LastProjectPath: D:\git_test\sdk_TEST + m_LastProjectPath: D:\git_test\BingoGrassland_unity_a m_LockTracker: m_IsLocked: 0 m_FolderTreeState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: f07c0000 - m_LastClickedID: 31984 - m_ExpandedIDs: 00000000b27c0000b47c0000b87c0000ba7c0000bc7c0000be7c0000c47c0000c67c0000c87c0000ca7c0000cc7c0000ce7c0000d07c0000d27c0000d47c0000d67c0000d87c0000dc7c0000de7c0000e07c0000e27c0000e47c0000e67c0000e87c0000ea7c0000ec7c0000ee7c0000f27c0000f47c0000f67c0000f87c0000fa7c0000fc7c0000fe7c0000007d0000027d0000047d0000067d0000087d00000a7d00000c7d00000e7d0000107d0000127d0000247d000000ca9a3bffffff7f + m_SelectedIDs: e4800000 + m_LastClickedID: 32996 + m_ExpandedIDs: 00000000b4720000b6720000b8720000ba720000bc720000be720000c0720000c2720000c4720000c6720000c8720000ca720000cc720000ce720000d0720000d2720000d4720000d6720000d8720000da720000dc720000de720000e0720000e2720000e4720000e6720000e8720000ea720000ec720000ee720000f0720000f2720000f4720000f6720000f8720000fa720000fc720000fe72000000730000027300000473000006730000087300000a7300003673000000ca9a3bffffff7f m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -426,7 +426,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: 96670000 m_LastClickedID: 26518 - m_ExpandedIDs: 00000000b27c0000b47c0000b67c0000b87c0000ba7c0000bc7c0000be7c0000c07c0000c27c0000c47c0000c67c0000c87c0000ca7c0000cc7c0000ce7c0000d07c0000d27c0000d47c0000d67c0000d87c0000da7c0000dc7c0000de7c0000e07c0000e27c0000e47c0000e67c0000e87c0000ea7c0000ec7c0000ee7c0000f07c0000f27c0000f47c0000f67c0000f87c0000fa7c0000fc7c0000fe7c0000007d0000027d0000047d0000067d0000087d00000a7d00000c7d00000e7d0000107d0000127d0000 + m_ExpandedIDs: 00000000b4720000b6720000b8720000ba720000bc720000be720000c0720000c2720000c4720000c6720000c8720000ca720000cc720000ce720000d0720000d2720000d4720000d6720000d8720000da720000dc720000de720000e0720000e2720000e4720000e6720000e8720000ea720000ec720000ee720000f0720000f2720000f4720000f6720000f8720000fa720000fc720000fe72000000730000027300000473000006730000087300000a730000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -502,9 +502,9 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 252 - y: 73 - width: 419 + x: 2172 + y: 70 + width: 417 height: 918 m_SerializedDataModeController: m_DataMode: 0 @@ -558,23 +558,23 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 21 - width: 419 + width: 417 height: 897 m_Scale: {x: 0.500558, y: 0.500558} - m_Translation: {x: 209.5, y: 448.5} + m_Translation: {x: 208.5, y: 448.5} m_MarginLeft: 0 m_MarginRight: 0 m_MarginTop: 0 m_MarginBottom: 0 m_LastShownAreaInsideMargins: serializedVersion: 2 - x: -418.5329 + x: -416.53513 y: -896 - width: 837.0658 + width: 833.07025 height: 1792 m_MinimalGUI: 1 m_defaultScale: 0.500558 - m_LastWindowPixelSize: {x: 419, y: 918} + m_LastWindowPixelSize: {x: 417, y: 918} m_ClearInEditMode: 1 m_NoCameraWarning: 1 m_LowResolutionForAspectRatios: 00000100000000000000 @@ -1010,8 +1010,8 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 0 - y: 73 + x: 1920 + y: 70 width: 251 height: 918 m_SerializedDataModeController: @@ -1029,7 +1029,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 5e52ffff6e52ffff6e5effff7e5effff9e64ffffae64ffffb66affffc66affffbc70ffffcc70ffff4ad5fffff4ffffff + m_ExpandedIDs: 3ecdffff18fbffff1afbffff m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: