【用户隐私协议】添加到健康提示之后,热更之前

dev_chengFeng
gaoxin 2021-10-21 10:21:03 +08:00
parent a17242b0c0
commit b30a5e09eb
1 changed files with 83 additions and 16 deletions

View File

@ -30,11 +30,14 @@ namespace GameLogic
UpdateMsgBox msgBox; UpdateMsgBox msgBox;
AssetBundle bundle; AssetBundle bundle;
bool needUserAgree;
void Awake() void Awake()
{ {
msgBox.gameObject.SetActive(false); msgBox.gameObject.SetActive(false);
//StartCoroutine(GetGameConfig()); //StartCoroutine(GetGameConfig());
BeginUpdatePlatform(); //BeginUpdatePlatform();
} }
public IEnumerator LoadFromStream(Action<Sprite> act) public IEnumerator LoadFromStream(Action<Sprite> act)
@ -58,6 +61,10 @@ namespace GameLogic
else else
{ {
Hashtable table = MiniJSON.jsonDecode(uwr.downloadHandler.text) as Hashtable; 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 bgName = table["UpdatePanelBG"] as string;
string texPath = Application.streamingAssetsPath + "/Res/" + bgName + ".png"; string texPath = Application.streamingAssetsPath + "/Res/" + bgName + ".png";
#if UNITY_IOS #if UNITY_IOS
@ -104,8 +111,68 @@ namespace GameLogic
img.color = new Color(1f, 1f, 1f, 1f); img.color = new Color(1f, 1f, 1f, 1f);
go.SetActive(true); go.SetActive(true);
go2.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() private void OnDestroy()
{ {
string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value"); string updatePanelBg = ConfigManager.Instance.GetConfigInfo("Setting.UPDATE_PANEL_BG.value");
@ -118,21 +185,21 @@ namespace GameLogic
private void Update() private void Update()
{ {
if (Input.GetKeyDown(KeyCode.Escape)) //if (Input.GetKeyDown(KeyCode.Escape))
{ //{
if(AppConst.isSDK && App.SDKMgr.IsSupportExit()) // if(AppConst.isSDK && App.SDKMgr.IsSupportExit())
{ // {
App.SDKMgr.ExitGame(); // App.SDKMgr.ExitGame();
} // }
else // else
{ // {
msgBox.Show(SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CANEL), SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CONFIRM), SLanguageMoreLanguageMgr.Instance.GetLanguageChValBykey(more_language.CONFIRM_CLOSE), (result) => // 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) // if (result == 1)
Application.Quit(); // Application.Quit();
}); // });
} // }
} //}
} }
// void Start() // void Start()