using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameNotice { static bool noticeShowed = false; public static void OpenGameNotice() { try { if (VersionUtility.Instance.versionInfo == null || noticeShowed) return; if (null == VersionConfig.config) { throw new System.Exception("VersionConfig is null when OpenGameNotice, game will pause here"); } var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.config.branch); if (!string.IsNullOrEmpty(url)) { SDKUtils.Instance.OpenUrl(url); noticeShowed = true; } } catch (System.Exception ex) { noticeShowed = true; } } public static bool HasNotice() { try { if (VersionUtility.Instance.versionInfo == null) return false; if (null == VersionConfig.config) { throw new System.Exception("VersionConfig is null when HasNotice, check VersionConfig.GetAsync for more details"); } var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.config.branch); Debug.LogFormat("公告地址:{0}", url); return !string.IsNullOrEmpty(url); } catch (System.Exception ex) { return false; } } public static void OpenGameNoticeForce() { try { if (VersionUtility.Instance.versionInfo == null) return; if (null == VersionConfig.config) { throw new System.Exception("VersionConfig is null when OpenGameNoticeForce, check VersionConfig.GetAsync for more details"); } var url = VersionUtility.Instance.versionInfo.GetNoticeURL(VersionConfig.config.branch); if (!string.IsNullOrEmpty(url)) { SDKUtils.Instance.OpenUrl(url); } } catch (System.Exception ex) { Debug.Log(ex); } } }