h5sdk提交
This commit is contained in:
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,246 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using BingoBrain.Core;
|
||||
using UnityEngine;
|
||||
using BingoBrain.Asset;
|
||||
using BingoBrain.HotFix;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using BingoBrain;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class ConfigSystem_sdk
|
||||
{
|
||||
|
||||
private ConfigSystem_sdk()
|
||||
{
|
||||
}
|
||||
private static readonly ConfigSystem_sdk _instance = new ConfigSystem_sdk();
|
||||
|
||||
public static ConfigSystem_sdk Instance
|
||||
{
|
||||
get { return _instance; }
|
||||
}
|
||||
|
||||
private static Dictionary<Type, object> configData = new();
|
||||
public void OnRequestGetConfig()
|
||||
{
|
||||
GameHelper.PostFunnelLogin("loadBegin");
|
||||
var loginData = LoginModel_sdk.Instance;
|
||||
|
||||
var configFileName = "Json";
|
||||
var configFileSavePath = $"{Application.persistentDataPath}/sdkConfig/";
|
||||
var assetHotFixFilePath = $"{configFileSavePath}{configFileName}.txt";
|
||||
var configFileNameKey = "sdkconfigFileName";
|
||||
|
||||
var CDNConfigFileName = loginData.setting;
|
||||
string savedCfgName = PlayerPrefs.GetString(configFileNameKey);
|
||||
bool needDownloadConfigFile = false;
|
||||
|
||||
if (!string.IsNullOrEmpty(CDNConfigFileName))
|
||||
{
|
||||
//如果本地Player Prefs里没有保存配置文件名
|
||||
if (string.IsNullOrEmpty(savedCfgName))
|
||||
{
|
||||
// Debug.Log("[UNITY] No config file name saved.");
|
||||
needDownloadConfigFile = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Debug.Log($"[UNITY] Saved config name: {savedCfgName}, CDN config name: {CDNConfigFileName}");
|
||||
//与CDN上的对比名称
|
||||
if (!savedCfgName.Equals(CDNConfigFileName))
|
||||
{
|
||||
needDownloadConfigFile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Debug.Log($"[UNITY] needDownloadConfigFile: {needDownloadConfigFile}");
|
||||
//默默地拉去新配置
|
||||
// Debug.Log("kkkkkkkkkkkkkkkkkkkkkk" + needDownloadConfigFile);
|
||||
// Debug.Log("kkkkkkkkkkkkkkkkkkkkkk" + savedCfgName);
|
||||
|
||||
if (needDownloadConfigFile || !File.Exists(assetHotFixFilePath))
|
||||
{
|
||||
IsfvKit.StartCoroutine(CachKit.GetTextFromUrl($"{loginData.cdn_url}/config/{CDNConfigFileName}",
|
||||
configFileName, (content) =>
|
||||
{
|
||||
PlayerPrefs.SetString(configFileNameKey, CDNConfigFileName);
|
||||
ParseConfig(content);
|
||||
//CtrlDispatcher.Instance.Dispatch(CtrlMsg.NewConfigRead);
|
||||
}, configFileSavePath));
|
||||
}
|
||||
|
||||
//检查设备本地是否有配置文件
|
||||
if (File.Exists(assetHotFixFilePath))
|
||||
{
|
||||
// Debug.Log($"[UNITY] Load config from datapath: {assetHotFixFilePath}");
|
||||
ParseConfig(File.ReadAllText(assetHotFixFilePath));
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
AppDispatcher.Instance.Dispatch(CsjInfoC.LoginInit);
|
||||
GameHelper.PostFunnelLogin("loadFinish");
|
||||
}
|
||||
// else //没有就从StreamingAssets读取
|
||||
// {
|
||||
// var path = $"{Application.streamingAssetsPath}/Config/{configFileName}.txt";
|
||||
// #if UNITY_IOS
|
||||
// path = "file://" + path;
|
||||
// #endif
|
||||
// // Debug.Log($"[UNITY] Load config from streaming asset: {path}");
|
||||
// IsfvKit.StartCoroutine(CachKit.GetTextFromUrl(path, configFileName, content =>
|
||||
// {
|
||||
// ParseConfig(content);
|
||||
// // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
// AppDispatcher.Instance.Dispatch(CsjInfoC.LoginInit);
|
||||
// GameHelper.PostFunnelLogin("loadFinish");
|
||||
// }, configFileSavePath));
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
private void ParseConfig(string json)
|
||||
{
|
||||
Debug.Log("sdk--------json" + json);
|
||||
if (json == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json.StartsWith("{"))
|
||||
{
|
||||
json = Encoding.UTF8.GetString(Base64Kit_sdk.Decrypt(Encoding.UTF8.GetBytes(json),
|
||||
"com.matchgame.captaindicedubloons"));
|
||||
// json = Base64Kit.Decode(json, "com.matchgame.captaindicedubloons");
|
||||
}
|
||||
Debug.Log("转化后的json" + json);
|
||||
SetConfig(json);
|
||||
if (true)
|
||||
{
|
||||
// SdkManager.
|
||||
}
|
||||
// CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_StartBefore);
|
||||
|
||||
}
|
||||
RootObject SDKConfig;
|
||||
private void SetConfig(string json_)
|
||||
{
|
||||
SDKConfig = JsonConvert.DeserializeObject<RootObject>(json_);
|
||||
|
||||
|
||||
// for (int i = 0; i < SDKConfig.h5Conf.links.Count; i++)
|
||||
// {
|
||||
// light_weblist.Add(data_new[i]);
|
||||
// }
|
||||
|
||||
|
||||
// List<int> type_list = new List<int>();
|
||||
|
||||
|
||||
// for (int i = 0; i < SDKConfig.h6Conf.layerConfList.Count; i++)
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// dark_weblist.Add(data_new[i]);
|
||||
|
||||
// if (!type_list.Contains(data_new[i].wvType))
|
||||
// {
|
||||
// web_through_str += data_new[i].wvthrough;
|
||||
// web_through_str += "|";
|
||||
// type_list.Add(data_new[i].wvType);
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// web_through_str.Remove(web_through_str.Length - 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public string bid;
|
||||
public H5Conf h5Conf;
|
||||
public H6Conf h6Conf;
|
||||
}
|
||||
|
||||
public class H5Conf
|
||||
{
|
||||
public F5Interval f5Interval;//自动刷新间隔
|
||||
public List<H5Link> links; // H5 的 Link
|
||||
}
|
||||
|
||||
public class F5Interval
|
||||
{
|
||||
public int min;
|
||||
public int max;
|
||||
}
|
||||
|
||||
public class H5Link
|
||||
{
|
||||
public int id;
|
||||
public string url;
|
||||
public int weight;
|
||||
public int maxF5Times;
|
||||
}
|
||||
|
||||
public class H6Conf
|
||||
{
|
||||
public int layers;//层数总数
|
||||
public ADClickF5Delay ADClickF5Delay;//延长时间
|
||||
public SwitchCondition switchCondition;//开启条件
|
||||
public List<LayerConfList> layerConfList;
|
||||
}
|
||||
|
||||
public class ADClickF5Delay
|
||||
{
|
||||
public int min;
|
||||
public int max;
|
||||
}
|
||||
|
||||
public class SwitchCondition//开启条件
|
||||
{
|
||||
public List<RetentionConf> retentionConf; // 已经实例化为具体类型
|
||||
}
|
||||
|
||||
public class RetentionConf//开启条件
|
||||
{
|
||||
public Days days;
|
||||
public int prob;
|
||||
}
|
||||
|
||||
public class Days
|
||||
{
|
||||
public int min;
|
||||
public int max;
|
||||
}
|
||||
|
||||
public class LayerConfList
|
||||
{
|
||||
public int layerId;//第几层
|
||||
public int weight;//显示权重
|
||||
public F5Interval f5Interval;//自动刷新间隔
|
||||
public int offset;
|
||||
public List<H6Link> links; // H6 内部图层的 Link
|
||||
}
|
||||
|
||||
public class H6Link
|
||||
{
|
||||
public int id;
|
||||
public string url;
|
||||
public int weight;
|
||||
public int maxF5Times;//刷新上限
|
||||
public int ctProb;
|
||||
public int ctProb2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fb008dbf6acb0d41b42eb4b0083e089
|
||||
timeCreated: 1692603665
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
public class LoginModel_sdk
|
||||
{
|
||||
public static LoginModel_sdk _instance = new LoginModel_sdk();
|
||||
private LoginModel_sdk()
|
||||
{
|
||||
|
||||
}
|
||||
public static LoginModel_sdk Instance
|
||||
{
|
||||
get { return _instance; }
|
||||
}
|
||||
public long uid;
|
||||
public bool new_player;
|
||||
public string token;
|
||||
public long expires_at;
|
||||
public string country;
|
||||
public bool is_magic;
|
||||
public string invite_code;
|
||||
public string invite_url;
|
||||
public long last_login_time;
|
||||
public string play_data;
|
||||
public string setting;
|
||||
public string cdn_url;
|
||||
public long login_time;
|
||||
public long reg_time;
|
||||
public bool debug_log = true;
|
||||
public int enwp;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d66722231daf944ba4c10b0af879c96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,179 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using BingoBrain.Core;
|
||||
using BingoBrain;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
|
||||
public class LoginSystem_sdk
|
||||
{
|
||||
|
||||
//is debug test (LoginCountLimit 应该为 5, 测试改为2)
|
||||
private const int LoginCountLimit = 5;
|
||||
public int loginCount = 0;
|
||||
private LoginSystem_sdk()
|
||||
{
|
||||
}
|
||||
private static readonly LoginSystem_sdk _instance = new LoginSystem_sdk();
|
||||
|
||||
public static LoginSystem_sdk Instance
|
||||
{
|
||||
get { return _instance; }
|
||||
}
|
||||
|
||||
public void RequestLogin()
|
||||
{
|
||||
|
||||
var requestLoginData = new RequestLoginData_sdk
|
||||
{
|
||||
device_id = SystemInfo.deviceUniqueIdentifier,
|
||||
// device_id ="E742FE8B-C32E-56A7-8F8A-6B3BC0F3169",
|
||||
pack_name = "com.matchgame.captaindicedubloons",
|
||||
app_version = Application.version,
|
||||
// channel = BingoBea.Instance.attribution,
|
||||
// sim = WebviewManager.haveSimCard
|
||||
};
|
||||
Debug.Log(JsonConvert.SerializeObject(requestLoginData));
|
||||
Debug.Log(SystemInfo.deviceUniqueIdentifier);
|
||||
Debug.Log(JsonConvert.SerializeObject(requestLoginData));
|
||||
NetworkKit_sdk.Post<LoginModel_sdk>("login", requestLoginData, (isSuccess, loginData) =>
|
||||
{
|
||||
|
||||
|
||||
if (isSuccess)
|
||||
{
|
||||
Debug.Log("Login_sdk" + "-------------------" + JsonConvert.SerializeObject(loginData));
|
||||
LoginModel_sdk loginModel = LoginModel_sdk.Instance;
|
||||
loginModel.cdn_url = loginData.cdn_url;
|
||||
loginModel.setting = loginData.setting;
|
||||
loginModel.play_data = loginData.play_data;
|
||||
loginModel.token = loginData.token;
|
||||
loginModel.uid = loginData.uid;
|
||||
loginModel.country = loginData.country;
|
||||
loginModel.expires_at = loginData.expires_at;
|
||||
loginModel.is_magic = loginData.is_magic;
|
||||
loginModel.invite_code = loginData.invite_code;
|
||||
loginModel.invite_url = loginData.invite_url;
|
||||
loginModel.last_login_time = loginData.last_login_time;
|
||||
loginModel.login_time = loginData.login_time;
|
||||
loginModel.reg_time = loginData.reg_time;
|
||||
loginModel.new_player = loginData.new_player;
|
||||
loginModel.debug_log = loginData.debug_log;
|
||||
loginModel.enwp = loginData.enwp;
|
||||
|
||||
// if (loginData.is_magic)
|
||||
// {
|
||||
// if (PlayerPrefs.GetInt("is_gift") != 1)
|
||||
// {
|
||||
// AppDispatcher.Instance.Dispatch(CsjInfoC.UI_DisplayLoadingUI);
|
||||
// UICtrlDispatcher.Instance.Dispatch(SkinInfo.LoginAUI_Close);
|
||||
// }
|
||||
// PlayerPrefs.SetInt("is_gift", 1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
NetworkKit_sdk.CDNUrl = $"{loginData.cdn_url}/";
|
||||
NetworkKit_sdk.SetCacheToken(loginData.token);
|
||||
|
||||
// DateTimeBoardk.Instance.SetServerCurrTimestamp(loginData.login_time);
|
||||
|
||||
// Sequence mLoopSequence = DOTween.Sequence();
|
||||
// mLoopSequence.AppendCallback(() =>
|
||||
// {
|
||||
// RequestHeart();
|
||||
|
||||
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetPlayData);
|
||||
|
||||
NetworkDispatcher.Instance.Dispatch(ExternalInfo.GetConfig);
|
||||
GameHelper.PostFunnelLogin("loginRecv", true);
|
||||
ConfigSystem_sdk.Instance.OnRequestGetConfig();
|
||||
// if (GameHelper.IsGiftSwitch())
|
||||
// {
|
||||
// // GameObject.Find("MainCameraRoot").SetActive(false);
|
||||
// }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(JsonConvert.SerializeObject(loginData));
|
||||
//UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.NetLoadingUI_Close);
|
||||
Debug.Log("登陆请求失败");
|
||||
GameHelper.PostFunnelLogin("loginRecv", false);
|
||||
|
||||
float times = loginCount == 0 ? 0 : 5f;
|
||||
|
||||
DOVirtual.DelayedCall(times, () =>
|
||||
{
|
||||
if (loginCount < LoginCountLimit)
|
||||
{
|
||||
loginCount++;
|
||||
RequestLogin();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
loginCount = 0;
|
||||
Action _OnFail = () =>
|
||||
{
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
||||
};
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, _OnFail);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void RequestHeart()
|
||||
{
|
||||
NetworkKit.PostWithHeader("user/health");
|
||||
}
|
||||
|
||||
|
||||
private void OnRequestLogin(object obj = null)
|
||||
{
|
||||
RequestLogin();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public partial class NetworkMsg_sdk
|
||||
{
|
||||
private static uint MsgRootLogic = 100000;
|
||||
|
||||
public static uint GetConfig = ++MsgRootLogic;
|
||||
|
||||
public static uint Reconnect = ++MsgRootLogic;
|
||||
|
||||
public static uint Login = ++MsgRootLogic;
|
||||
|
||||
public static uint SavePlayData = ++MsgRootLogic;
|
||||
|
||||
public static uint GetPlayData = ++MsgRootLogic;
|
||||
|
||||
public static uint SendInviteCode = ++MsgRootLogic;
|
||||
|
||||
public static uint GetInviteData = ++MsgRootLogic;
|
||||
|
||||
public static uint UpdateCheckInviteData = ++MsgRootLogic;
|
||||
|
||||
public static string Identifier = "com.interactivegames.bingotornado";
|
||||
public static uint Start = ++MsgRootLogic;
|
||||
public static uint NotNetwork = ++MsgRootLogic;
|
||||
}
|
||||
public class RequestLoginData_sdk
|
||||
{
|
||||
public string device_id;
|
||||
public string pack_name;
|
||||
public string app_version;
|
||||
public string channel;
|
||||
public bool sim;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3a411886fa88a741b96f7124a48b681
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,664 @@
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
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;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
|
||||
public class NetworkKit_sdk
|
||||
{
|
||||
public static string CDNUrl;
|
||||
public static string GetCacheToken()
|
||||
{
|
||||
string token = null;
|
||||
if (PlayerPrefsKit.HasKey(PrefsKeyConst.JarvisToken))
|
||||
{
|
||||
token = PlayerPrefsKit.ReadString(PrefsKeyConst.JarvisToken);
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
public static void SetCacheToken(string token)
|
||||
{
|
||||
PlayerPrefsKit.WriteString(PrefsKeyConst.JarvisToken, token);
|
||||
}
|
||||
public const string DomainDebugUrl = @"https://sdkapi.jsoncompare.online/api/";
|
||||
|
||||
public static readonly string DomainReleaseUrl = $"https://bingotornado.top/api/";
|
||||
|
||||
private static IEnumerator PostInternal<T>(string url, object requestData, UnityAction<bool, T> onCompleted,
|
||||
Dictionary<string, string> header = null)
|
||||
{
|
||||
var requestJson = SerializeUtil.ToJsonIndented(requestData);
|
||||
|
||||
var 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;
|
||||
//Debug.Log($"Url: {url1}");
|
||||
var loginRequest = new UnityWebRequest(url1, UnityWebRequest.kHttpVerbPOST)
|
||||
{
|
||||
uploadHandler = new UploadHandlerRaw(bytes),
|
||||
downloadHandler = new DownloadHandlerBuffer()
|
||||
};
|
||||
|
||||
if (header != null)
|
||||
{
|
||||
foreach (var keyValuePair in header)
|
||||
{
|
||||
loginRequest.SetRequestHeader(keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
SetRequestContentType(loginRequest);
|
||||
yield return loginRequest.SendWebRequest();
|
||||
if (loginRequest.result is not UnityWebRequest.Result.Success)
|
||||
{
|
||||
onCompleted?.Invoke(false, default);
|
||||
}
|
||||
else
|
||||
{
|
||||
var receiveContent = loginRequest.downloadHandler.text;
|
||||
#if BingoBrainRelease
|
||||
if (!receiveContent.IsNullOrWhiteSpace())
|
||||
{
|
||||
receiveContent = receiveContent.Substring(0, receiveContent.Length - 1);
|
||||
receiveContent = receiveContent.Substring(1);
|
||||
receiveContent = Base64Kit_sdk.Decode(receiveContent);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Debug.Log(url + "--------" + loginRequest.downloadHandler.text);
|
||||
Debug.Log(url + "--------" + receiveContent);
|
||||
var response = SerializeUtil.ToObject<ResponseData>(receiveContent);
|
||||
|
||||
if (response?.code == 0)
|
||||
{
|
||||
var responseData = SerializeUtil.ToObject<T>(response.data.ToString());
|
||||
onCompleted?.Invoke(true, responseData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (response?.code == 1005)
|
||||
{
|
||||
ReLoginGetToken();
|
||||
}
|
||||
|
||||
onCompleted?.Invoke(false, default);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
loginRequest.Dispose();
|
||||
}
|
||||
|
||||
public static void SetRequestContentType(UnityWebRequest request)
|
||||
{
|
||||
request.SetRequestHeader("Content-Type", "application/json;charset=utf-8");
|
||||
}
|
||||
|
||||
public static void Post<T>(string url, object requestData, UnityAction<bool, T> onCompleted)
|
||||
{
|
||||
IsfvKit.StartCoroutine(PostInternal(url, requestData, onCompleted));
|
||||
}
|
||||
public static void Post(string url, object requestData, UnityAction<bool, object> onCompleted = null)
|
||||
{
|
||||
IsfvKit.StartCoroutine(PostInternal(url, requestData, onCompleted));
|
||||
}
|
||||
|
||||
public static void PostWithHeader<T>(string url, object requestData = null,
|
||||
UnityAction<bool, T> onCompleted = null)
|
||||
{
|
||||
ReSetToken();
|
||||
|
||||
var headers = new Dictionary<string, string> { { "x-token", GetCacheToken() } };
|
||||
IsfvKit.StartCoroutine(PostInternal(url, requestData, onCompleted, headers));
|
||||
}
|
||||
|
||||
public static void PostWithHeader<T>(string url, UnityAction<bool, T> onCompleted)
|
||||
{
|
||||
if (onCompleted != null)
|
||||
{
|
||||
PostWithHeader<T>(url, null, (isSuccess, obj) => { onCompleted.Invoke(isSuccess, obj); });
|
||||
}
|
||||
else
|
||||
{
|
||||
PostWithHeader<T>(url);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PostWithHeader(string url, object requestData = null, UnityAction<bool> onCompleted = null)
|
||||
{
|
||||
if (onCompleted != null)
|
||||
{
|
||||
PostWithHeader<object>(url, requestData, (isSuccess, obj) => { onCompleted?.Invoke(isSuccess); });
|
||||
}
|
||||
else
|
||||
{
|
||||
PostWithHeader<object>(url, requestData);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Get(string url, UnityAction<string> onCompleted)
|
||||
{
|
||||
IsfvKit.StartCoroutine(GetInternal(url, onCompleted));
|
||||
}
|
||||
|
||||
public static IEnumerator GetInternal(string url, UnityAction<string> onCompleted)
|
||||
{
|
||||
var request = UnityWebRequest.Get(url);
|
||||
yield return request.SendWebRequest();
|
||||
if (request.result is not UnityWebRequest.Result.Success)
|
||||
{
|
||||
onCompleted?.Invoke(default);
|
||||
}
|
||||
else
|
||||
{
|
||||
var receiveContent = request.downloadHandler.text;
|
||||
|
||||
var json = Json_StringFormat(receiveContent);
|
||||
|
||||
|
||||
onCompleted?.Invoke(receiveContent);
|
||||
}
|
||||
|
||||
request.Dispose();
|
||||
}
|
||||
public static string Json_StringFormat(string sourceJson)
|
||||
{
|
||||
sourceJson += " ";
|
||||
var index = 0;
|
||||
var newJson = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < sourceJson.Length - 1; i++)
|
||||
{
|
||||
if (sourceJson[i] == '{' || sourceJson[i] == '[')
|
||||
{
|
||||
index++;
|
||||
newJson.Append(sourceJson[i]);
|
||||
newJson.Append("\n");
|
||||
for (var a = 0; a < index; a++)
|
||||
{
|
||||
newJson.Append("\t");
|
||||
}
|
||||
}
|
||||
else if ((sourceJson[i] == '}' || sourceJson[i] == ']'))
|
||||
{
|
||||
index--;
|
||||
newJson.Append("\n");
|
||||
for (var a = 0; a < index; a++)
|
||||
{
|
||||
newJson.Append("\t");
|
||||
}
|
||||
|
||||
newJson.Append(sourceJson[i]);
|
||||
newJson.Append(sourceJson[i + 1] == ',' ? "," : "");
|
||||
newJson.Append("\n");
|
||||
|
||||
if (sourceJson[i + 1] == ',') i++;
|
||||
for (int a = 0; a < index; a++)
|
||||
{
|
||||
newJson.Append("\t");
|
||||
}
|
||||
}
|
||||
else if (sourceJson[i] != '}' && sourceJson[i] != ']' && sourceJson[i + 1] == ',')
|
||||
{
|
||||
newJson.Append(sourceJson[i]);
|
||||
newJson.Append(sourceJson[i + 1]);
|
||||
newJson.Append("\n");
|
||||
i++;
|
||||
for (var a = 0; a < index; a++)
|
||||
{
|
||||
newJson.Append("\t");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newJson.Append(sourceJson[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return newJson.ToString();
|
||||
}
|
||||
public static void BuriedPoint(string eventname, string eventproperty, int integer)
|
||||
{
|
||||
|
||||
if (eventname == BuriedPointEvent.Apple_AD_event || eventname == BuriedPointEvent.Apple_pay_event)
|
||||
{
|
||||
eventname = GameHelper.IsAdModelOfPay() ? BuriedPointEvent.Apple_AD_event : BuriedPointEvent.Apple_pay_event;
|
||||
}
|
||||
|
||||
buriedPointObject.@event = eventname;
|
||||
buriedPointObject.property = eventproperty;
|
||||
buriedPointObject.n = integer;
|
||||
PostWithHeader<BuriedPointObject>("/event/incrN", buriedPointObject, (isSuccess, obj) =>
|
||||
{
|
||||
// Debug.Log(isSuccess);
|
||||
// Debug.Log(eventproperty);
|
||||
//Debug.Log(JsonUtility.ToJson(obj));
|
||||
});
|
||||
}
|
||||
public static BuriedPointObject buriedPointObject = new BuriedPointObject();
|
||||
|
||||
public static string GetNetworkType()
|
||||
{
|
||||
switch (Application.internetReachability)
|
||||
{
|
||||
case NetworkReachability.ReachableViaCarrierDataNetwork:
|
||||
return NetworkType.mobile;
|
||||
case NetworkReachability.ReachableViaLocalAreaNetwork:
|
||||
return NetworkType.wifi;
|
||||
case NetworkReachability.NotReachable:
|
||||
return NetworkType.notConnected;
|
||||
default:
|
||||
return NetworkType.notConnected;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool isReqToken = false;
|
||||
public static void ReSetToken()
|
||||
{
|
||||
if (isReqToken) return;
|
||||
|
||||
var nowTimes = GameHelper.GetNowTime();
|
||||
var passtime = GameHelper.GetLoginModel().expires_at;
|
||||
// Debug.Log($"ReSetToken nowTimes:{nowTimes} passtime:{passtime}");
|
||||
if (passtime == 0 || passtime - nowTimes > 3600) return;
|
||||
|
||||
isReqToken = true;
|
||||
|
||||
var headers = new Dictionary<string, string> { { "x-token", GetCacheToken() } };
|
||||
|
||||
IsfvKit.StartCoroutine(PostInternal<ResquestTokenData>("tokenRefresh", null, (isSuccess, tokenData) =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
LoginModel loginModel = GameHelper.GetLoginModel();
|
||||
loginModel.token = tokenData.token;
|
||||
loginModel.expires_at = tokenData.expires_at;
|
||||
|
||||
SetCacheToken(tokenData.token);
|
||||
}
|
||||
isReqToken = false;
|
||||
|
||||
}, headers));
|
||||
}
|
||||
|
||||
|
||||
private static bool isReqToken1 = false;
|
||||
|
||||
public static void ReLoginGetToken()
|
||||
{
|
||||
if (isReqToken1) return;
|
||||
|
||||
var requestLoginData = new RequestLoginData
|
||||
{
|
||||
device_id = SystemInfo.deviceUniqueIdentifier,
|
||||
pack_name = NetworkMsg.Identifier,
|
||||
app_version = Application.version,
|
||||
channel = BingoBea.Instance.attribution,
|
||||
sim = WebviewManager.haveSimCard
|
||||
|
||||
};
|
||||
isReqToken1 = true;
|
||||
|
||||
|
||||
Post<LoginModel>("login", requestLoginData, (isSuccess, loginData) =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
LoginModel loginModel = GameHelper.GetLoginModel();
|
||||
loginModel.token = loginData.token;
|
||||
loginModel.expires_at = loginData.expires_at;
|
||||
|
||||
SetCacheToken(loginData.token);
|
||||
}
|
||||
|
||||
isReqToken1 = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
public class Base64Kit_sdk
|
||||
{
|
||||
public static string Base64Encode(string source)
|
||||
{
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(source);
|
||||
string encode = Convert.ToBase64String(bytes);
|
||||
return encode;
|
||||
}
|
||||
public static string Encode(string data, bool is_apple_pay = false)
|
||||
{
|
||||
var key = BingoBrain.Network.DomainRelease;
|
||||
//if (is_apple_pay) key = "com.leisuregames.crazygourmet";
|
||||
|
||||
var keyMD5 = MD5Kit.MD5String1(key);
|
||||
//UnityEngine.Debug.Log("Base64 Encode Key: " + keyMD5);
|
||||
var str = Base64EncodeUtil.Base64Encode(data + keyMD5);
|
||||
|
||||
var bytes = Encoding.UTF8.GetBytes(str);
|
||||
for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
(bytes[i], bytes[j]) = (bytes[j], bytes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var loginData = Encoding.UTF8.GetString(bytes);
|
||||
return loginData;
|
||||
}
|
||||
|
||||
public static string Decode(string data)
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(data);
|
||||
for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
(bytes[i], bytes[j]) = (bytes[j], bytes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var str = Encoding.UTF8.GetString(bytes);
|
||||
var str1 = Base64EncodeUtil.Base64Decode(str);
|
||||
var key = BingoBrain.Network.DomainRelease;
|
||||
var keyMD5 = MD5Kit.MD5String1(key);
|
||||
// Debug.Log("Base64 Decode Key: " + keyMD5);
|
||||
// Debug.Log("Base64 Decode str1: " + str1);
|
||||
var result = str1.Replace(keyMD5, string.Empty);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string Decode(string data, string key)
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(data);
|
||||
for (int i = 0, j = bytes.Length - 1; i < j; i += 1, j -= 1)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
(bytes[i], bytes[j]) = (bytes[j], bytes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var str = Encoding.UTF8.GetString(bytes);
|
||||
var str1 = Base64EncodeUtil.Base64Decode(str);
|
||||
// var key = NetworkManager.DomainRelease;
|
||||
var keyMD5 = MD5Kit.MD5String1(key);
|
||||
var result = str1.Replace(keyMD5, string.Empty);
|
||||
return result;
|
||||
}
|
||||
private static byte[] GenerateKey(string secret)
|
||||
{
|
||||
using var sha256 = SHA256.Create();
|
||||
return sha256.ComputeHash(Encoding.UTF8.GetBytes(secret));
|
||||
}
|
||||
|
||||
internal static byte[] Encrypt(byte[] plainText, string secret)
|
||||
{
|
||||
if (plainText == null || plainText.Length == 0) return plainText;
|
||||
var key = GenerateKey(secret);
|
||||
using var aes = Aes.Create();
|
||||
aes.Key = key;
|
||||
aes.Mode = CipherMode.CBC;
|
||||
aes.Padding = PaddingMode.None;
|
||||
aes.GenerateIV();
|
||||
var iv = aes.IV;
|
||||
var blockSize = aes.BlockSize / 8;
|
||||
var padding = blockSize - plainText.Length % blockSize;
|
||||
var padded = new byte[plainText.Length + padding];
|
||||
Buffer.BlockCopy(plainText, 0, padded, 0, plainText.Length);
|
||||
for (var i = plainText.Length; i < padded.Length; i++) padded[i] = (byte)padding;
|
||||
using var encryptor = aes.CreateEncryptor();
|
||||
var encrypted = encryptor.TransformFinalBlock(padded, 0, padded.Length);
|
||||
var result = new byte[iv.Length + encrypted.Length];
|
||||
Buffer.BlockCopy(iv, 0, result, 0, iv.Length);
|
||||
Buffer.BlockCopy(encrypted, 0, result, iv.Length, encrypted.Length);
|
||||
return ToUrlSafeBase64(result);
|
||||
}
|
||||
|
||||
internal static byte[] Decrypt(byte[] encryptedBase64, string secret)
|
||||
{
|
||||
if (encryptedBase64 == null || encryptedBase64.Length == 0) return encryptedBase64;
|
||||
var key = GenerateKey(secret);
|
||||
var fullCipher = FromUrlSafeBase64(encryptedBase64);
|
||||
if (fullCipher.Length < 16) throw new Exception("Invalid cipher data");
|
||||
var iv = fullCipher.Take(16).ToArray();
|
||||
var cipherText = fullCipher.Skip(16).ToArray();
|
||||
using var aes = Aes.Create();
|
||||
aes.Key = key;
|
||||
aes.IV = iv;
|
||||
aes.Mode = CipherMode.CBC;
|
||||
aes.Padding = PaddingMode.None;
|
||||
using var decryptor = aes.CreateDecryptor();
|
||||
var decrypted = decryptor.TransformFinalBlock(cipherText, 0, cipherText.Length);
|
||||
int pad = decrypted[^1];
|
||||
if (pad <= 0 || pad > decrypted.Length) throw new Exception("Invalid padding");
|
||||
var result = decrypted.Take(decrypted.Length - pad).ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
// 用双引号包裹字节数组
|
||||
private static byte[] QuoteBytes(byte[] input)
|
||||
{
|
||||
var result = new byte[input.Length + 2];
|
||||
result[0] = (byte)'"';
|
||||
Buffer.BlockCopy(input, 0, result, 1, input.Length);
|
||||
result[result.Length - 1] = (byte)'"';
|
||||
return result;
|
||||
}
|
||||
|
||||
// 去除双引号(如果存在)
|
||||
internal static byte[] UnquoteBytes(byte[] input)
|
||||
{
|
||||
if (input.Length >= 2 && input[0] == (byte)'"' && input[input.Length - 1] == (byte)'"')
|
||||
{
|
||||
var result = new byte[input.Length - 2];
|
||||
Buffer.BlockCopy(input, 1, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
private static byte[] ToUrlSafeBase64(byte[] data)
|
||||
{
|
||||
var base64 = Convert.ToBase64String(data);
|
||||
var urlSafe = base64.Replace('+', '-').Replace('/', '_');
|
||||
return Encoding.UTF8.GetBytes(urlSafe);
|
||||
}
|
||||
|
||||
private static byte[] FromUrlSafeBase64(byte[] urlSafe)
|
||||
{
|
||||
var base64 = Encoding.UTF8.GetString(urlSafe).Replace('-', '+').Replace('_', '/');
|
||||
return Convert.FromBase64String(base64);
|
||||
}
|
||||
}
|
||||
|
||||
public class ResquestTokenData_sdk
|
||||
{
|
||||
public string token;
|
||||
public long expires_at;
|
||||
}
|
||||
public class NetworkType_sdk
|
||||
{
|
||||
public static string mobile = "Mobile Data";
|
||||
public static string wifi = "Wi-Fi";
|
||||
public static string notConnected = "Not Connected";
|
||||
}
|
||||
public static class Base64EncodeUtil_sdk
|
||||
{
|
||||
public static string Base64Encode(string source)
|
||||
{
|
||||
return Base64Encode(Encoding.UTF8, source);
|
||||
}
|
||||
|
||||
public static string Base64Decode(string result)
|
||||
{
|
||||
return Base64Decode(Encoding.UTF8, result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static string Base64Encode(Encoding encoding, string source)
|
||||
{
|
||||
byte[] bytes = encoding.GetBytes(source);
|
||||
string encode = Convert.ToBase64String(bytes);
|
||||
return encode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static string Base64Decode(Encoding encoding, string result)
|
||||
{
|
||||
byte[] bytes = Convert.FromBase64String(result);
|
||||
string decode = encoding.GetString(bytes);
|
||||
return decode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static string Base64EncodeString(byte[] source)
|
||||
{
|
||||
return Convert.ToBase64String(source);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static byte[] Base64DecodeBytes(string result)
|
||||
{
|
||||
return Convert.FromBase64String(result);
|
||||
}
|
||||
}
|
||||
public class ResponseData_sdk
|
||||
{
|
||||
public int code;
|
||||
public string msg;
|
||||
public object data;
|
||||
}
|
||||
public class BuriedPointObject_sdk
|
||||
{
|
||||
public string @event;
|
||||
public string property;
|
||||
public int n;
|
||||
}
|
||||
public class BuriedPointEvent_sdk
|
||||
{
|
||||
public static string play_event = "Number_of_people_play";
|
||||
public static string play_property = "Number_of_people_playing";
|
||||
|
||||
public static string playing_event = "Playing_time";
|
||||
public static string playing_property = "Room_type";
|
||||
|
||||
public static string ad_task = "ad_task";
|
||||
public static string watch_ad_number = "watch_ad_number";
|
||||
public static string finish_ad_number = "finish_ad_number";
|
||||
|
||||
public static string h5_event = "H5_task";
|
||||
public static string h5_event_time = "H5_time";
|
||||
public static string h5_event_numbers = "finish_H5_number";
|
||||
|
||||
public static string withdraw_behavior = "withdraw_behavior";
|
||||
public static string withdraw_message = "withdraw_message";
|
||||
public static string withdraw_cash1 = "withdraw_cash1";
|
||||
public static string withdraw_cash2 = "withdraw_cash2";
|
||||
public static string withdraw_cash3 = "withdraw_cash3";
|
||||
|
||||
public static string Hall_behavior = "Hall_behavior";
|
||||
public static string open_hall_number = "open_hall_number";
|
||||
//public static string open_hall_people = "open_hall_people";
|
||||
public static string collect_fly_number = "collect_fly_number";
|
||||
//public static string collect_fly_people = "collect_fly_people";
|
||||
public static string fly_ct_number = "fly_ct_number";
|
||||
//public static string fly_ct_people = "fly_ct_people";
|
||||
public static string annular_finish_number = "annular_finish_number";
|
||||
public static string annular_get_number = "annular_get_number";
|
||||
public static string annular_ct_number = "annular_ct_number";
|
||||
//public static string annular_ct_people = "annular_ct_people";
|
||||
|
||||
public static string video_behavior = "video_behavior";
|
||||
public static string watch_ad_people = "watch_ad_people";
|
||||
public static string watch_success_ad_people = "watch_success_ad_people";
|
||||
|
||||
public static string video_type = "video_type";
|
||||
public static string Rewarded_videos_trigger_number = "Rewarded_videos_trigger_number";
|
||||
public static string Rewarded_videos_fill_number = "Rewarded_videos_fill_number";
|
||||
public static string Rewarded_videos_dinish_number = "Rewarded_videos_dinish_number";
|
||||
public static string Interstitial_videos_trigger_number = "Interstitial_videos_trigger_number";
|
||||
public static string Interstitial_videos_fill_number = "Interstitial_videos_fill_number";
|
||||
public static string Interstitial_videos_dinish_number = "Interstitial_videos_dinish_number";
|
||||
public static string Apple_pay_event = "Pay_Event";
|
||||
public static string Apple_AD_event = "AD_Event";
|
||||
|
||||
|
||||
public static string pack_show = "pack_show";
|
||||
public static string pack_click = "pack_click";
|
||||
public static string pack_open = "pack_open";
|
||||
public static string pack_success = "pack_success";
|
||||
|
||||
public static string remove_ad_show = "remove_ad_show";
|
||||
public static string remove_ad_click = "remove_ad_click";
|
||||
public static string remove_ad_open = "remove_ad_open";
|
||||
public static string remove_ad_success = "remove_ad_success";
|
||||
|
||||
|
||||
public static string pass_show = "master_pass_show";
|
||||
public static string pass_click = "master_pass_click";
|
||||
public static string pass_open = "pass_open";
|
||||
public static string pass_success = "master_pass_receive";
|
||||
|
||||
public static string buy_one_show = "buy_one_show";
|
||||
public static string buy_one_click = "buy_one_click";
|
||||
public static string buy_one_open = "buy_one_open";
|
||||
public static string buy_one_success = "buy_one_success";
|
||||
|
||||
public static string gold_show = "shop_show";
|
||||
public static string gold_click_1 = "shop_click";
|
||||
|
||||
public static string gold_click_ad = "gold_click_ad";
|
||||
|
||||
// public static string gold_click_2 = "gold_click_2";
|
||||
// public static string gold_click_3 = "gold_click_3";
|
||||
// public static string gold_click_4 = "gold_click_4";
|
||||
// public static string gold_open_1 = "gold_open_1";
|
||||
// public static string gold_open_2 = "gold_open_2";
|
||||
// public static string gold_open_3 = "gold_open_3";
|
||||
// public static string gold_open_4 = "gold_open_4";
|
||||
public static string gold_success_1 = "shop_receive";
|
||||
// public static string gold_success_2 = "gold_success_2";
|
||||
// public static string gold_success_3 = "gold_success_3";
|
||||
// public static string gold_success_4 = "gold_success_4";
|
||||
public static string afterRewardAdShow = "afterRewardAdShow";
|
||||
public static string afterRewardAdEnd = "afterRewardAdEnd";
|
||||
public static string fail_show = "fail_show";
|
||||
public static string fail_click = "fail_click";
|
||||
public static string fail_buy_success = "fail_buy_success";
|
||||
public static string three_days_gift_show = "three_days_gift_show";
|
||||
public static string three_days_gift_click = "three_days_gift_click";
|
||||
public static string three_days_gift_buy_success = "three_days_gift_buy_success";
|
||||
public static string three_days_gift_open = "three_days_gift_open";
|
||||
public static string three_day1_success = "three_day1_success";
|
||||
public static string three_day2_success = "three_day2_success";
|
||||
public static string three_day3_success = "three_day3_success";
|
||||
public static string Three_days_gift_event = "Three_days_gift_event";
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14b39d653503e7f42b9992c6815b62a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,804 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using BingoBrain;
|
||||
using DG.Tweening;
|
||||
using BingoBrain;
|
||||
using BingoBrain.Core;
|
||||
using BingoBrain.HotFix;
|
||||
|
||||
|
||||
|
||||
public class SdkManager : MonoBehaviour
|
||||
{
|
||||
|
||||
private SdkManager()
|
||||
{
|
||||
}
|
||||
private static readonly SdkManager _instance = new SdkManager();
|
||||
|
||||
public static SdkManager Instance
|
||||
{
|
||||
get { return _instance; }
|
||||
}
|
||||
|
||||
public void OpenWebView(string url)
|
||||
{
|
||||
//Debug.Log("[WebviewManager] OpenWebView");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.OpenWebview(url);
|
||||
#endif
|
||||
}
|
||||
public void showDarkWebview()
|
||||
{
|
||||
//Debug.Log("[WebviewManager] OpenWebView");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.showDarkWebview();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void CloseWebview()
|
||||
{
|
||||
//Debug.Log("[WebviewManager] CloseWebview");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.CloseWebview();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void SetOffset(int offset_y, int offset_y1)
|
||||
{
|
||||
// Debug.Log($"barry [WebviewManager] SetOffset:{offset_y}, {offset_y1}");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetOffset(offset_y, offset_y1);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void SetPadding(float left, float top, float right, float bottom)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetPadding");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetPadding(left, top, right, bottom);
|
||||
#endif
|
||||
}
|
||||
public void SetDarkThough(bool though)
|
||||
{
|
||||
if (!GameHelper.IsGiftSwitch()) return;
|
||||
// if (though)
|
||||
// {
|
||||
// if (UI.Instance.IsExistUI(UIConst.LevelSuccessUI) || UI.Instance.IsExistUI(UIConst.MakeupConfirmUI) ||
|
||||
// UI.Instance.IsExistUI(UIConst.NewTaskUI) || UI.Instance.IsExistUI(UIConst.PackrewardUI) || UI.Instance.IsExistUI(UIConst.SaveingPotUI)
|
||||
// )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// }
|
||||
// Debug.Log("[WebviewManager] SetPadding");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetDarkThough(though);
|
||||
#endif
|
||||
}
|
||||
public void SetBtn(int left, int top, int right, int bottom)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetBtn");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetBtn(left, top, right, bottom);
|
||||
#endif
|
||||
}
|
||||
public void SetCTEnable(bool flag)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetCTEnable");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetCTEnable(flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void SetFullScreen()
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetFullScreen");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetFullScreen();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void addH5Field(int field1, int field2, int field3, int field4, int field5, string field6, string field7, string dark_url, string light_url, bool is_gift, string web_through_str, string click_add_time)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.addH5Field(field1,field2,field3,field4,field5,field6,field7,dark_url,light_url,is_gift,web_through_str,click_add_time);
|
||||
#endif
|
||||
}
|
||||
public void ShowH5View(bool flag)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetCTEnable");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.ShowH5View(flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void SetIconProgress(float val)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetCTEnable");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetIconProgress(val);
|
||||
#endif
|
||||
}
|
||||
public void setInH5View(bool flag)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetCTEnable");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.setInH5View(flag);
|
||||
#endif
|
||||
}
|
||||
public void upDataH5times(string weblink, int times, bool is_dark)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.upDataH5times( weblink, times,is_dark);
|
||||
#endif
|
||||
}
|
||||
public void ShowFlyBtn(bool flag)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetCTEnable");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.ShowFlyBtn(flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void setFlyBtnTag(bool flag)
|
||||
{
|
||||
// Debug.Log($"[WebviewManager] setFlyBtnTag ---{flag}");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.setFlyBtnTag(flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void setRewardBtnTag(bool flag)
|
||||
{
|
||||
// Debug.Log($"[WebviewManager] setRewardBtnTag--- {flag}");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.setRewardBtnTag(flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ObjC_TouchClick(string name)
|
||||
{
|
||||
// Debug.Log("Touch click: " + name);
|
||||
GameDispatcher.Instance.Dispatch(BingoInfo.H5ViewClickBtn, name);
|
||||
}
|
||||
public void H5AutoRefresh(string times)
|
||||
{
|
||||
if (times == "") return;
|
||||
DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
newDate = newDate.AddSeconds(GameHelper.GetNowTime(true));
|
||||
var newDays = newDate.Day;
|
||||
|
||||
|
||||
if (times == "Dailyrefreshtimes")
|
||||
{
|
||||
var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
|
||||
|
||||
if (last_time == newDays)
|
||||
{
|
||||
var numbers = PlayerPrefs.GetInt("Dailyrefreshnum", 0);
|
||||
numbers++;
|
||||
PlayerPrefs.SetInt("Dailyrefreshnum", numbers);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
PlayerPrefs.SetInt("Dailyrefreshnum", 1);
|
||||
PlayerPrefs.SetInt("Dayreftimes", newDays);
|
||||
string darkWVRefreshtime_str = "";
|
||||
string darkWVDailyrefreshtimes_str = "";
|
||||
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime.Length; i++)
|
||||
// {
|
||||
// if (i != 0) darkWVRefreshtime_str += "|";
|
||||
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime[i].ToString();
|
||||
// }
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2.Length; i++)
|
||||
// {
|
||||
// darkWVRefreshtime_str += "|";
|
||||
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2[i].ToString();
|
||||
// }
|
||||
|
||||
int dark_type = -1;
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (dark_type != ConfigSystem.dark_weblist[i].wvType)
|
||||
{
|
||||
if (i != 0) darkWVRefreshtime_str += "|";
|
||||
darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[0];
|
||||
darkWVRefreshtime_str += "|";
|
||||
darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[1];
|
||||
dark_type = ConfigSystem.dark_weblist[i].wvType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes.Length; i++)
|
||||
// {
|
||||
// if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
// darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[i].ToString();
|
||||
// }
|
||||
|
||||
dark_type = -1;
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (dark_type != ConfigSystem.dark_weblist[i].wvType)
|
||||
{
|
||||
if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes;
|
||||
dark_type = ConfigSystem.dark_weblist[i].wvType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
|
||||
ConfigSystem.GetConfig<CommonModel>().H5Refreshtime, ConfigSystem.GetConfig<CommonModel>().Dailyrefreshtimes, ConfigSystem.GetConfig<CommonModel>().darkThoughProbability, darkWVRefreshtime_str,
|
||||
darkWVDailyrefreshtimes_str, "", "", GameHelper.IsGiftSwitch(), "", "");
|
||||
}
|
||||
}
|
||||
else if (times.Contains("dark_Dailyrefreshtimes"))
|
||||
{
|
||||
var last_time = PlayerPrefs.GetInt("dark_refreshDay", 0);
|
||||
if (last_time == newDays)
|
||||
{
|
||||
// var numbers = PlayerPrefs.GetInt("dark_Dayref", 0);
|
||||
// numbers++;
|
||||
// PlayerPrefs.SetInt("dark_Dayref", numbers);
|
||||
string[] temp_arr = times.Split("|");
|
||||
if (temp_arr.Length >= 2)
|
||||
{
|
||||
SaveData.GetSaveobject().dark_Dayref[Int32.Parse(temp_arr[1])]++;
|
||||
SaveData.saveDataFunc();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// PlayerPrefs.SetInt("dark_Dayref", 1);
|
||||
string[] temp_arr = times.Split("|");
|
||||
if (temp_arr.Length >= 2)
|
||||
{
|
||||
SaveData.GetSaveobject().dark_Dayref[Int32.Parse(temp_arr[1])] = 1;
|
||||
SaveData.saveDataFunc();
|
||||
}
|
||||
PlayerPrefs.SetInt("dark_refreshDay", newDays);
|
||||
string darkWVRefreshtime_str = "";
|
||||
string darkWVDailyrefreshtimes_str = "";
|
||||
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime.Length; i++)
|
||||
// {
|
||||
// if (i != 0) darkWVRefreshtime_str += "|";
|
||||
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime[i].ToString();
|
||||
// }
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2.Length; i++)
|
||||
// {
|
||||
// darkWVRefreshtime_str += "|";
|
||||
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2[i].ToString();
|
||||
// }
|
||||
int dark_type = -1;
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (dark_type != ConfigSystem.dark_weblist[i].wvType)
|
||||
{
|
||||
if (i != 0) darkWVRefreshtime_str += "|";
|
||||
darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[0];
|
||||
darkWVRefreshtime_str += "|";
|
||||
darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[1];
|
||||
dark_type = ConfigSystem.dark_weblist[i].wvType;
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes.Length; i++)
|
||||
// {
|
||||
// if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
// darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[i].ToString();
|
||||
// }
|
||||
|
||||
dark_type = -1;
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (dark_type != ConfigSystem.dark_weblist[i].wvType)
|
||||
{
|
||||
if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes;
|
||||
dark_type = ConfigSystem.dark_weblist[i].wvType;
|
||||
}
|
||||
}
|
||||
addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
|
||||
ConfigSystem.GetConfig<CommonModel>().H5Refreshtime, ConfigSystem.GetConfig<CommonModel>().Dailyrefreshtimes, ConfigSystem.GetConfig<CommonModel>().darkThoughProbability, darkWVRefreshtime_str,
|
||||
darkWVDailyrefreshtimes_str, "", "", GameHelper.IsGiftSwitch(), "", "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
string[] temp_array = times.Split("|");
|
||||
if (temp_array.Length >= 2 && temp_array[0] != null && temp_array[0] != "")
|
||||
{
|
||||
if (temp_array[1] == "h5")
|
||||
{
|
||||
|
||||
H5sendClass info = new H5sendClass() { link = temp_array[0], type = "h5" };
|
||||
NetworkKit.PostWithHeader<H5refreshTimes>("event/h5Impressions", info, (isSuccess, obj) =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
|
||||
int numbers = 0;
|
||||
for (int i = 0; i < ConfigSystem.light_weblist.Count; i++)
|
||||
{
|
||||
if (ConfigSystem.light_weblist[i].webLink == temp_array[0])
|
||||
{
|
||||
// Debug.Log("uuuuuuuuuuuuuuuuu明穿透" + temp_array[0] + "已经刷新了" + obj.times + "次" + "上限是" + ConfigSystem.light_weblist[i].refreshMax + "次");
|
||||
numbers = ConfigSystem.light_weblist[i].refreshMax - obj.times;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (numbers < 0) numbers = 0;
|
||||
upDataH5times(temp_array[0], numbers, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
H5sendClass info = new H5sendClass() { link = temp_array[0], type = "h6" };
|
||||
NetworkKit.PostWithHeader<H5refreshTimes>("event/h5Impressions", info, (isSuccess, obj) =>
|
||||
{
|
||||
if (isSuccess)
|
||||
{
|
||||
int numbers = 0;
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (ConfigSystem.dark_weblist[i].webLink == temp_array[0])
|
||||
{
|
||||
// Debug.Log("uuuuuuuuuuuuuuuuu暗穿透" + temp_array[0] + "已经刷新了" + obj.times + "次" + "上限是" + ConfigSystem.dark_weblist[i].refreshMax + "次");
|
||||
numbers = ConfigSystem.dark_weblist[i].refreshMax - obj.times;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (numbers < 0) numbers = 0;
|
||||
upDataH5times(temp_array[0], numbers, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private GList select_glist;
|
||||
private float select_glist_y;
|
||||
public void TouchClickPoint(string name)
|
||||
{
|
||||
// Debug.Log("TouchClickPoint" + name);
|
||||
if (name == null) return;
|
||||
if (name == "flyBtn")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.fly_ct_number, 1);
|
||||
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.fly_ct_people,1);
|
||||
|
||||
}
|
||||
|
||||
if (name == "rewardBtn")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_ct_number, 1);
|
||||
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.annular_ct_people,1);
|
||||
}
|
||||
|
||||
if (name == "finish")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_finish_number, 1);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
||||
// string[] a = name.Split("|");
|
||||
// if (a.Length < 2) return;
|
||||
// if (!float.TryParse(a[0], out float x) || !float.TryParse(a[1], out float y))
|
||||
// {
|
||||
// Debug.LogError("Invalid format for coordinates: " + name);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Vector2 fguiScreenPos = new(x * GRoot.inst.width, y * GRoot.inst.height);
|
||||
|
||||
// // Debug.Log("mmmmmmmmmmmmmmmmmm" + a[0]);
|
||||
// // Debug.Log("mmmmmmmmmmmmmmmmmm" + a[1]);
|
||||
// // if (AppConst.DeviceLangue == "pt")
|
||||
// // {
|
||||
// // fguiScreenPos = new Vector2((float.Parse(a[0]) * GRoot.inst.width) / 1000000.0f,
|
||||
// // float.Parse(a[1]) * GRoot.inst.height / 1000000.0f);
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
|
||||
// //}
|
||||
// GButton objUnderPoint = null;
|
||||
|
||||
// var child_array = GRoot.inst.GetChildren().Reverse();
|
||||
// bool click_card = true;
|
||||
// foreach (GComponent child in child_array) //normal
|
||||
// {
|
||||
// if (child.GetChildren().Length > 0)
|
||||
// {
|
||||
// var com_array = child.GetChildren().Reverse();
|
||||
// foreach (GComponent com_child in com_array) //com_层面
|
||||
// {
|
||||
// if (child.name == "Popup" || child.name == "Highest")
|
||||
// {
|
||||
// click_card = false;/* */
|
||||
// }
|
||||
// var btn_array = com_child.GetChildren();
|
||||
// for (int i = btn_array.Length - 1; i >= 0; i--) //btn_层面
|
||||
// {
|
||||
// // if (btn_array[i] .name=="btn_collect")
|
||||
// // {
|
||||
// // Debug.Log(btn_array[i].x);
|
||||
// // Debug.Log(btn_array[i].y);
|
||||
// // Debug.Log(fguiScreenPos.x);
|
||||
// // Debug.Log(fguiScreenPos.y);
|
||||
// // Debug.Log(btn_array[i].position.x <= fguiScreenPos.x &&
|
||||
// // fguiScreenPos.x <= btn_array[i].position.x + btn_array[i].width);
|
||||
// // Debug.Log( btn_array[i].position.y <= fguiScreenPos.y &&
|
||||
// // fguiScreenPos.y <= btn_array[i].position.y + btn_array[i].height);
|
||||
// // }
|
||||
|
||||
// if (btn_array[i] is GButton)
|
||||
// {
|
||||
// GButton temp = btn_array[i] as GButton;
|
||||
|
||||
// if (temp.onStage && temp.visible && temp.position.x <= fguiScreenPos.x &&
|
||||
// fguiScreenPos.x <= temp.position.x + temp.width &&
|
||||
// temp.position.y <= fguiScreenPos.y &&
|
||||
// fguiScreenPos.y <= temp.position.y + temp.height)
|
||||
// {
|
||||
// objUnderPoint = btn_array[i] as GButton;
|
||||
// if (objUnderPoint.enabled)
|
||||
// {
|
||||
// objUnderPoint.FireClick(true, true);
|
||||
// }
|
||||
// else objUnderPoint.FireClick(true, false);
|
||||
// goto EndLoop;
|
||||
// }
|
||||
// }
|
||||
|
||||
// else if (btn_array[i] is GTextInput)
|
||||
// {
|
||||
|
||||
// GTextInput temp = btn_array[i] as GTextInput;
|
||||
// if (temp.onStage && temp.visible && temp.position.x <= fguiScreenPos.x &&
|
||||
// fguiScreenPos.x <= temp.position.x + temp.width &&
|
||||
// temp.position.y <= fguiScreenPos.y &&
|
||||
// fguiScreenPos.y <= temp.position.y + temp.height)
|
||||
// {
|
||||
|
||||
// temp.RequestFocus();
|
||||
// goto EndLoop;
|
||||
// }
|
||||
|
||||
// }
|
||||
// else if (btn_array[i] is GList)
|
||||
// {
|
||||
|
||||
// GList temp = btn_array[i] as GList;
|
||||
// if (temp.onStage && temp.visible && temp.position.x <= fguiScreenPos.x &&
|
||||
// fguiScreenPos.x <= temp.position.x + temp.width &&
|
||||
// temp.position.y <= fguiScreenPos.y &&
|
||||
// fguiScreenPos.y <= temp.position.y + temp.height)
|
||||
// {
|
||||
// if (select_glist == null)
|
||||
// {
|
||||
// select_glist_y = fguiScreenPos.y;
|
||||
// select_glist = btn_array[i] as GList;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// select_glist.scrollPane.posY -= (fguiScreenPos.y - select_glist_y);
|
||||
// select_glist_y = fguiScreenPos.y;
|
||||
// }
|
||||
|
||||
// goto EndLoop;
|
||||
// }
|
||||
|
||||
// }
|
||||
// else if (btn_array[i] is GComponent)
|
||||
// {
|
||||
// var child_btn_array = btn_array[i].asCom.GetChildren(); //嵌套的com
|
||||
|
||||
// for (int j = child_btn_array.Length - 1; j >= 0; j--)
|
||||
// {
|
||||
// if (child_btn_array[j] is GButton)
|
||||
// {
|
||||
// Vector2 local_pos = new Vector2(btn_array[i].x + child_btn_array[j].x,
|
||||
// btn_array[i].y + child_btn_array[j].y);
|
||||
// if (child_btn_array[j].visible && child_btn_array[j].onStage && child_btn_array[j].visible && local_pos.x <= fguiScreenPos.x &&
|
||||
// fguiScreenPos.x <= local_pos.x + child_btn_array[j].width &&
|
||||
// local_pos.y <= fguiScreenPos.y && fguiScreenPos.y <=
|
||||
// local_pos.y + child_btn_array[j].height)
|
||||
// {
|
||||
// objUnderPoint = child_btn_array[j] as GButton;
|
||||
// if (objUnderPoint.enabled) objUnderPoint.FireClick(true, true);
|
||||
// else objUnderPoint.FireClick(true, false);
|
||||
// goto EndLoop;
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// if (child.name == "Popup" || child.name == "Highest")
|
||||
// {
|
||||
// goto EndLoop;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// EndLoop: Debug.Log("");
|
||||
// // if (click_card)
|
||||
// // {
|
||||
// // if (orthoCamera == null) orthoCamera = GameObject.Find("GameCamera").GetComponent<Camera>();
|
||||
// // Ray ray = orthoCamera.ScreenPointToRay(new Vector2(float.Parse(a[0]) * Screen.width, (1 - float.Parse(a[1])) * Screen.height));
|
||||
// // RaycastHit hit;
|
||||
// // int layerMask = 1 << 6;
|
||||
|
||||
// // if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
|
||||
// // {
|
||||
// // // GameDispatcher.Instance.Dispatch(GameMsg.card_click, hit.collider.gameObject.name);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// }
|
||||
}
|
||||
public Camera orthoCamera;
|
||||
|
||||
public static Dictionary<string, string> adCallbackInfo = new Dictionary<string, string>();
|
||||
public void SendH5Event(string numbers)
|
||||
{
|
||||
|
||||
// adCallbackInfo.Clear();
|
||||
// adCallbackInfo.Add("h5_revenue",ConfigSystem.GetConfig<CommonModel>().h5_refreshRevenue.ToString());
|
||||
// //Debug.Log("sssssssssssssssssss"+JsonConvert.SerializeObject(adCallbackInfo));
|
||||
// AppsFlyer.sendEvent("Growing_Total_01_002",adCallbackInfo);
|
||||
}
|
||||
|
||||
public void RefreshUrl()
|
||||
{
|
||||
|
||||
// if (gameUrlInfo == null) return;
|
||||
//TODO: show invisible h5
|
||||
var Dailyrefresh_reamain = 0;
|
||||
var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
|
||||
DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
newDate = newDate.AddSeconds(GameHelper.GetNowTime());
|
||||
var newDays = newDate.Day;
|
||||
|
||||
|
||||
|
||||
if (last_time == newDays)
|
||||
{
|
||||
Dailyrefresh_reamain = ConfigSystem.GetConfig<CommonModel>().Dailyrefreshtimes -
|
||||
PlayerPrefs.GetInt("Dailyrefreshnum", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerPrefs.SetInt("Dailyrefreshnum", 0);
|
||||
Dailyrefresh_reamain = ConfigSystem.GetConfig<CommonModel>().Dailyrefreshtimes;
|
||||
PlayerPrefs.SetInt("Dayreftimes", newDays);
|
||||
}
|
||||
|
||||
int dark_last_time = PlayerPrefs.GetInt("dark_refreshDay", 0);
|
||||
|
||||
DateTime dark_newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
dark_newDate = dark_newDate.AddSeconds(GameHelper.GetNowTime());
|
||||
var dark_newDays = dark_newDate.Day;
|
||||
|
||||
|
||||
string darkWVDailyrefreshtimes_str = "";
|
||||
|
||||
|
||||
if (SaveData.GetSaveobject().dark_Dayref == null)
|
||||
{
|
||||
SaveData.GetSaveobject().dark_Dayref = new List<int>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
}
|
||||
|
||||
if (dark_last_time == dark_newDays)
|
||||
{
|
||||
// dark_Dailyrefresh_reamain = ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[Int32.Parse(webview_index) - 1] -
|
||||
// PlayerPrefs.GetInt("dark_Dayref", 0);
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes.Length; i++)
|
||||
// {
|
||||
|
||||
// if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
// darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[i] - SaveData.GetSaveobject().dark_Dayref[i];
|
||||
|
||||
// }
|
||||
int dark_type_ = -1;
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (dark_type_ != ConfigSystem.dark_weblist[i].wvType)
|
||||
{
|
||||
dark_type_ = ConfigSystem.dark_weblist[i].wvType;
|
||||
if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
Debug.Log(dark_type_);
|
||||
darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes - SaveData.GetSaveobject().dark_Dayref[dark_type_ - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// PlayerPrefs.SetInt("dark_Dayref", 0);
|
||||
for (int i = 0; i < SaveData.GetSaveobject().dark_Dayref.Count; i++)
|
||||
{
|
||||
SaveData.GetSaveobject().dark_Dayref[i] = 0;
|
||||
}
|
||||
SaveData.saveDataFunc();
|
||||
// dark_Dailyrefresh_reamain = ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[Int32.Parse(webview_index)];
|
||||
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes.Length; i++)
|
||||
// {
|
||||
|
||||
// if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
// darkWVDailyrefreshtimes_str += ConfigSystem.GetConfig<CommonModel>().darkWVDailyrefreshtimes[i];
|
||||
|
||||
// }
|
||||
int dark_type_ = -1;
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (dark_type_ != ConfigSystem.dark_weblist[i].wvType)
|
||||
{
|
||||
dark_type_ = ConfigSystem.dark_weblist[i].wvType;
|
||||
if (i != 0) darkWVDailyrefreshtimes_str += "|";
|
||||
darkWVDailyrefreshtimes_str += ConfigSystem.dark_weblist[i].darkWVDailyrefreshtimes;
|
||||
}
|
||||
}
|
||||
PlayerPrefs.SetInt("dark_refreshDay", dark_newDays);
|
||||
}
|
||||
|
||||
// var last_login_time = PlayerPrefs.GetInt("last_login_time", 0);//获取上次登录日期
|
||||
// PlayerPrefs.SetInt("last_login_time", newDays);
|
||||
|
||||
string light_str = "";
|
||||
string dark_str = "";
|
||||
|
||||
for (int i = 0; i < ConfigSystem.light_weblist.Count; i++)
|
||||
{
|
||||
int can_refresh_numbners = 0;
|
||||
// if (last_login_time==newDays)
|
||||
// {
|
||||
// can_refresh_numbners=ConfigSystem.light_weblist[i].refreshMax- PlayerPrefs.GetInt(ConfigSystem.light_weblist[i].webLink, 0);
|
||||
// if (can_refresh_numbners < 0) can_refresh_numbners = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
can_refresh_numbners = ConfigSystem.light_weblist[i].refreshMax;
|
||||
//if (can_refresh_numbners < 0) can_refresh_numbners = 9999999;
|
||||
// PlayerPrefs.SetInt(ConfigSystem.light_weblist[i].webLink, 0);
|
||||
// }
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
light_str += "|";
|
||||
}
|
||||
|
||||
light_str += ConfigSystem.light_weblist[i].webLink + "#" + ConfigSystem.light_weblist[i].probability + "#" + can_refresh_numbners + "#" + ConfigSystem.light_weblist[i].darkWebTimesCT; ;
|
||||
}
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
int can_refresh_numbners = 0;
|
||||
// if (last_login_time==newDays)
|
||||
// {
|
||||
// can_refresh_numbners=ConfigSystem.dark_weblist[i].refreshMax- PlayerPrefs.GetInt(ConfigSystem.dark_weblist[i].webLink, 0);
|
||||
// if (can_refresh_numbners < 0) can_refresh_numbners = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
can_refresh_numbners = ConfigSystem.dark_weblist[i].refreshMax;
|
||||
//if (can_refresh_numbners < 0) can_refresh_numbners = 9999999;
|
||||
// PlayerPrefs.SetInt(ConfigSystem.dark_weblist[i].webLink, 0);
|
||||
// }
|
||||
|
||||
if (i != 0)
|
||||
{
|
||||
dark_str += "|";
|
||||
}
|
||||
|
||||
dark_str += ConfigSystem.dark_weblist[i].webLink + "#" + ConfigSystem.dark_weblist[i].probability + "#" + can_refresh_numbners + "#" + ConfigSystem.dark_weblist[i].darkWebTimesCT + "#" + ConfigSystem.dark_weblist[i].wvType + "#" + ConfigSystem.dark_weblist[i].WVOffset;
|
||||
}
|
||||
|
||||
|
||||
string darkWVRefreshtime_str = "";
|
||||
|
||||
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime.Length; i++)
|
||||
// {
|
||||
// if (i != 0) darkWVRefreshtime_str += "|";
|
||||
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime[i].ToString();
|
||||
// }
|
||||
// for (int i = 0; i < ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2.Length; i++)
|
||||
// {
|
||||
// darkWVRefreshtime_str += "|";
|
||||
// darkWVRefreshtime_str += ConfigSystem.GetConfig<CommonModel>().darkWVRefreshtime2[i].ToString();
|
||||
// }
|
||||
int dark_type = -1;
|
||||
string add_time = "";
|
||||
for (int i = 0; i < ConfigSystem.dark_weblist.Count; i++)
|
||||
{
|
||||
if (dark_type != ConfigSystem.dark_weblist[i].wvType)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
darkWVRefreshtime_str += "|";
|
||||
add_time += "|";
|
||||
}
|
||||
darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[0];
|
||||
darkWVRefreshtime_str += "|";
|
||||
darkWVRefreshtime_str += ConfigSystem.dark_weblist[i].darkWVRefreshtime[1];
|
||||
dark_type = ConfigSystem.dark_weblist[i].wvType;
|
||||
add_time += ConfigSystem.dark_weblist[i].WVClickAddTime;
|
||||
}
|
||||
}
|
||||
Debug.Log("--------------------------------");
|
||||
|
||||
// add_time+= ConfigSystem.GetConfig<CommonModel>().WVClickAddTime[0] + "|" + ConfigSystem.GetConfig<CommonModel>().WVClickAddTime[1];
|
||||
|
||||
Debug.Log(add_time);
|
||||
Debug.Log(darkWVRefreshtime_str);
|
||||
Debug.Log(darkWVDailyrefreshtimes_str);
|
||||
Debug.Log(dark_str);
|
||||
Debug.Log(ConfigSystem.web_through_str);
|
||||
addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
|
||||
ConfigSystem.GetConfig<CommonModel>().H5Refreshtime, Dailyrefresh_reamain, ConfigSystem.GetConfig<CommonModel>().darkThoughProbability
|
||||
, darkWVRefreshtime_str, darkWVDailyrefreshtimes_str, dark_str, light_str, GameHelper.IsGiftSwitch(), ConfigSystem.web_through_str, add_time);
|
||||
// WebviewManager.Instance.OpenWebView(gameUrlInfo.webLink);
|
||||
|
||||
//WebviewManager.Instance.setFlyCtRate(ConfigSystem.GetConfig<CommonModel>().flyCtRate);
|
||||
// RefreshDataCT(isTop, gameUrlInfo);
|
||||
}
|
||||
|
||||
public void ClickAdEvent(string ad_msg)
|
||||
{
|
||||
string[] temp_array = ad_msg.Split("|");
|
||||
if (temp_array.Length >= 2 && temp_array[0] != null && temp_array[0] != "")
|
||||
{
|
||||
H5sendClass info = new H5sendClass() { link = temp_array[0], type = temp_array[1] };
|
||||
NetworkKit.PostWithHeader<object>("/event/h5Clicks", info, (isSuccess, obj) =>
|
||||
{
|
||||
// if (isSuccess)
|
||||
// {
|
||||
// Debug.Log("dadianchenggong" + temp_array[0]);
|
||||
// }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public static bool haveSimCard = false;
|
||||
public void diaoyongtest(string have)
|
||||
{
|
||||
if (have == "TRUE") haveSimCard = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class H5refreshTimes
|
||||
{
|
||||
public string link;
|
||||
public int times;
|
||||
|
||||
}
|
||||
public class H5sendClass
|
||||
{
|
||||
public string link;
|
||||
public string type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e4a4fc2ee037174b95c916ef5475ee2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user