You've already forked Commercialization.topon
update 1.1.25
This commit is contained in:
@@ -7,14 +7,15 @@ using System.Xml.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using AnyThink.Scripts.Assets;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AnyThink.Scripts.IntegrationManager.Editor
|
||||
{
|
||||
|
||||
// public class ATConfig : ScriptableObject
|
||||
public class ATConfig
|
||||
{
|
||||
public static string PLUGIN_VERSION = "2.0.1";
|
||||
public static string PLUGIN_VERSION = "2.0.3";
|
||||
public static bool isDebug = false;
|
||||
private static string LAST_SELECT_COUNTRY_KEY = "country_key"; //国家
|
||||
public static int CHINA_COUNTRY = 1;
|
||||
@@ -30,6 +31,7 @@ public static bool isDebug = false;
|
||||
//iOS network依赖文件的目录,不区分国家
|
||||
public static string IOS_NETWORK_FILES_PARENT_PATH = "Assets/AnyThinkAds/Plugins/iOS/";
|
||||
|
||||
|
||||
// 保存已安装的network到本地
|
||||
public static void saveInstalledNetworkVersion(string networkName, Versions v)
|
||||
{
|
||||
@@ -38,33 +40,73 @@ public static bool isDebug = false;
|
||||
|
||||
ATLog.log("saveInstalledNetworkVersion() >>> networkName: " + networkName + " unity: " + versions.Unity);
|
||||
versions = initUnityForVerions(versions, networkName, country);
|
||||
// ATPluginSetting.Instance.saveInstalledNetwork(networkName, country, versions);
|
||||
|
||||
string jsonStr = JsonUtility.ToJson(versions);
|
||||
PlayerPrefs.SetString(networkName + "_" + country, jsonStr);
|
||||
PlayerPrefs.Save();
|
||||
string key = networkName + "_" + country;
|
||||
// ATConfigAsset2.Instance.saveInstalledNetworkVersion(key, jsonStr);
|
||||
PlayerPrefs.SetString(key, jsonStr);
|
||||
}
|
||||
|
||||
//获取已安装的network版本,包括core network
|
||||
public static Versions getInstalledNetworkVersion(string networkName, int country)
|
||||
{
|
||||
Versions versions = null;
|
||||
string sdkJson = string.Empty;
|
||||
|
||||
string key = networkName + "_" + country;
|
||||
|
||||
// sdkJson = ATConfigAsset2.Instance.getInstalledNetworkVersion(key);
|
||||
sdkJson = PlayerPrefs.GetString(key);
|
||||
|
||||
ATLog.log("getInstalledNetworkVersion() >>> key: " + key + " sdkJson: " + sdkJson + " country: " + country);
|
||||
if (sdkJson == null || sdkJson.Length == 0)
|
||||
{
|
||||
//适配旧版本插件,避免直接升级SDK
|
||||
// if (PlayerPrefs.HasKey(key)) {
|
||||
// sdkJson = PlayerPrefs.GetString(key);
|
||||
// PlayerPrefs.DeleteKey(key);
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
versions = JsonUtility.FromJson<Versions>(sdkJson);
|
||||
versions = initUnityForVerions(versions, networkName, country);
|
||||
return versions;
|
||||
}
|
||||
|
||||
public static int getLocalCountry()
|
||||
{
|
||||
string key = LAST_SELECT_COUNTRY_KEY;
|
||||
//适配旧版本插件,避免直接升级SDK
|
||||
// if (PlayerPrefs.HasKey(key)) {
|
||||
// int country = PlayerPrefs.GetInt(key);
|
||||
// saveLocalCountry(country);
|
||||
// PlayerPrefs.DeleteKey(key);
|
||||
// }
|
||||
// return ATConfigAsset2.Instance.LocalCountry;
|
||||
return PlayerPrefs.GetInt(key, CHINA_COUNTRY);
|
||||
}
|
||||
|
||||
public static void saveLocalCountry(int country)
|
||||
{
|
||||
PlayerPrefs.SetInt(LAST_SELECT_COUNTRY_KEY, country);
|
||||
PlayerPrefs.Save();
|
||||
// ATConfigAsset2.Instance.LocalCountry = country;
|
||||
PlayerPrefs.SetInt(LAST_SELECT_COUNTRY_KEY, country);
|
||||
}
|
||||
//获取已安装的network版本,包括core network
|
||||
public static Versions getInstalledNetworkVersion(string networkName, int country)
|
||||
|
||||
public static void removeInstalledNetworkVersion(string networkName, int country)
|
||||
{
|
||||
string key = networkName + "_" + country;
|
||||
string sdkJson = PlayerPrefs.GetString(key);
|
||||
ATLog.log("getInstalledNetworkVersion() >>> networkName: " + networkName + " sdkJson: " + sdkJson + " country: " + country);
|
||||
if (sdkJson == null || sdkJson.Length == 0)
|
||||
{
|
||||
return null;
|
||||
|
||||
if (PlayerPrefs.HasKey(key)) {
|
||||
PlayerPrefs.DeleteKey(key);
|
||||
}
|
||||
|
||||
Versions versions = JsonUtility.FromJson<Versions>(sdkJson);
|
||||
versions = initUnityForVerions(versions, networkName, country);
|
||||
return versions;
|
||||
ATLog.log("removeInstalledNetworkVersion() >>> networkName: " + networkName + " country: " + country);
|
||||
// ATConfigAsset2.Instance.removeInstalledNetworkVersion(key);
|
||||
}
|
||||
|
||||
|
||||
private static Versions initUnityForVerions(Versions versions, string networkName, int country)
|
||||
{
|
||||
if (versions == null)
|
||||
@@ -190,24 +232,11 @@ public static bool isDebug = false;
|
||||
return defaultResult;
|
||||
}
|
||||
|
||||
|
||||
public static int getLocalCountry()
|
||||
{
|
||||
return PlayerPrefs.GetInt(LAST_SELECT_COUNTRY_KEY, CHINA_COUNTRY); //默认是国内
|
||||
// return CHINA_COUNTRY;
|
||||
}
|
||||
|
||||
public static bool isSelectedChina()
|
||||
{
|
||||
return getLocalCountry() == CHINA_COUNTRY;
|
||||
}
|
||||
|
||||
public static void removeInstalledNetworkVersion(string networkName, int country)
|
||||
{
|
||||
// int country = getLocalCountry();
|
||||
PlayerPrefs.DeleteKey(networkName + "_" + country);
|
||||
}
|
||||
|
||||
public static string[] getNetworkFilesPath(string networkName, int country)
|
||||
{
|
||||
// if (networkName.Equals(ATIntegrationManager.AnyThinkNetworkName)) {
|
||||
|
||||
Reference in New Issue
Block a user