Merge branch 'main' of https://source.jsoncompare.online/changyunjia/BingoGrassland_unity_a
This commit is contained in:
@@ -10,6 +10,9 @@ using BingoBrain;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DontConfuse;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.Events;
|
||||
using System.Collections;
|
||||
namespace BingoBrain
|
||||
{
|
||||
public class ConfigSystem_sdk
|
||||
@@ -65,7 +68,7 @@ namespace BingoBrain
|
||||
|
||||
if (needDownloadConfigFile || !File.Exists(assetHotFixFilePath))
|
||||
{
|
||||
IsfvKit.StartCoroutine(CachKit.GetTextFromUrl($"{loginData.cdn_url}/config/{CDNConfigFileName}",
|
||||
SdkManager.Instance.StartCoroutine(GetTextFromUrl($"{loginData.cdn_url}/config/{CDNConfigFileName}",
|
||||
configFileName, (content) =>
|
||||
{
|
||||
PlayerPrefs.SetString(configFileNameKey, CDNConfigFileName);
|
||||
@@ -73,7 +76,6 @@ namespace BingoBrain
|
||||
//CtrlDispatcher.Instance.Dispatch(CtrlMsg.NewConfigRead);
|
||||
}, configFileSavePath));
|
||||
}
|
||||
|
||||
//检查设备本地是否有配置文件
|
||||
if (File.Exists(assetHotFixFilePath))
|
||||
{
|
||||
@@ -84,6 +86,35 @@ namespace BingoBrain
|
||||
GameHelper.PostFunnelLogin("loadFinish");
|
||||
}
|
||||
}
|
||||
public static IEnumerator GetTextFromUrl(string url, string fileName, UnityAction<string> action = null,
|
||||
string savePath = null)
|
||||
{
|
||||
var unityWebRequest = UnityWebRequest.Get(url);
|
||||
yield return unityWebRequest.SendWebRequest();
|
||||
if (unityWebRequest.result is UnityWebRequest.Result.ConnectionError
|
||||
or UnityWebRequest.Result.ProtocolError)
|
||||
{
|
||||
Debug.LogError($"加载 [ {fileName} ] 文本文件失败 {unityWebRequest.error} [ url: {url} ]");
|
||||
action?.Invoke(default);
|
||||
yield break;
|
||||
}
|
||||
|
||||
var content = unityWebRequest.downloadHandler.text;
|
||||
|
||||
SaveTextFile(content, savePath, fileName);
|
||||
|
||||
action?.Invoke(content);
|
||||
}
|
||||
private static void SaveTextFile(string content, string filePath, string fileName)
|
||||
{
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
|
||||
File.WriteAllText($"{filePath}{fileName}.txt", content);
|
||||
}
|
||||
|
||||
|
||||
private void ParseConfig(string json)
|
||||
{
|
||||
@@ -123,6 +154,7 @@ namespace BingoBrain
|
||||
Debug.Log(open_dark_wv);
|
||||
if (open_dark_wv)
|
||||
{
|
||||
|
||||
SdkManager.Instance.OpenWv();
|
||||
// int flyswitch = ConfigSystem.GetConfig<CommonModel>().flyswitch;
|
||||
// int propswitch = ConfigSystem.GetConfig<CommonModel>().propswitch;
|
||||
@@ -140,6 +172,7 @@ namespace BingoBrain
|
||||
SdkManager.Instance.SetDarkThough(true);
|
||||
SdkManager.Instance.RefreshUrl();
|
||||
SdkManager.Instance.ShowH5View(false);
|
||||
|
||||
}
|
||||
}
|
||||
public int GetRegisteredCalendarDaysByUTC(long regTimeTimestamp)
|
||||
|
||||
Reference in New Issue
Block a user