提交
This commit is contained in:
+281
-507
@@ -13,596 +13,370 @@ using BingoBrain.Core;
|
||||
using BingoBrain.HotFix;
|
||||
using Unity.VisualScripting.FullSerializer;
|
||||
using Unity.VisualScripting;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
|
||||
public class SdkManager : MonoBehaviour
|
||||
namespace DontConfuse
|
||||
{
|
||||
|
||||
private SdkManager()
|
||||
public class SdkManager : MonoBehaviour
|
||||
{
|
||||
}
|
||||
private static readonly SdkManager _instance = new SdkManager();
|
||||
private static SdkManager _instance;
|
||||
|
||||
public static SdkManager Instance
|
||||
{
|
||||
get { return _instance; }
|
||||
}
|
||||
|
||||
public void OpenWebView(string url)
|
||||
{
|
||||
//Debug.Log("[WebviewManager] OpenWebView");
|
||||
// 供外部调用的公共属性
|
||||
public static SdkManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
// 如果实例为空,尝试在场景中寻找已经挂载的脚本
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = FindFirstObjectByType<SdkManager>();
|
||||
if (_instance == null)
|
||||
{
|
||||
Debug.LogError("场景中没有找到挂载 SdkManager 的物体!请确保场景中有一个 GameObject 挂载了该脚本。");
|
||||
}
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
private void Awake()
|
||||
{
|
||||
// 当场景加载时,如果 _instance 还没赋值,就由挂载在物体上的自己来赋值
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = this;
|
||||
DontDestroyOnLoad(gameObject); // 可选:如果跨场景不想被销毁,加上这行
|
||||
}
|
||||
else if (_instance != this)
|
||||
{
|
||||
// 防止场景里不小心挂载了多个 SdkManager, secondary 实例直接销毁,保证单例唯一
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
public void OpenWv()
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetPadding");
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.OpenWebview(url);
|
||||
BrigdeIOS.OpenWv();
|
||||
#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");
|
||||
}
|
||||
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");
|
||||
}
|
||||
public void SetDarkThough(bool though)
|
||||
{
|
||||
if (!GameHelper.IsGiftSwitch()) return;
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
BrigdeIOS.SetDarkThough(though);
|
||||
#endif
|
||||
}
|
||||
public void SetBtn(int left, int top, int right, int bottom)
|
||||
{
|
||||
// Debug.Log("[WebviewManager] SetBtn");
|
||||
}
|
||||
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)
|
||||
{
|
||||
}
|
||||
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");
|
||||
}
|
||||
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");
|
||||
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");
|
||||
}
|
||||
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}");
|
||||
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}");
|
||||
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 today = DateTime.Now;
|
||||
var newDays = today.Day;
|
||||
|
||||
|
||||
if (times == "Dailyrefreshtimes")
|
||||
public void ObjC_TouchClick(string name)
|
||||
{
|
||||
var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
|
||||
// Debug.Log("Touch click: " + name);
|
||||
GameDispatcher.Instance.Dispatch(BingoInfo.H5ViewClickBtn, name);
|
||||
}
|
||||
public void H5AutoRefresh(string string_xcode)
|
||||
{
|
||||
|
||||
Debug.Log("string_xcode" + string_xcode);
|
||||
|
||||
if (string_xcode.Contains("|h5"))
|
||||
{
|
||||
Debug.Log(JsonConvert.SerializeObject(light_restoredList));
|
||||
string[] _string_arr = string_xcode.Split("|");
|
||||
if (_string_arr.Length >= 2)
|
||||
{
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count; i++)
|
||||
{
|
||||
if (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].url == _string_arr[0])
|
||||
{
|
||||
light_restoredList[i]++;
|
||||
string str = string.Join(",", light_restoredList);
|
||||
PlayerPrefs.SetString("Dailyrefreshnum", str);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (string_xcode.Contains("|h6"))
|
||||
{
|
||||
|
||||
string[] _string_arr = string_xcode.Split("|");
|
||||
if (_string_arr.Length >= 2)
|
||||
{
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count; j++)
|
||||
{
|
||||
if (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].url == _string_arr[0])
|
||||
{
|
||||
dark_restoredList[i][j]++;
|
||||
PlayerPrefs.SetString("Darkrefreshnum", string.Join(";", dark_restoredList.Select(row => string.Join(",", row))));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private GList select_glist;
|
||||
private float select_glist_y;
|
||||
public void TouchClickPoint(string name)
|
||||
{
|
||||
// Debug.Log("TouchClickPoint" + name);
|
||||
if (name == null) return;
|
||||
if (name == "flyBtn")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.fly_ct_number, 1);
|
||||
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.fly_ct_people,1);
|
||||
|
||||
}
|
||||
|
||||
if (name == "rewardBtn")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_ct_number, 1);
|
||||
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.annular_ct_people,1);
|
||||
}
|
||||
|
||||
if (name == "finish")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_finish_number, 1);
|
||||
}
|
||||
}
|
||||
List<int> light_restoredList;
|
||||
List<List<int>> dark_restoredList;
|
||||
public void RefreshUrl()
|
||||
{
|
||||
|
||||
string Dailyrefresh_reamain = "";
|
||||
int last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
|
||||
DateTime today = DateTime.Now;
|
||||
int newDays = today.Day;
|
||||
|
||||
string light_refresh_str = PlayerPrefs.GetString("Dailyrefreshnum", "");
|
||||
|
||||
if (string.IsNullOrEmpty(light_refresh_str))
|
||||
{
|
||||
light_restoredList = new List<int>();
|
||||
}
|
||||
else
|
||||
{
|
||||
light_restoredList = light_refresh_str.Split(',').Select(int.Parse).ToList();
|
||||
}
|
||||
|
||||
if (light_restoredList.Count < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count)
|
||||
{
|
||||
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count;
|
||||
|
||||
for (int i = light_restoredList.Count; i < targetCount; i++)
|
||||
{
|
||||
light_restoredList.Add(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (last_time == newDays)
|
||||
{
|
||||
var numbers = PlayerPrefs.GetInt("Dailyrefreshnum", 0);
|
||||
numbers++;
|
||||
PlayerPrefs.SetInt("Dailyrefreshnum", numbers);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
PlayerPrefs.SetInt("Dailyrefreshnum", 1);
|
||||
for (int i = 0; i < light_restoredList.Count; i++)
|
||||
{
|
||||
light_restoredList[i] = 0;
|
||||
}
|
||||
string str = string.Join(",", light_restoredList);
|
||||
PlayerPrefs.SetString("Dailyrefreshnum", str);
|
||||
PlayerPrefs.SetInt("Dayreftimes", newDays);
|
||||
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)
|
||||
|
||||
int dark_last_time = PlayerPrefs.GetInt("dark_refreshDay", 0);
|
||||
|
||||
|
||||
string darkWVDailyrefreshtimes_str = "";
|
||||
|
||||
string dark_refresh_str = PlayerPrefs.GetString("Darkrefreshnum", "");
|
||||
if (string.IsNullOrEmpty(dark_refresh_str))
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
dark_restoredList = new List<List<int>>();
|
||||
}
|
||||
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 = "";
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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(), "", "");
|
||||
dark_restoredList = dark_refresh_str.Split(';').Select(row => row.Split(',').Select(int.Parse).ToList()).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private GList select_glist;
|
||||
private float select_glist_y;
|
||||
public void TouchClickPoint(string name)
|
||||
{
|
||||
// Debug.Log("TouchClickPoint" + name);
|
||||
if (name == null) return;
|
||||
if (name == "flyBtn")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.fly_ct_number, 1);
|
||||
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.fly_ct_people,1);
|
||||
|
||||
}
|
||||
|
||||
if (name == "rewardBtn")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_ct_number, 1);
|
||||
//NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior,BuriedPointEvent.annular_ct_people,1);
|
||||
}
|
||||
|
||||
if (name == "finish")
|
||||
{
|
||||
NetworkKit.BuriedPoint(BuriedPointEvent.Hall_behavior, BuriedPointEvent.annular_finish_number, 1);
|
||||
}
|
||||
}
|
||||
List<int> light_restoredList;
|
||||
List<List<int>> dark_restoredList;
|
||||
public void RefreshUrl()
|
||||
{
|
||||
|
||||
// if (gameUrlInfo == null) return;
|
||||
//TODO: show invisible h5
|
||||
|
||||
|
||||
string Dailyrefresh_reamain = "";
|
||||
int last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
|
||||
DateTime today = DateTime.Now;
|
||||
int newDays = today.Day;
|
||||
|
||||
string light_refresh_str = PlayerPrefs.GetString("Dailyrefreshnum", "");
|
||||
|
||||
if (string.IsNullOrEmpty(light_refresh_str))
|
||||
{
|
||||
light_restoredList = new List<int>();
|
||||
}
|
||||
else
|
||||
{
|
||||
light_restoredList = light_refresh_str.Split(',').Select(int.Parse).ToList();
|
||||
}
|
||||
|
||||
if (light_restoredList.Count < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count)
|
||||
{
|
||||
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count;
|
||||
|
||||
for (int i = light_restoredList.Count; i < targetCount; i++)
|
||||
if (dark_restoredList.Count < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count)
|
||||
{
|
||||
light_restoredList.Add(0);
|
||||
}
|
||||
}
|
||||
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count;
|
||||
|
||||
if (last_time == newDays)
|
||||
{
|
||||
// for (int i = 0; i < light_restoredList.Count; i++)
|
||||
// {
|
||||
// if (i != 0) Dailyrefresh_reamain += "|";
|
||||
|
||||
// if (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count > i)
|
||||
// {
|
||||
// Dailyrefresh_reamain += (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].maxF5Times - light_restoredList[i]);
|
||||
// }
|
||||
// else Dailyrefresh_reamain += 0;
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (int i = 0; i < light_restoredList.Count; i++)
|
||||
{
|
||||
light_restoredList[i] = 0;
|
||||
}
|
||||
string str = string.Join(",", light_restoredList);
|
||||
PlayerPrefs.SetString("Dailyrefreshnum", str);
|
||||
|
||||
|
||||
// for (int i = 0; i < light_restoredList.Count; i++)
|
||||
// {
|
||||
// if (i != 0) Dailyrefresh_reamain += "|";
|
||||
// if (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count > i) Dailyrefresh_reamain += ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].maxF5Times;
|
||||
// else Dailyrefresh_reamain += 0;
|
||||
// }
|
||||
|
||||
PlayerPrefs.SetInt("Dayreftimes", newDays);
|
||||
}
|
||||
|
||||
int dark_last_time = PlayerPrefs.GetInt("dark_refreshDay", 0);
|
||||
|
||||
|
||||
string darkWVDailyrefreshtimes_str = "";
|
||||
|
||||
string dark_refresh_str = PlayerPrefs.GetString("Darkrefreshnum", "");
|
||||
// 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 (string.IsNullOrEmpty(dark_refresh_str))
|
||||
{
|
||||
dark_restoredList = new List<List<int>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dark_restoredList = dark_refresh_str.Split(';').Select(row => row.Split(',').Select(int.Parse).ToList()).ToList();
|
||||
}
|
||||
|
||||
|
||||
if (dark_restoredList.Count < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count)
|
||||
{
|
||||
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count;
|
||||
|
||||
for (int i = dark_restoredList.Count; i < targetCount; i++)
|
||||
{
|
||||
dark_restoredList.Add(new List<int>());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < dark_restoredList.Count; i++)
|
||||
{
|
||||
if (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count > i)
|
||||
{
|
||||
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count;
|
||||
if (dark_restoredList[i].Count < targetCount)
|
||||
for (int i = dark_restoredList.Count; i < targetCount; i++)
|
||||
{
|
||||
for (int j = dark_restoredList[i].Count; j < targetCount; j++)
|
||||
{
|
||||
dark_restoredList[i].Add(0);
|
||||
}
|
||||
dark_restoredList.Add(new List<int>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (dark_last_time == newDays)
|
||||
{
|
||||
// for (int i = 0; i < dark_restoredList.Count; i++)
|
||||
// {
|
||||
// for (int j = 0; j < dark_restoredList[i].Count; j++)
|
||||
// {
|
||||
// // darkWVDailyrefreshtimes_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].maxF5Times - dark_restoredList[i][j]
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// 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
|
||||
{
|
||||
|
||||
|
||||
for (int i = 0; i < dark_restoredList.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < dark_restoredList[i].Count; j++)
|
||||
if (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count > i)
|
||||
{
|
||||
dark_restoredList[i][j] = 0;
|
||||
int targetCount = ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count;
|
||||
if (dark_restoredList[i].Count < targetCount)
|
||||
{
|
||||
for (int j = dark_restoredList[i].Count; j < targetCount; j++)
|
||||
{
|
||||
dark_restoredList[i].Add(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerPrefs.SetInt("dark_refreshDay", newDays);
|
||||
PlayerPrefs.SetString("Darkrefreshnum", string.Join(";", dark_restoredList.Select(row => string.Join(",", row))));
|
||||
// PlayerPrefs.SetInt("dark_Dayref", 0);
|
||||
|
||||
// for (int i = 0; i < SaveData.GetSaveobject().dark_Dayref.Count; i++)
|
||||
// {
|
||||
// SaveData.GetSaveobject().dark_Dayref[i] = 0;
|
||||
// }
|
||||
// SaveData.saveDataFunc();
|
||||
|
||||
// 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;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
string light_str = "";
|
||||
string dark_str = "";
|
||||
int can_refresh_numbners = 0;
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
if (dark_last_time == newDays)
|
||||
{
|
||||
light_str += "|";
|
||||
}
|
||||
light_str += ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].url + "#" + ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].weight + "#" + (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].maxF5Times - light_restoredList[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
|
||||
{
|
||||
|
||||
for (int j = 0; j < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count; j++)
|
||||
else
|
||||
{
|
||||
if (i != 0 || j != 0)
|
||||
for (int i = 0; i < dark_restoredList.Count; i++)
|
||||
{
|
||||
dark_str += "|";
|
||||
for (int j = 0; j < dark_restoredList[i].Count; j++)
|
||||
{
|
||||
dark_restoredList[i][j] = 0;
|
||||
}
|
||||
}
|
||||
dark_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].url + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].weight + "#" + (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].maxF5Times - dark_restoredList[i][j]) +
|
||||
"#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].ctProb + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].layerId + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].offset;
|
||||
|
||||
PlayerPrefs.SetInt("dark_refreshDay", newDays);
|
||||
PlayerPrefs.SetString("Darkrefreshnum", string.Join(";", dark_restoredList.Select(row => string.Join(",", row))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string darkWVRefreshtime_str = "";
|
||||
|
||||
string add_time = "";
|
||||
string layer_click_probability = "";
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
string light_str = "";
|
||||
string dark_str = "";
|
||||
int can_refresh_numbners = 0;
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links.Count; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
light_str += "|";
|
||||
}
|
||||
light_str += ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].url + "#" + ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].weight + "#" + (ConfigSystem_sdk.Instance.SDKConfig.h5Conf.links[i].maxF5Times - light_restoredList[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
|
||||
{
|
||||
|
||||
for (int j = 0; j < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links.Count; j++)
|
||||
{
|
||||
if (i != 0 || j != 0)
|
||||
{
|
||||
dark_str += "|";
|
||||
}
|
||||
dark_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].url + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].weight + "#" + (ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].maxF5Times - dark_restoredList[i][j]) +
|
||||
"#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].links[j].ctProb + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].layerId + "#" + ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string darkWVRefreshtime_str = "";
|
||||
|
||||
string add_time = "";
|
||||
string layer_click_probability = "";
|
||||
for (int i = 0; i < ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList.Count; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
darkWVRefreshtime_str += "|";
|
||||
add_time += "|";
|
||||
layer_click_probability += "|";
|
||||
}
|
||||
|
||||
darkWVRefreshtime_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].f5Interval.min;
|
||||
darkWVRefreshtime_str += "|";
|
||||
add_time += "|";
|
||||
layer_click_probability += "|";
|
||||
darkWVRefreshtime_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].f5Interval.max;
|
||||
|
||||
add_time += UnityEngine.Random.Range(ConfigSystem_sdk.Instance.SDKConfig.h6Conf.ADClickF5Delay.min, ConfigSystem_sdk.Instance.SDKConfig.h6Conf.ADClickF5Delay.max + 1);
|
||||
|
||||
layer_click_probability += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].weight;
|
||||
}
|
||||
|
||||
darkWVRefreshtime_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].f5Interval.min;
|
||||
darkWVRefreshtime_str += "|";
|
||||
darkWVRefreshtime_str += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].f5Interval.max;
|
||||
|
||||
add_time += UnityEngine.Random.Range(ConfigSystem_sdk.Instance.SDKConfig.h6Conf.ADClickF5Delay.min, ConfigSystem_sdk.Instance.SDKConfig.h6Conf.ADClickF5Delay.max + 1);
|
||||
|
||||
layer_click_probability += ConfigSystem_sdk.Instance.SDKConfig.h6Conf.layerConfList[i].weight;
|
||||
}
|
||||
Debug.Log("|||||||||||||||||||||--------------------------------");
|
||||
Debug.Log("|||||||||||||||||||||--------------------------------");
|
||||
|
||||
|
||||
Debug.Log(darkWVRefreshtime_str);
|
||||
Debug.Log(darkWVRefreshtime_str);
|
||||
|
||||
Debug.Log(dark_str);
|
||||
Debug.Log(light_str);
|
||||
Debug.Log(layer_click_probability);
|
||||
Debug.Log(add_time);
|
||||
addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
|
||||
UnityEngine.Random.Range(ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.min, ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.max + 1), -1, -1
|
||||
, darkWVRefreshtime_str, "", dark_str, light_str, GameHelper.IsGiftSwitch(), layer_click_probability, add_time);
|
||||
|
||||
}
|
||||
|
||||
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]);
|
||||
// }
|
||||
});
|
||||
Debug.Log(dark_str);
|
||||
Debug.Log(light_str);
|
||||
Debug.Log(layer_click_probability);
|
||||
Debug.Log(add_time);
|
||||
addH5Field(ConfigSystem.GetConfig<CommonModel>().flyCtRate, ConfigSystem.GetConfig<CommonModel>().otherH5switch,
|
||||
UnityEngine.Random.Range(ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.min, ConfigSystem_sdk.Instance.SDKConfig.h5Conf.f5Interval.max + 1), -1, -1
|
||||
, darkWVRefreshtime_str, "", dark_str, light_str, GameHelper.IsGiftSwitch(), layer_click_probability, add_time);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user