diff --git a/Assets/Scripts/GameInit/UpdatePanel.cs b/Assets/Scripts/GameInit/UpdatePanel.cs index 84cc9d1dae..362a36416a 100644 --- a/Assets/Scripts/GameInit/UpdatePanel.cs +++ b/Assets/Scripts/GameInit/UpdatePanel.cs @@ -30,11 +30,14 @@ namespace GameLogic UpdateMsgBox msgBox; AssetBundle bundle; + + bool needUserAgree; + void Awake() { msgBox.gameObject.SetActive(false); //StartCoroutine(GetGameConfig()); - BeginUpdatePlatform(); + //BeginUpdatePlatform(); } public IEnumerator LoadFromStream(Action act) @@ -58,6 +61,10 @@ namespace GameLogic else { Hashtable table = MiniJSON.jsonDecode(uwr.downloadHandler.text) as Hashtable; + // 判断是否需要用户隐私协议 + string userAgree = table["UserAgree"] as string; + bool needUserAgree = userAgree == "1"; + // 背景图 string bgName = table["UpdatePanelBG"] as string; string texPath = Application.streamingAssetsPath + "/Res/" + bgName + ".png"; #if UNITY_IOS @@ -104,8 +111,68 @@ namespace GameLogic img.color = new Color(1f, 1f, 1f, 1f); go.SetActive(true); go2.SetActive(true); + + + // 用户隐私协议 + TryGetUserAgree(() => + { + BeginUpdatePlatform(); + }); + })); + } + + private void TryGetUserAgree(Action a) + { + // 判断是否需要显示用户隐私界面 + if(!needUserAgree) + { + if (a != null) + { + a(); + } + return; + } + // 判断是否已经同意 + bool isAgree = PlayerPrefs.GetInt("APP_IsAgreeUser", 0) == 1; + if (isAgree) + { + if (a != null) + { + a(); + } + return; + } + // 没同意则弹窗提示 + msgBox.Show("拒绝", "同意", "这里是隐私协议的提示内容", (r1) => + { + if (r1 == 1) + { + PlayerPrefs.SetInt("APP_IsAgreeUser", 1); + if (a != null) + { + a(); + } + } + else + { + msgBox.Show("退出游戏", "查看协议", "不同意你就不能玩儿哦", (r2) => + { + if (r2 == 1) + { + TryGetUserAgree(a); + } + else + { + Application.Quit(); + } + + }); + } + }); + } + private void OnDestroy() { string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value"); @@ -118,21 +185,21 @@ namespace GameLogic private void Update() { - if (Input.GetKeyDown(KeyCode.Escape)) - { - if(AppConst.isSDK && App.SDKMgr.IsSupportExit()) - { - App.SDKMgr.ExitGame(); - } - else - { - msgBox.Show(SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CANEL), SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CONFIRM), SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CONFIRM_CLOSE), (result) => - { - if (result == 1) - Application.Quit(); - }); - } - } + //if (Input.GetKeyDown(KeyCode.Escape)) + //{ + // if(AppConst.isSDK && App.SDKMgr.IsSupportExit()) + // { + // App.SDKMgr.ExitGame(); + // } + // else + // { + // msgBox.Show(SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CANEL), SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CONFIRM), SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CONFIRM_CLOSE), (result) => + // { + // if (result == 1) + // Application.Quit(); + // }); + // } + //} } // void Start()