using UnityEngine; using Thousandto.CoreSDK; namespace Thousandto.UpdateForm.Center { /// /// 更新流程的启动类 /// public static class LauncherUpdate { private static UpdateCenter _center; public static bool UseEditor = false; public static MyRuntimePlatform RumtimePlatform = MyRuntimePlatform.None; //保存启动参数 public static string[] StartupArgs; public static void Start(string[] args) { StartupArgs = args; UnityEngine.Debug.Log(typeof(LauncherUpdate).ToString() + "->Start"); GameObject go = GameObject.Find("[UpdateRoot]"); if (go != null) { if (_center == null) { _center = go.AddComponent(); } } else UnityEngine.Debug.LogError("没有找到启动节点[UpdateRoot]"); } public static void StartEditor(string[] arg) { UseEditor = true; Start(arg); } /// /// 从Launcher工程通过反射调用的函数,传递当前平台和是否跳过下载RemoteVersion.xml的标签 /// /// /// public static void SetDataFromLauncher(int targetPlatform) { RumtimePlatform = (MyRuntimePlatform)targetPlatform; SDKInitialize.SetRuntimePlatform(RumtimePlatform); UnityEngine.Debug.Log("From launcher, targetplatform=" + RumtimePlatform); } /// /// 网络是否可用 /// /// public static bool IsNetworkEnable() { return Application.internetReachability != NetworkReachability.NotReachable; } /// /// 是否4G流量 /// /// public static bool Is4G() { return Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork; } } }